Loading core/java/android/hardware/face/FaceManager.java +11 −0 Original line number Diff line number Diff line Loading @@ -1074,6 +1074,14 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan */ public interface FaceDetectionCallback { void onFaceDetected(int sensorId, int userId, boolean isStrongBiometric); /** * An error has occurred with face detection. * * This callback signifies that this operation has been completed, and * no more callbacks should be expected. */ default void onDetectionError(int errorMsgId) {} } /** Loading Loading @@ -1373,6 +1381,9 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan } else if (mRemovalCallback != null) { mRemovalCallback.onRemovalError(mRemovalFace, clientErrMsgId, getErrorString(mContext, errMsgId, vendorCode)); } else if (mFaceDetectionCallback != null) { mFaceDetectionCallback.onDetectionError(errMsgId); mFaceDetectionCallback = null; } } Loading core/java/android/hardware/fingerprint/FingerprintManager.java +11 −0 Original line number Diff line number Diff line Loading @@ -462,6 +462,14 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing * Invoked when a fingerprint has been detected. */ void onFingerprintDetected(int sensorId, int userId, boolean isStrongBiometric); /** * An error has occurred with fingerprint detection. * * This callback signifies that this operation has been completed, and * no more callbacks should be expected. */ default void onDetectionError(int errorMsgId) {} } /** Loading Loading @@ -1484,6 +1492,9 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing ? mRemoveTracker.mSingleFingerprint : null; mRemovalCallback.onRemovalError(fp, clientErrMsgId, getErrorString(mContext, errMsgId, vendorCode)); } else if (mFingerprintDetectionCallback != null) { mFingerprintDetectionCallback.onDetectionError(errMsgId); mFingerprintDetectionCallback = null; } } Loading core/tests/coretests/src/android/hardware/face/FaceManagerTest.java +19 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,8 @@ public class FaceManagerTest { private FaceManager.AuthenticationCallback mAuthCallback; @Mock private FaceManager.EnrollmentCallback mEnrollmentCallback; @Mock private FaceManager.FaceDetectionCallback mFaceDetectionCallback; @Captor private ArgumentCaptor<IFaceAuthenticatorsRegisteredCallback> mCaptor; Loading Loading @@ -191,6 +193,23 @@ public class FaceManagerTest { any(), anyString(), any(), any(), anyBoolean()); } @Test public void detectClient_onError() throws RemoteException { ArgumentCaptor<IFaceServiceReceiver> argumentCaptor = ArgumentCaptor.forClass(IFaceServiceReceiver.class); CancellationSignal cancellationSignal = new CancellationSignal(); mFaceManager.detectFace(cancellationSignal, mFaceDetectionCallback, new FaceAuthenticateOptions.Builder().build()); verify(mService).detectFace(any(), argumentCaptor.capture(), any()); argumentCaptor.getValue().onError(5 /* error */, 0 /* vendorCode */); mLooper.dispatchAll(); verify(mFaceDetectionCallback).onDetectionError(anyInt()); } private void initializeProperties() throws RemoteException { verify(mService).addAuthenticatorsRegisteredCallback(mCaptor.capture()); Loading core/tests/coretests/src/android/hardware/fingerprint/FingerprintManagerTest.java +19 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,8 @@ public class FingerprintManagerTest { private FingerprintManager.AuthenticationCallback mAuthCallback; @Mock private FingerprintManager.EnrollmentCallback mEnrollCallback; @Mock private FingerprintManager.FingerprintDetectionCallback mFingerprintDetectionCallback; @Captor private ArgumentCaptor<IFingerprintAuthenticatorsRegisteredCallback> mCaptor; Loading Loading @@ -166,4 +168,21 @@ public class FingerprintManagerTest { anyString()); verify(mService, never()).enroll(any(), any(), anyInt(), any(), anyString(), anyInt()); } @Test public void detectClient_onError() throws RemoteException { ArgumentCaptor<IFingerprintServiceReceiver> argumentCaptor = ArgumentCaptor.forClass(IFingerprintServiceReceiver.class); mFingerprintManager.detectFingerprint(new CancellationSignal(), mFingerprintDetectionCallback, new FingerprintAuthenticateOptions.Builder().build()); verify(mService).detectFingerprint(any(), argumentCaptor.capture(), any()); argumentCaptor.getValue().onError(5 /* error */, 0 /* vendorCode */); mLooper.dispatchAll(); verify(mFingerprintDetectionCallback).onDetectionError(anyInt()); } } Loading
core/java/android/hardware/face/FaceManager.java +11 −0 Original line number Diff line number Diff line Loading @@ -1074,6 +1074,14 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan */ public interface FaceDetectionCallback { void onFaceDetected(int sensorId, int userId, boolean isStrongBiometric); /** * An error has occurred with face detection. * * This callback signifies that this operation has been completed, and * no more callbacks should be expected. */ default void onDetectionError(int errorMsgId) {} } /** Loading Loading @@ -1373,6 +1381,9 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan } else if (mRemovalCallback != null) { mRemovalCallback.onRemovalError(mRemovalFace, clientErrMsgId, getErrorString(mContext, errMsgId, vendorCode)); } else if (mFaceDetectionCallback != null) { mFaceDetectionCallback.onDetectionError(errMsgId); mFaceDetectionCallback = null; } } Loading
core/java/android/hardware/fingerprint/FingerprintManager.java +11 −0 Original line number Diff line number Diff line Loading @@ -462,6 +462,14 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing * Invoked when a fingerprint has been detected. */ void onFingerprintDetected(int sensorId, int userId, boolean isStrongBiometric); /** * An error has occurred with fingerprint detection. * * This callback signifies that this operation has been completed, and * no more callbacks should be expected. */ default void onDetectionError(int errorMsgId) {} } /** Loading Loading @@ -1484,6 +1492,9 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing ? mRemoveTracker.mSingleFingerprint : null; mRemovalCallback.onRemovalError(fp, clientErrMsgId, getErrorString(mContext, errMsgId, vendorCode)); } else if (mFingerprintDetectionCallback != null) { mFingerprintDetectionCallback.onDetectionError(errMsgId); mFingerprintDetectionCallback = null; } } Loading
core/tests/coretests/src/android/hardware/face/FaceManagerTest.java +19 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,8 @@ public class FaceManagerTest { private FaceManager.AuthenticationCallback mAuthCallback; @Mock private FaceManager.EnrollmentCallback mEnrollmentCallback; @Mock private FaceManager.FaceDetectionCallback mFaceDetectionCallback; @Captor private ArgumentCaptor<IFaceAuthenticatorsRegisteredCallback> mCaptor; Loading Loading @@ -191,6 +193,23 @@ public class FaceManagerTest { any(), anyString(), any(), any(), anyBoolean()); } @Test public void detectClient_onError() throws RemoteException { ArgumentCaptor<IFaceServiceReceiver> argumentCaptor = ArgumentCaptor.forClass(IFaceServiceReceiver.class); CancellationSignal cancellationSignal = new CancellationSignal(); mFaceManager.detectFace(cancellationSignal, mFaceDetectionCallback, new FaceAuthenticateOptions.Builder().build()); verify(mService).detectFace(any(), argumentCaptor.capture(), any()); argumentCaptor.getValue().onError(5 /* error */, 0 /* vendorCode */); mLooper.dispatchAll(); verify(mFaceDetectionCallback).onDetectionError(anyInt()); } private void initializeProperties() throws RemoteException { verify(mService).addAuthenticatorsRegisteredCallback(mCaptor.capture()); Loading
core/tests/coretests/src/android/hardware/fingerprint/FingerprintManagerTest.java +19 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,8 @@ public class FingerprintManagerTest { private FingerprintManager.AuthenticationCallback mAuthCallback; @Mock private FingerprintManager.EnrollmentCallback mEnrollCallback; @Mock private FingerprintManager.FingerprintDetectionCallback mFingerprintDetectionCallback; @Captor private ArgumentCaptor<IFingerprintAuthenticatorsRegisteredCallback> mCaptor; Loading Loading @@ -166,4 +168,21 @@ public class FingerprintManagerTest { anyString()); verify(mService, never()).enroll(any(), any(), anyInt(), any(), anyString(), anyInt()); } @Test public void detectClient_onError() throws RemoteException { ArgumentCaptor<IFingerprintServiceReceiver> argumentCaptor = ArgumentCaptor.forClass(IFingerprintServiceReceiver.class); mFingerprintManager.detectFingerprint(new CancellationSignal(), mFingerprintDetectionCallback, new FingerprintAuthenticateOptions.Builder().build()); verify(mService).detectFingerprint(any(), argumentCaptor.capture(), any()); argumentCaptor.getValue().onError(5 /* error */, 0 /* vendorCode */); mLooper.dispatchAll(); verify(mFingerprintDetectionCallback).onDetectionError(anyInt()); } }