Loading core/java/android/hardware/face/FaceManager.java +42 −15 Original line number Diff line number Diff line Loading @@ -93,8 +93,8 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan } @Override // binder call public void onAuthenticationSucceeded(long deviceId, Face face) { mHandler.obtainMessage(MSG_AUTHENTICATION_SUCCEEDED, face).sendToTarget(); public void onAuthenticationSucceeded(long deviceId, Face face, int userId) { mHandler.obtainMessage(MSG_AUTHENTICATION_SUCCEEDED, userId, 0, face).sendToTarget(); } @Override // binder call Loading Loading @@ -168,6 +168,44 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan @RequiresPermission(USE_BIOMETRIC_INTERNAL) public void authenticate(@Nullable CryptoObject crypto, @Nullable CancellationSignal cancel, int flags, @NonNull AuthenticationCallback callback, @Nullable Handler handler) { authenticate(crypto, cancel, flags, callback, handler, mContext.getUserId()); } /** * Use the provided handler thread for events. */ 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 operates the face recognition hardware * and starts capturing images. It terminates when * {@link AuthenticationCallback#onAuthenticationError(int, CharSequence)} or * {@link AuthenticationCallback#onAuthenticationSucceeded(AuthenticationResult)} is called, at * which point the object is no longer valid. The operation can be canceled by using the * provided cancel object. * * @param crypto object associated with the call or null if none required. * @param cancel an object that can be used to cancel authentication * @param flags optional flags; should be 0 * @param callback an object to receive authentication events * @param handler an optional handler to handle callback events * @param userId userId to authenticate for * @throws IllegalArgumentException if the crypto operation is not supported or is not backed * by * <a href="{@docRoot}training/articles/keystore.html">Android * Keystore facility</a>. * @throws IllegalStateException if the crypto primitive is not initialized. * @hide */ public void authenticate(@Nullable CryptoObject crypto, @Nullable CancellationSignal cancel, int flags, @NonNull AuthenticationCallback callback, @Nullable Handler handler, int userId) { if (callback == null) { throw new IllegalArgumentException("Must supply an authentication callback"); } Loading @@ -187,7 +225,7 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan mAuthenticationCallback = callback; mCryptoObject = crypto; long sessionId = crypto != null ? crypto.getOpId() : 0; mService.authenticate(mToken, sessionId, mContext.getUserId(), mServiceReceiver, mService.authenticate(mToken, sessionId, userId, mServiceReceiver, flags, mContext.getOpPackageName()); } catch (RemoteException e) { Log.w(TAG, "Remote exception while authenticating: ", e); Loading @@ -202,17 +240,6 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan } } /** * Use the provided handler thread for events. */ 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 face authentication enrollment. This call operates the face authentication hardware * and starts capturing images. Progress will be indicated by callbacks to the Loading core/java/android/hardware/face/IFaceServiceReceiver.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ import android.hardware.face.Face; oneway interface IFaceServiceReceiver { void onEnrollResult(long deviceId, int faceId, int remaining); void onAcquired(long deviceId, int acquiredInfo, int vendorCode); void onAuthenticationSucceeded(long deviceId, in Face face); void onAuthenticationSucceeded(long deviceId, in Face face, int userId); void onAuthenticationFailed(long deviceId); void onError(long deviceId, int error, int vendorCode); void onRemoved(long deviceId, int faceId, int remaining); Loading packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +1 −1 Original line number Diff line number Diff line Loading @@ -1665,7 +1665,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { } mFaceCancelSignal = new CancellationSignal(); mFaceManager.authenticate(null, mFaceCancelSignal, 0, mFaceAuthenticationCallback, null); mFaceAuthenticationCallback, null, userId); setFaceRunningState(BIOMETRIC_STATE_RUNNING); } } Loading packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java +3 −3 Original line number Diff line number Diff line Loading @@ -288,7 +288,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { mKeyguardUpdateMonitor.sendKeyguardBouncerChanged(true); mTestableLooper.processAllMessages(); verify(mFaceManager).authenticate(any(), any(), anyInt(), any(), any()); verify(mFaceManager).authenticate(any(), any(), anyInt(), any(), any(), anyInt()); verify(mFaceManager).isHardwareDetected(); verify(mFaceManager).hasEnrolledTemplates(anyInt()); } Loading @@ -298,7 +298,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { mKeyguardUpdateMonitor.dispatchStartedWakingUp(); mTestableLooper.processAllMessages(); mKeyguardUpdateMonitor.onKeyguardVisibilityChanged(true); verify(mFaceManager).authenticate(any(), any(), anyInt(), any(), any()); verify(mFaceManager).authenticate(any(), any(), anyInt(), any(), any(), anyInt()); } @Test Loading @@ -317,7 +317,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { mKeyguardUpdateMonitor.setKeyguardOccluded(true); mKeyguardUpdateMonitor.setAssistantVisible(true); verify(mFaceManager).authenticate(any(), any(), anyInt(), any(), any()); verify(mFaceManager).authenticate(any(), any(), anyInt(), any(), any(), anyInt()); } @Test Loading services/core/java/com/android/server/biometrics/AuthenticationClient.java +2 −1 Original line number Diff line number Diff line Loading @@ -134,7 +134,8 @@ public abstract class AuthenticationClient extends ClientMonitor { + ", Owner: " + getOwnerString() + ", isBP: " + isBiometricPrompt() + ", listener: " + listener + ", requireConfirmation: " + mRequireConfirmation); + ", requireConfirmation: " + mRequireConfirmation + ", user: " + getTargetUserId()); if (authenticated) { mAlreadyDone = true; Loading Loading
core/java/android/hardware/face/FaceManager.java +42 −15 Original line number Diff line number Diff line Loading @@ -93,8 +93,8 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan } @Override // binder call public void onAuthenticationSucceeded(long deviceId, Face face) { mHandler.obtainMessage(MSG_AUTHENTICATION_SUCCEEDED, face).sendToTarget(); public void onAuthenticationSucceeded(long deviceId, Face face, int userId) { mHandler.obtainMessage(MSG_AUTHENTICATION_SUCCEEDED, userId, 0, face).sendToTarget(); } @Override // binder call Loading Loading @@ -168,6 +168,44 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan @RequiresPermission(USE_BIOMETRIC_INTERNAL) public void authenticate(@Nullable CryptoObject crypto, @Nullable CancellationSignal cancel, int flags, @NonNull AuthenticationCallback callback, @Nullable Handler handler) { authenticate(crypto, cancel, flags, callback, handler, mContext.getUserId()); } /** * Use the provided handler thread for events. */ 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 operates the face recognition hardware * and starts capturing images. It terminates when * {@link AuthenticationCallback#onAuthenticationError(int, CharSequence)} or * {@link AuthenticationCallback#onAuthenticationSucceeded(AuthenticationResult)} is called, at * which point the object is no longer valid. The operation can be canceled by using the * provided cancel object. * * @param crypto object associated with the call or null if none required. * @param cancel an object that can be used to cancel authentication * @param flags optional flags; should be 0 * @param callback an object to receive authentication events * @param handler an optional handler to handle callback events * @param userId userId to authenticate for * @throws IllegalArgumentException if the crypto operation is not supported or is not backed * by * <a href="{@docRoot}training/articles/keystore.html">Android * Keystore facility</a>. * @throws IllegalStateException if the crypto primitive is not initialized. * @hide */ public void authenticate(@Nullable CryptoObject crypto, @Nullable CancellationSignal cancel, int flags, @NonNull AuthenticationCallback callback, @Nullable Handler handler, int userId) { if (callback == null) { throw new IllegalArgumentException("Must supply an authentication callback"); } Loading @@ -187,7 +225,7 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan mAuthenticationCallback = callback; mCryptoObject = crypto; long sessionId = crypto != null ? crypto.getOpId() : 0; mService.authenticate(mToken, sessionId, mContext.getUserId(), mServiceReceiver, mService.authenticate(mToken, sessionId, userId, mServiceReceiver, flags, mContext.getOpPackageName()); } catch (RemoteException e) { Log.w(TAG, "Remote exception while authenticating: ", e); Loading @@ -202,17 +240,6 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan } } /** * Use the provided handler thread for events. */ 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 face authentication enrollment. This call operates the face authentication hardware * and starts capturing images. Progress will be indicated by callbacks to the Loading
core/java/android/hardware/face/IFaceServiceReceiver.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ import android.hardware.face.Face; oneway interface IFaceServiceReceiver { void onEnrollResult(long deviceId, int faceId, int remaining); void onAcquired(long deviceId, int acquiredInfo, int vendorCode); void onAuthenticationSucceeded(long deviceId, in Face face); void onAuthenticationSucceeded(long deviceId, in Face face, int userId); void onAuthenticationFailed(long deviceId); void onError(long deviceId, int error, int vendorCode); void onRemoved(long deviceId, int faceId, int remaining); Loading
packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +1 −1 Original line number Diff line number Diff line Loading @@ -1665,7 +1665,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { } mFaceCancelSignal = new CancellationSignal(); mFaceManager.authenticate(null, mFaceCancelSignal, 0, mFaceAuthenticationCallback, null); mFaceAuthenticationCallback, null, userId); setFaceRunningState(BIOMETRIC_STATE_RUNNING); } } Loading
packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java +3 −3 Original line number Diff line number Diff line Loading @@ -288,7 +288,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { mKeyguardUpdateMonitor.sendKeyguardBouncerChanged(true); mTestableLooper.processAllMessages(); verify(mFaceManager).authenticate(any(), any(), anyInt(), any(), any()); verify(mFaceManager).authenticate(any(), any(), anyInt(), any(), any(), anyInt()); verify(mFaceManager).isHardwareDetected(); verify(mFaceManager).hasEnrolledTemplates(anyInt()); } Loading @@ -298,7 +298,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { mKeyguardUpdateMonitor.dispatchStartedWakingUp(); mTestableLooper.processAllMessages(); mKeyguardUpdateMonitor.onKeyguardVisibilityChanged(true); verify(mFaceManager).authenticate(any(), any(), anyInt(), any(), any()); verify(mFaceManager).authenticate(any(), any(), anyInt(), any(), any(), anyInt()); } @Test Loading @@ -317,7 +317,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { mKeyguardUpdateMonitor.setKeyguardOccluded(true); mKeyguardUpdateMonitor.setAssistantVisible(true); verify(mFaceManager).authenticate(any(), any(), anyInt(), any(), any()); verify(mFaceManager).authenticate(any(), any(), anyInt(), any(), any(), anyInt()); } @Test Loading
services/core/java/com/android/server/biometrics/AuthenticationClient.java +2 −1 Original line number Diff line number Diff line Loading @@ -134,7 +134,8 @@ public abstract class AuthenticationClient extends ClientMonitor { + ", Owner: " + getOwnerString() + ", isBP: " + isBiometricPrompt() + ", listener: " + listener + ", requireConfirmation: " + mRequireConfirmation); + ", requireConfirmation: " + mRequireConfirmation + ", user: " + getTargetUserId()); if (authenticated) { mAlreadyDone = true; Loading