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"
|
style="@style/SecurityPreferenceButtonContainer"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal"
|
||||||
|
android:visibility="invisible">
|
||||||
|
|
||||||
<!-- left / top button: skip, or re-try -->
|
<!-- left / top button: skip, or re-try -->
|
||||||
<Button android:id="@+id/footerLeftButton"
|
<Button android:id="@+id/footerLeftButton"
|
||||||
|
@@ -58,6 +58,7 @@ public class ChooseLockGeneric extends PreferenceActivity {
|
|||||||
private static final int FALLBACK_REQUEST = 101;
|
private static final int FALLBACK_REQUEST = 101;
|
||||||
private static final String PASSWORD_CONFIRMED = "password_confirmed";
|
private static final String PASSWORD_CONFIRMED = "password_confirmed";
|
||||||
private static final String CONFIRM_CREDENTIALS = "confirm_credentials";
|
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";
|
public static final String MINIMUM_QUALITY_KEY = "minimum_quality";
|
||||||
|
|
||||||
private static final boolean ALWAY_SHOW_TUTORIAL = true;
|
private static final boolean ALWAY_SHOW_TUTORIAL = true;
|
||||||
@@ -66,6 +67,7 @@ public class ChooseLockGeneric extends PreferenceActivity {
|
|||||||
private DevicePolicyManager mDPM;
|
private DevicePolicyManager mDPM;
|
||||||
private KeyStore mKeyStore;
|
private KeyStore mKeyStore;
|
||||||
private boolean mPasswordConfirmed = false;
|
private boolean mPasswordConfirmed = false;
|
||||||
|
private boolean mWaitingForConfirmation = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -82,19 +84,24 @@ public class ChooseLockGeneric extends PreferenceActivity {
|
|||||||
|
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
mPasswordConfirmed = savedInstanceState.getBoolean(PASSWORD_CONFIRMED);
|
mPasswordConfirmed = savedInstanceState.getBoolean(PASSWORD_CONFIRMED);
|
||||||
|
mWaitingForConfirmation = savedInstanceState.getBoolean(WAITING_FOR_CONFIRMATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mPasswordConfirmed) {
|
if (mPasswordConfirmed) {
|
||||||
|
updatePreferencesOrFinish();
|
||||||
|
} else if (!mWaitingForConfirmation) {
|
||||||
ChooseLockSettingsHelper helper =
|
ChooseLockSettingsHelper helper =
|
||||||
new ChooseLockSettingsHelper(this.getActivity(), this);
|
new ChooseLockSettingsHelper(this.getActivity(), this);
|
||||||
if (!helper.launchConfirmationActivity(CONFIRM_EXISTING_REQUEST, null, null)) {
|
if (!helper.launchConfirmationActivity(CONFIRM_EXISTING_REQUEST, null, null)) {
|
||||||
mPasswordConfirmed = true; // no password set, so no need to confirm
|
mPasswordConfirmed = true; // no password set, so no need to confirm
|
||||||
updatePreferencesOrFinish();
|
updatePreferencesOrFinish();
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
updatePreferencesOrFinish();
|
mWaitingForConfirmation = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
|
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
|
||||||
@@ -143,6 +150,7 @@ public class ChooseLockGeneric extends PreferenceActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
mWaitingForConfirmation = false;
|
||||||
if (requestCode == CONFIRM_EXISTING_REQUEST && resultCode == Activity.RESULT_OK) {
|
if (requestCode == CONFIRM_EXISTING_REQUEST && resultCode == Activity.RESULT_OK) {
|
||||||
mPasswordConfirmed = true;
|
mPasswordConfirmed = true;
|
||||||
updatePreferencesOrFinish();
|
updatePreferencesOrFinish();
|
||||||
@@ -161,6 +169,7 @@ public class ChooseLockGeneric extends PreferenceActivity {
|
|||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
// Saved so we don't force user to re-enter their password if configuration changes
|
// Saved so we don't force user to re-enter their password if configuration changes
|
||||||
outState.putBoolean(PASSWORD_CONFIRMED, mPasswordConfirmed);
|
outState.putBoolean(PASSWORD_CONFIRMED, mPasswordConfirmed);
|
||||||
|
outState.putBoolean(WAITING_FOR_CONFIRMATION, mWaitingForConfirmation);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updatePreferencesOrFinish() {
|
private void updatePreferencesOrFinish() {
|
||||||
|
Reference in New Issue
Block a user