Restart encryption display after screen power cycle

Bug: 3414241
Change-Id: I881fc14c3e0850089b98fcbdbd86c39dde22771c
This commit is contained in:
Andy Stadler
2011-02-01 17:35:20 -08:00
parent 95ef5575a2
commit 9597406aa1

View File

@@ -99,6 +99,7 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// If we are not encrypted or encrypting, get out quickly.
String state = SystemProperties.get("vold.decrypt");
if ("".equals(state) || DECRYPT_STATE.equals(state)) {
// Disable the crypt keeper.
@@ -108,17 +109,6 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
return;
}
// Check to see why we were started.
String progress = SystemProperties.get("vold.encrypt_progress");
if (!"".equals(progress)) {
setContentView(R.layout.crypt_keeper_progress);
encryptionProgressInit();
} else {
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
@@ -136,6 +126,26 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
}
}
/**
* Note, we defer the state check and screen setup to onStart() because this will be
* re-run if the user clicks the power button (sleeping/waking the screen), and this is
* especially important if we were to lose the wakelock for any reason.
*/
@Override
public void onStart() {
super.onStart();
// Check to see why we were started.
String progress = SystemProperties.get("vold.encrypt_progress");
if (!"".equals(progress)) {
setContentView(R.layout.crypt_keeper_progress);
encryptionProgressInit();
} else {
setContentView(R.layout.crypt_keeper_password_entry);
passwordEntryInit();
}
}
@Override
public void onStop() {
super.onStop();