diff options
Diffstat (limited to 'services/core/java/com/android/server/biometrics')
-rw-r--r-- | services/core/java/com/android/server/biometrics/sensors/AuthenticationClient.java | 81 | ||||
-rw-r--r-- | services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintService.java | 22 |
2 files changed, 46 insertions, 57 deletions
diff --git a/services/core/java/com/android/server/biometrics/sensors/AuthenticationClient.java b/services/core/java/com/android/server/biometrics/sensors/AuthenticationClient.java index 92c8c9bb57ec..358263df916b 100644 --- a/services/core/java/com/android/server/biometrics/sensors/AuthenticationClient.java +++ b/services/core/java/com/android/server/biometrics/sensors/AuthenticationClient.java @@ -118,7 +118,7 @@ public abstract class AuthenticationClient<T> extends AcquisitionClient<T> mIsStrongBiometric = isStrongBiometric; mOperationId = operationId; mRequireConfirmation = requireConfirmation; - mActivityTaskManager = getActivityTaskManager(); + mActivityTaskManager = ActivityTaskManager.getInstance(); mBiometricManager = context.getSystemService(BiometricManager.class); mTaskStackListener = taskStackListener; mLockoutTracker = lockoutTracker; @@ -146,10 +146,6 @@ public abstract class AuthenticationClient<T> extends AcquisitionClient<T> return mStartTimeMs; } - protected ActivityTaskManager getActivityTaskManager() { - return ActivityTaskManager.getInstance(); - } - @Override public void binderDied() { final boolean clearListener = !isBiometricPrompt(); @@ -326,50 +322,45 @@ public abstract class AuthenticationClient<T> extends AcquisitionClient<T> sendCancelOnly(listener); } }); - } else { // not authenticated - if (isBackgroundAuth) { - Slog.e(TAG, "cancelling due to background auth"); - cancel(); - } else { - // Allow system-defined limit of number of attempts before giving up - final @LockoutTracker.LockoutMode int lockoutMode = - handleFailedAttempt(getTargetUserId()); - if (lockoutMode != LockoutTracker.LOCKOUT_NONE) { - markAlreadyDone(); - } + } else { + // Allow system-defined limit of number of attempts before giving up + final @LockoutTracker.LockoutMode int lockoutMode = + handleFailedAttempt(getTargetUserId()); + if (lockoutMode != LockoutTracker.LOCKOUT_NONE) { + markAlreadyDone(); + } - final CoexCoordinator coordinator = CoexCoordinator.getInstance(); - coordinator.onAuthenticationRejected(SystemClock.uptimeMillis(), this, lockoutMode, - new CoexCoordinator.Callback() { - @Override - public void sendAuthenticationResult(boolean addAuthTokenIfStrong) { - if (listener != null) { - try { - listener.onAuthenticationFailed(getSensorId()); - } catch (RemoteException e) { - Slog.e(TAG, "Unable to notify listener", e); - } - } - } + final CoexCoordinator coordinator = CoexCoordinator.getInstance(); + coordinator.onAuthenticationRejected(SystemClock.uptimeMillis(), this, lockoutMode, + new CoexCoordinator.Callback() { + @Override + public void sendAuthenticationResult(boolean addAuthTokenIfStrong) { + if (listener != null) { + try { + listener.onAuthenticationFailed(getSensorId()); + } catch (RemoteException e) { + Slog.e(TAG, "Unable to notify listener", e); + } + } + } - @Override - public void sendHapticFeedback() { - if (listener != null && mShouldVibrate) { - vibrateError(); - } - } + @Override + public void sendHapticFeedback() { + if (listener != null && mShouldVibrate) { + vibrateError(); + } + } - @Override - public void handleLifecycleAfterAuth() { - AuthenticationClient.this.handleLifecycleAfterAuth(false /* authenticated */); - } + @Override + public void handleLifecycleAfterAuth() { + AuthenticationClient.this.handleLifecycleAfterAuth(false /* authenticated */); + } - @Override - public void sendAuthenticationCanceled() { - sendCancelOnly(listener); - } - }); - } + @Override + public void sendAuthenticationCanceled() { + sendCancelOnly(listener); + } + }); } } 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 3a93d82a68ee..b44f4dc68274 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 @@ -331,12 +331,12 @@ public class FingerprintService extends SystemService { provider.second.getSensorProperties(sensorId); if (!isKeyguard && !Utils.isSettings(getContext(), opPackageName) && sensorProps != null && sensorProps.isAnyUdfpsType()) { + identity = Binder.clearCallingIdentity(); try { return authenticateWithPrompt(operationId, sensorProps, userId, receiver, - opPackageName, ignoreEnrollmentState); - } catch (PackageManager.NameNotFoundException e) { - Slog.e(TAG, "Invalid package", e); - return -1; + ignoreEnrollmentState); + } finally { + Binder.restoreCallingIdentity(identity); } } return provider.second.scheduleAuthenticate(provider.first, token, operationId, userId, @@ -349,15 +349,12 @@ public class FingerprintService extends SystemService { @NonNull final FingerprintSensorPropertiesInternal props, final int userId, final IFingerprintServiceReceiver receiver, - final String opPackageName, - boolean ignoreEnrollmentState) throws PackageManager.NameNotFoundException { + boolean ignoreEnrollmentState) { final Context context = getUiContext(); - final Context promptContext = context.createPackageContextAsUser( - opPackageName, 0 /* flags */, UserHandle.getUserHandleForUid(userId)); final Executor executor = context.getMainExecutor(); - final BiometricPrompt biometricPrompt = new BiometricPrompt.Builder(promptContext) + final BiometricPrompt biometricPrompt = new BiometricPrompt.Builder(context) .setTitle(context.getString(R.string.biometric_dialog_default_title)) .setSubtitle(context.getString(R.string.fingerprint_dialog_default_subtitle)) .setNegativeButton( @@ -371,7 +368,8 @@ public class FingerprintService extends SystemService { Slog.e(TAG, "Remote exception in negative button onClick()", e); } }) - .setIsForLegacyFingerprintManager(props.sensorId) + .setAllowedSensorIds(new ArrayList<>( + Collections.singletonList(props.sensorId))) .setIgnoreEnrollmentState(ignoreEnrollmentState) .build(); @@ -425,8 +423,8 @@ public class FingerprintService extends SystemService { } }; - return biometricPrompt.authenticateForOperation( - new CancellationSignal(), executor, promptCallback, operationId); + return biometricPrompt.authenticateUserForOperation( + new CancellationSignal(), executor, promptCallback, userId, operationId); } @Override |