Loading packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +2 −2 Original line number Diff line number Diff line Loading @@ -2227,8 +2227,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab private void updateFaceEnrolled(int userId) { mIsFaceEnrolled = whitelistIpcs( () -> mFaceManager != null && mFaceManager.isHardwareDetected() && mFaceManager.hasEnrolledTemplates(userId) && mBiometricEnabledForUser.get(userId)); && mBiometricEnabledForUser.get(userId)) && mAuthController.isFaceAuthEnrolled(userId); } public boolean isFaceSupported() { Loading packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java +12 −1 Original line number Diff line number Diff line Loading @@ -153,6 +153,7 @@ public class AuthController implements CoreStartable, CommandQueue.Callbacks, @Nullable private List<FingerprintSensorPropertiesInternal> mSidefpsProps; @NonNull private final SparseBooleanArray mUdfpsEnrolledForUser; @NonNull private final SparseBooleanArray mFaceEnrolledForUser; @NonNull private final SensorPrivacyManager mSensorPrivacyManager; private final WakefulnessLifecycle mWakefulnessLifecycle; private boolean mAllFingerprintAuthenticatorsRegistered; Loading Loading @@ -349,6 +350,15 @@ public class AuthController implements CoreStartable, CommandQueue.Callbacks, } } } if (mFaceProps == null) { Log.d(TAG, "handleEnrollmentsChanged, mFaceProps is null"); } else { for (FaceSensorPropertiesInternal prop : mFaceProps) { if (prop.sensorId == sensorId) { mFaceEnrolledForUser.put(userId, hasEnrollments); } } } for (Callback cb : mCallbacks) { cb.onEnrollmentsChanged(modality); } Loading Loading @@ -704,6 +714,7 @@ public class AuthController implements CoreStartable, CommandQueue.Callbacks, mWindowManager = windowManager; mInteractionJankMonitor = jankMonitor; mUdfpsEnrolledForUser = new SparseBooleanArray(); mFaceEnrolledForUser = new SparseBooleanArray(); mVibratorHelper = vibrator; mOrientationListener = new BiometricDisplayListener( Loading Loading @@ -1054,7 +1065,7 @@ public class AuthController implements CoreStartable, CommandQueue.Callbacks, return false; } return mFaceManager.hasEnrolledTemplates(userId); return mFaceEnrolledForUser.get(userId); } /** Loading packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java +2 −3 Original line number Diff line number Diff line Loading @@ -237,8 +237,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { when(mActivityService.getCurrentUser()).thenReturn(mCurrentUserInfo); when(mActivityService.getCurrentUserId()).thenReturn(mCurrentUserId); when(mFaceManager.isHardwareDetected()).thenReturn(true); when(mFaceManager.hasEnrolledTemplates()).thenReturn(true); when(mFaceManager.hasEnrolledTemplates(anyInt())).thenReturn(true); when(mAuthController.isFaceAuthEnrolled(anyInt())).thenReturn(true); when(mFaceManager.getSensorPropertiesInternal()).thenReturn(mFaceSensorProperties); when(mSessionTracker.getSessionId(SESSION_KEYGUARD)).thenReturn(mKeyguardInstanceId); Loading Loading @@ -593,7 +592,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { verify(mFaceManager).authenticate(any(), any(), any(), any(), anyInt(), anyBoolean()); verify(mFaceManager).isHardwareDetected(); verify(mFaceManager).hasEnrolledTemplates(anyInt()); verify(mFaceManager, never()).hasEnrolledTemplates(anyInt()); } @Test Loading packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthControllerTest.java +33 −5 Original line number Diff line number Diff line Loading @@ -25,7 +25,9 @@ import static com.android.systemui.keyguard.WakefulnessLifecycle.WAKEFULNESS_AWA import static com.google.common.truth.Truth.assertThat; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertFalse; import static junit.framework.Assert.assertNull; import static junit.framework.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; Loading Loading @@ -236,7 +238,7 @@ public class AuthControllerTest extends SysuiTestCase { 2 /* sensorId */, SensorProperties.STRENGTH_STRONG, 1 /* maxEnrollmentsPerUser */, fpComponentInfo, faceComponentInfo, FaceSensorProperties.TYPE_RGB, true /* supportsFaceDetection */, true /* supportsSelfIllumination */, Loading Loading @@ -276,8 +278,6 @@ public class AuthControllerTest extends SysuiTestCase { reset(mFingerprintManager); reset(mFaceManager); when(mVibratorHelper.hasVibrator()).thenReturn(true); // This test requires an uninitialized AuthController. AuthController authController = new TestableAuthController(mContextSpy, mExecution, mCommandQueue, mActivityTaskManager, mWindowManager, mFingerprintManager, Loading Loading @@ -308,8 +308,6 @@ public class AuthControllerTest extends SysuiTestCase { reset(mFingerprintManager); reset(mFaceManager); when(mVibratorHelper.hasVibrator()).thenReturn(true); // This test requires an uninitialized AuthController. AuthController authController = new TestableAuthController(mContextSpy, mExecution, mCommandQueue, mActivityTaskManager, mWindowManager, mFingerprintManager, Loading Loading @@ -342,6 +340,36 @@ public class AuthControllerTest extends SysuiTestCase { // Nothing should crash. } @Test public void testFaceAuthEnrollmentStatus() throws RemoteException { final int userId = 0; reset(mFaceManager); mAuthController.start(); verify(mFaceManager).addAuthenticatorsRegisteredCallback( mFaceAuthenticatorsRegisteredCaptor.capture()); mFaceAuthenticatorsRegisteredCaptor.getValue().onAllAuthenticatorsRegistered( mFaceManager.getSensorPropertiesInternal()); mTestableLooper.processAllMessages(); verify(mFaceManager).registerBiometricStateListener( mBiometricStateCaptor.capture()); assertFalse(mAuthController.isFaceAuthEnrolled(userId)); // Enrollments changed for an unknown sensor. for (BiometricStateListener listener : mBiometricStateCaptor.getAllValues()) { listener.onEnrollmentsChanged(userId, 2 /* sensorId */, true /* hasEnrollments */); } mTestableLooper.processAllMessages(); assertTrue(mAuthController.isFaceAuthEnrolled(userId)); } @Test public void testSendsReasonUserCanceled_whenDismissedByUserCancel() throws Exception { showDialog(new int[]{1} /* sensorIds */, false /* credentialAllowed */); Loading services/core/java/com/android/server/biometrics/sensors/face/FaceService.java +5 −4 Original line number Diff line number Diff line Loading @@ -600,8 +600,9 @@ public class FaceService extends SystemService { } try { final SensorProps[] props = face.getSensorProps(); final FaceProvider provider = new FaceProvider(getContext(), props, instance, mLockoutResetDispatcher, BiometricContext.getInstance(getContext())); final FaceProvider provider = new FaceProvider(getContext(), mBiometricStateCallback, props, instance, mLockoutResetDispatcher, BiometricContext.getInstance(getContext())); providers.add(provider); } catch (RemoteException e) { Slog.e(TAG, "Remote exception in getSensorProps: " + fqName); Loading @@ -612,14 +613,14 @@ public class FaceService extends SystemService { } @android.annotation.EnforcePermission(android.Manifest.permission.USE_BIOMETRIC_INTERNAL) @Override // Binder call public void registerAuthenticators( @NonNull List<FaceSensorPropertiesInternal> hidlSensors) { mRegistry.registerAll(() -> { final List<ServiceProvider> providers = new ArrayList<>(); for (FaceSensorPropertiesInternal hidlSensor : hidlSensors) { providers.add( Face10.newInstance(getContext(), hidlSensor, mLockoutResetDispatcher)); Face10.newInstance(getContext(), mBiometricStateCallback, hidlSensor, mLockoutResetDispatcher)); } providers.addAll(getAidlProviders()); return providers; Loading Loading
packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +2 −2 Original line number Diff line number Diff line Loading @@ -2227,8 +2227,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab private void updateFaceEnrolled(int userId) { mIsFaceEnrolled = whitelistIpcs( () -> mFaceManager != null && mFaceManager.isHardwareDetected() && mFaceManager.hasEnrolledTemplates(userId) && mBiometricEnabledForUser.get(userId)); && mBiometricEnabledForUser.get(userId)) && mAuthController.isFaceAuthEnrolled(userId); } public boolean isFaceSupported() { Loading
packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java +12 −1 Original line number Diff line number Diff line Loading @@ -153,6 +153,7 @@ public class AuthController implements CoreStartable, CommandQueue.Callbacks, @Nullable private List<FingerprintSensorPropertiesInternal> mSidefpsProps; @NonNull private final SparseBooleanArray mUdfpsEnrolledForUser; @NonNull private final SparseBooleanArray mFaceEnrolledForUser; @NonNull private final SensorPrivacyManager mSensorPrivacyManager; private final WakefulnessLifecycle mWakefulnessLifecycle; private boolean mAllFingerprintAuthenticatorsRegistered; Loading Loading @@ -349,6 +350,15 @@ public class AuthController implements CoreStartable, CommandQueue.Callbacks, } } } if (mFaceProps == null) { Log.d(TAG, "handleEnrollmentsChanged, mFaceProps is null"); } else { for (FaceSensorPropertiesInternal prop : mFaceProps) { if (prop.sensorId == sensorId) { mFaceEnrolledForUser.put(userId, hasEnrollments); } } } for (Callback cb : mCallbacks) { cb.onEnrollmentsChanged(modality); } Loading Loading @@ -704,6 +714,7 @@ public class AuthController implements CoreStartable, CommandQueue.Callbacks, mWindowManager = windowManager; mInteractionJankMonitor = jankMonitor; mUdfpsEnrolledForUser = new SparseBooleanArray(); mFaceEnrolledForUser = new SparseBooleanArray(); mVibratorHelper = vibrator; mOrientationListener = new BiometricDisplayListener( Loading Loading @@ -1054,7 +1065,7 @@ public class AuthController implements CoreStartable, CommandQueue.Callbacks, return false; } return mFaceManager.hasEnrolledTemplates(userId); return mFaceEnrolledForUser.get(userId); } /** Loading
packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java +2 −3 Original line number Diff line number Diff line Loading @@ -237,8 +237,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { when(mActivityService.getCurrentUser()).thenReturn(mCurrentUserInfo); when(mActivityService.getCurrentUserId()).thenReturn(mCurrentUserId); when(mFaceManager.isHardwareDetected()).thenReturn(true); when(mFaceManager.hasEnrolledTemplates()).thenReturn(true); when(mFaceManager.hasEnrolledTemplates(anyInt())).thenReturn(true); when(mAuthController.isFaceAuthEnrolled(anyInt())).thenReturn(true); when(mFaceManager.getSensorPropertiesInternal()).thenReturn(mFaceSensorProperties); when(mSessionTracker.getSessionId(SESSION_KEYGUARD)).thenReturn(mKeyguardInstanceId); Loading Loading @@ -593,7 +592,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { verify(mFaceManager).authenticate(any(), any(), any(), any(), anyInt(), anyBoolean()); verify(mFaceManager).isHardwareDetected(); verify(mFaceManager).hasEnrolledTemplates(anyInt()); verify(mFaceManager, never()).hasEnrolledTemplates(anyInt()); } @Test Loading
packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthControllerTest.java +33 −5 Original line number Diff line number Diff line Loading @@ -25,7 +25,9 @@ import static com.android.systemui.keyguard.WakefulnessLifecycle.WAKEFULNESS_AWA import static com.google.common.truth.Truth.assertThat; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertFalse; import static junit.framework.Assert.assertNull; import static junit.framework.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; Loading Loading @@ -236,7 +238,7 @@ public class AuthControllerTest extends SysuiTestCase { 2 /* sensorId */, SensorProperties.STRENGTH_STRONG, 1 /* maxEnrollmentsPerUser */, fpComponentInfo, faceComponentInfo, FaceSensorProperties.TYPE_RGB, true /* supportsFaceDetection */, true /* supportsSelfIllumination */, Loading Loading @@ -276,8 +278,6 @@ public class AuthControllerTest extends SysuiTestCase { reset(mFingerprintManager); reset(mFaceManager); when(mVibratorHelper.hasVibrator()).thenReturn(true); // This test requires an uninitialized AuthController. AuthController authController = new TestableAuthController(mContextSpy, mExecution, mCommandQueue, mActivityTaskManager, mWindowManager, mFingerprintManager, Loading Loading @@ -308,8 +308,6 @@ public class AuthControllerTest extends SysuiTestCase { reset(mFingerprintManager); reset(mFaceManager); when(mVibratorHelper.hasVibrator()).thenReturn(true); // This test requires an uninitialized AuthController. AuthController authController = new TestableAuthController(mContextSpy, mExecution, mCommandQueue, mActivityTaskManager, mWindowManager, mFingerprintManager, Loading Loading @@ -342,6 +340,36 @@ public class AuthControllerTest extends SysuiTestCase { // Nothing should crash. } @Test public void testFaceAuthEnrollmentStatus() throws RemoteException { final int userId = 0; reset(mFaceManager); mAuthController.start(); verify(mFaceManager).addAuthenticatorsRegisteredCallback( mFaceAuthenticatorsRegisteredCaptor.capture()); mFaceAuthenticatorsRegisteredCaptor.getValue().onAllAuthenticatorsRegistered( mFaceManager.getSensorPropertiesInternal()); mTestableLooper.processAllMessages(); verify(mFaceManager).registerBiometricStateListener( mBiometricStateCaptor.capture()); assertFalse(mAuthController.isFaceAuthEnrolled(userId)); // Enrollments changed for an unknown sensor. for (BiometricStateListener listener : mBiometricStateCaptor.getAllValues()) { listener.onEnrollmentsChanged(userId, 2 /* sensorId */, true /* hasEnrollments */); } mTestableLooper.processAllMessages(); assertTrue(mAuthController.isFaceAuthEnrolled(userId)); } @Test public void testSendsReasonUserCanceled_whenDismissedByUserCancel() throws Exception { showDialog(new int[]{1} /* sensorIds */, false /* credentialAllowed */); Loading
services/core/java/com/android/server/biometrics/sensors/face/FaceService.java +5 −4 Original line number Diff line number Diff line Loading @@ -600,8 +600,9 @@ public class FaceService extends SystemService { } try { final SensorProps[] props = face.getSensorProps(); final FaceProvider provider = new FaceProvider(getContext(), props, instance, mLockoutResetDispatcher, BiometricContext.getInstance(getContext())); final FaceProvider provider = new FaceProvider(getContext(), mBiometricStateCallback, props, instance, mLockoutResetDispatcher, BiometricContext.getInstance(getContext())); providers.add(provider); } catch (RemoteException e) { Slog.e(TAG, "Remote exception in getSensorProps: " + fqName); Loading @@ -612,14 +613,14 @@ public class FaceService extends SystemService { } @android.annotation.EnforcePermission(android.Manifest.permission.USE_BIOMETRIC_INTERNAL) @Override // Binder call public void registerAuthenticators( @NonNull List<FaceSensorPropertiesInternal> hidlSensors) { mRegistry.registerAll(() -> { final List<ServiceProvider> providers = new ArrayList<>(); for (FaceSensorPropertiesInternal hidlSensor : hidlSensors) { providers.add( Face10.newInstance(getContext(), hidlSensor, mLockoutResetDispatcher)); Face10.newInstance(getContext(), mBiometricStateCallback, hidlSensor, mLockoutResetDispatcher)); } providers.addAll(getAidlProviders()); return providers; Loading