Add a new flow for decryption checking.

Bug: 17875087

Change-Id: I78ba98901bc74ae654414c0a4a303b104a629965
This commit is contained in:
Paul Crowley
2014-10-21 10:12:47 +01:00
parent 815c61d729
commit 529834dae1
2 changed files with 43 additions and 11 deletions

View File

@@ -4677,8 +4677,19 @@
<string name="enter_pin">To start Android, enter your PIN</string> <string name="enter_pin">To start Android, enter your PIN</string>
<!-- Informational text on the pattern entry screen prompting the user for their pattern --> <!-- Informational text on the pattern entry screen prompting the user for their pattern -->
<string name="enter_pattern">To start Android, draw your pattern</string> <string name="enter_pattern">To start Android, draw your pattern</string>
<!-- This is displayed when the password is entered incorrectly -->
<string name="try_again">Try again.</string> <!-- Message shown when user enters wrong pattern -->
<string name="cryptkeeper_wrong_pattern">Wrong Pattern</string>
<!-- Message shown when user enters wrong password -->
<string name="cryptkeeper_wrong_password">Wrong Password</string>
<!-- Message shown when user enters wrong PIN -->
<string name="cryptkeeper_wrong_pin">Wrong PIN</string>
<!-- Shown when a password has been entered, and we're checking it -->
<string name="checking_decryption">Checking\u2026</string>
<!-- Shown when password is correct, and we're starting Android -->
<string name="starting_android">Starting Android</string>
<!-- the following are for Settings Storage screen --> <!-- the following are for Settings Storage screen -->
<!-- Menu item/button 'delete' --> <!-- Menu item/button 'delete' -->

View File

@@ -61,8 +61,6 @@ import android.widget.EditText;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; 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.telephony.PhoneConstants;
import com.android.internal.widget.LockPatternUtils; import com.android.internal.widget.LockPatternUtils;
import com.android.internal.widget.LockPatternView; import com.android.internal.widget.LockPatternView;
@@ -138,6 +136,7 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
private static final int RIGHT_PATTERN_CLEAR_TIMEOUT_MS = 500; private static final int RIGHT_PATTERN_CLEAR_TIMEOUT_MS = 500;
private Runnable mClearPatternRunnable = new Runnable() { private Runnable mClearPatternRunnable = new Runnable() {
@Override
public void run() { public void run() {
mLockPatternView.clearPattern(); mLockPatternView.clearPattern();
} }
@@ -162,6 +161,13 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
} }
} }
@Override
protected void onPreExecute() {
super.onPreExecute();
final TextView status = (TextView) findViewById(R.id.status);
status.setText(R.string.checking_decryption);
}
@Override @Override
protected Integer doInBackground(String... params) { protected Integer doInBackground(String... params) {
final IMountService service = getMountService(); final IMountService service = getMountService();
@@ -182,10 +188,11 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
mLockPatternView.removeCallbacks(mClearPatternRunnable); mLockPatternView.removeCallbacks(mClearPatternRunnable);
mLockPatternView.postDelayed(mClearPatternRunnable, RIGHT_PATTERN_CLEAR_TIMEOUT_MS); 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.passwordEntry);
hide(R.id.switch_ime_button); hide(R.id.switch_ime_button);
hide(R.id.lockPattern); hide(R.id.lockPattern);
hide(R.id.status);
hide(R.id.owner_info); hide(R.id.owner_info);
hide(R.id.emergencyCallButton); hide(R.id.emergencyCallButton);
} else if (failedAttempts == MAX_FAILED_ATTEMPTS) { } else if (failedAttempts == MAX_FAILED_ATTEMPTS) {
@@ -219,9 +226,24 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
Integer.toString(remainingAttempts)); Integer.toString(remainingAttempts));
status.setText(warning); status.setText(warning);
} else { } 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) { if (mLockPatternView != null) {
mLockPatternView.setDisplayMode(DisplayMode.Wrong); mLockPatternView.setDisplayMode(DisplayMode.Wrong);
} }
@@ -434,7 +456,7 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
encryptionProgressInit(); encryptionProgressInit();
} else if (mValidationComplete || isDebugView(FORCE_VIEW_PASSWORD)) { } else if (mValidationComplete || isDebugView(FORCE_VIEW_PASSWORD)) {
new AsyncTask<Void, Void, Void>() { new AsyncTask<Void, Void, Void>() {
int type = StorageManager.CRYPT_TYPE_PASSWORD; int passwordType = StorageManager.CRYPT_TYPE_PASSWORD;
String owner_info; String owner_info;
boolean pattern_visible; boolean pattern_visible;
@@ -442,7 +464,7 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
public Void doInBackground(Void... v) { public Void doInBackground(Void... v) {
try { try {
final IMountService service = getMountService(); final IMountService service = getMountService();
type = service.getPasswordType(); passwordType = service.getPasswordType();
owner_info = service.getField(StorageManager.OWNER_INFO_KEY); owner_info = service.getField(StorageManager.OWNER_INFO_KEY);
pattern_visible = !("0".equals(service.getField(StorageManager.PATTERN_VISIBLE_KEY))); pattern_visible = !("0".equals(service.getField(StorageManager.PATTERN_VISIBLE_KEY)));
} catch (Exception e) { } catch (Exception e) {
@@ -454,10 +476,10 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
@Override @Override
public void onPostExecute(java.lang.Void v) { 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); setContentView(R.layout.crypt_keeper_pin_entry);
mStatusString = R.string.enter_pin; 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); setContentView(R.layout.crypt_keeper_pattern_entry);
setBackFunctionality(false); setBackFunctionality(false);
mStatusString = R.string.enter_pattern; mStatusString = R.string.enter_pattern;
@@ -851,7 +873,6 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
mPasswordEntry.setEnabled(false); mPasswordEntry.setEnabled(false);
setBackFunctionality(false); setBackFunctionality(false);
Log.d(TAG, "Attempting to send command to decrypt");
new DecryptTask().execute(password); new DecryptTask().execute(password);
return true; return true;