summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/hardware/biometrics/BiometricManager.java19
-rw-r--r--core/java/android/hardware/biometrics/IBiometricService.aidl3
-rw-r--r--services/core/java/com/android/server/biometrics/BiometricService.java18
-rw-r--r--services/core/java/com/android/server/locksettings/LockSettingsStrongAuth.java16
4 files changed, 47 insertions, 9 deletions
diff --git a/core/java/android/hardware/biometrics/BiometricManager.java b/core/java/android/hardware/biometrics/BiometricManager.java
index ff58c7525a3a..eb3414d2ca48 100644
--- a/core/java/android/hardware/biometrics/BiometricManager.java
+++ b/core/java/android/hardware/biometrics/BiometricManager.java
@@ -152,5 +152,24 @@ public class BiometricManager {
Slog.w(TAG, "setActiveUser(): Service not connected");
}
}
+
+ /**
+ * Reset the timeout when user authenticates with strong auth (e.g. PIN, pattern or password)
+ *
+ * @param token an opaque token returned by password confirmation.
+ * @hide
+ */
+ @RequiresPermission(USE_BIOMETRIC_INTERNAL)
+ public void resetTimeout(byte[] token) {
+ if (mService != null) {
+ try {
+ mService.resetTimeout(token);
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ } else {
+ Slog.w(TAG, "resetTimeout(): Service not connected");
+ }
+ }
}
diff --git a/core/java/android/hardware/biometrics/IBiometricService.aidl b/core/java/android/hardware/biometrics/IBiometricService.aidl
index 53a076135aaa..de828f2d6757 100644
--- a/core/java/android/hardware/biometrics/IBiometricService.aidl
+++ b/core/java/android/hardware/biometrics/IBiometricService.aidl
@@ -48,4 +48,7 @@ interface IBiometricService {
// Notify BiometricService when <Biometric>Service is ready to start the prepared client.
// Client lifecycle is still managed in <Biometric>Service.
void onReadyForAuthentication(int cookie, boolean requireConfirmation, int userId);
+
+ // Reset the timeout when user authenticates with strong auth (e.g. PIN, pattern or password)
+ void resetTimeout(in byte [] token);
}
diff --git a/services/core/java/com/android/server/biometrics/BiometricService.java b/services/core/java/com/android/server/biometrics/BiometricService.java
index add55eaad166..1882be26ebf0 100644
--- a/services/core/java/com/android/server/biometrics/BiometricService.java
+++ b/services/core/java/com/android/server/biometrics/BiometricService.java
@@ -813,6 +813,24 @@ public class BiometricService extends SystemService {
}
}
+ @Override // Binder call
+ public void resetTimeout(byte[] token) {
+ checkInternalPermission();
+ final long ident = Binder.clearCallingIdentity();
+ try {
+ if (mFingerprintService != null) {
+ mFingerprintService.resetTimeout(token);
+ }
+ if (mFaceService != null) {
+ mFaceService.resetTimeout(token);
+ }
+ } catch (RemoteException e) {
+ Slog.e(TAG, "Remote exception", e);
+ } finally {
+ Binder.restoreCallingIdentity(ident);
+ }
+ }
+
void cancelInternal(IBinder token, String opPackageName, boolean fromClient) {
final int callingUid = Binder.getCallingUid();
final int callingPid = Binder.getCallingPid();
diff --git a/services/core/java/com/android/server/locksettings/LockSettingsStrongAuth.java b/services/core/java/com/android/server/locksettings/LockSettingsStrongAuth.java
index c4f1f3d7369d..44804350309d 100644
--- a/services/core/java/com/android/server/locksettings/LockSettingsStrongAuth.java
+++ b/services/core/java/com/android/server/locksettings/LockSettingsStrongAuth.java
@@ -24,8 +24,7 @@ import android.app.AlarmManager.OnAlarmListener;
import android.app.admin.DevicePolicyManager;
import android.app.trust.IStrongAuthTracker;
import android.content.Context;
-import android.content.pm.PackageManager;
-import android.hardware.fingerprint.FingerprintManager;
+import android.hardware.biometrics.BiometricManager;
import android.os.Handler;
import android.os.Message;
import android.os.RemoteCallbackList;
@@ -62,7 +61,7 @@ public class LockSettingsStrongAuth {
private final Context mContext;
private AlarmManager mAlarmManager;
- private FingerprintManager mFingerprintManager;
+ private BiometricManager mBiometricManager;
public LockSettingsStrongAuth(Context context) {
mContext = context;
@@ -71,9 +70,8 @@ public class LockSettingsStrongAuth {
}
public void systemReady() {
- final PackageManager pm = mContext.getPackageManager();
- if (pm.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)) {
- mFingerprintManager = mContext.getSystemService(FingerprintManager.class);
+ if (BiometricManager.hasBiometrics(mContext)) {
+ mBiometricManager = mContext.getSystemService(BiometricManager.class);
}
}
@@ -187,9 +185,9 @@ public class LockSettingsStrongAuth {
}
public void reportSuccessfulStrongAuthUnlock(int userId) {
- if (mFingerprintManager != null) {
- byte[] token = null; /* TODO: pass real auth token once fp HAL supports it */
- mFingerprintManager.resetTimeout(token);
+ if (mBiometricManager != null) {
+ byte[] token = null; /* TODO: pass real auth token once HAL supports it */
+ mBiometricManager.resetTimeout(token);
}
final int argNotUsed = 0;