More UI tweaks and fixes.
* Actually post the correct message every 5 second for the progress bar.
* Update the text for the settings to a more finalish version.
* Check the battery status before allowing encryption to proceed.
* Display a place holder message if no password is set for the device.
Change-Id: I2734300c9a81467dbd0401427d8b656922ab4819
diff --git a/src/com/android/settings/CryptKeeper.java b/src/com/android/settings/CryptKeeper.java
index 25bb242..222e954 100644
--- a/src/com/android/settings/CryptKeeper.java
+++ b/src/com/android/settings/CryptKeeper.java
@@ -75,9 +75,9 @@
} catch (Exception e) {
Log.w(TAG, "Error parsing progress: " + e.toString());
}
-
- // Check the status every 1 second
- sendEmptyMessageDelayed(0, 1000);
+
+ // Check the status every 5 second
+ sendEmptyMessageDelayed(UPDATE_PROGRESS, 5000);
break;
case COOLDOWN:
@@ -128,6 +128,12 @@
setContentView(R.layout.crypt_keeper_password_entry);
passwordEntryInit();
}
+
+ // Disable the status bar
+ StatusBarManager sbm = (StatusBarManager) getSystemService(Context.STATUS_BAR_SERVICE);
+ sbm.disable(StatusBarManager.DISABLE_EXPAND | StatusBarManager.DISABLE_NOTIFICATION_ICONS
+ | StatusBarManager.DISABLE_NOTIFICATION_ALERTS
+ | StatusBarManager.DISABLE_SYSTEM_INFO | StatusBarManager.DISABLE_NAVIGATION);
}
private void encryptionProgressInit() {
@@ -151,12 +157,6 @@
String dateFormatString = getString(com.android.internal.R.string.full_wday_month_day_no_year);
TextView date = (TextView) findViewById(R.id.date);
date.setText(DateFormat.format(dateFormatString, new Date()));
-
- // Disable the status bar
- StatusBarManager sbm = (StatusBarManager) getSystemService(Context.STATUS_BAR_SERVICE);
- sbm.disable(StatusBarManager.DISABLE_EXPAND | StatusBarManager.DISABLE_NOTIFICATION_ICONS
- | StatusBarManager.DISABLE_NOTIFICATION_ALERTS
- | StatusBarManager.DISABLE_SYSTEM_INFO | StatusBarManager.DISABLE_NAVIGATION);
}
private IMountService getMountService() {
@@ -184,12 +184,10 @@
try {
service.decryptStorage(password);
- // For now the only way to get here is for the password to be
- // wrong.
+ if (mFailedAttempts == 0) {
+ // Success. Do something here within 2 seconds
- mFailedAttempts++;
-
- if (mFailedAttempts == MAX_FAILED_ATTEMPTS) {
+ } else if (mFailedAttempts == MAX_FAILED_ATTEMPTS) {
// Factory reset the device.
sendBroadcast(new Intent("android.intent.action.MASTER_CLEAR"));
} else if ((mFailedAttempts % COOL_DOWN_ATTEMPTS) == 0) {