Loading packages/SystemUI/src/com/android/systemui/biometrics/BiometricNotificationService.java +3 −0 Original line number Original line Diff line number Diff line Loading @@ -177,6 +177,9 @@ public class BiometricNotificationService implements CoreStartable { if (mFaceManager != null) { if (mFaceManager != null) { mFaceManager.registerBiometricStateListener(mFaceStateListener); mFaceManager.registerBiometricStateListener(mFaceStateListener); } } Settings.Secure.putIntForUser(mContext.getContentResolver(), Settings.Secure.FACE_UNLOCK_RE_ENROLL, REENROLL_NOT_REQUIRED, UserHandle.USER_CURRENT); } } private void queueFaceReenrollNotification() { private void queueFaceReenrollNotification() { Loading packages/SystemUI/tests/src/com/android/systemui/biometrics/BiometricNotificationServiceTest.java +24 −2 Original line number Original line Diff line number Diff line Loading @@ -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; Loading Loading @@ -86,6 +87,7 @@ public class BiometricNotificationServiceTest extends SysuiTestCase { private final ArgumentCaptor<Notification> mNotificationArgumentCaptor = private final ArgumentCaptor<Notification> mNotificationArgumentCaptor = ArgumentCaptor.forClass(Notification.class); ArgumentCaptor.forClass(Notification.class); private BiometricNotificationService mBiometricNotificationService; private TestableLooper mLooper; private TestableLooper mLooper; private KeyguardUpdateMonitorCallback mKeyguardUpdateMonitorCallback; private KeyguardUpdateMonitorCallback mKeyguardUpdateMonitorCallback; private KeyguardStateController.Callback mKeyguardStateControllerCallback; private KeyguardStateController.Callback mKeyguardStateControllerCallback; Loading @@ -104,7 +106,7 @@ 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, Loading @@ -112,7 +114,7 @@ public class BiometricNotificationServiceTest extends SysuiTestCase { mFingerprintReEnrollNotificationOptional, mFingerprintReEnrollNotificationOptional, mFingerprintManager, mFingerprintManager, mFaceManager); mFaceManager); biometricNotificationService.start(); mBiometricNotificationService.start(); ArgumentCaptor<KeyguardUpdateMonitorCallback> updateMonitorCallbackArgumentCaptor = ArgumentCaptor<KeyguardUpdateMonitorCallback> updateMonitorCallbackArgumentCaptor = ArgumentCaptor.forClass(KeyguardUpdateMonitorCallback.class); ArgumentCaptor.forClass(KeyguardUpdateMonitorCallback.class); Loading Loading @@ -231,4 +233,24 @@ public class BiometricNotificationServiceTest extends SysuiTestCase { eq(UserHandle.CURRENT)); eq(UserHandle.CURRENT)); } } @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()); } } } Loading
packages/SystemUI/src/com/android/systemui/biometrics/BiometricNotificationService.java +3 −0 Original line number Original line Diff line number Diff line Loading @@ -177,6 +177,9 @@ public class BiometricNotificationService implements CoreStartable { if (mFaceManager != null) { if (mFaceManager != null) { mFaceManager.registerBiometricStateListener(mFaceStateListener); mFaceManager.registerBiometricStateListener(mFaceStateListener); } } Settings.Secure.putIntForUser(mContext.getContentResolver(), Settings.Secure.FACE_UNLOCK_RE_ENROLL, REENROLL_NOT_REQUIRED, UserHandle.USER_CURRENT); } } private void queueFaceReenrollNotification() { private void queueFaceReenrollNotification() { Loading
packages/SystemUI/tests/src/com/android/systemui/biometrics/BiometricNotificationServiceTest.java +24 −2 Original line number Original line Diff line number Diff line Loading @@ -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; Loading Loading @@ -86,6 +87,7 @@ public class BiometricNotificationServiceTest extends SysuiTestCase { private final ArgumentCaptor<Notification> mNotificationArgumentCaptor = private final ArgumentCaptor<Notification> mNotificationArgumentCaptor = ArgumentCaptor.forClass(Notification.class); ArgumentCaptor.forClass(Notification.class); private BiometricNotificationService mBiometricNotificationService; private TestableLooper mLooper; private TestableLooper mLooper; private KeyguardUpdateMonitorCallback mKeyguardUpdateMonitorCallback; private KeyguardUpdateMonitorCallback mKeyguardUpdateMonitorCallback; private KeyguardStateController.Callback mKeyguardStateControllerCallback; private KeyguardStateController.Callback mKeyguardStateControllerCallback; Loading @@ -104,7 +106,7 @@ 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, Loading @@ -112,7 +114,7 @@ public class BiometricNotificationServiceTest extends SysuiTestCase { mFingerprintReEnrollNotificationOptional, mFingerprintReEnrollNotificationOptional, mFingerprintManager, mFingerprintManager, mFaceManager); mFaceManager); biometricNotificationService.start(); mBiometricNotificationService.start(); ArgumentCaptor<KeyguardUpdateMonitorCallback> updateMonitorCallbackArgumentCaptor = ArgumentCaptor<KeyguardUpdateMonitorCallback> updateMonitorCallbackArgumentCaptor = ArgumentCaptor.forClass(KeyguardUpdateMonitorCallback.class); ArgumentCaptor.forClass(KeyguardUpdateMonitorCallback.class); Loading Loading @@ -231,4 +233,24 @@ public class BiometricNotificationServiceTest extends SysuiTestCase { eq(UserHandle.CURRENT)); eq(UserHandle.CURRENT)); } } @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()); } } }