Loading core/java/android/hardware/biometrics/BiometricAuthenticator.java +10 −3 Original line number Diff line number Diff line Loading @@ -36,23 +36,30 @@ public interface BiometricAuthenticator { * @hide */ int TYPE_NONE = 0; /** * Constant representing credential (PIN, pattern, or password). * @hide */ int TYPE_CREDENTIAL = 1 << 0; /** * Constant representing fingerprint. * @hide */ int TYPE_FINGERPRINT = 1 << 0; int TYPE_FINGERPRINT = 1 << 1; /** * Constant representing iris. * @hide */ int TYPE_IRIS = 1 << 1; int TYPE_IRIS = 1 << 2; /** * Constant representing face. * @hide */ int TYPE_FACE = 1 << 2; int TYPE_FACE = 1 << 3; /** * Container for biometric data Loading core/java/android/hardware/biometrics/BiometricConstants.java +7 −0 Original line number Diff line number Diff line Loading @@ -133,6 +133,13 @@ public interface BiometricConstants { */ int BIOMETRIC_ERROR_NO_DEVICE_CREDENTIAL = 14; /** * This constant is only used by SystemUI. It notifies SystemUI that authentication was paused * because the authentication attempt was unsuccessful. * @hide */ int BIOMETRIC_PAUSED_REJECTED = 100; /** * @hide */ Loading core/java/android/hardware/biometrics/BiometricManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -137,7 +137,7 @@ public class BiometricManager { public boolean hasEnrolledBiometrics(int userId) { if (mService != null) { try { return mService.hasEnrolledBiometrics(userId); return mService.hasEnrolledBiometrics(userId, mContext.getOpPackageName()); } catch (RemoteException e) { Slog.w(TAG, "Remote exception in hasEnrolledBiometrics(): " + e); return false; Loading core/java/android/hardware/biometrics/BiometricPrompt.java +18 −2 Original line number Diff line number Diff line Loading @@ -26,6 +26,8 @@ import android.annotation.RequiresPermission; import android.app.KeyguardManager; import android.content.Context; import android.content.DialogInterface; import android.hardware.face.FaceManager; import android.hardware.fingerprint.FingerprintManager; import android.os.Binder; import android.os.Bundle; import android.os.CancellationSignal; Loading Loading @@ -339,9 +341,23 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan } @Override public void onError(int error, String message) throws RemoteException { public void onError(int modality, int error, int vendorCode) throws RemoteException { mExecutor.execute(() -> { mAuthenticationCallback.onAuthenticationError(error, message); String errorMessage; switch (modality) { case TYPE_FACE: errorMessage = FaceManager.getErrorString(mContext, error, vendorCode); break; case TYPE_FINGERPRINT: errorMessage = FingerprintManager.getErrorString(mContext, error, vendorCode); break; default: errorMessage = ""; } mAuthenticationCallback.onAuthenticationError(error, errorMessage); }); } Loading core/java/android/hardware/biometrics/IBiometricAuthenticator.aidl 0 → 100644 +58 −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.hardware.biometrics.IBiometricServiceReceiverInternal; import android.hardware.biometrics.IBiometricServiceLockoutResetCallback; import android.hardware.face.IFaceServiceReceiver; import android.hardware.face.Face; /** * This interface encapsulates fingerprint, face, iris, etc. authenticators. * Implementations of this interface are meant to be registered with BiometricService. * @hide */ interface IBiometricAuthenticator { // This method prepares the service to start authenticating, but doesn't start authentication. // This is protected by the MANAGE_BIOMETRIC signature permission. This method should only be // called from BiometricService. The additional uid, pid, userId arguments should be determined // by BiometricService. To start authentication after the clients are ready, use // startPreparedClient(). void prepareForAuthentication(boolean requireConfirmation, IBinder token, long sessionId, int userId, IBiometricServiceReceiverInternal wrapperReceiver, String opPackageName, int cookie, int callingUid, int callingPid, int callingUserId); // Starts authentication with the previously prepared client. void startPreparedClient(int cookie); // Same as above, with extra arguments. void cancelAuthenticationFromService(IBinder token, String opPackageName, int callingUid, int callingPid, int callingUserId, boolean fromClient); // Determine if HAL is loaded and ready boolean isHardwareDetected(String opPackageName); // Determine if a user has at least one enrolled face boolean hasEnrolledTemplates(int userId, String opPackageName); // Reset the lockout when user authenticates with strong auth (e.g. PIN, pattern or password) void resetLockout(in byte [] token); // Explicitly set the active user (for enrolling work profile) void setActiveUser(int uid); } Loading
core/java/android/hardware/biometrics/BiometricAuthenticator.java +10 −3 Original line number Diff line number Diff line Loading @@ -36,23 +36,30 @@ public interface BiometricAuthenticator { * @hide */ int TYPE_NONE = 0; /** * Constant representing credential (PIN, pattern, or password). * @hide */ int TYPE_CREDENTIAL = 1 << 0; /** * Constant representing fingerprint. * @hide */ int TYPE_FINGERPRINT = 1 << 0; int TYPE_FINGERPRINT = 1 << 1; /** * Constant representing iris. * @hide */ int TYPE_IRIS = 1 << 1; int TYPE_IRIS = 1 << 2; /** * Constant representing face. * @hide */ int TYPE_FACE = 1 << 2; int TYPE_FACE = 1 << 3; /** * Container for biometric data Loading
core/java/android/hardware/biometrics/BiometricConstants.java +7 −0 Original line number Diff line number Diff line Loading @@ -133,6 +133,13 @@ public interface BiometricConstants { */ int BIOMETRIC_ERROR_NO_DEVICE_CREDENTIAL = 14; /** * This constant is only used by SystemUI. It notifies SystemUI that authentication was paused * because the authentication attempt was unsuccessful. * @hide */ int BIOMETRIC_PAUSED_REJECTED = 100; /** * @hide */ Loading
core/java/android/hardware/biometrics/BiometricManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -137,7 +137,7 @@ public class BiometricManager { public boolean hasEnrolledBiometrics(int userId) { if (mService != null) { try { return mService.hasEnrolledBiometrics(userId); return mService.hasEnrolledBiometrics(userId, mContext.getOpPackageName()); } catch (RemoteException e) { Slog.w(TAG, "Remote exception in hasEnrolledBiometrics(): " + e); return false; Loading
core/java/android/hardware/biometrics/BiometricPrompt.java +18 −2 Original line number Diff line number Diff line Loading @@ -26,6 +26,8 @@ import android.annotation.RequiresPermission; import android.app.KeyguardManager; import android.content.Context; import android.content.DialogInterface; import android.hardware.face.FaceManager; import android.hardware.fingerprint.FingerprintManager; import android.os.Binder; import android.os.Bundle; import android.os.CancellationSignal; Loading Loading @@ -339,9 +341,23 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan } @Override public void onError(int error, String message) throws RemoteException { public void onError(int modality, int error, int vendorCode) throws RemoteException { mExecutor.execute(() -> { mAuthenticationCallback.onAuthenticationError(error, message); String errorMessage; switch (modality) { case TYPE_FACE: errorMessage = FaceManager.getErrorString(mContext, error, vendorCode); break; case TYPE_FINGERPRINT: errorMessage = FingerprintManager.getErrorString(mContext, error, vendorCode); break; default: errorMessage = ""; } mAuthenticationCallback.onAuthenticationError(error, errorMessage); }); } Loading
core/java/android/hardware/biometrics/IBiometricAuthenticator.aidl 0 → 100644 +58 −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.hardware.biometrics.IBiometricServiceReceiverInternal; import android.hardware.biometrics.IBiometricServiceLockoutResetCallback; import android.hardware.face.IFaceServiceReceiver; import android.hardware.face.Face; /** * This interface encapsulates fingerprint, face, iris, etc. authenticators. * Implementations of this interface are meant to be registered with BiometricService. * @hide */ interface IBiometricAuthenticator { // This method prepares the service to start authenticating, but doesn't start authentication. // This is protected by the MANAGE_BIOMETRIC signature permission. This method should only be // called from BiometricService. The additional uid, pid, userId arguments should be determined // by BiometricService. To start authentication after the clients are ready, use // startPreparedClient(). void prepareForAuthentication(boolean requireConfirmation, IBinder token, long sessionId, int userId, IBiometricServiceReceiverInternal wrapperReceiver, String opPackageName, int cookie, int callingUid, int callingPid, int callingUserId); // Starts authentication with the previously prepared client. void startPreparedClient(int cookie); // Same as above, with extra arguments. void cancelAuthenticationFromService(IBinder token, String opPackageName, int callingUid, int callingPid, int callingUserId, boolean fromClient); // Determine if HAL is loaded and ready boolean isHardwareDetected(String opPackageName); // Determine if a user has at least one enrolled face boolean hasEnrolledTemplates(int userId, String opPackageName); // Reset the lockout when user authenticates with strong auth (e.g. PIN, pattern or password) void resetLockout(in byte [] token); // Explicitly set the active user (for enrolling work profile) void setActiveUser(int uid); }