[BiometricsV2] Fix fingerprint add another fail
Fix enrolling can't finished because FingerprintEnrollment attaches to wrong ViewModel during onCreate() with non-null savedInstance after rotation. Read latest fragment through findFragmentById to fix it Bug: 275513362 Test: atest FingerprintEnrollmentActivityTest Change-Id: Icb2c0edec325a813ec5a7822aba39ca201d2d8e9
This commit is contained in:
@@ -66,7 +66,6 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.fragment.app.FragmentManager;
|
|
||||||
import androidx.lifecycle.Observer;
|
import androidx.lifecycle.Observer;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
import androidx.lifecycle.viewmodel.CreationExtras;
|
import androidx.lifecycle.viewmodel.CreationExtras;
|
||||||
@@ -194,11 +193,13 @@ public class FingerprintEnrollmentActivity extends FragmentActivity {
|
|||||||
// fragment
|
// fragment
|
||||||
setContentView(R.layout.biometric_enrollment_container);
|
setContentView(R.layout.biometric_enrollment_container);
|
||||||
|
|
||||||
|
final Fragment fragment = getSupportFragmentManager().findFragmentById(
|
||||||
|
R.id.fragment_container_view);
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Log.e(TAG, "onCreate() has savedInstance:" + (savedInstanceState != null));
|
Log.d(TAG, "onCreate() has savedInstance:" + (savedInstanceState != null)
|
||||||
|
+ ", fragment:" + fragment);
|
||||||
}
|
}
|
||||||
if (savedInstanceState == null) {
|
if (fragment == null) {
|
||||||
Log.d(TAG, "onCreate()"); // Use to differentiate biometrics v2
|
|
||||||
checkCredential();
|
checkCredential();
|
||||||
final EnrollmentRequest request = mViewModel.getRequest();
|
final EnrollmentRequest request = mViewModel.getRequest();
|
||||||
if (request.isSkipFindSensor()) {
|
if (request.isSkipFindSensor()) {
|
||||||
@@ -209,42 +210,26 @@ public class FingerprintEnrollmentActivity extends FragmentActivity {
|
|||||||
startIntroFragment();
|
startIntroFragment();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
final FragmentManager manager = getSupportFragmentManager();
|
final String tag = fragment.getTag();
|
||||||
String[] tags = new String[] {
|
if (INTRO_TAG.equals(tag)) {
|
||||||
FINISH_TAG,
|
|
||||||
ENROLLING_UDFPS_TAG,
|
|
||||||
ENROLLING_SFPS_TAG,
|
|
||||||
ENROLLING_RFPS_TAG,
|
|
||||||
FIND_UDFPS_TAG,
|
|
||||||
FIND_SFPS_TAG,
|
|
||||||
FIND_RFPS_TAG,
|
|
||||||
INTRO_TAG
|
|
||||||
};
|
|
||||||
for (String tag: tags) {
|
|
||||||
final Fragment fragment = manager.findFragmentByTag(tag);
|
|
||||||
if (fragment == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (DEBUG) {
|
|
||||||
Log.e(TAG, "onCreate() currentFragment:" + tag);
|
|
||||||
}
|
|
||||||
if (tag.equals(INTRO_TAG)) {
|
|
||||||
attachIntroViewModel();
|
attachIntroViewModel();
|
||||||
} else if (tag.equals(FIND_UDFPS_TAG) || tag.equals(FIND_SFPS_TAG)
|
} else if (FIND_UDFPS_TAG.equals(tag) || FIND_SFPS_TAG.equals(tag)
|
||||||
|| tag.equals(FIND_RFPS_TAG)) {
|
|| FIND_RFPS_TAG.equals(tag)) {
|
||||||
attachFindSensorViewModel();
|
attachFindSensorViewModel();
|
||||||
attachIntroViewModel();
|
attachIntroViewModel();
|
||||||
} else if (tag.equals(ENROLLING_UDFPS_TAG) || tag.equals(ENROLLING_SFPS_TAG)
|
} else if (ENROLLING_UDFPS_TAG.equals(tag) || ENROLLING_SFPS_TAG.equals(tag)
|
||||||
|| tag.equals(ENROLLING_RFPS_TAG)) {
|
|| ENROLLING_RFPS_TAG.equals(tag)) {
|
||||||
attachEnrollingViewModel();
|
attachEnrollingViewModel();
|
||||||
attachFindSensorViewModel();
|
attachFindSensorViewModel();
|
||||||
attachIntroViewModel();
|
attachIntroViewModel();
|
||||||
} else { // FINISH_TAG
|
} else if (FINISH_TAG.equals(tag)) {
|
||||||
attachFinishViewModel();
|
attachFinishViewModel();
|
||||||
attachFindSensorViewModel();
|
attachFindSensorViewModel();
|
||||||
attachIntroViewModel();
|
attachIntroViewModel();
|
||||||
}
|
} else {
|
||||||
break;
|
Log.e(TAG, "fragment tag " + tag + " not found");
|
||||||
|
finish();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -56,12 +56,15 @@ public class FingerprintEnrollmentActivityTest {
|
|||||||
private static final String ACTIVITY_CLASS_NAME =
|
private static final String ACTIVITY_CLASS_NAME =
|
||||||
"com.android.settings.biometrics2.ui.view.FingerprintEnrollmentActivity";
|
"com.android.settings.biometrics2.ui.view.FingerprintEnrollmentActivity";
|
||||||
private static final String EXTRA_IS_SETUP_FLOW = "isSetupFlow";
|
private static final String EXTRA_IS_SETUP_FLOW = "isSetupFlow";
|
||||||
|
private static final String EXTRA_SKIP_INTRO = "skip_intro";
|
||||||
private static final String EXTRA_SKIP_FIND_SENSOR = "skip_find_sensor";
|
private static final String EXTRA_SKIP_FIND_SENSOR = "skip_find_sensor";
|
||||||
private static final String EXTRA_FROM_SETTINGS_SUMMARY = "from_settings_summary";
|
private static final String EXTRA_FROM_SETTINGS_SUMMARY = "from_settings_summary";
|
||||||
private static final String EXTRA_PAGE_TRANSITION_TYPE = "page_transition_type";
|
private static final String EXTRA_PAGE_TRANSITION_TYPE = "page_transition_type";
|
||||||
private static final String EXTRA_KEY_GK_PW_HANDLE = "gk_pw_handle";
|
private static final String EXTRA_KEY_GK_PW_HANDLE = "gk_pw_handle";
|
||||||
private static final String TEST_PIN = "1234";
|
private static final String TEST_PIN = "1234";
|
||||||
|
|
||||||
|
private static final String DO_IT_LATER = "Do it later";
|
||||||
|
|
||||||
private static final String UDFPS_ENROLLING_TITLE = "Touch & hold the fingerprint sensor";
|
private static final String UDFPS_ENROLLING_TITLE = "Touch & hold the fingerprint sensor";
|
||||||
private static final String SFPS_ENROLLING_TITLE =
|
private static final String SFPS_ENROLLING_TITLE =
|
||||||
"Lift, then touch. Move your finger slightly each time.";
|
"Lift, then touch. Move your finger slightly each time.";
|
||||||
@@ -120,6 +123,12 @@ public class FingerprintEnrollmentActivityTest {
|
|||||||
mDevice.pressHome();
|
mDevice.pressHome();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() throws Exception {
|
||||||
|
LockScreenUtil.resetLockscreen(TEST_PIN);
|
||||||
|
mDevice.pressHome();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIntroChooseLock() {
|
public void testIntroChooseLock() {
|
||||||
final Intent intent = newActivityIntent();
|
final Intent intent = newActivityIntent();
|
||||||
@@ -165,7 +174,7 @@ public class FingerprintEnrollmentActivityTest {
|
|||||||
agreeBtn.click();
|
agreeBtn.click();
|
||||||
|
|
||||||
// FindUdfps page
|
// FindUdfps page
|
||||||
assertThat(mDevice.wait(Until.hasObject(By.text("Do it later")), IDLE_TIMEOUT)).isTrue();
|
assertThat(mDevice.wait(Until.hasObject(By.text(DO_IT_LATER)), IDLE_TIMEOUT)).isTrue();
|
||||||
final UiObject2 lottie = mDevice.findObject(By.res(SETTINGS_PACKAGE_NAME,
|
final UiObject2 lottie = mDevice.findObject(By.res(SETTINGS_PACKAGE_NAME,
|
||||||
"illustration_lottie"));
|
"illustration_lottie"));
|
||||||
assertThat(lottie).isNotNull();
|
assertThat(lottie).isNotNull();
|
||||||
@@ -193,7 +202,7 @@ public class FingerprintEnrollmentActivityTest {
|
|||||||
agreeBtn.click();
|
agreeBtn.click();
|
||||||
|
|
||||||
// FindUdfps page
|
// FindUdfps page
|
||||||
assertThat(mDevice.wait(Until.hasObject(By.text("Do it later")), IDLE_TIMEOUT)).isTrue();
|
assertThat(mDevice.wait(Until.hasObject(By.text(DO_IT_LATER)), IDLE_TIMEOUT)).isTrue();
|
||||||
final UiObject2 lottie = mDevice.findObject(By.res(SETTINGS_PACKAGE_NAME,
|
final UiObject2 lottie = mDevice.findObject(By.res(SETTINGS_PACKAGE_NAME,
|
||||||
"illustration_lottie"));
|
"illustration_lottie"));
|
||||||
assertThat(lottie).isNotNull();
|
assertThat(lottie).isNotNull();
|
||||||
@@ -221,7 +230,7 @@ public class FingerprintEnrollmentActivityTest {
|
|||||||
agreeBtn.click();
|
agreeBtn.click();
|
||||||
|
|
||||||
// FindSfps page
|
// FindSfps page
|
||||||
assertThat(mDevice.wait(Until.hasObject(By.text("Do it later")), IDLE_TIMEOUT)).isTrue();
|
assertThat(mDevice.wait(Until.hasObject(By.text(DO_IT_LATER)), IDLE_TIMEOUT)).isTrue();
|
||||||
final UiObject2 lottie = mDevice.findObject(By.res(SETTINGS_PACKAGE_NAME,
|
final UiObject2 lottie = mDevice.findObject(By.res(SETTINGS_PACKAGE_NAME,
|
||||||
"illustration_lottie"));
|
"illustration_lottie"));
|
||||||
assertThat(lottie).isNotNull();
|
assertThat(lottie).isNotNull();
|
||||||
@@ -244,7 +253,7 @@ public class FingerprintEnrollmentActivityTest {
|
|||||||
agreeBtn.click();
|
agreeBtn.click();
|
||||||
|
|
||||||
// FindRfps page
|
// FindRfps page
|
||||||
assertThat(mDevice.wait(Until.hasObject(By.text("Do it later")), IDLE_TIMEOUT)).isTrue();
|
assertThat(mDevice.wait(Until.hasObject(By.text(DO_IT_LATER)), IDLE_TIMEOUT)).isTrue();
|
||||||
final UiObject2 lottie = mDevice.findObject(By.res(SETTINGS_PACKAGE_NAME,
|
final UiObject2 lottie = mDevice.findObject(By.res(SETTINGS_PACKAGE_NAME,
|
||||||
"illustration_lottie"));
|
"illustration_lottie"));
|
||||||
if (lottie == null) {
|
if (lottie == null) {
|
||||||
@@ -284,15 +293,15 @@ public class FingerprintEnrollmentActivityTest {
|
|||||||
agreeBtn.click();
|
agreeBtn.click();
|
||||||
|
|
||||||
// FindSensor page
|
// FindSensor page
|
||||||
assertThat(mDevice.wait(Until.hasObject(By.text("Do it later")), IDLE_TIMEOUT)).isTrue();
|
assertThat(mDevice.wait(Until.hasObject(By.text(DO_IT_LATER)), IDLE_TIMEOUT)).isTrue();
|
||||||
final UiObject2 doItLaterBtn = mDevice.findObject(By.text("Do it later"));
|
final UiObject2 doItLaterBtn = mDevice.findObject(By.text(DO_IT_LATER));
|
||||||
assertThat(doItLaterBtn).isNotNull();
|
assertThat(doItLaterBtn).isNotNull();
|
||||||
assertThat(doItLaterBtn.isClickable()).isTrue();
|
assertThat(doItLaterBtn.isClickable()).isTrue();
|
||||||
doItLaterBtn.click();
|
doItLaterBtn.click();
|
||||||
|
|
||||||
// Back to home
|
// Back to home
|
||||||
mDevice.waitForWindowUpdate("com.android.settings", IDLE_TIMEOUT);
|
mDevice.waitForWindowUpdate("com.android.settings", IDLE_TIMEOUT);
|
||||||
assertThat(mDevice.findObject(By.text("Do it later"))).isNull();
|
assertThat(mDevice.findObject(By.text(DO_IT_LATER))).isNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -308,8 +317,8 @@ public class FingerprintEnrollmentActivityTest {
|
|||||||
agreeBtn.click();
|
agreeBtn.click();
|
||||||
|
|
||||||
// FindSensor page
|
// FindSensor page
|
||||||
assertThat(mDevice.wait(Until.hasObject(By.text("Do it later")), IDLE_TIMEOUT)).isTrue();
|
assertThat(mDevice.wait(Until.hasObject(By.text(DO_IT_LATER)), IDLE_TIMEOUT)).isTrue();
|
||||||
final UiObject2 doItLaterBtn = mDevice.findObject(By.text("Do it later"));
|
final UiObject2 doItLaterBtn = mDevice.findObject(By.text(DO_IT_LATER));
|
||||||
assertThat(doItLaterBtn).isNotNull();
|
assertThat(doItLaterBtn).isNotNull();
|
||||||
assertThat(doItLaterBtn.isClickable()).isTrue();
|
assertThat(doItLaterBtn.isClickable()).isTrue();
|
||||||
doItLaterBtn.click();
|
doItLaterBtn.click();
|
||||||
@@ -325,7 +334,7 @@ public class FingerprintEnrollmentActivityTest {
|
|||||||
// Back to home
|
// Back to home
|
||||||
mDevice.waitForWindowUpdate("com.android.settings", IDLE_TIMEOUT);
|
mDevice.waitForWindowUpdate("com.android.settings", IDLE_TIMEOUT);
|
||||||
assertThat(mDevice.findObject(By.text("Skip anyway"))).isNull();
|
assertThat(mDevice.findObject(By.text("Skip anyway"))).isNull();
|
||||||
assertThat(mDevice.findObject(By.text("Do it later"))).isNull();
|
assertThat(mDevice.findObject(By.text(DO_IT_LATER))).isNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -341,8 +350,8 @@ public class FingerprintEnrollmentActivityTest {
|
|||||||
agreeBtn.click();
|
agreeBtn.click();
|
||||||
|
|
||||||
// FindSensor page
|
// FindSensor page
|
||||||
assertThat(mDevice.wait(Until.hasObject(By.text("Do it later")), IDLE_TIMEOUT)).isTrue();
|
assertThat(mDevice.wait(Until.hasObject(By.text(DO_IT_LATER)), IDLE_TIMEOUT)).isTrue();
|
||||||
final UiObject2 doItLaterBtn = mDevice.findObject(By.text("Do it later"));
|
final UiObject2 doItLaterBtn = mDevice.findObject(By.text(DO_IT_LATER));
|
||||||
assertThat(doItLaterBtn).isNotNull();
|
assertThat(doItLaterBtn).isNotNull();
|
||||||
assertThat(doItLaterBtn.isClickable()).isTrue();
|
assertThat(doItLaterBtn.isClickable()).isTrue();
|
||||||
doItLaterBtn.click();
|
doItLaterBtn.click();
|
||||||
@@ -356,7 +365,7 @@ public class FingerprintEnrollmentActivityTest {
|
|||||||
goBackBtn.click();
|
goBackBtn.click();
|
||||||
|
|
||||||
// FindSensor page again
|
// FindSensor page again
|
||||||
assertThat(mDevice.wait(Until.hasObject(By.text("Do it later")), IDLE_TIMEOUT)).isTrue();
|
assertThat(mDevice.wait(Until.hasObject(By.text(DO_IT_LATER)), IDLE_TIMEOUT)).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -447,10 +456,103 @@ public class FingerprintEnrollmentActivityTest {
|
|||||||
assertThat(mDevice.wait(Until.hasObject(By.text(mEnrollingTitle)), IDLE_TIMEOUT)).isTrue();
|
assertThat(mDevice.wait(Until.hasObject(By.text(mEnrollingTitle)), IDLE_TIMEOUT)).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@Test
|
||||||
public void tearDown() throws Exception {
|
public void testFindUdfpsWithGkPwHandle_clickStart() {
|
||||||
LockScreenUtil.resetLockscreen(TEST_PIN);
|
assumeTrue(mCanAssumeUdfps);
|
||||||
mDevice.pressHome();
|
|
||||||
|
LockScreenUtil.setLockscreen(LockScreenUtil.LockscreenType.PIN, TEST_PIN, true);
|
||||||
|
|
||||||
|
launchFindSensorWithGkPwHandle();
|
||||||
|
|
||||||
|
// FindUdfps page
|
||||||
|
assertThat(mDevice.wait(Until.hasObject(By.text(DO_IT_LATER)), IDLE_TIMEOUT)).isTrue();
|
||||||
|
final UiObject2 lottie = mDevice.findObject(By.res(SETTINGS_PACKAGE_NAME,
|
||||||
|
"illustration_lottie"));
|
||||||
|
assertThat(lottie).isNotNull();
|
||||||
|
assertThat(lottie.isClickable()).isTrue();
|
||||||
|
final UiObject2 startBtn = mDevice.findObject(By.text("Start"));
|
||||||
|
assertThat(startBtn.isClickable()).isTrue();
|
||||||
|
startBtn.click();
|
||||||
|
|
||||||
|
// Enrolling page
|
||||||
|
assertThat(mDevice.wait(Until.hasObject(By.text(mEnrollingTitle)), IDLE_TIMEOUT)).isTrue();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFindUdfpsWithGkPwHandle_clickLottie() {
|
||||||
|
assumeTrue(mCanAssumeUdfps);
|
||||||
|
|
||||||
|
LockScreenUtil.setLockscreen(LockScreenUtil.LockscreenType.PIN, TEST_PIN, true);
|
||||||
|
|
||||||
|
launchFindSensorWithGkPwHandle();
|
||||||
|
|
||||||
|
// FindUdfps page
|
||||||
|
assertThat(mDevice.wait(Until.hasObject(By.text(DO_IT_LATER)), IDLE_TIMEOUT)).isTrue();
|
||||||
|
final UiObject2 lottie = mDevice.findObject(By.res(SETTINGS_PACKAGE_NAME,
|
||||||
|
"illustration_lottie"));
|
||||||
|
assertThat(lottie).isNotNull();
|
||||||
|
assertThat(lottie.isClickable()).isTrue();
|
||||||
|
final UiObject2 startBtn = mDevice.findObject(By.text("Start"));
|
||||||
|
assertThat(startBtn.isClickable()).isTrue();
|
||||||
|
lottie.click();
|
||||||
|
|
||||||
|
// Enrolling page
|
||||||
|
assertThat(mDevice.wait(Until.hasObject(By.text(mEnrollingTitle)), IDLE_TIMEOUT)).isTrue();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFindSfpsWithGkPwHandle() {
|
||||||
|
assumeTrue(mCanAssumeSfps);
|
||||||
|
|
||||||
|
LockScreenUtil.setLockscreen(LockScreenUtil.LockscreenType.PIN, TEST_PIN, true);
|
||||||
|
|
||||||
|
launchFindSensorWithGkPwHandle();
|
||||||
|
|
||||||
|
// FindSfps page
|
||||||
|
assertThat(mDevice.wait(Until.hasObject(By.text(DO_IT_LATER)), IDLE_TIMEOUT)).isTrue();
|
||||||
|
final UiObject2 lottie = mDevice.findObject(By.res(SETTINGS_PACKAGE_NAME,
|
||||||
|
"illustration_lottie"));
|
||||||
|
assertThat(lottie).isNotNull();
|
||||||
|
|
||||||
|
// We don't have view which can be clicked to run to next page, stop at here.
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFindRfpsWithGkPwHandle() {
|
||||||
|
assumeFalse(mCanAssumeUdfps || mCanAssumeSfps);
|
||||||
|
|
||||||
|
LockScreenUtil.setLockscreen(LockScreenUtil.LockscreenType.PIN, TEST_PIN, true);
|
||||||
|
|
||||||
|
launchFindSensorWithGkPwHandle();
|
||||||
|
|
||||||
|
// FindRfps page
|
||||||
|
assertThat(mDevice.wait(Until.hasObject(By.text(DO_IT_LATER)), IDLE_TIMEOUT)).isTrue();
|
||||||
|
final UiObject2 lottie = mDevice.findObject(By.res(SETTINGS_PACKAGE_NAME,
|
||||||
|
"illustration_lottie"));
|
||||||
|
if (lottie == null) {
|
||||||
|
// FindSfps page shall have an animation view if no lottie view
|
||||||
|
assertThat(mDevice.findObject(By.res(SETTINGS_PACKAGE_NAME,
|
||||||
|
"fingerprint_sensor_location_animation"))).isNotNull();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFindSensorWithGkPwHandle_clickSkipInFindSensor() {
|
||||||
|
LockScreenUtil.setLockscreen(LockScreenUtil.LockscreenType.PIN, TEST_PIN, true);
|
||||||
|
|
||||||
|
launchFindSensorWithGkPwHandle();
|
||||||
|
|
||||||
|
// FindSensor page
|
||||||
|
assertThat(mDevice.wait(Until.hasObject(By.text(DO_IT_LATER)), IDLE_TIMEOUT)).isTrue();
|
||||||
|
final UiObject2 doItLaterBtn = mDevice.findObject(By.text(DO_IT_LATER));
|
||||||
|
assertThat(doItLaterBtn).isNotNull();
|
||||||
|
assertThat(doItLaterBtn.isClickable()).isTrue();
|
||||||
|
doItLaterBtn.click();
|
||||||
|
|
||||||
|
// Back to home
|
||||||
|
mDevice.waitForWindowUpdate("com.android.settings", IDLE_TIMEOUT);
|
||||||
|
assertThat(mDevice.findObject(By.text(DO_IT_LATER))).isNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void launchIntroWithGkPwHandle(boolean isSuw) {
|
private void launchIntroWithGkPwHandle(boolean isSuw) {
|
||||||
@@ -469,6 +571,20 @@ public class FingerprintEnrollmentActivityTest {
|
|||||||
userId, LockPatternUtils.VERIFY_FLAG_REQUEST_GK_PW_HANDLE, onVerifyCallback);
|
userId, LockPatternUtils.VERIFY_FLAG_REQUEST_GK_PW_HANDLE, onVerifyCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void launchFindSensorWithGkPwHandle() {
|
||||||
|
LockPatternUtils lockPatternUtils = new LockPatternUtils(mContext);
|
||||||
|
final LockscreenCredential lockscreenCredential = LockscreenCredential.createPin(TEST_PIN);
|
||||||
|
final int userId = UserHandle.myUserId();
|
||||||
|
final LockPatternChecker.OnVerifyCallback onVerifyCallback = (response, timeoutMs) -> {
|
||||||
|
final Intent intent = newActivityIntent();
|
||||||
|
intent.putExtra(EXTRA_SKIP_INTRO, true);
|
||||||
|
intent.putExtra(EXTRA_KEY_GK_PW_HANDLE, response.getGatekeeperPasswordHandle());
|
||||||
|
mContext.startActivity(intent);
|
||||||
|
};
|
||||||
|
LockPatternChecker.verifyCredential(lockPatternUtils, lockscreenCredential,
|
||||||
|
userId, LockPatternUtils.VERIFY_FLAG_REQUEST_GK_PW_HANDLE, onVerifyCallback);
|
||||||
|
}
|
||||||
|
|
||||||
private void launchEnrollingWithGkPwHandle() {
|
private void launchEnrollingWithGkPwHandle() {
|
||||||
LockPatternUtils lockPatternUtils = new LockPatternUtils(mContext);
|
LockPatternUtils lockPatternUtils = new LockPatternUtils(mContext);
|
||||||
final LockscreenCredential lockscreenCredential = LockscreenCredential.createPin(TEST_PIN);
|
final LockscreenCredential lockscreenCredential = LockscreenCredential.createPin(TEST_PIN);
|
||||||
|
Reference in New Issue
Block a user