4/n: Remove challenge from choose/confirm, use new path
Biometric enrollment will not request a Gatekeeper HAT during initial credential setup or credential confirmation anymore. Instead, it is broken down into the following steps now. Bug: 161765592 1) Request credential setup / confirmation to return a Gatekeeper Password 2) Biometric enrollment will generate a challenge 3) Biometric enrollment will request LockSettingsService to verify(GatekeeperPassword, challenge), and upon verification, the Gatekeeper HAT will be returned. Since both LockSettingsService and Biometric enroll/settings make use of biometric challenges, this allows us to make the challenge ownership/lifecycle clear (vs. previously, where LockSettingsService has no idea who the challenge belongs to). Exempt-From-Owner-Approval:For files not owned by our team, (StorageWizard), this change is just a method rename Test: RunSettingsRoboTests Run the following on face/fingerprint devices Test: Remove credential adb shell am start -a android.app.action.SET_NEW_PASSWORD Set up credential + fingerprint Test: Remove credential, adb shell am start -a android.settings.FINGERPRINT_SETTINGS This tests the ChooseLock* logic in FingerprintSettings Test: Set up credential, adb shell am start -a android.settings.FINGERPRINT_SETTINGS This tests the ConfirmLock* logic in FingerprintSettings Test: Remove device credential, enroll fingerprint/face. Succeeds. This tests the ChooseLock* returning SP path from BiometricEnrollIntro Test: With credential and fingerprint/face enrolled, go to fingerprint/face settings and enroll. This tests the ConfirmLock* path in Fingerprint/FaceSettings Test: Remove device credential, enroll credential-only, enroll fingerprint/face separately. Succeeds. This tests the ConfirmLock* returning SP path in BiometricEnrollIntro Test: In SUW, set up credential, then biometric. This tests the ChooseLock* path in SUW Test: In SUW, set up credential, go back, then set up biometric. This tests the ConfirmLock* path in SUW Change-Id: Idf6fcb43f7497323d089eb9c37125294e7a7f5dc
This commit is contained in:
@@ -92,8 +92,8 @@ public class ChooseLockPasswordTest {
|
||||
.setUserId(123)
|
||||
.build();
|
||||
|
||||
assertThat(intent.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_HAS_CHALLENGE, true))
|
||||
.named("EXTRA_KEY_HAS_CHALLENGE")
|
||||
assertThat(intent.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_FORCE_VERIFY, false))
|
||||
.named("EXTRA_KEY_FORCE_VERIFY")
|
||||
.isFalse();
|
||||
assertThat((LockscreenCredential) intent.getParcelableExtra(
|
||||
ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD))
|
||||
@@ -108,19 +108,16 @@ public class ChooseLockPasswordTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void intentBuilder_setChallenge_shouldAddExtras() {
|
||||
public void intentBuilder_setRequestGatekeeperPassword_shouldAddExtras() {
|
||||
Intent intent = new IntentBuilder(application)
|
||||
.setChallenge(12345L)
|
||||
.setRequestGatekeeperPassword(true)
|
||||
.setPasswordQuality(PASSWORD_QUALITY_ALPHANUMERIC)
|
||||
.setUserId(123)
|
||||
.build();
|
||||
|
||||
assertThat(intent.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_HAS_CHALLENGE, false))
|
||||
.named("EXTRA_KEY_HAS_CHALLENGE")
|
||||
assertThat(intent.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW, false))
|
||||
.named("EXTRA_KEY_REQUEST_GK_PW")
|
||||
.isTrue();
|
||||
assertThat(intent.getLongExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE, 0L))
|
||||
.named("EXTRA_KEY_CHALLENGE")
|
||||
.isEqualTo(12345L);
|
||||
assertThat(intent.getIntExtra(PASSWORD_TYPE_KEY, 0))
|
||||
.named("PASSWORD_TYPE_KEY")
|
||||
.isEqualTo(PASSWORD_QUALITY_ALPHANUMERIC);
|
||||
|
@@ -59,8 +59,8 @@ public class ChooseLockPatternTest {
|
||||
.build();
|
||||
|
||||
assertThat(intent
|
||||
.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_HAS_CHALLENGE, true))
|
||||
.named("EXTRA_KEY_HAS_CHALLENGE")
|
||||
.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_FORCE_VERIFY, false))
|
||||
.named("EXTRA_KEY_FORCE_VERIFY")
|
||||
.isFalse();
|
||||
assertThat((LockscreenCredential) intent
|
||||
.getParcelableExtra(ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD))
|
||||
@@ -72,20 +72,16 @@ public class ChooseLockPatternTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void intentBuilder_setChallenge_shouldAddExtras() {
|
||||
public void intentBuilder_setRequestGatekeeperPassword_shouldAddExtras() {
|
||||
Intent intent = new IntentBuilder(application)
|
||||
.setChallenge(12345L)
|
||||
.setRequestGatekeeperPassword(true)
|
||||
.setUserId(123)
|
||||
.build();
|
||||
|
||||
assertThat(intent
|
||||
.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_HAS_CHALLENGE, false))
|
||||
.named("EXTRA_KEY_HAS_CHALLENGE")
|
||||
.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW, false))
|
||||
.named("EXTRA_KEY_REQUEST_GK_PW")
|
||||
.isTrue();
|
||||
assertThat(intent
|
||||
.getLongExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE, 0L))
|
||||
.named("EXTRA_KEY_CHALLENGE")
|
||||
.isEqualTo(12345L);
|
||||
assertThat(intent
|
||||
.getIntExtra(Intent.EXTRA_USER_ID, 0))
|
||||
.named("EXTRA_USER_ID")
|
||||
|
@@ -36,7 +36,7 @@ import org.robolectric.shadows.ShadowActivity.IntentForResult;
|
||||
public class ChooseLockSettingsHelperTest {
|
||||
|
||||
@Test
|
||||
public void testLaunchConfirmationActivityWithExternalAndChallenge() {
|
||||
public void testLaunchConfirmationActivityWithExternal() {
|
||||
final Activity activity = Robolectric.setupActivity(Activity.class);
|
||||
|
||||
ChooseLockSettingsHelper.Builder builder = new ChooseLockSettingsHelper.Builder(activity);
|
||||
@@ -45,7 +45,6 @@ public class ChooseLockSettingsHelperTest {
|
||||
.setHeader("header")
|
||||
.setDescription("description")
|
||||
.setExternal(true)
|
||||
.setChallenge(10000L)
|
||||
.setUserId(UserHandle.myUserId());
|
||||
ChooseLockSettingsHelper helper = getChooseLockSettingsHelper(builder);
|
||||
helper.launch();
|
||||
@@ -53,15 +52,10 @@ public class ChooseLockSettingsHelperTest {
|
||||
ShadowActivity shadowActivity = Shadows.shadowOf(activity);
|
||||
Intent startedIntent = shadowActivity.getNextStartedActivity();
|
||||
|
||||
assertEquals(new ComponentName("com.android.settings",
|
||||
ConfirmLockPattern.InternalActivity.class.getName()),
|
||||
assertEquals(new ComponentName("com.android.settings", ConfirmLockPattern.class.getName()),
|
||||
startedIntent.getComponent());
|
||||
assertFalse(startedIntent.getBooleanExtra(
|
||||
ChooseLockSettingsHelper.EXTRA_KEY_RETURN_CREDENTIALS, false));
|
||||
assertTrue(startedIntent.getBooleanExtra(
|
||||
ChooseLockSettingsHelper.EXTRA_KEY_HAS_CHALLENGE, false));
|
||||
assertEquals(10000L, startedIntent.getLongExtra(
|
||||
ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE, 0L));
|
||||
assertTrue((startedIntent.getFlags() & Intent.FLAG_ACTIVITY_FORWARD_RESULT) != 0);
|
||||
assertFalse(startedIntent.getBooleanExtra(
|
||||
ConfirmDeviceCredentialBaseFragment.DARK_THEME, false));
|
||||
@@ -72,7 +66,7 @@ public class ChooseLockSettingsHelperTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLaunchConfirmationActivityInternalAndChallenge() {
|
||||
public void testLaunchConfirmationActivityInternal() {
|
||||
final Activity activity = Robolectric.setupActivity(Activity.class);
|
||||
|
||||
ChooseLockSettingsHelper.Builder builder = new ChooseLockSettingsHelper.Builder(activity);
|
||||
@@ -80,7 +74,8 @@ public class ChooseLockSettingsHelperTest {
|
||||
.setTitle("title")
|
||||
.setHeader("header")
|
||||
.setDescription("description")
|
||||
.setChallenge(10000L)
|
||||
.setForceVerifyPath(true)
|
||||
.setReturnCredentials(true)
|
||||
.setUserId(UserHandle.myUserId());
|
||||
ChooseLockSettingsHelper helper = getChooseLockSettingsHelper(builder);
|
||||
helper.launch();
|
||||
@@ -91,12 +86,10 @@ public class ChooseLockSettingsHelperTest {
|
||||
assertEquals(new ComponentName("com.android.settings",
|
||||
ConfirmLockPattern.InternalActivity.class.getName()),
|
||||
startedIntent.getComponent());
|
||||
assertFalse(startedIntent.getBooleanExtra(
|
||||
ChooseLockSettingsHelper.EXTRA_KEY_RETURN_CREDENTIALS, false));
|
||||
assertTrue(startedIntent.getBooleanExtra(
|
||||
ChooseLockSettingsHelper.EXTRA_KEY_HAS_CHALLENGE, false));
|
||||
assertEquals(10000L, startedIntent.getLongExtra(
|
||||
ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE, 0L));
|
||||
ChooseLockSettingsHelper.EXTRA_KEY_RETURN_CREDENTIALS, true));
|
||||
assertTrue(startedIntent.getBooleanExtra(
|
||||
ChooseLockSettingsHelper.EXTRA_KEY_FORCE_VERIFY, true));
|
||||
assertFalse((startedIntent.getFlags() & Intent.FLAG_ACTIVITY_FORWARD_RESULT) != 0);
|
||||
assertFalse(startedIntent.getBooleanExtra(
|
||||
ConfirmDeviceCredentialBaseFragment.DARK_THEME, false));
|
||||
|
@@ -19,14 +19,11 @@ package com.android.settings.password;
|
||||
import static android.content.pm.PackageManager.FEATURE_FACE;
|
||||
import static android.content.pm.PackageManager.FEATURE_FINGERPRINT;
|
||||
|
||||
import static com.android.settings.password.ChooseLockGeneric.ChooseLockGenericFragment
|
||||
.HIDE_DISABLED_PREFS;
|
||||
import static com.android.settings.password.ChooseLockGeneric.ChooseLockGenericFragment
|
||||
.MINIMUM_QUALITY_KEY;
|
||||
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE;
|
||||
import static com.android.settings.password.ChooseLockGeneric.ChooseLockGenericFragment.HIDE_DISABLED_PREFS;
|
||||
import static com.android.settings.password.ChooseLockGeneric.ChooseLockGenericFragment.MINIMUM_QUALITY_KEY;
|
||||
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_FOR_FACE;
|
||||
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_FOR_FINGERPRINT;
|
||||
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_HAS_CHALLENGE;
|
||||
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
@@ -278,12 +275,8 @@ public final class SetNewPasswordControllerTest {
|
||||
"All disabled preference should be removed.",
|
||||
actualBundle.getBoolean(HIDE_DISABLED_PREFS));
|
||||
assertTrue(
|
||||
"There must be a fingerprint challenge.",
|
||||
actualBundle.getBoolean(EXTRA_KEY_HAS_CHALLENGE));
|
||||
assertEquals(
|
||||
"The fingerprint challenge must come from the FingerprintManager",
|
||||
FINGERPRINT_CHALLENGE,
|
||||
actualBundle.getLong(EXTRA_KEY_CHALLENGE));
|
||||
"Fingerprint enroll must request Gatekeeper Password.",
|
||||
actualBundle.getBoolean(EXTRA_KEY_REQUEST_GK_PW));
|
||||
assertTrue(
|
||||
"The request must be a fingerprint set up request.",
|
||||
actualBundle.getBoolean(EXTRA_KEY_FOR_FINGERPRINT));
|
||||
@@ -302,12 +295,8 @@ public final class SetNewPasswordControllerTest {
|
||||
"All disabled preference should be removed.",
|
||||
actualBundle.getBoolean(HIDE_DISABLED_PREFS));
|
||||
assertTrue(
|
||||
"There must be a face challenge.",
|
||||
actualBundle.getBoolean(EXTRA_KEY_HAS_CHALLENGE));
|
||||
assertEquals(
|
||||
"The face challenge must come from the FaceManager",
|
||||
FACE_CHALLENGE,
|
||||
actualBundle.getLong(EXTRA_KEY_CHALLENGE));
|
||||
"Face enroll must request Gatekeeper Password",
|
||||
actualBundle.getBoolean(EXTRA_KEY_REQUEST_GK_PW));
|
||||
assertTrue(
|
||||
"The request must be a face set up request.",
|
||||
actualBundle.getBoolean(EXTRA_KEY_FOR_FACE));
|
||||
|
Reference in New Issue
Block a user