summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings
diff options
context:
space:
mode:
authorPaul Lawrence <paullawrence@google.com>2014-08-13 19:47:52 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-08-13 16:52:03 +0000
commitd6d0cd53d00a84619f3f90761ee3907732fac898 (patch)
tree22e06e44d4397b04cc5511267f773e8339f21195 /src/com/android/settings
parent5a10a8df0efcf034077cbfcd28dd2e495b8d0441 (diff)
parent384d8e52b6750b2be7079f8828e4d2f038e22180 (diff)
downloadpackages_apps_Settings-d6d0cd53d00a84619f3f90761ee3907732fac898.zip
packages_apps_Settings-d6d0cd53d00a84619f3f90761ee3907732fac898.tar.gz
packages_apps_Settings-d6d0cd53d00a84619f3f90761ee3907732fac898.tar.bz2
Merge "Bring up factory reset UI when decryption fails but password is correct" into lmp-dev
Diffstat (limited to 'src/com/android/settings')
-rw-r--r--src/com/android/settings/CryptKeeper.java26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/com/android/settings/CryptKeeper.java b/src/com/android/settings/CryptKeeper.java
index 129b201..c2295e6 100644
--- a/src/com/android/settings/CryptKeeper.java
+++ b/src/com/android/settings/CryptKeeper.java
@@ -170,6 +170,11 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
} else if (failedAttempts == MAX_FAILED_ATTEMPTS) {
// Factory reset the device.
sendBroadcast(new Intent("android.intent.action.MASTER_CLEAR"));
+ } else if (failedAttempts == -1) {
+ // Right password, but decryption failed. Tell user bad news ...
+ setContentView(R.layout.crypt_keeper_progress);
+ showFactoryReset(true);
+ return;
} else {
// Wrong entry. Handle pattern case.
if (mLockPatternView != null) {
@@ -392,7 +397,7 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
private void setupUi() {
if (mEncryptionGoneBad || isDebugView(FORCE_VIEW_ERROR)) {
setContentView(R.layout.crypt_keeper_progress);
- showFactoryReset();
+ showFactoryReset(false);
return;
}
@@ -508,7 +513,13 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
updateProgress();
}
- private void showFactoryReset() {
+ /**
+ * Show factory reset screen allowing the user to reset their phone when
+ * there is nothing else we can do
+ * @param corrupt true if userdata is corrupt, false if encryption failed
+ * partway through
+ */
+ private void showFactoryReset(boolean corrupt) {
// Hide the encryption-bot to make room for the "factory reset" button
findViewById(R.id.encroid).setVisibility(View.GONE);
@@ -524,8 +535,13 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
});
// Alert the user of the failure.
- ((TextView) findViewById(R.id.title)).setText(R.string.crypt_keeper_failed_title);
- ((TextView) findViewById(R.id.status)).setText(R.string.crypt_keeper_failed_summary);
+ if (corrupt) {
+ ((TextView) findViewById(R.id.title)).setText(R.string.crypt_keeper_data_corrupt_title);
+ ((TextView) findViewById(R.id.status)).setText(R.string.crypt_keeper_data_corrupt_summary);
+ } else {
+ ((TextView) findViewById(R.id.title)).setText(R.string.crypt_keeper_failed_title);
+ ((TextView) findViewById(R.id.status)).setText(R.string.crypt_keeper_failed_summary);
+ }
final View view = findViewById(R.id.bottom_divider);
// TODO(viki): Why would the bottom divider be missing in certain layouts? Investigate.
@@ -538,7 +554,7 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
final String state = SystemProperties.get("vold.encrypt_progress");
if ("error_partially_encrypted".equals(state)) {
- showFactoryReset();
+ showFactoryReset(false);
return;
}