Setup lock screen go back one screen at a time
SetupChooseLockGeneric no longer finishes itself when it receives a RESULT_CANCELED result from an activity it started. Bug: 18631770 Change-Id: I892b76847904225fe607b9406d6e76f932daa062
This commit is contained in:
@@ -81,10 +81,10 @@ public class ChooseLockGeneric extends SettingsActivity {
|
|||||||
private static final String KEY_UNLOCK_SET_PATTERN = "unlock_set_pattern";
|
private static final String KEY_UNLOCK_SET_PATTERN = "unlock_set_pattern";
|
||||||
private static final int CONFIRM_EXISTING_REQUEST = 100;
|
private static final int CONFIRM_EXISTING_REQUEST = 100;
|
||||||
private static final int ENABLE_ENCRYPTION_REQUEST = 102;
|
private static final int ENABLE_ENCRYPTION_REQUEST = 102;
|
||||||
|
private static final int CHOOSE_LOCK_REQUEST = 103;
|
||||||
private static final String PASSWORD_CONFIRMED = "password_confirmed";
|
private static final String PASSWORD_CONFIRMED = "password_confirmed";
|
||||||
|
|
||||||
private static final String WAITING_FOR_CONFIRMATION = "waiting_for_confirmation";
|
private static final String WAITING_FOR_CONFIRMATION = "waiting_for_confirmation";
|
||||||
private static final String FINISH_PENDING = "finish_pending";
|
|
||||||
private static final String TAG = "ChooseLockGenericFragment";
|
private static final String TAG = "ChooseLockGenericFragment";
|
||||||
public static final String MINIMUM_QUALITY_KEY = "minimum_quality";
|
public static final String MINIMUM_QUALITY_KEY = "minimum_quality";
|
||||||
public static final String ENCRYPT_REQUESTED_QUALITY = "encrypt_requested_quality";
|
public static final String ENCRYPT_REQUESTED_QUALITY = "encrypt_requested_quality";
|
||||||
@@ -98,7 +98,6 @@ public class ChooseLockGeneric extends SettingsActivity {
|
|||||||
private KeyStore mKeyStore;
|
private KeyStore mKeyStore;
|
||||||
private boolean mPasswordConfirmed = false;
|
private boolean mPasswordConfirmed = false;
|
||||||
private boolean mWaitingForConfirmation = false;
|
private boolean mWaitingForConfirmation = false;
|
||||||
private boolean mFinishPending = false;
|
|
||||||
private int mEncryptionRequestQuality;
|
private int mEncryptionRequestQuality;
|
||||||
private boolean mEncryptionRequestDisabled;
|
private boolean mEncryptionRequestDisabled;
|
||||||
private boolean mRequirePassword;
|
private boolean mRequirePassword;
|
||||||
@@ -123,7 +122,6 @@ public class ChooseLockGeneric extends SettingsActivity {
|
|||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
mPasswordConfirmed = savedInstanceState.getBoolean(PASSWORD_CONFIRMED);
|
mPasswordConfirmed = savedInstanceState.getBoolean(PASSWORD_CONFIRMED);
|
||||||
mWaitingForConfirmation = savedInstanceState.getBoolean(WAITING_FOR_CONFIRMATION);
|
mWaitingForConfirmation = savedInstanceState.getBoolean(WAITING_FOR_CONFIRMATION);
|
||||||
mFinishPending = savedInstanceState.getBoolean(FINISH_PENDING);
|
|
||||||
mEncryptionRequestQuality = savedInstanceState.getInt(ENCRYPT_REQUESTED_QUALITY);
|
mEncryptionRequestQuality = savedInstanceState.getInt(ENCRYPT_REQUESTED_QUALITY);
|
||||||
mEncryptionRequestDisabled = savedInstanceState.getBoolean(
|
mEncryptionRequestDisabled = savedInstanceState.getBoolean(
|
||||||
ENCRYPT_REQUESTED_DISABLED);
|
ENCRYPT_REQUESTED_DISABLED);
|
||||||
@@ -143,15 +141,6 @@ public class ChooseLockGeneric extends SettingsActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onResume() {
|
|
||||||
super.onResume();
|
|
||||||
if (mFinishPending) {
|
|
||||||
mFinishPending = false;
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
|
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
|
||||||
Preference preference) {
|
Preference preference) {
|
||||||
@@ -204,6 +193,9 @@ public class ChooseLockGeneric extends SettingsActivity {
|
|||||||
mRequirePassword = data.getBooleanExtra(
|
mRequirePassword = data.getBooleanExtra(
|
||||||
EncryptionInterstitial.EXTRA_REQUIRE_PASSWORD, true);
|
EncryptionInterstitial.EXTRA_REQUIRE_PASSWORD, true);
|
||||||
updateUnlockMethodAndFinish(mEncryptionRequestQuality, mEncryptionRequestDisabled);
|
updateUnlockMethodAndFinish(mEncryptionRequestQuality, mEncryptionRequestDisabled);
|
||||||
|
} else if (requestCode == CHOOSE_LOCK_REQUEST) {
|
||||||
|
getActivity().setResult(resultCode, data);
|
||||||
|
finish();
|
||||||
} else {
|
} else {
|
||||||
getActivity().setResult(Activity.RESULT_CANCELED);
|
getActivity().setResult(Activity.RESULT_CANCELED);
|
||||||
finish();
|
finish();
|
||||||
@@ -216,7 +208,6 @@ public class ChooseLockGeneric extends SettingsActivity {
|
|||||||
// 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);
|
outState.putBoolean(WAITING_FOR_CONFIRMATION, mWaitingForConfirmation);
|
||||||
outState.putBoolean(FINISH_PENDING, mFinishPending);
|
|
||||||
outState.putInt(ENCRYPT_REQUESTED_QUALITY, mEncryptionRequestQuality);
|
outState.putInt(ENCRYPT_REQUESTED_QUALITY, mEncryptionRequestQuality);
|
||||||
outState.putBoolean(ENCRYPT_REQUESTED_DISABLED, mEncryptionRequestDisabled);
|
outState.putBoolean(ENCRYPT_REQUESTED_DISABLED, mEncryptionRequestDisabled);
|
||||||
}
|
}
|
||||||
@@ -392,15 +383,11 @@ public class ChooseLockGeneric extends SettingsActivity {
|
|||||||
final int maxLength = mDPM.getPasswordMaximumLength(quality);
|
final int maxLength = mDPM.getPasswordMaximumLength(quality);
|
||||||
Intent intent = getLockPasswordIntent(context, quality, minLength,
|
Intent intent = getLockPasswordIntent(context, quality, minLength,
|
||||||
maxLength, mRequirePassword, /* confirm credentials */false);
|
maxLength, mRequirePassword, /* confirm credentials */false);
|
||||||
mFinishPending = true;
|
startActivityForResult(intent, CHOOSE_LOCK_REQUEST);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
|
|
||||||
startActivity(intent);
|
|
||||||
} else if (quality == DevicePolicyManager.PASSWORD_QUALITY_SOMETHING) {
|
} else if (quality == DevicePolicyManager.PASSWORD_QUALITY_SOMETHING) {
|
||||||
Intent intent = getLockPatternIntent(context, mRequirePassword,
|
Intent intent = getLockPatternIntent(context, mRequirePassword,
|
||||||
/* confirm credentials */false);
|
/* confirm credentials */false);
|
||||||
mFinishPending = true;
|
startActivityForResult(intent, CHOOSE_LOCK_REQUEST);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
|
|
||||||
startActivity(intent);
|
|
||||||
} else if (quality == DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) {
|
} else if (quality == DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) {
|
||||||
mChooseLockSettingsHelper.utils().clearLock();
|
mChooseLockSettingsHelper.utils().clearLock();
|
||||||
mChooseLockSettingsHelper.utils().setLockScreenDisabled(disabled);
|
mChooseLockSettingsHelper.utils().setLockScreenDisabled(disabled);
|
||||||
|
@@ -94,6 +94,15 @@ public class SetupChooseLockGeneric extends ChooseLockGeneric
|
|||||||
SetupWizardUtils.setHeaderText(getActivity(), getActivity().getTitle());
|
SetupWizardUtils.setHeaderText(getActivity(), getActivity().getTitle());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
if (resultCode != RESULT_CANCELED) {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
}
|
||||||
|
// If the started activity was cancelled (e.g. the user presses back), then this
|
||||||
|
// activity will be resumed to foreground.
|
||||||
|
}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* Disables preferences that are less secure than required quality and shows only secure
|
* Disables preferences that are less secure than required quality and shows only secure
|
||||||
* screen lock options here.
|
* screen lock options here.
|
||||||
|
@@ -67,6 +67,7 @@ public class SetupRedactionInterstitial extends RedactionInterstitial
|
|||||||
@Override
|
@Override
|
||||||
public void onNavigationBarCreated(SetupWizardNavBar bar) {
|
public void onNavigationBarCreated(SetupWizardNavBar bar) {
|
||||||
SetupWizardUtils.setImmersiveMode(this, bar);
|
SetupWizardUtils.setImmersiveMode(this, bar);
|
||||||
|
bar.getBackButton().setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Reference in New Issue
Block a user