Loading core/java/android/hardware/fingerprint/FingerprintManager.java +18 −51 Original line number Diff line number Diff line Loading @@ -418,6 +418,18 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing void onChallengeGenerated(int sensorId, long challenge); } /** * Use the provided handler thread for events. * @param handler */ private void useHandler(Handler handler) { if (handler != null) { mHandler = new MyHandler(handler.getLooper()); } else if (mHandler.getLooper() != mContext.getMainLooper()) { mHandler = new MyHandler(mContext.getMainLooper()); } } /** * Request authentication of a crypto object. This call warms up the fingerprint hardware * and starts scanning for a fingerprint. It terminates when Loading Loading @@ -448,46 +460,16 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing authenticate(crypto, cancel, callback, handler, mContext.getUserId()); } /** * Use the provided handler thread for events. * @param handler */ private void useHandler(Handler handler) { if (handler != null) { mHandler = new MyHandler(handler.getLooper()); } else if (mHandler.getLooper() != mContext.getMainLooper()){ mHandler = new MyHandler(mContext.getMainLooper()); } } /** * Defaults to {@link FingerprintManager#authenticate(CryptoObject, CancellationSignal, * AuthenticationCallback, Handler, int, Surface)} with {@code surface} set to null. * * @see FingerprintManager#authenticate(CryptoObject, CancellationSignal, * AuthenticationCallback, Handler, int, Surface) * * @hide */ @RequiresPermission(anyOf = {USE_BIOMETRIC, USE_FINGERPRINT}) public void authenticate(@Nullable CryptoObject crypto, @Nullable CancellationSignal cancel, @NonNull AuthenticationCallback callback, Handler handler, int userId) { authenticate(crypto, cancel, callback, handler, userId, null /* surface */); } /** * Per-user version, see {@link FingerprintManager#authenticate(CryptoObject, * CancellationSignal, int, AuthenticationCallback, Handler)}. This version does not * display the BiometricPrompt. * @param userId the user ID that the fingerprint hardware will authenticate for. * @param surface for optical fingerprint sensors that require active illumination by the OLED * display. Should be null for devices that don't require illumination. * @hide */ @RequiresPermission(anyOf = {USE_BIOMETRIC, USE_FINGERPRINT}) public void authenticate(@Nullable CryptoObject crypto, @Nullable CancellationSignal cancel, @NonNull AuthenticationCallback callback, Handler handler, int userId, @Nullable Surface surface) { @NonNull AuthenticationCallback callback, Handler handler, int userId) { if (callback == null) { throw new IllegalArgumentException("Must supply an authentication callback"); } Loading @@ -508,7 +490,7 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing mCryptoObject = crypto; final long operationId = crypto != null ? crypto.getOpId() : 0; mService.authenticate(mToken, operationId, userId, mServiceReceiver, mContext.getOpPackageName(), surface); mContext.getOpPackageName()); } catch (RemoteException e) { Slog.w(TAG, "Remote exception while authenticating: ", e); // Though this may not be a hardware issue, it will cause apps to give up or try Loading @@ -527,7 +509,7 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing */ @RequiresPermission(USE_BIOMETRIC_INTERNAL) public void detectFingerprint(@NonNull CancellationSignal cancel, @NonNull FingerprintDetectionCallback callback, int userId, @Nullable Surface surface) { @NonNull FingerprintDetectionCallback callback, int userId) { if (mService == null) { return; } Loading @@ -543,27 +525,12 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing try { mService.detectFingerprint(mToken, userId, mServiceReceiver, mContext.getOpPackageName(), surface); mContext.getOpPackageName()); } catch (RemoteException e) { Slog.w(TAG, "Remote exception when requesting finger detect", e); } } /** * Defaults to {@link FingerprintManager#enroll(byte[], CancellationSignal, int, * EnrollmentCallback, Surface)} with {@code surface} set to null. * * @see FingerprintManager#enroll(byte[], CancellationSignal, int, EnrollmentCallback, * Surface) * * @hide */ @RequiresPermission(MANAGE_FINGERPRINT) public void enroll(byte [] hardwareAuthToken, CancellationSignal cancel, int userId, EnrollmentCallback callback) { enroll(hardwareAuthToken, cancel, userId, callback, null /* surface */); } /** * Request fingerprint enrollment. This call warms up the fingerprint hardware * and starts scanning for fingerprints. Progress will be indicated by callbacks to the Loading @@ -581,7 +548,7 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing */ @RequiresPermission(MANAGE_FINGERPRINT) public void enroll(byte [] hardwareAuthToken, CancellationSignal cancel, int userId, EnrollmentCallback callback, @Nullable Surface surface) { EnrollmentCallback callback) { if (userId == UserHandle.USER_CURRENT) { userId = getCurrentUserId(); } Loading @@ -602,7 +569,7 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing try { mEnrollmentCallback = callback; mService.enroll(mToken, hardwareAuthToken, userId, mServiceReceiver, mContext.getOpPackageName(), surface); mContext.getOpPackageName()); } catch (RemoteException e) { Slog.w(TAG, "Remote exception in enroll: ", e); // Though this may not be a hardware issue, it will cause apps to give up or try Loading core/java/android/hardware/fingerprint/IFingerprintService.aidl +4 −5 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ import android.hardware.fingerprint.IFingerprintServiceReceiver; import android.hardware.fingerprint.IUdfpsOverlayController; import android.hardware.fingerprint.Fingerprint; import android.hardware.fingerprint.FingerprintSensorPropertiesInternal; import android.view.Surface; import java.util.List; /** Loading @@ -42,12 +41,12 @@ interface IFingerprintService { // USE_FINGERPRINT/USE_BIOMETRIC permission. This is effectively deprecated, since it only comes // through FingerprintManager now. void authenticate(IBinder token, long operationId, int userId, IFingerprintServiceReceiver receiver, String opPackageName, in Surface surface); IFingerprintServiceReceiver receiver, String opPackageName); // Uses the fingerprint hardware to detect for the presence of a finger, without giving details // about accept/reject/lockout. void detectFingerprint(IBinder token, int userId, IFingerprintServiceReceiver receiver, String opPackageName, in Surface surface); String opPackageName); // This method prepares the service to start authenticating, but doesn't start authentication. // This is protected by the MANAGE_BIOMETRIC signatuer permission. This method should only be Loading @@ -56,7 +55,7 @@ interface IFingerprintService { // startPreparedClient(). void prepareForAuthentication(IBinder token, long operationId, int userId, IBiometricSensorReceiver sensorReceiver, String opPackageName, int cookie, int callingUid, int callingPid, int callingUserId, in Surface surface); int callingUid, int callingPid, int callingUserId); // Starts authentication with the previously prepared client. void startPreparedClient(int cookie); Loading @@ -74,7 +73,7 @@ interface IFingerprintService { // Start fingerprint enrollment void enroll(IBinder token, in byte [] hardwareAuthToken, int userId, IFingerprintServiceReceiver receiver, String opPackageName, in Surface surface); String opPackageName); // Cancel enrollment in progress void cancelEnrollment(IBinder token); Loading packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +1 −1 Original line number Diff line number Diff line Loading @@ -2102,7 +2102,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab if (isEncryptedOrLockdown(userId)) { mFpm.detectFingerprint(mFingerprintCancelSignal, mFingerprintDetectionCallback, userId, null /* surface */); userId); } else { mFpm.authenticate(null /* crypto */, mFingerprintCancelSignal, mFingerprintAuthenticationCallback, null /* handler */, userId); Loading packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -439,7 +439,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { mTestableLooper.processAllMessages(); verify(mFingerprintManager).authenticate(any(), any(), any(), any(), anyInt()); verify(mFingerprintManager, never()).detectFingerprint(any(), any(), anyInt(), any()); verify(mFingerprintManager, never()).detectFingerprint(any(), any(), anyInt()); } @Test Loading @@ -466,7 +466,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { mTestableLooper.processAllMessages(); verify(mFingerprintManager, never()).authenticate(any(), any(), any(), any(), anyInt()); verify(mFingerprintManager).detectFingerprint(any(), any(), anyInt(), any()); verify(mFingerprintManager).detectFingerprint(any(), any(), anyInt()); } @Test Loading services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintAuthenticator.java +1 −1 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ public final class FingerprintAuthenticator extends IBiometricAuthenticator.Stub String opPackageName, int cookie, int callingUid, int callingPid, int callingUserId) throws RemoteException { mFingerprintService.prepareForAuthentication(token, operationId, userId, sensorReceiver, opPackageName, cookie, callingUid, callingPid, callingUserId, null /* surface */); opPackageName, cookie, callingUid, callingPid, callingUserId); } @Override Loading Loading
core/java/android/hardware/fingerprint/FingerprintManager.java +18 −51 Original line number Diff line number Diff line Loading @@ -418,6 +418,18 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing void onChallengeGenerated(int sensorId, long challenge); } /** * Use the provided handler thread for events. * @param handler */ private void useHandler(Handler handler) { if (handler != null) { mHandler = new MyHandler(handler.getLooper()); } else if (mHandler.getLooper() != mContext.getMainLooper()) { mHandler = new MyHandler(mContext.getMainLooper()); } } /** * Request authentication of a crypto object. This call warms up the fingerprint hardware * and starts scanning for a fingerprint. It terminates when Loading Loading @@ -448,46 +460,16 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing authenticate(crypto, cancel, callback, handler, mContext.getUserId()); } /** * Use the provided handler thread for events. * @param handler */ private void useHandler(Handler handler) { if (handler != null) { mHandler = new MyHandler(handler.getLooper()); } else if (mHandler.getLooper() != mContext.getMainLooper()){ mHandler = new MyHandler(mContext.getMainLooper()); } } /** * Defaults to {@link FingerprintManager#authenticate(CryptoObject, CancellationSignal, * AuthenticationCallback, Handler, int, Surface)} with {@code surface} set to null. * * @see FingerprintManager#authenticate(CryptoObject, CancellationSignal, * AuthenticationCallback, Handler, int, Surface) * * @hide */ @RequiresPermission(anyOf = {USE_BIOMETRIC, USE_FINGERPRINT}) public void authenticate(@Nullable CryptoObject crypto, @Nullable CancellationSignal cancel, @NonNull AuthenticationCallback callback, Handler handler, int userId) { authenticate(crypto, cancel, callback, handler, userId, null /* surface */); } /** * Per-user version, see {@link FingerprintManager#authenticate(CryptoObject, * CancellationSignal, int, AuthenticationCallback, Handler)}. This version does not * display the BiometricPrompt. * @param userId the user ID that the fingerprint hardware will authenticate for. * @param surface for optical fingerprint sensors that require active illumination by the OLED * display. Should be null for devices that don't require illumination. * @hide */ @RequiresPermission(anyOf = {USE_BIOMETRIC, USE_FINGERPRINT}) public void authenticate(@Nullable CryptoObject crypto, @Nullable CancellationSignal cancel, @NonNull AuthenticationCallback callback, Handler handler, int userId, @Nullable Surface surface) { @NonNull AuthenticationCallback callback, Handler handler, int userId) { if (callback == null) { throw new IllegalArgumentException("Must supply an authentication callback"); } Loading @@ -508,7 +490,7 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing mCryptoObject = crypto; final long operationId = crypto != null ? crypto.getOpId() : 0; mService.authenticate(mToken, operationId, userId, mServiceReceiver, mContext.getOpPackageName(), surface); mContext.getOpPackageName()); } catch (RemoteException e) { Slog.w(TAG, "Remote exception while authenticating: ", e); // Though this may not be a hardware issue, it will cause apps to give up or try Loading @@ -527,7 +509,7 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing */ @RequiresPermission(USE_BIOMETRIC_INTERNAL) public void detectFingerprint(@NonNull CancellationSignal cancel, @NonNull FingerprintDetectionCallback callback, int userId, @Nullable Surface surface) { @NonNull FingerprintDetectionCallback callback, int userId) { if (mService == null) { return; } Loading @@ -543,27 +525,12 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing try { mService.detectFingerprint(mToken, userId, mServiceReceiver, mContext.getOpPackageName(), surface); mContext.getOpPackageName()); } catch (RemoteException e) { Slog.w(TAG, "Remote exception when requesting finger detect", e); } } /** * Defaults to {@link FingerprintManager#enroll(byte[], CancellationSignal, int, * EnrollmentCallback, Surface)} with {@code surface} set to null. * * @see FingerprintManager#enroll(byte[], CancellationSignal, int, EnrollmentCallback, * Surface) * * @hide */ @RequiresPermission(MANAGE_FINGERPRINT) public void enroll(byte [] hardwareAuthToken, CancellationSignal cancel, int userId, EnrollmentCallback callback) { enroll(hardwareAuthToken, cancel, userId, callback, null /* surface */); } /** * Request fingerprint enrollment. This call warms up the fingerprint hardware * and starts scanning for fingerprints. Progress will be indicated by callbacks to the Loading @@ -581,7 +548,7 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing */ @RequiresPermission(MANAGE_FINGERPRINT) public void enroll(byte [] hardwareAuthToken, CancellationSignal cancel, int userId, EnrollmentCallback callback, @Nullable Surface surface) { EnrollmentCallback callback) { if (userId == UserHandle.USER_CURRENT) { userId = getCurrentUserId(); } Loading @@ -602,7 +569,7 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing try { mEnrollmentCallback = callback; mService.enroll(mToken, hardwareAuthToken, userId, mServiceReceiver, mContext.getOpPackageName(), surface); mContext.getOpPackageName()); } catch (RemoteException e) { Slog.w(TAG, "Remote exception in enroll: ", e); // Though this may not be a hardware issue, it will cause apps to give up or try Loading
core/java/android/hardware/fingerprint/IFingerprintService.aidl +4 −5 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ import android.hardware.fingerprint.IFingerprintServiceReceiver; import android.hardware.fingerprint.IUdfpsOverlayController; import android.hardware.fingerprint.Fingerprint; import android.hardware.fingerprint.FingerprintSensorPropertiesInternal; import android.view.Surface; import java.util.List; /** Loading @@ -42,12 +41,12 @@ interface IFingerprintService { // USE_FINGERPRINT/USE_BIOMETRIC permission. This is effectively deprecated, since it only comes // through FingerprintManager now. void authenticate(IBinder token, long operationId, int userId, IFingerprintServiceReceiver receiver, String opPackageName, in Surface surface); IFingerprintServiceReceiver receiver, String opPackageName); // Uses the fingerprint hardware to detect for the presence of a finger, without giving details // about accept/reject/lockout. void detectFingerprint(IBinder token, int userId, IFingerprintServiceReceiver receiver, String opPackageName, in Surface surface); String opPackageName); // This method prepares the service to start authenticating, but doesn't start authentication. // This is protected by the MANAGE_BIOMETRIC signatuer permission. This method should only be Loading @@ -56,7 +55,7 @@ interface IFingerprintService { // startPreparedClient(). void prepareForAuthentication(IBinder token, long operationId, int userId, IBiometricSensorReceiver sensorReceiver, String opPackageName, int cookie, int callingUid, int callingPid, int callingUserId, in Surface surface); int callingUid, int callingPid, int callingUserId); // Starts authentication with the previously prepared client. void startPreparedClient(int cookie); Loading @@ -74,7 +73,7 @@ interface IFingerprintService { // Start fingerprint enrollment void enroll(IBinder token, in byte [] hardwareAuthToken, int userId, IFingerprintServiceReceiver receiver, String opPackageName, in Surface surface); String opPackageName); // Cancel enrollment in progress void cancelEnrollment(IBinder token); Loading
packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +1 −1 Original line number Diff line number Diff line Loading @@ -2102,7 +2102,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab if (isEncryptedOrLockdown(userId)) { mFpm.detectFingerprint(mFingerprintCancelSignal, mFingerprintDetectionCallback, userId, null /* surface */); userId); } else { mFpm.authenticate(null /* crypto */, mFingerprintCancelSignal, mFingerprintAuthenticationCallback, null /* handler */, userId); Loading
packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -439,7 +439,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { mTestableLooper.processAllMessages(); verify(mFingerprintManager).authenticate(any(), any(), any(), any(), anyInt()); verify(mFingerprintManager, never()).detectFingerprint(any(), any(), anyInt(), any()); verify(mFingerprintManager, never()).detectFingerprint(any(), any(), anyInt()); } @Test Loading @@ -466,7 +466,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { mTestableLooper.processAllMessages(); verify(mFingerprintManager, never()).authenticate(any(), any(), any(), any(), anyInt()); verify(mFingerprintManager).detectFingerprint(any(), any(), anyInt(), any()); verify(mFingerprintManager).detectFingerprint(any(), any(), anyInt()); } @Test Loading
services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintAuthenticator.java +1 −1 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ public final class FingerprintAuthenticator extends IBiometricAuthenticator.Stub String opPackageName, int cookie, int callingUid, int callingPid, int callingUserId) throws RemoteException { mFingerprintService.prepareForAuthentication(token, operationId, userId, sensorReceiver, opPackageName, cookie, callingUid, callingPid, callingUserId, null /* surface */); opPackageName, cookie, callingUid, callingPid, callingUserId); } @Override Loading