summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/hardware/biometrics/BiometricManager.java27
-rw-r--r--core/java/android/hardware/biometrics/BiometricPrompt.java23
-rw-r--r--core/java/android/hardware/fingerprint/FingerprintManager.java21
3 files changed, 65 insertions, 6 deletions
diff --git a/core/java/android/hardware/biometrics/BiometricManager.java b/core/java/android/hardware/biometrics/BiometricManager.java
index 0dbd9e4c83ac..d054ee207110 100644
--- a/core/java/android/hardware/biometrics/BiometricManager.java
+++ b/core/java/android/hardware/biometrics/BiometricManager.java
@@ -21,6 +21,8 @@ import static android.Manifest.permission.USE_BIOMETRIC;
import static android.Manifest.permission.USE_BIOMETRIC_INTERNAL;
import static android.Manifest.permission.WRITE_DEVICE_CONFIG;
+import static com.android.internal.util.FrameworkStatsLog.AUTH_DEPRECATED_APIUSED__DEPRECATED_API__API_BIOMETRIC_MANAGER_CAN_AUTHENTICATE;
+
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -34,6 +36,8 @@ import android.os.RemoteException;
import android.security.keystore.KeyProperties;
import android.util.Slog;
+import com.android.internal.util.FrameworkStatsLog;
+
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
@@ -405,7 +409,17 @@ public class BiometricManager {
@RequiresPermission(USE_BIOMETRIC)
@BiometricError
public int canAuthenticate() {
- return canAuthenticate(Authenticators.BIOMETRIC_WEAK);
+ @BiometricError final int result = canAuthenticate(mContext.getUserId(),
+ Authenticators.BIOMETRIC_WEAK);
+
+ FrameworkStatsLog.write(FrameworkStatsLog.AUTH_MANAGER_CAN_AUTHENTICATE_INVOKED,
+ false /* isAllowedAuthenticatorsSet */, Authenticators.EMPTY_SET, result);
+ FrameworkStatsLog.write(FrameworkStatsLog.AUTH_DEPRECATED_API_USED,
+ AUTH_DEPRECATED_APIUSED__DEPRECATED_API__API_BIOMETRIC_MANAGER_CAN_AUTHENTICATE,
+ mContext.getApplicationInfo().uid,
+ mContext.getApplicationInfo().targetSdkVersion);
+
+ return result;
}
/**
@@ -436,7 +450,12 @@ public class BiometricManager {
@RequiresPermission(USE_BIOMETRIC)
@BiometricError
public int canAuthenticate(@Authenticators.Types int authenticators) {
- return canAuthenticate(mContext.getUserId(), authenticators);
+ @BiometricError final int result = canAuthenticate(mContext.getUserId(), authenticators);
+
+ FrameworkStatsLog.write(FrameworkStatsLog.AUTH_MANAGER_CAN_AUTHENTICATE_INVOKED,
+ true /* isAllowedAuthenticatorsSet */, authenticators, result);
+
+ return result;
}
/**
@@ -444,9 +463,7 @@ public class BiometricManager {
*/
@RequiresPermission(USE_BIOMETRIC_INTERNAL)
@BiometricError
- public int canAuthenticate(
- int userId, @Authenticators.Types int authenticators) {
-
+ public int canAuthenticate(int userId, @Authenticators.Types int authenticators) {
if (mService != null) {
try {
final String opPackageName = mContext.getOpPackageName();
diff --git a/core/java/android/hardware/biometrics/BiometricPrompt.java b/core/java/android/hardware/biometrics/BiometricPrompt.java
index 2e51dc4427fe..3f3db29ed0fd 100644
--- a/core/java/android/hardware/biometrics/BiometricPrompt.java
+++ b/core/java/android/hardware/biometrics/BiometricPrompt.java
@@ -43,6 +43,7 @@ import android.text.TextUtils;
import android.util.Log;
import com.android.internal.R;
+import com.android.internal.util.FrameworkStatsLog;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -422,7 +423,7 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan
final boolean deviceCredentialAllowed = mPromptInfo.isDeviceCredentialAllowed();
final @Authenticators.Types int authenticators = mPromptInfo.getAuthenticators();
final boolean willShowDeviceCredentialButton = deviceCredentialAllowed
- || (authenticators & Authenticators.DEVICE_CREDENTIAL) != 0;
+ || isCredentialAllowed(authenticators);
if (TextUtils.isEmpty(title) && !useDefaultTitle) {
throw new IllegalArgumentException("Title must be set and non-empty");
@@ -916,6 +917,14 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan
@NonNull CancellationSignal cancel,
@NonNull @CallbackExecutor Executor executor,
@NonNull AuthenticationCallback callback) {
+
+ FrameworkStatsLog.write(FrameworkStatsLog.AUTH_PROMPT_AUTHENTICATE_INVOKED,
+ true /* isCrypto */,
+ mPromptInfo.isConfirmationRequested(),
+ mPromptInfo.isDeviceCredentialAllowed(),
+ mPromptInfo.getAuthenticators() != Authenticators.EMPTY_SET,
+ mPromptInfo.getAuthenticators());
+
if (crypto == null) {
throw new IllegalArgumentException("Must supply a crypto object");
}
@@ -973,6 +982,14 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan
public void authenticate(@NonNull CancellationSignal cancel,
@NonNull @CallbackExecutor Executor executor,
@NonNull AuthenticationCallback callback) {
+
+ FrameworkStatsLog.write(FrameworkStatsLog.AUTH_PROMPT_AUTHENTICATE_INVOKED,
+ false /* isCrypto */,
+ mPromptInfo.isConfirmationRequested(),
+ mPromptInfo.isDeviceCredentialAllowed(),
+ mPromptInfo.getAuthenticators() != Authenticators.EMPTY_SET,
+ mPromptInfo.getAuthenticators());
+
if (cancel == null) {
throw new IllegalArgumentException("Must supply a cancellation signal");
}
@@ -1058,4 +1075,8 @@ public class BiometricPrompt implements BiometricAuthenticator, BiometricConstan
mContext.getString(R.string.biometric_error_hw_unavailable)));
}
}
+
+ private static boolean isCredentialAllowed(@Authenticators.Types int allowedAuthenticators) {
+ return (allowedAuthenticators & Authenticators.DEVICE_CREDENTIAL) != 0;
+ }
}
diff --git a/core/java/android/hardware/fingerprint/FingerprintManager.java b/core/java/android/hardware/fingerprint/FingerprintManager.java
index ab9e0dffc428..6a0772db34d2 100644
--- a/core/java/android/hardware/fingerprint/FingerprintManager.java
+++ b/core/java/android/hardware/fingerprint/FingerprintManager.java
@@ -24,6 +24,10 @@ import static android.Manifest.permission.USE_BIOMETRIC;
import static android.Manifest.permission.USE_BIOMETRIC_INTERNAL;
import static android.Manifest.permission.USE_FINGERPRINT;
+import static com.android.internal.util.FrameworkStatsLog.AUTH_DEPRECATED_APIUSED__DEPRECATED_API__API_FINGERPRINT_MANAGER_AUTHENTICATE;
+import static com.android.internal.util.FrameworkStatsLog.AUTH_DEPRECATED_APIUSED__DEPRECATED_API__API_FINGERPRINT_MANAGER_HAS_ENROLLED_FINGERPRINTS;
+import static com.android.internal.util.FrameworkStatsLog.AUTH_DEPRECATED_APIUSED__DEPRECATED_API__API_FINGERPRINT_MANAGER_IS_HARDWARE_DETECTED;
+
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -56,6 +60,8 @@ import android.security.identity.IdentityCredential;
import android.util.Slog;
import android.view.Surface;
+import com.android.internal.util.FrameworkStatsLog;
+
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.security.Signature;
@@ -534,6 +540,11 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
public void authenticate(@Nullable CryptoObject crypto, @Nullable CancellationSignal cancel,
@NonNull AuthenticationCallback callback, Handler handler, int sensorId, int userId) {
+ FrameworkStatsLog.write(FrameworkStatsLog.AUTH_DEPRECATED_API_USED,
+ AUTH_DEPRECATED_APIUSED__DEPRECATED_API__API_FINGERPRINT_MANAGER_AUTHENTICATE,
+ mContext.getApplicationInfo().uid,
+ mContext.getApplicationInfo().targetSdkVersion);
+
if (callback == null) {
throw new IllegalArgumentException("Must supply an authentication callback");
}
@@ -910,6 +921,11 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
@Deprecated
@RequiresPermission(USE_FINGERPRINT)
public boolean hasEnrolledFingerprints() {
+ FrameworkStatsLog.write(FrameworkStatsLog.AUTH_DEPRECATED_API_USED,
+ AUTH_DEPRECATED_APIUSED__DEPRECATED_API__API_FINGERPRINT_MANAGER_HAS_ENROLLED_FINGERPRINTS,
+ mContext.getApplicationInfo().uid,
+ mContext.getApplicationInfo().targetSdkVersion);
+
return hasEnrolledFingerprints(UserHandle.myUserId());
}
@@ -938,6 +954,11 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
@Deprecated
@RequiresPermission(USE_FINGERPRINT)
public boolean isHardwareDetected() {
+ FrameworkStatsLog.write(FrameworkStatsLog.AUTH_DEPRECATED_API_USED,
+ AUTH_DEPRECATED_APIUSED__DEPRECATED_API__API_FINGERPRINT_MANAGER_IS_HARDWARE_DETECTED,
+ mContext.getApplicationInfo().uid,
+ mContext.getApplicationInfo().targetSdkVersion);
+
if (mService != null) {
try {
return mService.isHardwareDetectedDeprecated(mContext.getOpPackageName());