Fix 6291333: Don't show multiple pin/pattern/password confirmations
This fixes a bug where orientation changes caused the system to ask for the pin/pattern/password multiple times. It also fixes a minor issue where we were showing buttons on the pattern confirmation screen (bug 6218057) Change-Id: I0894f37bb697baa4cc17917aaeb466440279b092
This commit is contained in:
@@ -47,7 +47,8 @@
|
||||
style="@style/SecurityPreferenceButtonContainer"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="horizontal"
|
||||
android:visibility="invisible">
|
||||
|
||||
<!-- left / top button: skip, or re-try -->
|
||||
<Button android:id="@+id/footerLeftButton"
|
||||
|
@@ -58,6 +58,7 @@ public class ChooseLockGeneric extends PreferenceActivity {
|
||||
private static final int FALLBACK_REQUEST = 101;
|
||||
private static final String PASSWORD_CONFIRMED = "password_confirmed";
|
||||
private static final String CONFIRM_CREDENTIALS = "confirm_credentials";
|
||||
private static final String WAITING_FOR_CONFIRMATION = "waiting_for_confirmation";
|
||||
public static final String MINIMUM_QUALITY_KEY = "minimum_quality";
|
||||
|
||||
private static final boolean ALWAY_SHOW_TUTORIAL = true;
|
||||
@@ -66,6 +67,7 @@ public class ChooseLockGeneric extends PreferenceActivity {
|
||||
private DevicePolicyManager mDPM;
|
||||
private KeyStore mKeyStore;
|
||||
private boolean mPasswordConfirmed = false;
|
||||
private boolean mWaitingForConfirmation = false;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
@@ -82,20 +84,25 @@ public class ChooseLockGeneric extends PreferenceActivity {
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
mPasswordConfirmed = savedInstanceState.getBoolean(PASSWORD_CONFIRMED);
|
||||
mWaitingForConfirmation = savedInstanceState.getBoolean(WAITING_FOR_CONFIRMATION);
|
||||
}
|
||||
|
||||
if (!mPasswordConfirmed) {
|
||||
if (mPasswordConfirmed) {
|
||||
updatePreferencesOrFinish();
|
||||
} else if (!mWaitingForConfirmation) {
|
||||
ChooseLockSettingsHelper helper =
|
||||
new ChooseLockSettingsHelper(this.getActivity(), this);
|
||||
if (!helper.launchConfirmationActivity(CONFIRM_EXISTING_REQUEST, null, null)) {
|
||||
mPasswordConfirmed = true; // no password set, so no need to confirm
|
||||
updatePreferencesOrFinish();
|
||||
} else {
|
||||
mWaitingForConfirmation = true;
|
||||
}
|
||||
} else {
|
||||
updatePreferencesOrFinish();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
|
||||
Preference preference) {
|
||||
@@ -143,6 +150,7 @@ public class ChooseLockGeneric extends PreferenceActivity {
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
mWaitingForConfirmation = false;
|
||||
if (requestCode == CONFIRM_EXISTING_REQUEST && resultCode == Activity.RESULT_OK) {
|
||||
mPasswordConfirmed = true;
|
||||
updatePreferencesOrFinish();
|
||||
@@ -161,6 +169,7 @@ public class ChooseLockGeneric extends PreferenceActivity {
|
||||
super.onSaveInstanceState(outState);
|
||||
// Saved so we don't force user to re-enter their password if configuration changes
|
||||
outState.putBoolean(PASSWORD_CONFIRMED, mPasswordConfirmed);
|
||||
outState.putBoolean(WAITING_FOR_CONFIRMATION, mWaitingForConfirmation);
|
||||
}
|
||||
|
||||
private void updatePreferencesOrFinish() {
|
||||
|
Reference in New Issue
Block a user