Reset face_unlock_re_enroll value on reboot
Test: atest BiometricNotificationServiceTest Bug: 293314400 Change-Id: I8a50c96c2fd45996743daa0361df82883fe165a2
This commit is contained in:
@@ -135,6 +135,9 @@ public class BiometricNotificationService implements CoreStartable {
|
|||||||
intentFilter.addAction(ACTION_SHOW_FACE_REENROLL_DIALOG);
|
intentFilter.addAction(ACTION_SHOW_FACE_REENROLL_DIALOG);
|
||||||
mContext.registerReceiver(mBroadcastReceiver, intentFilter,
|
mContext.registerReceiver(mBroadcastReceiver, intentFilter,
|
||||||
Context.RECEIVER_EXPORTED_UNAUDITED);
|
Context.RECEIVER_EXPORTED_UNAUDITED);
|
||||||
|
Settings.Secure.putIntForUser(mContext.getContentResolver(),
|
||||||
|
Settings.Secure.FACE_UNLOCK_RE_ENROLL, REENROLL_NOT_REQUIRED,
|
||||||
|
UserHandle.USER_CURRENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void queueFaceReenrollNotification() {
|
private void queueFaceReenrollNotification() {
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import static com.google.common.truth.Truth.assertThat;
|
|||||||
|
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
import static org.mockito.ArgumentMatchers.eq;
|
import static org.mockito.ArgumentMatchers.eq;
|
||||||
|
import static org.mockito.Mockito.never;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
@@ -75,6 +76,7 @@ public class BiometricNotificationServiceTest extends SysuiTestCase {
|
|||||||
private TestableLooper mLooper;
|
private TestableLooper mLooper;
|
||||||
private KeyguardUpdateMonitorCallback mKeyguardUpdateMonitorCallback;
|
private KeyguardUpdateMonitorCallback mKeyguardUpdateMonitorCallback;
|
||||||
private KeyguardStateController.Callback mKeyguardStateControllerCallback;
|
private KeyguardStateController.Callback mKeyguardStateControllerCallback;
|
||||||
|
private BiometricNotificationService mBiometricNotificationService;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
@@ -83,12 +85,10 @@ public class BiometricNotificationServiceTest extends SysuiTestCase {
|
|||||||
BiometricNotificationDialogFactory dialogFactory = new BiometricNotificationDialogFactory();
|
BiometricNotificationDialogFactory dialogFactory = new BiometricNotificationDialogFactory();
|
||||||
BiometricNotificationBroadcastReceiver broadcastReceiver =
|
BiometricNotificationBroadcastReceiver broadcastReceiver =
|
||||||
new BiometricNotificationBroadcastReceiver(mContext, dialogFactory);
|
new BiometricNotificationBroadcastReceiver(mContext, dialogFactory);
|
||||||
BiometricNotificationService biometricNotificationService =
|
mBiometricNotificationService = new BiometricNotificationService(mContext,
|
||||||
new BiometricNotificationService(mContext,
|
|
||||||
mKeyguardUpdateMonitor, mKeyguardStateController, handler,
|
mKeyguardUpdateMonitor, mKeyguardStateController, handler,
|
||||||
mNotificationManager,
|
mNotificationManager, broadcastReceiver);
|
||||||
broadcastReceiver);
|
mBiometricNotificationService.start();
|
||||||
biometricNotificationService.start();
|
|
||||||
|
|
||||||
ArgumentCaptor<KeyguardUpdateMonitorCallback> updateMonitorCallbackArgumentCaptor =
|
ArgumentCaptor<KeyguardUpdateMonitorCallback> updateMonitorCallbackArgumentCaptor =
|
||||||
ArgumentCaptor.forClass(KeyguardUpdateMonitorCallback.class);
|
ArgumentCaptor.forClass(KeyguardUpdateMonitorCallback.class);
|
||||||
@@ -149,4 +149,23 @@ public class BiometricNotificationServiceTest extends SysuiTestCase {
|
|||||||
.isEqualTo(ACTION_SHOW_FACE_REENROLL_DIALOG);
|
.isEqualTo(ACTION_SHOW_FACE_REENROLL_DIALOG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testResetFaceUnlockReEnroll_onStart() {
|
||||||
|
when(mKeyguardStateController.isShowing()).thenReturn(false);
|
||||||
|
|
||||||
|
mKeyguardUpdateMonitorCallback.onBiometricError(
|
||||||
|
BiometricFaceConstants.BIOMETRIC_ERROR_RE_ENROLL,
|
||||||
|
"Testing Face Re-enrollment" /* errString */,
|
||||||
|
BiometricSourceType.FACE
|
||||||
|
);
|
||||||
|
|
||||||
|
mBiometricNotificationService.start();
|
||||||
|
mKeyguardStateControllerCallback.onKeyguardShowingChanged();
|
||||||
|
|
||||||
|
mLooper.moveTimeForward(SHOW_NOTIFICATION_DELAY_MS);
|
||||||
|
mLooper.processAllMessages();
|
||||||
|
|
||||||
|
verify(mNotificationManager, never()).notifyAsUser(eq(TAG), eq(FACE_NOTIFICATION_ID),
|
||||||
|
mNotificationArgumentCaptor.capture(), any());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user