/** When encryption is detected, this flag indivates whether or not we've checked for erros. */
private boolean mValidationComplete;
+ private boolean mValidationRequested;
/** A flag to indicate that the volume is in a bad state (e.g. partially encrypted). */
private boolean mEncryptionGoneBad;
protected Boolean doInBackground(Void... params) {
IMountService service = getMountService();
try {
+ Log.d(TAG, "Validating encryption state.");
int state = service.getEncryptionState();
if (state == IMountService.ENCRYPTION_STATE_NONE) {
Log.w(TAG, "Unexpectedly in CryptKeeper even though there is no encryption.");
if (Boolean.FALSE.equals(result)) {
Log.w(TAG, "Incomplete, or corrupted encryption detected. Prompting user to wipe.");
mEncryptionGoneBad = true;
+ } else {
+ Log.d(TAG, "Encryption state validated. Proceeding to configure UI");
}
setupUi();
}
mWakeLock = retained.wakelock;
Log.d(TAG, "Restoring wakelock from NonConfigurationInstanceState");
}
-
- // Check the encryption status to ensure something hasn't gone bad.
- new ValidationTask().execute((Void[]) null);
}
/**
public void onStart() {
super.onStart();
- // Check to see why we were started.
- if (mValidationComplete) {
- setupUi();
- }
+ setupUi();
}
/**
if (!"".equals(progress) || isDebugView(FORCE_VIEW_PROGRESS)) {
setContentView(R.layout.crypt_keeper_progress);
encryptionProgressInit();
- } else {
+ } else if (mValidationComplete) {
setContentView(R.layout.crypt_keeper_password_entry);
passwordEntryInit();
+ } else if (!mValidationRequested) {
+ // We're supposed to be encrypted, but no validation has been done.
+ new ValidationTask().execute((Void[]) null);
+ mValidationRequested = true;
}
}