Loading core/java/android/app/SystemServiceRegistry.java +4 −4 Original line number Diff line number Diff line Loading @@ -68,7 +68,7 @@ import android.hardware.SensorPrivacyManager; import android.hardware.SerialManager; import android.hardware.SystemSensorManager; import android.hardware.biometrics.BiometricManager; import android.hardware.biometrics.IBiometricService; import android.hardware.biometrics.IAuthService; import android.hardware.camera2.CameraManager; import android.hardware.display.ColorDisplayManager; import android.hardware.display.DisplayManager; Loading Loading @@ -947,9 +947,9 @@ public final class SystemServiceRegistry { throws ServiceNotFoundException { if (BiometricManager.hasBiometrics(ctx)) { final IBinder binder = ServiceManager.getServiceOrThrow(Context.BIOMETRIC_SERVICE); final IBiometricService service = IBiometricService.Stub.asInterface(binder); ServiceManager.getServiceOrThrow(Context.AUTH_SERVICE); final IAuthService service = IAuthService.Stub.asInterface(binder); return new BiometricManager(ctx.getOuterContext(), service); } else { // Allow access to the manager when service is null. This saves memory Loading core/java/android/content/Context.java +28 −2 Original line number Diff line number Diff line Loading @@ -3289,6 +3289,7 @@ public abstract class Context { WIFI_RTT_RANGING_SERVICE, NSD_SERVICE, AUDIO_SERVICE, AUTH_SERVICE, FINGERPRINT_SERVICE, //@hide: FACE_SERVICE, BIOMETRIC_SERVICE, Loading Loading @@ -4006,6 +4007,31 @@ public abstract class Context { */ public static final String AUDIO_SERVICE = "audio"; /** * AuthService orchestrates biometric and PIN/pattern/password authentication. * * BiometricService was split into two services, AuthService and BiometricService, where * AuthService is the high level service that orchestrates all types of authentication, and * BiometricService is a lower layer responsible only for biometric authentication. * * Ideally we should have renamed BiometricManager to AuthManager, because it logically * corresponds to AuthService. However, because BiometricManager is a public API, we kept * the old name but changed the internal implementation to use AuthService. * * As of now, the AUTH_SERVICE constant is only used to identify the service in * SystemServiceRegistry and SELinux. To obtain the manager for AUTH_SERVICE, one should use * BIOMETRIC_SERVICE with {@link #getSystemService(String)} to retrieve a * {@link android.hardware.biometrics.BiometricManager} * * Map of the two services and their managers: * [Service] [Manager] * AuthService BiometricManager * BiometricService N/A * * @hide */ public static final String AUTH_SERVICE = "auth"; /** * Use with {@link #getSystemService(String)} to retrieve a * {@link android.hardware.fingerprint.FingerprintManager} for handling management Loading Loading @@ -4040,8 +4066,8 @@ public abstract class Context { /** * Use with {@link #getSystemService(String)} to retrieve a * {@link android.hardware.biometrics.BiometricManager} for handling management * of face authentication. * {@link android.hardware.biometrics.BiometricManager} for handling * biometric and PIN/pattern/password authentication. * * @see #getSystemService * @see android.hardware.biometrics.BiometricManager Loading core/java/android/hardware/biometrics/BiometricManager.java +2 −2 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ public class BiometricManager { @interface BiometricError {} private final Context mContext; private final IBiometricService mService; private final IAuthService mService; private final boolean mHasHardware; /** Loading @@ -86,7 +86,7 @@ public class BiometricManager { * @param context * @param service */ public BiometricManager(Context context, IBiometricService service) { public BiometricManager(Context context, IAuthService service) { mContext = context; mService = service; Loading core/java/android/hardware/biometrics/IAuthService.aidl 0 → 100644 +51 −0 Original line number Diff line number Diff line /* * Copyright (C) 2019 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; import android.os.Bundle; import android.hardware.biometrics.IBiometricEnabledOnKeyguardCallback; import android.hardware.biometrics.IBiometricServiceReceiver; /** * Communication channel from BiometricPrompt and BiometricManager to AuthService. The * interface does not expose specific biometric modalities. The system will use the default * biometric for apps. On devices with more than one, the choice is dictated by user preference in * Settings. * @hide */ interface IAuthService { // Requests authentication. The service choose the appropriate biometric to use, and show // the corresponding BiometricDialog. void authenticate(IBinder token, long sessionId, int userId, IBiometricServiceReceiver receiver, String opPackageName, in Bundle bundle); // TODO(b/141025588): Make userId the first arg to be consistent with hasEnrolledBiometrics. // Checks if biometrics can be used. int canAuthenticate(String opPackageName, int userId); // Checks if any biometrics are enrolled. boolean hasEnrolledBiometrics(int userId, String opPackageName); // Register callback for when keyguard biometric eligibility changes. void registerEnabledOnKeyguardCallback(IBiometricEnabledOnKeyguardCallback callback); // Explicitly set the active user. void setActiveUser(int userId); // Reset the lockout when user authenticates with strong auth (e.g. PIN, pattern or password) void resetLockout(in byte [] token); } core/java/android/hardware/biometrics/IBiometricService.aidl +1 −4 Original line number Diff line number Diff line Loading @@ -22,10 +22,7 @@ import android.hardware.biometrics.IBiometricServiceReceiver; import android.hardware.biometrics.IBiometricAuthenticator; /** * Communication channel from BiometricPrompt and BiometricManager to BiometricService. The * interface does not expose specific biometric modalities. The system will use the default * biometric for apps. On devices with more than one, the choice is dictated by user preference in * Settings. * Communication channel from AuthService to BiometricService. * @hide */ interface IBiometricService { Loading Loading
core/java/android/app/SystemServiceRegistry.java +4 −4 Original line number Diff line number Diff line Loading @@ -68,7 +68,7 @@ import android.hardware.SensorPrivacyManager; import android.hardware.SerialManager; import android.hardware.SystemSensorManager; import android.hardware.biometrics.BiometricManager; import android.hardware.biometrics.IBiometricService; import android.hardware.biometrics.IAuthService; import android.hardware.camera2.CameraManager; import android.hardware.display.ColorDisplayManager; import android.hardware.display.DisplayManager; Loading Loading @@ -947,9 +947,9 @@ public final class SystemServiceRegistry { throws ServiceNotFoundException { if (BiometricManager.hasBiometrics(ctx)) { final IBinder binder = ServiceManager.getServiceOrThrow(Context.BIOMETRIC_SERVICE); final IBiometricService service = IBiometricService.Stub.asInterface(binder); ServiceManager.getServiceOrThrow(Context.AUTH_SERVICE); final IAuthService service = IAuthService.Stub.asInterface(binder); return new BiometricManager(ctx.getOuterContext(), service); } else { // Allow access to the manager when service is null. This saves memory Loading
core/java/android/content/Context.java +28 −2 Original line number Diff line number Diff line Loading @@ -3289,6 +3289,7 @@ public abstract class Context { WIFI_RTT_RANGING_SERVICE, NSD_SERVICE, AUDIO_SERVICE, AUTH_SERVICE, FINGERPRINT_SERVICE, //@hide: FACE_SERVICE, BIOMETRIC_SERVICE, Loading Loading @@ -4006,6 +4007,31 @@ public abstract class Context { */ public static final String AUDIO_SERVICE = "audio"; /** * AuthService orchestrates biometric and PIN/pattern/password authentication. * * BiometricService was split into two services, AuthService and BiometricService, where * AuthService is the high level service that orchestrates all types of authentication, and * BiometricService is a lower layer responsible only for biometric authentication. * * Ideally we should have renamed BiometricManager to AuthManager, because it logically * corresponds to AuthService. However, because BiometricManager is a public API, we kept * the old name but changed the internal implementation to use AuthService. * * As of now, the AUTH_SERVICE constant is only used to identify the service in * SystemServiceRegistry and SELinux. To obtain the manager for AUTH_SERVICE, one should use * BIOMETRIC_SERVICE with {@link #getSystemService(String)} to retrieve a * {@link android.hardware.biometrics.BiometricManager} * * Map of the two services and their managers: * [Service] [Manager] * AuthService BiometricManager * BiometricService N/A * * @hide */ public static final String AUTH_SERVICE = "auth"; /** * Use with {@link #getSystemService(String)} to retrieve a * {@link android.hardware.fingerprint.FingerprintManager} for handling management Loading Loading @@ -4040,8 +4066,8 @@ public abstract class Context { /** * Use with {@link #getSystemService(String)} to retrieve a * {@link android.hardware.biometrics.BiometricManager} for handling management * of face authentication. * {@link android.hardware.biometrics.BiometricManager} for handling * biometric and PIN/pattern/password authentication. * * @see #getSystemService * @see android.hardware.biometrics.BiometricManager Loading
core/java/android/hardware/biometrics/BiometricManager.java +2 −2 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ public class BiometricManager { @interface BiometricError {} private final Context mContext; private final IBiometricService mService; private final IAuthService mService; private final boolean mHasHardware; /** Loading @@ -86,7 +86,7 @@ public class BiometricManager { * @param context * @param service */ public BiometricManager(Context context, IBiometricService service) { public BiometricManager(Context context, IAuthService service) { mContext = context; mService = service; Loading
core/java/android/hardware/biometrics/IAuthService.aidl 0 → 100644 +51 −0 Original line number Diff line number Diff line /* * Copyright (C) 2019 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; import android.os.Bundle; import android.hardware.biometrics.IBiometricEnabledOnKeyguardCallback; import android.hardware.biometrics.IBiometricServiceReceiver; /** * Communication channel from BiometricPrompt and BiometricManager to AuthService. The * interface does not expose specific biometric modalities. The system will use the default * biometric for apps. On devices with more than one, the choice is dictated by user preference in * Settings. * @hide */ interface IAuthService { // Requests authentication. The service choose the appropriate biometric to use, and show // the corresponding BiometricDialog. void authenticate(IBinder token, long sessionId, int userId, IBiometricServiceReceiver receiver, String opPackageName, in Bundle bundle); // TODO(b/141025588): Make userId the first arg to be consistent with hasEnrolledBiometrics. // Checks if biometrics can be used. int canAuthenticate(String opPackageName, int userId); // Checks if any biometrics are enrolled. boolean hasEnrolledBiometrics(int userId, String opPackageName); // Register callback for when keyguard biometric eligibility changes. void registerEnabledOnKeyguardCallback(IBiometricEnabledOnKeyguardCallback callback); // Explicitly set the active user. void setActiveUser(int userId); // Reset the lockout when user authenticates with strong auth (e.g. PIN, pattern or password) void resetLockout(in byte [] token); }
core/java/android/hardware/biometrics/IBiometricService.aidl +1 −4 Original line number Diff line number Diff line Loading @@ -22,10 +22,7 @@ import android.hardware.biometrics.IBiometricServiceReceiver; import android.hardware.biometrics.IBiometricAuthenticator; /** * Communication channel from BiometricPrompt and BiometricManager to BiometricService. The * interface does not expose specific biometric modalities. The system will use the default * biometric for apps. On devices with more than one, the choice is dictated by user preference in * Settings. * Communication channel from AuthService to BiometricService. * @hide */ interface IBiometricService { Loading