diff options
6 files changed, 70 insertions, 12 deletions
diff --git a/api/test-current.txt b/api/test-current.txt index b69ba9386ef0..a165af789c95 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -688,8 +688,8 @@ package android.hardware.biometrics { method @RequiresPermission(android.Manifest.permission.TEST_BIOMETRIC) public void cleanupInternalState(int); method @RequiresPermission(android.Manifest.permission.TEST_BIOMETRIC) public void close(); method @RequiresPermission(android.Manifest.permission.TEST_BIOMETRIC) public void finishEnroll(int); - method @RequiresPermission(android.Manifest.permission.TEST_BIOMETRIC) public void notifyAcquired(int); - method @RequiresPermission(android.Manifest.permission.TEST_BIOMETRIC) public void notifyError(int); + method @RequiresPermission(android.Manifest.permission.TEST_BIOMETRIC) public void notifyAcquired(int, int); + method @RequiresPermission(android.Manifest.permission.TEST_BIOMETRIC) public void notifyError(int, int); method @RequiresPermission(android.Manifest.permission.TEST_BIOMETRIC) public void rejectAuthentication(int); method @RequiresPermission(android.Manifest.permission.TEST_BIOMETRIC) public void startEnroll(int); } diff --git a/core/java/android/hardware/biometrics/BiometricConstants.java b/core/java/android/hardware/biometrics/BiometricConstants.java index 3040932f69dd..bed9a0640693 100644 --- a/core/java/android/hardware/biometrics/BiometricConstants.java +++ b/core/java/android/hardware/biometrics/BiometricConstants.java @@ -172,8 +172,7 @@ public interface BiometricConstants { BIOMETRIC_ERROR_NEGATIVE_BUTTON, BIOMETRIC_ERROR_NO_DEVICE_CREDENTIAL, BIOMETRIC_ERROR_SECURITY_UPDATE_REQUIRED, - BIOMETRIC_PAUSED_REJECTED, - BIOMETRIC_ERROR_VENDOR_BASE}) + BIOMETRIC_PAUSED_REJECTED}) @Retention(RetentionPolicy.SOURCE) @interface Errors {} @@ -182,6 +181,19 @@ public interface BiometricConstants { // /** + * @hide + */ + @IntDef({BIOMETRIC_ACQUIRED_GOOD, + BIOMETRIC_ACQUIRED_PARTIAL, + BIOMETRIC_ACQUIRED_INSUFFICIENT, + BIOMETRIC_ACQUIRED_IMAGER_DIRTY, + BIOMETRIC_ACQUIRED_TOO_SLOW, + BIOMETRIC_ACQUIRED_TOO_FAST, + BIOMETRIC_ACQUIRED_VENDOR}) + @Retention(RetentionPolicy.SOURCE) + @interface Acquired {} + + /** * The image acquired was good. */ int BIOMETRIC_ACQUIRED_GOOD = 0; diff --git a/core/java/android/hardware/biometrics/BiometricFingerprintConstants.java b/core/java/android/hardware/biometrics/BiometricFingerprintConstants.java index 46e8cc036809..c7b554b3aafc 100644 --- a/core/java/android/hardware/biometrics/BiometricFingerprintConstants.java +++ b/core/java/android/hardware/biometrics/BiometricFingerprintConstants.java @@ -16,11 +16,15 @@ package android.hardware.biometrics; +import android.annotation.IntDef; import android.app.KeyguardManager; import android.compat.annotation.UnsupportedAppUsage; import android.hardware.biometrics.BiometricManager.Authenticators; import android.hardware.fingerprint.FingerprintManager; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + /** * Interface containing all of the fingerprint-specific constants. * @@ -36,6 +40,27 @@ public interface BiometricFingerprintConstants { // /** + * @hide + */ + @IntDef({FINGERPRINT_ERROR_HW_UNAVAILABLE, + FINGERPRINT_ERROR_UNABLE_TO_PROCESS, + FINGERPRINT_ERROR_TIMEOUT, + FINGERPRINT_ERROR_NO_SPACE, + FINGERPRINT_ERROR_CANCELED, + FINGERPRINT_ERROR_UNABLE_TO_REMOVE, + FINGERPRINT_ERROR_LOCKOUT, + FINGERPRINT_ERROR_VENDOR, + FINGERPRINT_ERROR_LOCKOUT_PERMANENT, + FINGERPRINT_ERROR_USER_CANCELED, + FINGERPRINT_ERROR_NO_FINGERPRINTS, + FINGERPRINT_ERROR_HW_NOT_PRESENT, + FINGERPRINT_ERROR_NEGATIVE_BUTTON, + BIOMETRIC_ERROR_NO_DEVICE_CREDENTIAL, + BIOMETRIC_ERROR_SECURITY_UPDATE_REQUIRED}) + @Retention(RetentionPolicy.SOURCE) + @interface FingerprintError {} + + /** * The hardware is unavailable. Try again later. */ int FINGERPRINT_ERROR_HW_UNAVAILABLE = 1; @@ -150,6 +175,20 @@ public interface BiometricFingerprintConstants { // /** + * @hide + */ + @IntDef({FINGERPRINT_ACQUIRED_GOOD, + FINGERPRINT_ACQUIRED_PARTIAL, + FINGERPRINT_ACQUIRED_INSUFFICIENT, + FINGERPRINT_ACQUIRED_IMAGER_DIRTY, + FINGERPRINT_ACQUIRED_TOO_SLOW, + FINGERPRINT_ACQUIRED_TOO_FAST, + FINGERPRINT_ACQUIRED_VENDOR, + FINGERPRINT_ACQUIRED_START}) + @Retention(RetentionPolicy.SOURCE) + @interface FingerprintAcquired {} + + /** * The image acquired was good. */ int FINGERPRINT_ACQUIRED_GOOD = 0; diff --git a/core/java/android/hardware/biometrics/BiometricTestSession.java b/core/java/android/hardware/biometrics/BiometricTestSession.java index 4c7aa27968fe..802655b0d364 100644 --- a/core/java/android/hardware/biometrics/BiometricTestSession.java +++ b/core/java/android/hardware/biometrics/BiometricTestSession.java @@ -22,6 +22,7 @@ import android.annotation.NonNull; import android.annotation.RequiresPermission; import android.annotation.TestApi; import android.content.Context; +import android.hardware.fingerprint.FingerprintManager; import android.os.RemoteException; import android.util.ArraySet; @@ -128,11 +129,14 @@ public class BiometricTestSession implements AutoCloseable { * Simulates an acquired message from the HAL. * * @param userId User that this command applies to. + * @param acquireInfo See + * {@link BiometricPrompt.AuthenticationCallback#onAuthenticationAcquired(int)} and + * {@link FingerprintManager.AuthenticationCallback#onAuthenticationAcquired(int)} */ @RequiresPermission(TEST_BIOMETRIC) - public void notifyAcquired(int userId) { + public void notifyAcquired(int userId, int acquireInfo) { try { - mTestSession.notifyAcquired(userId); + mTestSession.notifyAcquired(userId, acquireInfo); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -142,11 +146,14 @@ public class BiometricTestSession implements AutoCloseable { * Simulates an error message from the HAL. * * @param userId User that this command applies to. + * @param errorCode See + * {@link BiometricPrompt.AuthenticationCallback#onAuthenticationError(int, CharSequence)} and + * {@link FingerprintManager.AuthenticationCallback#onAuthenticationError(int, CharSequence)} */ @RequiresPermission(TEST_BIOMETRIC) - public void notifyError(int userId) { + public void notifyError(int userId, int errorCode) { try { - mTestSession.notifyError(userId); + mTestSession.notifyError(userId, errorCode); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } diff --git a/core/java/android/hardware/biometrics/ITestSession.aidl b/core/java/android/hardware/biometrics/ITestSession.aidl index 5677f6517ae5..6112f17949d7 100644 --- a/core/java/android/hardware/biometrics/ITestSession.aidl +++ b/core/java/android/hardware/biometrics/ITestSession.aidl @@ -42,10 +42,10 @@ interface ITestSession { void rejectAuthentication(int userId); // Simulates an acquired message from the HAL. - void notifyAcquired(int userId); + void notifyAcquired(int userId, int acquireInfo); // Simulates an error message from the HAL. - void notifyError(int userId); + void notifyError(int userId, int errorCode); // Matches the framework's cached enrollments against the HAL's enrollments. Any enrollment // that isn't known by both sides are deleted. This should generally be used when the test 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 1f71d7809133..5dcadee20e13 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 @@ -127,12 +127,12 @@ public class FingerprintService extends SystemService { } @Override - public void notifyAcquired(int userId) { + public void notifyAcquired(int userId, int acquireInfo) { Utils.checkPermission(getContext(), TEST_BIOMETRIC); } @Override - public void notifyError(int userId) { + public void notifyError(int userId, int errorCode) { Utils.checkPermission(getContext(), TEST_BIOMETRIC); } |