diff --git a/api/current.txt b/api/current.txt index 5f399598689da..a275bfdd4335e 100755 --- a/api/current.txt +++ b/api/current.txt @@ -16074,10 +16074,10 @@ package android.hardware.biometrics { public class BiometricManager { method public int canAuthenticate(); - field public static final int ERROR_NONE = 0; // 0x0 - field public static final int ERROR_NO_BIOMETRICS = 11; // 0xb - field public static final int ERROR_NO_HARDWARE = 12; // 0xc - field public static final int ERROR_UNAVAILABLE = 1; // 0x1 + field public static final int BIOMETRIC_ERROR_NO_BIOMETRICS = 11; // 0xb + field public static final int BIOMETRIC_ERROR_NO_HARDWARE = 12; // 0xc + field public static final int BIOMETRIC_ERROR_UNAVAILABLE = 1; // 0x1 + field public static final int BIOMETRIC_SUCCESS = 0; // 0x0 } public class BiometricPrompt { diff --git a/core/java/android/hardware/biometrics/BiometricConstants.java b/core/java/android/hardware/biometrics/BiometricConstants.java index 2a64c2e1e0741..c814b7c67817c 100644 --- a/core/java/android/hardware/biometrics/BiometricConstants.java +++ b/core/java/android/hardware/biometrics/BiometricConstants.java @@ -38,7 +38,7 @@ public interface BiometricConstants { * BiometricManager. * @hide */ - int BIOMETRIC_ERROR_NONE = 0; + int BIOMETRIC_SUCCESS = 0; /** * The hardware is unavailable. Try again later. diff --git a/core/java/android/hardware/biometrics/BiometricManager.java b/core/java/android/hardware/biometrics/BiometricManager.java index 1d400018d60c0..fe006045bf0fb 100644 --- a/core/java/android/hardware/biometrics/BiometricManager.java +++ b/core/java/android/hardware/biometrics/BiometricManager.java @@ -35,24 +35,31 @@ public class BiometricManager { /** * No error detected. */ - public static final int ERROR_NONE = BiometricConstants.BIOMETRIC_ERROR_NONE; + public static final int BIOMETRIC_SUCCESS = + BiometricConstants.BIOMETRIC_SUCCESS; /** * The hardware is unavailable. Try again later. */ - public static final int ERROR_UNAVAILABLE = BiometricConstants.BIOMETRIC_ERROR_HW_UNAVAILABLE; + public static final int BIOMETRIC_ERROR_UNAVAILABLE = + BiometricConstants.BIOMETRIC_ERROR_HW_UNAVAILABLE; /** * The user does not have any biometrics enrolled. */ - public static final int ERROR_NO_BIOMETRICS = BiometricConstants.BIOMETRIC_ERROR_NO_BIOMETRICS; + public static final int BIOMETRIC_ERROR_NO_BIOMETRICS = + BiometricConstants.BIOMETRIC_ERROR_NO_BIOMETRICS; /** * There is no biometric hardware. */ - public static final int ERROR_NO_HARDWARE = BiometricConstants.BIOMETRIC_ERROR_HW_NOT_PRESENT; + public static final int BIOMETRIC_ERROR_NO_HARDWARE = + BiometricConstants.BIOMETRIC_ERROR_HW_NOT_PRESENT; - @IntDef({ERROR_NONE, ERROR_UNAVAILABLE, ERROR_NO_BIOMETRICS, ERROR_NO_HARDWARE}) + @IntDef({BIOMETRIC_SUCCESS, + BIOMETRIC_ERROR_UNAVAILABLE, + BIOMETRIC_ERROR_NO_BIOMETRICS, + BIOMETRIC_ERROR_NO_HARDWARE}) @interface BiometricError {} private final Context mContext; @@ -72,9 +79,10 @@ public class BiometricManager { * Determine if biometrics can be used. In other words, determine if {@link BiometricPrompt} * can be expected to be shown (hardware available, templates enrolled, user-enabled). * - * @return Returns {@link #ERROR_NO_BIOMETRICS} if the user does not have any enrolled, or - * {@link #ERROR_UNAVAILABLE} if none are currently supported/enabled. Returns - * {@link #ERROR_NONE} if a biometric can currently be used (enrolled and available). + * @return Returns {@link #BIOMETRIC_ERROR_NO_BIOMETRICS} if the user does not have any + * enrolled, or {@link #BIOMETRIC_ERROR_UNAVAILABLE} if none are currently + * supported/enabled. Returns {@link #BIOMETRIC_SUCCESS} if a biometric can currently be + * used (enrolled and available). */ @RequiresPermission(USE_BIOMETRIC) public @BiometricError int canAuthenticate() { @@ -86,7 +94,7 @@ public class BiometricManager { } } else { Slog.w(TAG, "hasEnrolledBiometrics(): Service not connected"); - return ERROR_UNAVAILABLE; + return BIOMETRIC_ERROR_UNAVAILABLE; } } diff --git a/services/core/java/com/android/server/biometrics/BiometricService.java b/services/core/java/com/android/server/biometrics/BiometricService.java index b80dca6019faa..278c55f74ebbb 100644 --- a/services/core/java/com/android/server/biometrics/BiometricService.java +++ b/services/core/java/com/android/server/biometrics/BiometricService.java @@ -272,7 +272,7 @@ public class BiometricService extends SystemService { final int error = result.second; // Check for errors, notify callback, and return - if (error != BiometricConstants.BIOMETRIC_ERROR_NONE) { + if (error != BiometricConstants.BIOMETRIC_SUCCESS) { try { final String hardwareUnavailable = getContext().getString(R.string.biometric_error_hw_unavailable); @@ -540,7 +540,7 @@ public class BiometricService extends SystemService { return new Pair<>(BIOMETRIC_NONE, BiometricConstants.BIOMETRIC_ERROR_HW_UNAVAILABLE); } - return new Pair<>(modality, BiometricConstants.BIOMETRIC_ERROR_NONE); + return new Pair<>(modality, BiometricConstants.BIOMETRIC_SUCCESS); } private boolean isEnabledForApp(int modality) {