Update BiometricManager constants
Fixes: 117822032
Test: atest BiometricManagerTest
Change-Id: I9a384a94138e188d870dc3f224f6c21b7de1b82c
diff --git a/api/current.txt b/api/current.txt
index 870c020..69b1ae9 100755
--- a/api/current.txt
+++ b/api/current.txt
@@ -16068,10 +16068,10 @@
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/api/system-current.txt b/api/system-current.txt
index 7e51082..27554e3 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -987,8 +987,8 @@
field public static final java.lang.String ACTION_PRE_BOOT_COMPLETED = "android.intent.action.PRE_BOOT_COMPLETED";
field public static final java.lang.String ACTION_QUERY_PACKAGE_RESTART = "android.intent.action.QUERY_PACKAGE_RESTART";
field public static final java.lang.String ACTION_RESOLVE_INSTANT_APP_PACKAGE = "android.intent.action.RESOLVE_INSTANT_APP_PACKAGE";
- field public static final java.lang.String ACTION_REVIEW_PERMISSION_USAGE = "android.intent.action.REVIEW_PERMISSION_USAGE";
field public static final java.lang.String ACTION_REVIEW_PERMISSIONS = "android.intent.action.REVIEW_PERMISSIONS";
+ field public static final java.lang.String ACTION_REVIEW_PERMISSION_USAGE = "android.intent.action.REVIEW_PERMISSION_USAGE";
field public static final java.lang.String ACTION_SHOW_SUSPENDED_APP_DETAILS = "android.intent.action.SHOW_SUSPENDED_APP_DETAILS";
field public static final deprecated java.lang.String ACTION_SIM_STATE_CHANGED = "android.intent.action.SIM_STATE_CHANGED";
field public static final java.lang.String ACTION_SPLIT_CONFIGURATION_CHANGED = "android.intent.action.SPLIT_CONFIGURATION_CHANGED";
diff --git a/core/java/android/hardware/biometrics/BiometricConstants.java b/core/java/android/hardware/biometrics/BiometricConstants.java
index 2a64c2e..c814b7c 100644
--- a/core/java/android/hardware/biometrics/BiometricConstants.java
+++ b/core/java/android/hardware/biometrics/BiometricConstants.java
@@ -38,7 +38,7 @@
* 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 1d40001..fe00604 100644
--- a/core/java/android/hardware/biometrics/BiometricManager.java
+++ b/core/java/android/hardware/biometrics/BiometricManager.java
@@ -35,24 +35,31 @@
/**
* 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 @@
* 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 @@
}
} 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 b80dca6..278c55f 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 @@
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 @@
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) {