Loading src/com/android/settings/biometrics/BiometricEnrollBase.java +2 −2 Original line number Diff line number Diff line Loading @@ -172,11 +172,11 @@ public abstract class BiometricEnrollBase extends InstrumentedActivity { if (mUserId == UserHandle.USER_NULL) { launchedConfirmationActivity = helper.launchConfirmationActivity(CONFIRM_REQUEST, getString(titleResId), null, null, challenge); null, null, challenge, true /* foregroundOnly */); } else { launchedConfirmationActivity = helper.launchConfirmationActivity(CONFIRM_REQUEST, getString(titleResId), null, null, challenge, mUserId); null, null, challenge, mUserId, true /* foregroundOnly */); } if (!launchedConfirmationActivity) { // This shouldn't happen, as we should only end up at this step if a lock thingy is Loading src/com/android/settings/biometrics/face/FaceSettings.java +1 −1 Original line number Diff line number Diff line Loading @@ -179,7 +179,7 @@ public class FaceSettings extends DashboardFragment { mConfirmingPassword = true; if (!helper.launchConfirmationActivity(CONFIRM_REQUEST, getString(R.string.security_settings_face_preference_title), null, null, challenge, mUserId)) { null, null, challenge, mUserId, true /* foregroundOnly */)) { Log.e(TAG, "Password not set"); finish(); } Loading src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java +1 −1 Original line number Diff line number Diff line Loading @@ -617,7 +617,7 @@ public class FingerprintSettings extends SubSettings { ChooseLockSettingsHelper helper = new ChooseLockSettingsHelper(getActivity(), this); if (!helper.launchConfirmationActivity(CONFIRM_REQUEST, getString(R.string.security_settings_fingerprint_preference_title), null, null, challenge, mUserId)) { null, null, challenge, mUserId, true /* foregroundOnly */)) { intent.setClassName(SETTINGS_PACKAGE_NAME, ChooseLockGeneric.class.getName()); intent.putExtra(ChooseLockGeneric.ChooseLockGenericFragment.MINIMUM_QUALITY_KEY, DevicePolicyManager.PASSWORD_QUALITY_SOMETHING); Loading src/com/android/settings/password/ChooseLockSettingsHelper.java +39 −19 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ public final class ChooseLockSettingsHelper { public static final String EXTRA_KEY_FOR_FINGERPRINT = "for_fingerprint"; public static final String EXTRA_KEY_FOR_FACE = "for_face"; public static final String EXTRA_KEY_FOR_CHANGE_CRED_REQUIRED_FOR_BOOT = "for_cred_req_boot"; public static final String EXTRA_KEY_FOREGROUND_ONLY = "foreground_only"; /** * Intent extra for passing the requested min password complexity to later steps in the set new Loading Loading @@ -105,7 +106,8 @@ public final class ChooseLockSettingsHelper { null /* header */, null /* description */, false /* returnCredentials */, false /* external */); false /* external */, false /* foregroundOnly */); } /** Loading @@ -124,7 +126,8 @@ public final class ChooseLockSettingsHelper { null /* header */, null /* description */, returnCredentials /* returnCredentials */, false /* external */); false /* external */, false /* foregroundOnly */); } /** Loading @@ -148,7 +151,8 @@ public final class ChooseLockSettingsHelper { false /* external */, false /* hasChallenge */, 0 /* challenge */, Utils.enforceSameOwner(mActivity, userId) /* userId */); Utils.enforceSameOwner(mActivity, userId) /* userId */, false /* foregroundOnly */); } /** Loading @@ -162,12 +166,13 @@ public final class ChooseLockSettingsHelper { * @param external specifies whether this activity is launched externally, meaning that it will * get a dark theme, allow fingerprint authentication and it will forward * activity result. * @param foregroundOnly if the confirmation activity should be finished if it loses foreground. * @return true if one exists and we launched an activity to confirm it * @see Activity#onActivityResult(int, int, android.content.Intent) */ boolean launchConfirmationActivity(int request, @Nullable CharSequence title, @Nullable CharSequence header, @Nullable CharSequence description, boolean returnCredentials, boolean external) { boolean returnCredentials, boolean external, boolean foregroundOnly) { return launchConfirmationActivity( request /* request */, title /* title */, Loading @@ -177,7 +182,8 @@ public final class ChooseLockSettingsHelper { external /* external */, false /* hasChallenge */, 0 /* challenge */, Utils.getCredentialOwnerUserId(mActivity) /* userId */); Utils.getCredentialOwnerUserId(mActivity) /* userId */, foregroundOnly /* foregroundOnly */); } /** Loading Loading @@ -207,7 +213,8 @@ public final class ChooseLockSettingsHelper { external /* external */, false /* hasChallenge */, 0 /* challenge */, Utils.enforceSameOwner(mActivity, userId) /* userId */); Utils.enforceSameOwner(mActivity, userId) /* userId */, false /* foregroundOnly */); } /** Loading @@ -217,12 +224,13 @@ public final class ChooseLockSettingsHelper { * @param header header of the confirmation screen; shown as large text * @param description description of the confirmation screen * @param challenge a challenge to be verified against the device credential. * @param foregroundOnly if the confirmation activity should be finished if it loses foreground. * @return true if one exists and we launched an activity to confirm it * @see Activity#onActivityResult(int, int, android.content.Intent) */ public boolean launchConfirmationActivity(int request, @Nullable CharSequence title, @Nullable CharSequence header, @Nullable CharSequence description, long challenge) { long challenge, boolean foregroundOnly) { return launchConfirmationActivity( request /* request */, title /* title */, Loading @@ -232,7 +240,8 @@ public final class ChooseLockSettingsHelper { false /* external */, true /* hasChallenge */, challenge /* challenge */, Utils.getCredentialOwnerUserId(mActivity) /* userId */); Utils.getCredentialOwnerUserId(mActivity) /* userId */, foregroundOnly /* foregroundOnly */); } /** Loading @@ -243,12 +252,13 @@ public final class ChooseLockSettingsHelper { * @param description description of the confirmation screen * @param challenge a challenge to be verified against the device credential. * @param userId The userId for whom the lock should be confirmed. * @param foregroundOnly if the confirmation activity should be finished if it loses foreground. * @return true if one exists and we launched an activity to confirm it * @see Activity#onActivityResult(int, int, android.content.Intent) */ public boolean launchConfirmationActivity(int request, @Nullable CharSequence title, @Nullable CharSequence header, @Nullable CharSequence description, long challenge, int userId) { long challenge, int userId, boolean foregroundOnly) { return launchConfirmationActivity( request /* request */, title /* title */, Loading @@ -258,7 +268,8 @@ public final class ChooseLockSettingsHelper { false /* external */, true /* hasChallenge */, challenge /* challenge */, Utils.enforceSameOwner(mActivity, userId) /* userId */); Utils.enforceSameOwner(mActivity, userId) /* userId */, foregroundOnly); } /** Loading Loading @@ -287,7 +298,8 @@ public final class ChooseLockSettingsHelper { external /* external */, true /* hasChallenge */, challenge /* challenge */, Utils.enforceSameOwner(mActivity, userId) /* userId */); Utils.enforceSameOwner(mActivity, userId) /* userId */, false /* foregroundOnly */); } /** Loading Loading @@ -316,7 +328,7 @@ public final class ChooseLockSettingsHelper { private boolean launchConfirmationActivity(int request, @Nullable CharSequence title, @Nullable CharSequence header, @Nullable CharSequence description, boolean returnCredentials, boolean external, boolean hasChallenge, long challenge, int userId) { long challenge, int userId, boolean foregroundOnly) { return launchConfirmationActivity( request /* request */, title /* title */, Loading @@ -328,7 +340,8 @@ public final class ChooseLockSettingsHelper { challenge /* challenge */, userId /* userId */, null /* alternateButton */, null /* extras */); null /* extras */, foregroundOnly /* foregroundOnly */); } private boolean launchConfirmationActivity(int request, @Nullable CharSequence title, Loading @@ -346,7 +359,8 @@ public final class ChooseLockSettingsHelper { challenge /* challenge */, userId /* userId */, null /* alternateButton */, extras /* extras */); extras /* extras */, false /* foregroundOnly */); } public boolean launchFrpConfirmationActivity(int request, @Nullable CharSequence header, Loading @@ -362,13 +376,15 @@ public final class ChooseLockSettingsHelper { 0 /* challenge */, LockPatternUtils.USER_FRP /* userId */, alternateButton /* alternateButton */, null /* extras */); null /* extras */, false /* foregroundOnly */); } private boolean launchConfirmationActivity(int request, @Nullable CharSequence title, @Nullable CharSequence header, @Nullable CharSequence description, boolean returnCredentials, boolean external, boolean hasChallenge, long challenge, int userId, @Nullable CharSequence alternateButton, Bundle extras) { long challenge, int userId, @Nullable CharSequence alternateButton, Bundle extras, boolean foregroundOnly) { final int effectiveUserId = UserManager.get(mActivity).getCredentialOwnerProfile(userId); boolean launched = false; Loading @@ -378,7 +394,8 @@ public final class ChooseLockSettingsHelper { returnCredentials || hasChallenge ? ConfirmLockPattern.InternalActivity.class : ConfirmLockPattern.class, returnCredentials, external, hasChallenge, challenge, userId, alternateButton, extras); hasChallenge, challenge, userId, alternateButton, extras, foregroundOnly); break; case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC: case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC_COMPLEX: Loading @@ -390,7 +407,8 @@ public final class ChooseLockSettingsHelper { returnCredentials || hasChallenge ? ConfirmLockPassword.InternalActivity.class : ConfirmLockPassword.class, returnCredentials, external, hasChallenge, challenge, userId, alternateButton, extras); hasChallenge, challenge, userId, alternateButton, extras, foregroundOnly); break; } return launched; Loading @@ -399,7 +417,8 @@ public final class ChooseLockSettingsHelper { private boolean launchConfirmationActivity(int request, CharSequence title, CharSequence header, CharSequence message, Class<?> activityClass, boolean returnCredentials, boolean external, boolean hasChallenge, long challenge, int userId, @Nullable CharSequence alternateButton, Bundle extras) { int userId, @Nullable CharSequence alternateButton, Bundle extras, boolean foregroundOnly) { final Intent intent = new Intent(); intent.putExtra(ConfirmDeviceCredentialBaseFragment.TITLE_TEXT, title); intent.putExtra(ConfirmDeviceCredentialBaseFragment.HEADER_TEXT, header); Loading @@ -414,6 +433,7 @@ public final class ChooseLockSettingsHelper { intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE, challenge); intent.putExtra(Intent.EXTRA_USER_ID, userId); intent.putExtra(KeyguardManager.EXTRA_ALTERNATE_BUTTON_LABEL, alternateButton); intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOREGROUND_ONLY, foregroundOnly); if (extras != null) { intent.putExtras(extras); } Loading src/com/android/settings/password/ConfirmDeviceCredentialBaseActivity.java +4 −0 Original line number Diff line number Diff line Loading @@ -172,6 +172,10 @@ public abstract class ConfirmDeviceCredentialBaseActivity extends SettingsActivi mBiometricManager.onConfirmDeviceCredentialError( BiometricConstants.BIOMETRIC_ERROR_USER_CANCELED, getString(com.android.internal.R.string.biometric_error_user_canceled)); if (getIntent().getBooleanExtra( ChooseLockSettingsHelper.EXTRA_KEY_FOREGROUND_ONLY, false)) { finish(); } } } Loading Loading
src/com/android/settings/biometrics/BiometricEnrollBase.java +2 −2 Original line number Diff line number Diff line Loading @@ -172,11 +172,11 @@ public abstract class BiometricEnrollBase extends InstrumentedActivity { if (mUserId == UserHandle.USER_NULL) { launchedConfirmationActivity = helper.launchConfirmationActivity(CONFIRM_REQUEST, getString(titleResId), null, null, challenge); null, null, challenge, true /* foregroundOnly */); } else { launchedConfirmationActivity = helper.launchConfirmationActivity(CONFIRM_REQUEST, getString(titleResId), null, null, challenge, mUserId); null, null, challenge, mUserId, true /* foregroundOnly */); } if (!launchedConfirmationActivity) { // This shouldn't happen, as we should only end up at this step if a lock thingy is Loading
src/com/android/settings/biometrics/face/FaceSettings.java +1 −1 Original line number Diff line number Diff line Loading @@ -179,7 +179,7 @@ public class FaceSettings extends DashboardFragment { mConfirmingPassword = true; if (!helper.launchConfirmationActivity(CONFIRM_REQUEST, getString(R.string.security_settings_face_preference_title), null, null, challenge, mUserId)) { null, null, challenge, mUserId, true /* foregroundOnly */)) { Log.e(TAG, "Password not set"); finish(); } Loading
src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java +1 −1 Original line number Diff line number Diff line Loading @@ -617,7 +617,7 @@ public class FingerprintSettings extends SubSettings { ChooseLockSettingsHelper helper = new ChooseLockSettingsHelper(getActivity(), this); if (!helper.launchConfirmationActivity(CONFIRM_REQUEST, getString(R.string.security_settings_fingerprint_preference_title), null, null, challenge, mUserId)) { null, null, challenge, mUserId, true /* foregroundOnly */)) { intent.setClassName(SETTINGS_PACKAGE_NAME, ChooseLockGeneric.class.getName()); intent.putExtra(ChooseLockGeneric.ChooseLockGenericFragment.MINIMUM_QUALITY_KEY, DevicePolicyManager.PASSWORD_QUALITY_SOMETHING); Loading
src/com/android/settings/password/ChooseLockSettingsHelper.java +39 −19 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ public final class ChooseLockSettingsHelper { public static final String EXTRA_KEY_FOR_FINGERPRINT = "for_fingerprint"; public static final String EXTRA_KEY_FOR_FACE = "for_face"; public static final String EXTRA_KEY_FOR_CHANGE_CRED_REQUIRED_FOR_BOOT = "for_cred_req_boot"; public static final String EXTRA_KEY_FOREGROUND_ONLY = "foreground_only"; /** * Intent extra for passing the requested min password complexity to later steps in the set new Loading Loading @@ -105,7 +106,8 @@ public final class ChooseLockSettingsHelper { null /* header */, null /* description */, false /* returnCredentials */, false /* external */); false /* external */, false /* foregroundOnly */); } /** Loading @@ -124,7 +126,8 @@ public final class ChooseLockSettingsHelper { null /* header */, null /* description */, returnCredentials /* returnCredentials */, false /* external */); false /* external */, false /* foregroundOnly */); } /** Loading @@ -148,7 +151,8 @@ public final class ChooseLockSettingsHelper { false /* external */, false /* hasChallenge */, 0 /* challenge */, Utils.enforceSameOwner(mActivity, userId) /* userId */); Utils.enforceSameOwner(mActivity, userId) /* userId */, false /* foregroundOnly */); } /** Loading @@ -162,12 +166,13 @@ public final class ChooseLockSettingsHelper { * @param external specifies whether this activity is launched externally, meaning that it will * get a dark theme, allow fingerprint authentication and it will forward * activity result. * @param foregroundOnly if the confirmation activity should be finished if it loses foreground. * @return true if one exists and we launched an activity to confirm it * @see Activity#onActivityResult(int, int, android.content.Intent) */ boolean launchConfirmationActivity(int request, @Nullable CharSequence title, @Nullable CharSequence header, @Nullable CharSequence description, boolean returnCredentials, boolean external) { boolean returnCredentials, boolean external, boolean foregroundOnly) { return launchConfirmationActivity( request /* request */, title /* title */, Loading @@ -177,7 +182,8 @@ public final class ChooseLockSettingsHelper { external /* external */, false /* hasChallenge */, 0 /* challenge */, Utils.getCredentialOwnerUserId(mActivity) /* userId */); Utils.getCredentialOwnerUserId(mActivity) /* userId */, foregroundOnly /* foregroundOnly */); } /** Loading Loading @@ -207,7 +213,8 @@ public final class ChooseLockSettingsHelper { external /* external */, false /* hasChallenge */, 0 /* challenge */, Utils.enforceSameOwner(mActivity, userId) /* userId */); Utils.enforceSameOwner(mActivity, userId) /* userId */, false /* foregroundOnly */); } /** Loading @@ -217,12 +224,13 @@ public final class ChooseLockSettingsHelper { * @param header header of the confirmation screen; shown as large text * @param description description of the confirmation screen * @param challenge a challenge to be verified against the device credential. * @param foregroundOnly if the confirmation activity should be finished if it loses foreground. * @return true if one exists and we launched an activity to confirm it * @see Activity#onActivityResult(int, int, android.content.Intent) */ public boolean launchConfirmationActivity(int request, @Nullable CharSequence title, @Nullable CharSequence header, @Nullable CharSequence description, long challenge) { long challenge, boolean foregroundOnly) { return launchConfirmationActivity( request /* request */, title /* title */, Loading @@ -232,7 +240,8 @@ public final class ChooseLockSettingsHelper { false /* external */, true /* hasChallenge */, challenge /* challenge */, Utils.getCredentialOwnerUserId(mActivity) /* userId */); Utils.getCredentialOwnerUserId(mActivity) /* userId */, foregroundOnly /* foregroundOnly */); } /** Loading @@ -243,12 +252,13 @@ public final class ChooseLockSettingsHelper { * @param description description of the confirmation screen * @param challenge a challenge to be verified against the device credential. * @param userId The userId for whom the lock should be confirmed. * @param foregroundOnly if the confirmation activity should be finished if it loses foreground. * @return true if one exists and we launched an activity to confirm it * @see Activity#onActivityResult(int, int, android.content.Intent) */ public boolean launchConfirmationActivity(int request, @Nullable CharSequence title, @Nullable CharSequence header, @Nullable CharSequence description, long challenge, int userId) { long challenge, int userId, boolean foregroundOnly) { return launchConfirmationActivity( request /* request */, title /* title */, Loading @@ -258,7 +268,8 @@ public final class ChooseLockSettingsHelper { false /* external */, true /* hasChallenge */, challenge /* challenge */, Utils.enforceSameOwner(mActivity, userId) /* userId */); Utils.enforceSameOwner(mActivity, userId) /* userId */, foregroundOnly); } /** Loading Loading @@ -287,7 +298,8 @@ public final class ChooseLockSettingsHelper { external /* external */, true /* hasChallenge */, challenge /* challenge */, Utils.enforceSameOwner(mActivity, userId) /* userId */); Utils.enforceSameOwner(mActivity, userId) /* userId */, false /* foregroundOnly */); } /** Loading Loading @@ -316,7 +328,7 @@ public final class ChooseLockSettingsHelper { private boolean launchConfirmationActivity(int request, @Nullable CharSequence title, @Nullable CharSequence header, @Nullable CharSequence description, boolean returnCredentials, boolean external, boolean hasChallenge, long challenge, int userId) { long challenge, int userId, boolean foregroundOnly) { return launchConfirmationActivity( request /* request */, title /* title */, Loading @@ -328,7 +340,8 @@ public final class ChooseLockSettingsHelper { challenge /* challenge */, userId /* userId */, null /* alternateButton */, null /* extras */); null /* extras */, foregroundOnly /* foregroundOnly */); } private boolean launchConfirmationActivity(int request, @Nullable CharSequence title, Loading @@ -346,7 +359,8 @@ public final class ChooseLockSettingsHelper { challenge /* challenge */, userId /* userId */, null /* alternateButton */, extras /* extras */); extras /* extras */, false /* foregroundOnly */); } public boolean launchFrpConfirmationActivity(int request, @Nullable CharSequence header, Loading @@ -362,13 +376,15 @@ public final class ChooseLockSettingsHelper { 0 /* challenge */, LockPatternUtils.USER_FRP /* userId */, alternateButton /* alternateButton */, null /* extras */); null /* extras */, false /* foregroundOnly */); } private boolean launchConfirmationActivity(int request, @Nullable CharSequence title, @Nullable CharSequence header, @Nullable CharSequence description, boolean returnCredentials, boolean external, boolean hasChallenge, long challenge, int userId, @Nullable CharSequence alternateButton, Bundle extras) { long challenge, int userId, @Nullable CharSequence alternateButton, Bundle extras, boolean foregroundOnly) { final int effectiveUserId = UserManager.get(mActivity).getCredentialOwnerProfile(userId); boolean launched = false; Loading @@ -378,7 +394,8 @@ public final class ChooseLockSettingsHelper { returnCredentials || hasChallenge ? ConfirmLockPattern.InternalActivity.class : ConfirmLockPattern.class, returnCredentials, external, hasChallenge, challenge, userId, alternateButton, extras); hasChallenge, challenge, userId, alternateButton, extras, foregroundOnly); break; case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC: case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC_COMPLEX: Loading @@ -390,7 +407,8 @@ public final class ChooseLockSettingsHelper { returnCredentials || hasChallenge ? ConfirmLockPassword.InternalActivity.class : ConfirmLockPassword.class, returnCredentials, external, hasChallenge, challenge, userId, alternateButton, extras); hasChallenge, challenge, userId, alternateButton, extras, foregroundOnly); break; } return launched; Loading @@ -399,7 +417,8 @@ public final class ChooseLockSettingsHelper { private boolean launchConfirmationActivity(int request, CharSequence title, CharSequence header, CharSequence message, Class<?> activityClass, boolean returnCredentials, boolean external, boolean hasChallenge, long challenge, int userId, @Nullable CharSequence alternateButton, Bundle extras) { int userId, @Nullable CharSequence alternateButton, Bundle extras, boolean foregroundOnly) { final Intent intent = new Intent(); intent.putExtra(ConfirmDeviceCredentialBaseFragment.TITLE_TEXT, title); intent.putExtra(ConfirmDeviceCredentialBaseFragment.HEADER_TEXT, header); Loading @@ -414,6 +433,7 @@ public final class ChooseLockSettingsHelper { intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE, challenge); intent.putExtra(Intent.EXTRA_USER_ID, userId); intent.putExtra(KeyguardManager.EXTRA_ALTERNATE_BUTTON_LABEL, alternateButton); intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOREGROUND_ONLY, foregroundOnly); if (extras != null) { intent.putExtras(extras); } Loading
src/com/android/settings/password/ConfirmDeviceCredentialBaseActivity.java +4 −0 Original line number Diff line number Diff line Loading @@ -172,6 +172,10 @@ public abstract class ConfirmDeviceCredentialBaseActivity extends SettingsActivi mBiometricManager.onConfirmDeviceCredentialError( BiometricConstants.BIOMETRIC_ERROR_USER_CANCELED, getString(com.android.internal.R.string.biometric_error_user_canceled)); if (getIntent().getBooleanExtra( ChooseLockSettingsHelper.EXTRA_KEY_FOREGROUND_ONLY, false)) { finish(); } } } Loading