diff options
10 files changed, 36 insertions, 17 deletions
diff --git a/core/java/android/hardware/biometrics/IBiometricAuthenticator.aidl b/core/java/android/hardware/biometrics/IBiometricAuthenticator.aidl index addd622eef35..17cd18cc4182 100644 --- a/core/java/android/hardware/biometrics/IBiometricAuthenticator.aidl +++ b/core/java/android/hardware/biometrics/IBiometricAuthenticator.aidl @@ -48,7 +48,8 @@ interface IBiometricAuthenticator { // startPreparedClient(). void prepareForAuthentication(boolean requireConfirmation, IBinder token, long operationId, int userId, IBiometricSensorReceiver sensorReceiver, String opPackageName, - long requestId, int cookie, boolean allowBackgroundAuthentication); + long requestId, int cookie, boolean allowBackgroundAuthentication, + boolean isForLegacyFingerprintManager); // Starts authentication with the previously prepared client. void startPreparedClient(int cookie); diff --git a/core/java/android/hardware/fingerprint/IFingerprintService.aidl b/core/java/android/hardware/fingerprint/IFingerprintService.aidl index e2840ec20ff9..0100660669e9 100644 --- a/core/java/android/hardware/fingerprint/IFingerprintService.aidl +++ b/core/java/android/hardware/fingerprint/IFingerprintService.aidl @@ -74,7 +74,8 @@ interface IFingerprintService { @EnforcePermission("MANAGE_BIOMETRIC") void prepareForAuthentication(IBinder token, long operationId, IBiometricSensorReceiver sensorReceiver, in FingerprintAuthenticateOptions options, long requestId, - int cookie, boolean allowBackgroundAuthentication); + int cookie, boolean allowBackgroundAuthentication, + boolean isForLegacyFingerprintManager); // Starts authentication with the previously prepared client. @EnforcePermission("MANAGE_BIOMETRIC") diff --git a/services/core/java/com/android/server/biometrics/AuthSession.java b/services/core/java/com/android/server/biometrics/AuthSession.java index 2ae3118d7bfa..b9ccbfbf55e7 100644 --- a/services/core/java/com/android/server/biometrics/AuthSession.java +++ b/services/core/java/com/android/server/biometrics/AuthSession.java @@ -275,7 +275,8 @@ public final class AuthSession implements IBinder.DeathRecipient { } sensor.goToStateWaitingForCookie(requireConfirmation, mToken, mOperationId, mUserId, mSensorReceiver, mOpPackageName, mRequestId, cookie, - mPromptInfo.isAllowBackgroundAuthentication()); + mPromptInfo.isAllowBackgroundAuthentication(), + mPromptInfo.isForLegacyFingerprintManager()); } } @@ -747,7 +748,7 @@ public final class AuthSession implements IBinder.DeathRecipient { Slog.v(TAG, "Confirmed! Modality: " + statsModality() + ", User: " + mUserId + ", IsCrypto: " + isCrypto() - + ", Client: " + BiometricsProtoEnums.CLIENT_BIOMETRIC_PROMPT + + ", Client: " + getStatsClient() + ", RequireConfirmation: " + mPreAuthInfo.confirmationRequested + ", State: " + FrameworkStatsLog.BIOMETRIC_AUTHENTICATED__STATE__CONFIRMED + ", Latency: " + latency @@ -758,7 +759,7 @@ public final class AuthSession implements IBinder.DeathRecipient { mOperationContext, statsModality(), BiometricsProtoEnums.ACTION_UNKNOWN, - BiometricsProtoEnums.CLIENT_BIOMETRIC_PROMPT, + getStatsClient(), mDebugEnabled, latency, FrameworkStatsLog.BIOMETRIC_AUTHENTICATED__STATE__CONFIRMED, @@ -784,7 +785,7 @@ public final class AuthSession implements IBinder.DeathRecipient { + ", User: " + mUserId + ", IsCrypto: " + isCrypto() + ", Action: " + BiometricsProtoEnums.ACTION_AUTHENTICATE - + ", Client: " + BiometricsProtoEnums.CLIENT_BIOMETRIC_PROMPT + + ", Client: " + getStatsClient() + ", Reason: " + reason + ", Error: " + error + ", Latency: " + latency @@ -796,7 +797,7 @@ public final class AuthSession implements IBinder.DeathRecipient { mOperationContext, statsModality(), BiometricsProtoEnums.ACTION_AUTHENTICATE, - BiometricsProtoEnums.CLIENT_BIOMETRIC_PROMPT, + getStatsClient(), mDebugEnabled, latency, error, @@ -998,6 +999,12 @@ public final class AuthSession implements IBinder.DeathRecipient { } } + private int getStatsClient() { + return mPromptInfo.isForLegacyFingerprintManager() + ? BiometricsProtoEnums.CLIENT_FINGERPRINT_MANAGER + : BiometricsProtoEnums.CLIENT_BIOMETRIC_PROMPT; + } + @Override public String toString() { return "State: " + mState diff --git a/services/core/java/com/android/server/biometrics/BiometricSensor.java b/services/core/java/com/android/server/biometrics/BiometricSensor.java index 937e3f8f8668..42dd36a5c35a 100644 --- a/services/core/java/com/android/server/biometrics/BiometricSensor.java +++ b/services/core/java/com/android/server/biometrics/BiometricSensor.java @@ -106,12 +106,13 @@ public abstract class BiometricSensor { void goToStateWaitingForCookie(boolean requireConfirmation, IBinder token, long sessionId, int userId, IBiometricSensorReceiver sensorReceiver, String opPackageName, - long requestId, int cookie, boolean allowBackgroundAuthentication) + long requestId, int cookie, boolean allowBackgroundAuthentication, + boolean isForLegacyFingerprintManager) throws RemoteException { mCookie = cookie; impl.prepareForAuthentication(requireConfirmation, token, sessionId, userId, sensorReceiver, opPackageName, requestId, mCookie, - allowBackgroundAuthentication); + allowBackgroundAuthentication, isForLegacyFingerprintManager); mSensorState = STATE_WAITING_FOR_COOKIE; } diff --git a/services/core/java/com/android/server/biometrics/sensors/face/FaceAuthenticator.java b/services/core/java/com/android/server/biometrics/sensors/face/FaceAuthenticator.java index fb64bcc3abc1..22110037890f 100644 --- a/services/core/java/com/android/server/biometrics/sensors/face/FaceAuthenticator.java +++ b/services/core/java/com/android/server/biometrics/sensors/face/FaceAuthenticator.java @@ -62,7 +62,8 @@ public final class FaceAuthenticator extends IBiometricAuthenticator.Stub { @Override public void prepareForAuthentication(boolean requireConfirmation, IBinder token, long operationId, int userId, IBiometricSensorReceiver sensorReceiver, - String opPackageName, long requestId, int cookie, boolean allowBackgroundAuthentication) + String opPackageName, long requestId, int cookie, boolean allowBackgroundAuthentication, + boolean isForLegacyFingerprintManager) throws RemoteException { mFaceService.prepareForAuthentication(requireConfirmation, token, operationId, sensorReceiver, new FaceAuthenticateOptions.Builder() diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintAuthenticator.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintAuthenticator.java index d47a57ad6742..b6fa0c126cd6 100644 --- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintAuthenticator.java +++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintAuthenticator.java @@ -62,7 +62,8 @@ public final class FingerprintAuthenticator extends IBiometricAuthenticator.Stub @Override public void prepareForAuthentication(boolean requireConfirmation, IBinder token, long operationId, int userId, IBiometricSensorReceiver sensorReceiver, - String opPackageName, long requestId, int cookie, boolean allowBackgroundAuthentication) + String opPackageName, long requestId, int cookie, boolean allowBackgroundAuthentication, + boolean isForLegacyFingerprintManager) throws RemoteException { mFingerprintService.prepareForAuthentication(token, operationId, sensorReceiver, new FingerprintAuthenticateOptions.Builder() @@ -70,7 +71,7 @@ public final class FingerprintAuthenticator extends IBiometricAuthenticator.Stub .setUserId(userId) .setOpPackageName(opPackageName) .build(), - requestId, cookie, allowBackgroundAuthentication); + requestId, cookie, allowBackgroundAuthentication, isForLegacyFingerprintManager); } @Override diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintService.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintService.java index 7cc6940f4b9d..5ce0c8b384ef 100644 --- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintService.java +++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintService.java @@ -464,7 +464,8 @@ public class FingerprintService extends SystemService { public void prepareForAuthentication(IBinder token, long operationId, IBiometricSensorReceiver sensorReceiver, @NonNull FingerprintAuthenticateOptions options, - long requestId, int cookie, boolean allowBackgroundAuthentication) { + long requestId, int cookie, boolean allowBackgroundAuthentication, + boolean isForLegacyFingerprintManager) { super.prepareForAuthentication_enforcePermission(); final ServiceProvider provider = mRegistry.getProviderForSensor(options.getSensorId()); @@ -473,10 +474,13 @@ public class FingerprintService extends SystemService { return; } + final int statsClient = + isForLegacyFingerprintManager ? BiometricsProtoEnums.CLIENT_FINGERPRINT_MANAGER + : BiometricsProtoEnums.CLIENT_BIOMETRIC_PROMPT; final boolean restricted = true; // BiometricPrompt is always restricted provider.scheduleAuthenticate(token, operationId, cookie, new ClientMonitorCallbackConverter(sensorReceiver), options, requestId, - restricted, BiometricsProtoEnums.CLIENT_BIOMETRIC_PROMPT, + restricted, statsClient, allowBackgroundAuthentication); } diff --git a/services/core/java/com/android/server/biometrics/sensors/iris/IrisAuthenticator.java b/services/core/java/com/android/server/biometrics/sensors/iris/IrisAuthenticator.java index 5c0c3626037a..01d1e378a735 100644 --- a/services/core/java/com/android/server/biometrics/sensors/iris/IrisAuthenticator.java +++ b/services/core/java/com/android/server/biometrics/sensors/iris/IrisAuthenticator.java @@ -59,7 +59,8 @@ public final class IrisAuthenticator extends IBiometricAuthenticator.Stub { @Override public void prepareForAuthentication(boolean requireConfirmation, IBinder token, long sessionId, int userId, IBiometricSensorReceiver sensorReceiver, - String opPackageName, long requestId, int cookie, boolean allowBackgroundAuthentication) + String opPackageName, long requestId, int cookie, boolean allowBackgroundAuthentication, + boolean isForLegacyFingerprintManager) throws RemoteException { } diff --git a/services/tests/servicestests/src/com/android/server/biometrics/AuthSessionTest.java b/services/tests/servicestests/src/com/android/server/biometrics/AuthSessionTest.java index 769be177ce03..0f3daec263e0 100644 --- a/services/tests/servicestests/src/com/android/server/biometrics/AuthSessionTest.java +++ b/services/tests/servicestests/src/com/android/server/biometrics/AuthSessionTest.java @@ -182,7 +182,8 @@ public class AuthSessionTest { eq(TEST_PACKAGE), eq(TEST_REQUEST_ID), eq(sensor.getCookie()), - anyBoolean() /* allowBackgroundAuthentication */); + anyBoolean() /* allowBackgroundAuthentication */, + anyBoolean() /* isForLegacyFingerprintManager */); } final int cookie1 = session.mPreAuthInfo.eligibleSensors.get(0).getCookie(); diff --git a/services/tests/servicestests/src/com/android/server/biometrics/BiometricServiceTest.java b/services/tests/servicestests/src/com/android/server/biometrics/BiometricServiceTest.java index e79ac0986dc8..0230d77e8e14 100644 --- a/services/tests/servicestests/src/com/android/server/biometrics/BiometricServiceTest.java +++ b/services/tests/servicestests/src/com/android/server/biometrics/BiometricServiceTest.java @@ -598,7 +598,8 @@ public class BiometricServiceTest { anyString() /* opPackageName */, eq(TEST_REQUEST_ID), cookieCaptor.capture() /* cookie */, - anyBoolean() /* allowBackgroundAuthentication */); + anyBoolean() /* allowBackgroundAuthentication */, + anyBoolean() /* isForLegacyFingerprintManager */); // onReadyForAuthentication, mAuthSession state OK mBiometricService.mImpl.onReadyForAuthentication(TEST_REQUEST_ID, cookieCaptor.getValue()); |