summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason parks <jparks@google.com>2011-01-24 16:19:28 -0600
committerJason parks <jparks@google.com>2011-01-25 08:38:17 -0600
commitf1dbf55819e01f6cf1a99d38a292b15de1262a29 (patch)
tree5a59f7f87418959bab1a04161cd7cfdda964ff27 /src
parent22c060ebd14bd92c67bd97f53d67bb06f0a215de (diff)
downloadpackages_apps_settings-f1dbf55819e01f6cf1a99d38a292b15de1262a29.zip
packages_apps_settings-f1dbf55819e01f6cf1a99d38a292b15de1262a29.tar.gz
packages_apps_settings-f1dbf55819e01f6cf1a99d38a292b15de1262a29.tar.bz2
More UI tweaks.
* Grab a full wakelock while encrypting. * Fix a bug with failed attempts. * Add a custom theme to animate the screen to black. * Fix the keyboard to be displayed properly in landscape and portrait. Change-Id: Icc2d813ce1780588eb3b16f5204c3c60cae5236f
Diffstat (limited to 'src')
-rw-r--r--src/com/android/settings/CryptKeeper.java25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/com/android/settings/CryptKeeper.java b/src/com/android/settings/CryptKeeper.java
index 3917b76..5afc3f6 100644
--- a/src/com/android/settings/CryptKeeper.java
+++ b/src/com/android/settings/CryptKeeper.java
@@ -57,6 +57,9 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
private static final int COOL_DOWN_ATTEMPTS = 10;
private static final int COOL_DOWN_INTERVAL = 30; // 30 seconds
+ // This activity is used to fade the screen to black after the password is entered.
+ public static class Blank extends Activity {
+ }
private Handler mHandler = new Handler() {
@Override
@@ -103,7 +106,6 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
}
};
- private int mFailedAttempts = 0;
private int mCooldown;
@Override
@@ -143,7 +145,7 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
// is encrypted.
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
- PowerManager.WakeLock wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG);
+ PowerManager.WakeLock wakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, TAG);
wakeLock.acquire();
@@ -192,15 +194,20 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
IMountService service = getMountService();
try {
- service.decryptStorage(password);
-
- if (mFailedAttempts == 0) {
- // Success. Do something here within 2 seconds
-
- } else if (mFailedAttempts == MAX_FAILED_ATTEMPTS) {
+ int failedAttempts = service.decryptStorage(password);
+
+ if (failedAttempts == 0) {
+ // The password was entered successfully. Start the Blank activity
+ // so this activity animates to black before the devices starts. Note
+ // It has 1 second to complete the animation or it will be frozen
+ // until the boot animation comes back up.
+ Intent intent = new Intent(this, Blank.class);
+ finish();
+ startActivity(intent);
+ } else if (failedAttempts == MAX_FAILED_ATTEMPTS) {
// Factory reset the device.
sendBroadcast(new Intent("android.intent.action.MASTER_CLEAR"));
- } else if ((mFailedAttempts % COOL_DOWN_ATTEMPTS) == 0) {
+ } else if ((failedAttempts % COOL_DOWN_ATTEMPTS) == 0) {
mCooldown = COOL_DOWN_INTERVAL;
EditText passwordEntry = (EditText) findViewById(R.id.passwordEntry);
passwordEntry.setEnabled(false);