Add a new flow for decryption checking.
Bug: 17875087
Change-Id: I78ba98901bc74ae654414c0a4a303b104a629965
diff --git a/src/com/android/settings/CryptKeeper.java b/src/com/android/settings/CryptKeeper.java
index e552455..fa63a74 100644
--- a/src/com/android/settings/CryptKeeper.java
+++ b/src/com/android/settings/CryptKeeper.java
@@ -61,8 +61,6 @@
import android.widget.ProgressBar;
import android.widget.TextView;
-import com.android.internal.statusbar.StatusBarIcon;
-import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.widget.LockPatternUtils;
import com.android.internal.widget.LockPatternView;
@@ -138,6 +136,7 @@
private static final int RIGHT_PATTERN_CLEAR_TIMEOUT_MS = 500;
private Runnable mClearPatternRunnable = new Runnable() {
+ @Override
public void run() {
mLockPatternView.clearPattern();
}
@@ -163,6 +162,13 @@
}
@Override
+ protected void onPreExecute() {
+ super.onPreExecute();
+ final TextView status = (TextView) findViewById(R.id.status);
+ status.setText(R.string.checking_decryption);
+ }
+
+ @Override
protected Integer doInBackground(String... params) {
final IMountService service = getMountService();
try {
@@ -182,10 +188,11 @@
mLockPatternView.removeCallbacks(mClearPatternRunnable);
mLockPatternView.postDelayed(mClearPatternRunnable, RIGHT_PATTERN_CLEAR_TIMEOUT_MS);
}
+ final TextView status = (TextView) findViewById(R.id.status);
+ status.setText(R.string.starting_android);
hide(R.id.passwordEntry);
hide(R.id.switch_ime_button);
hide(R.id.lockPattern);
- hide(R.id.status);
hide(R.id.owner_info);
hide(R.id.emergencyCallButton);
} else if (failedAttempts == MAX_FAILED_ATTEMPTS) {
@@ -219,9 +226,24 @@
Integer.toString(remainingAttempts));
status.setText(warning);
} else {
- status.setText(R.string.try_again);
+ int passwordType = StorageManager.CRYPT_TYPE_PASSWORD;
+ try {
+ final IMountService service = getMountService();
+ passwordType = service.getPasswordType();
+ } catch (Exception e) {
+ Log.e(TAG, "Error calling mount service " + e);
+ }
+
+ if (passwordType == StorageManager.CRYPT_TYPE_PIN) {
+ status.setText(R.string.cryptkeeper_wrong_pin);
+ } else if (passwordType == StorageManager.CRYPT_TYPE_PATTERN) {
+ status.setText(R.string.cryptkeeper_wrong_password);
+ } else {
+ status.setText(R.string.cryptkeeper_wrong_pin);
+ }
}
+
if (mLockPatternView != null) {
mLockPatternView.setDisplayMode(DisplayMode.Wrong);
}
@@ -434,7 +456,7 @@
encryptionProgressInit();
} else if (mValidationComplete || isDebugView(FORCE_VIEW_PASSWORD)) {
new AsyncTask<Void, Void, Void>() {
- int type = StorageManager.CRYPT_TYPE_PASSWORD;
+ int passwordType = StorageManager.CRYPT_TYPE_PASSWORD;
String owner_info;
boolean pattern_visible;
@@ -442,7 +464,7 @@
public Void doInBackground(Void... v) {
try {
final IMountService service = getMountService();
- type = service.getPasswordType();
+ passwordType = service.getPasswordType();
owner_info = service.getField(StorageManager.OWNER_INFO_KEY);
pattern_visible = !("0".equals(service.getField(StorageManager.PATTERN_VISIBLE_KEY)));
} catch (Exception e) {
@@ -454,10 +476,10 @@
@Override
public void onPostExecute(java.lang.Void v) {
- if(type == StorageManager.CRYPT_TYPE_PIN) {
+ if(passwordType == StorageManager.CRYPT_TYPE_PIN) {
setContentView(R.layout.crypt_keeper_pin_entry);
mStatusString = R.string.enter_pin;
- } else if (type == StorageManager.CRYPT_TYPE_PATTERN) {
+ } else if (passwordType == StorageManager.CRYPT_TYPE_PATTERN) {
setContentView(R.layout.crypt_keeper_pattern_entry);
setBackFunctionality(false);
mStatusString = R.string.enter_pattern;
@@ -851,7 +873,6 @@
mPasswordEntry.setEnabled(false);
setBackFunctionality(false);
- Log.d(TAG, "Attempting to send command to decrypt");
new DecryptTask().execute(password);
return true;