Loading core/java/android/hardware/biometrics/AuthenticationStateListener.aidl 0 → 100644 +36 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.hardware.biometrics; /** * Low-level callback interface between <Biometric>Manager and <Auth>Service. Allows core system * services (e.g. SystemUI) to register a listener for updates about the current state of biometric * authentication. * @hide */ oneway interface AuthenticationStateListener { /** * Defines behavior in response to authentication starting * @param requestReason reason from [BiometricRequestConstants.RequestReason] for requesting * authentication starting */ void onAuthenticationStarted(int requestReason); /** * Defines behavior in response to authentication stopping */ void onAuthenticationStopped(); } core/java/android/hardware/biometrics/BiometricManager.java +38 −0 Original line number Diff line number Diff line Loading @@ -551,6 +551,44 @@ public class BiometricManager { } } /** * Registers listener for changes to biometric authentication state. * Only sends callbacks for events that occur after the callback has been registered. * @param listener Listener for changes to biometric authentication state * @hide */ @RequiresPermission(USE_BIOMETRIC_INTERNAL) public void registerAuthenticationStateListener(AuthenticationStateListener listener) { if (mService != null) { try { mService.registerAuthenticationStateListener(listener); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } else { Slog.w(TAG, "registerAuthenticationStateListener(): Service not connected"); } } /** * Unregisters listener for changes to biometric authentication state. * @param listener Listener for changes to biometric authentication state * @hide */ @RequiresPermission(USE_BIOMETRIC_INTERNAL) public void unregisterAuthenticationStateListener(AuthenticationStateListener listener) { if (mService != null) { try { mService.unregisterAuthenticationStateListener(listener); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } else { Slog.w(TAG, "unregisterAuthenticationStateListener(): Service not connected"); } } /** * Requests all {@link Authenticators.Types#BIOMETRIC_STRONG} sensors to have their * authenticatorId invalidated for the specified user. This happens when enrollments have been Loading core/java/android/hardware/biometrics/BiometricOverlayConstants.java→core/java/android/hardware/biometrics/BiometricRequestConstants.java +14 −11 Original line number Diff line number Diff line Loading @@ -22,24 +22,27 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * Common constants for biometric overlays. * Common constants for biometric requests. * @hide */ public interface BiometricOverlayConstants { public class BiometricRequestConstants { private BiometricRequestConstants() {} /** Unknown usage. */ int REASON_UNKNOWN = 0; public static final int REASON_UNKNOWN = 0; /** User is about to enroll. */ int REASON_ENROLL_FIND_SENSOR = 1; public static final int REASON_ENROLL_FIND_SENSOR = 1; /** User is enrolling. */ int REASON_ENROLL_ENROLLING = 2; public static final int REASON_ENROLL_ENROLLING = 2; /** Usage from BiometricPrompt. */ int REASON_AUTH_BP = 3; /** Usage from Keyguard. */ int REASON_AUTH_KEYGUARD = 4; public static final int REASON_AUTH_BP = 3; /** Usage from Device Entry. */ public static final int REASON_AUTH_KEYGUARD = 4; /** Non-specific usage (from FingerprintManager). */ int REASON_AUTH_OTHER = 5; public static final int REASON_AUTH_OTHER = 5; /** Usage from Settings. */ int REASON_AUTH_SETTINGS = 6; public static final int REASON_AUTH_SETTINGS = 6; @IntDef({REASON_UNKNOWN, REASON_ENROLL_FIND_SENSOR, Loading @@ -49,5 +52,5 @@ public interface BiometricOverlayConstants { REASON_AUTH_OTHER, REASON_AUTH_SETTINGS}) @Retention(RetentionPolicy.SOURCE) @interface ShowReason {} public @interface RequestReason {} } core/java/android/hardware/biometrics/IAuthService.aidl +7 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.hardware.biometrics; import android.hardware.biometrics.AuthenticationStateListener; import android.hardware.biometrics.IBiometricEnabledOnKeyguardCallback; import android.hardware.biometrics.IBiometricServiceReceiver; import android.hardware.biometrics.IInvalidationCallback; Loading Loading @@ -66,6 +67,12 @@ interface IAuthService { // Register callback for when keyguard biometric eligibility changes. void registerEnabledOnKeyguardCallback(IBiometricEnabledOnKeyguardCallback callback); // Register listener for changes to authentication state. void registerAuthenticationStateListener(AuthenticationStateListener listener); // Unregister listener for changes to authentication state. void unregisterAuthenticationStateListener(AuthenticationStateListener listener); // Requests all BIOMETRIC_STRONG sensors to have their authenticatorId invalidated for the // specified user. This happens when enrollments have been added on devices with multiple // biometric sensors. Loading core/java/android/hardware/fingerprint/FingerprintManager.java +1 −0 Original line number Diff line number Diff line Loading @@ -983,6 +983,7 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing } } // TODO(b/288175061): remove with Flags.FLAG_SIDEFPS_CONTROLLER_REFACTOR /** * @hide */ Loading Loading
core/java/android/hardware/biometrics/AuthenticationStateListener.aidl 0 → 100644 +36 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.hardware.biometrics; /** * Low-level callback interface between <Biometric>Manager and <Auth>Service. Allows core system * services (e.g. SystemUI) to register a listener for updates about the current state of biometric * authentication. * @hide */ oneway interface AuthenticationStateListener { /** * Defines behavior in response to authentication starting * @param requestReason reason from [BiometricRequestConstants.RequestReason] for requesting * authentication starting */ void onAuthenticationStarted(int requestReason); /** * Defines behavior in response to authentication stopping */ void onAuthenticationStopped(); }
core/java/android/hardware/biometrics/BiometricManager.java +38 −0 Original line number Diff line number Diff line Loading @@ -551,6 +551,44 @@ public class BiometricManager { } } /** * Registers listener for changes to biometric authentication state. * Only sends callbacks for events that occur after the callback has been registered. * @param listener Listener for changes to biometric authentication state * @hide */ @RequiresPermission(USE_BIOMETRIC_INTERNAL) public void registerAuthenticationStateListener(AuthenticationStateListener listener) { if (mService != null) { try { mService.registerAuthenticationStateListener(listener); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } else { Slog.w(TAG, "registerAuthenticationStateListener(): Service not connected"); } } /** * Unregisters listener for changes to biometric authentication state. * @param listener Listener for changes to biometric authentication state * @hide */ @RequiresPermission(USE_BIOMETRIC_INTERNAL) public void unregisterAuthenticationStateListener(AuthenticationStateListener listener) { if (mService != null) { try { mService.unregisterAuthenticationStateListener(listener); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } else { Slog.w(TAG, "unregisterAuthenticationStateListener(): Service not connected"); } } /** * Requests all {@link Authenticators.Types#BIOMETRIC_STRONG} sensors to have their * authenticatorId invalidated for the specified user. This happens when enrollments have been Loading
core/java/android/hardware/biometrics/BiometricOverlayConstants.java→core/java/android/hardware/biometrics/BiometricRequestConstants.java +14 −11 Original line number Diff line number Diff line Loading @@ -22,24 +22,27 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * Common constants for biometric overlays. * Common constants for biometric requests. * @hide */ public interface BiometricOverlayConstants { public class BiometricRequestConstants { private BiometricRequestConstants() {} /** Unknown usage. */ int REASON_UNKNOWN = 0; public static final int REASON_UNKNOWN = 0; /** User is about to enroll. */ int REASON_ENROLL_FIND_SENSOR = 1; public static final int REASON_ENROLL_FIND_SENSOR = 1; /** User is enrolling. */ int REASON_ENROLL_ENROLLING = 2; public static final int REASON_ENROLL_ENROLLING = 2; /** Usage from BiometricPrompt. */ int REASON_AUTH_BP = 3; /** Usage from Keyguard. */ int REASON_AUTH_KEYGUARD = 4; public static final int REASON_AUTH_BP = 3; /** Usage from Device Entry. */ public static final int REASON_AUTH_KEYGUARD = 4; /** Non-specific usage (from FingerprintManager). */ int REASON_AUTH_OTHER = 5; public static final int REASON_AUTH_OTHER = 5; /** Usage from Settings. */ int REASON_AUTH_SETTINGS = 6; public static final int REASON_AUTH_SETTINGS = 6; @IntDef({REASON_UNKNOWN, REASON_ENROLL_FIND_SENSOR, Loading @@ -49,5 +52,5 @@ public interface BiometricOverlayConstants { REASON_AUTH_OTHER, REASON_AUTH_SETTINGS}) @Retention(RetentionPolicy.SOURCE) @interface ShowReason {} public @interface RequestReason {} }
core/java/android/hardware/biometrics/IAuthService.aidl +7 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.hardware.biometrics; import android.hardware.biometrics.AuthenticationStateListener; import android.hardware.biometrics.IBiometricEnabledOnKeyguardCallback; import android.hardware.biometrics.IBiometricServiceReceiver; import android.hardware.biometrics.IInvalidationCallback; Loading Loading @@ -66,6 +67,12 @@ interface IAuthService { // Register callback for when keyguard biometric eligibility changes. void registerEnabledOnKeyguardCallback(IBiometricEnabledOnKeyguardCallback callback); // Register listener for changes to authentication state. void registerAuthenticationStateListener(AuthenticationStateListener listener); // Unregister listener for changes to authentication state. void unregisterAuthenticationStateListener(AuthenticationStateListener listener); // Requests all BIOMETRIC_STRONG sensors to have their authenticatorId invalidated for the // specified user. This happens when enrollments have been added on devices with multiple // biometric sensors. Loading
core/java/android/hardware/fingerprint/FingerprintManager.java +1 −0 Original line number Diff line number Diff line Loading @@ -983,6 +983,7 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing } } // TODO(b/288175061): remove with Flags.FLAG_SIDEFPS_CONTROLLER_REFACTOR /** * @hide */ Loading