Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0da404c5 authored by Kevin Chyn's avatar Kevin Chyn Committed by android-build-merger
Browse files

Merge changes from topic "face-challenge-bug" into qt-r1-dev

am: 01462c0b

Change-Id: If1fdf0fe496ed6babfdc3a57709edf7952e935b8
parents 7e66fb7f 01462c0b
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -104,9 +104,17 @@ public class BiometricManager {
     */
    @RequiresPermission(USE_BIOMETRIC)
    public @BiometricError int canAuthenticate() {
        return canAuthenticate(mContext.getUserId());
    }

    /**
     * @hide
     */
    @RequiresPermission(USE_BIOMETRIC_INTERNAL)
    public @BiometricError int canAuthenticate(int userId) {
        if (mService != null) {
            try {
                return mService.canAuthenticate(mContext.getOpPackageName());
                return mService.canAuthenticate(mContext.getOpPackageName(), userId);
            } catch (RemoteException e) {
                throw e.rethrowFromSystemServer();
            }
+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ interface IBiometricService {
    void cancelAuthentication(IBinder token, String opPackageName);

    // Checks if biometrics can be used.
    int canAuthenticate(String opPackageName);
    int canAuthenticate(String opPackageName, int userId);

    // Register callback for when keyguard biometric eligibility changes.
    void registerEnabledOnKeyguardCallback(IBiometricEnabledOnKeyguardCallback callback);
+14 −3
Original line number Diff line number Diff line
@@ -766,10 +766,16 @@ public class BiometricService extends SystemService {
        }

        @Override // Binder call
        public int canAuthenticate(String opPackageName) {
        public int canAuthenticate(String opPackageName, int userId) {
            Slog.d(TAG, "canAuthenticate: User=" + userId
                    + ", Caller=" + UserHandle.getCallingUserId());

            if (userId != UserHandle.getCallingUserId()) {
                checkInternalPermission();
            } else {
                checkPermission();
            }

            final int userId = UserHandle.getCallingUserId();
            final long ident = Binder.clearCallingIdentity();
            int error;
            try {
@@ -965,6 +971,11 @@ public class BiometricService extends SystemService {
            }
        }

        Slog.d(TAG, "checkAndGetBiometricModality: user=" + userId
                + " isHardwareDetected=" + isHardwareDetected
                + " hasTemplatesEnrolled=" + hasTemplatesEnrolled
                + " enabledForApps=" + enabledForApps);

        // Check error conditions
        if (!isHardwareDetected) {
            return new Pair<>(TYPE_NONE, BiometricConstants.BIOMETRIC_ERROR_HW_UNAVAILABLE);
+2 −0
Original line number Diff line number Diff line
@@ -1090,6 +1090,8 @@ public abstract class BiometricServiceBase extends SystemService
        if (DEBUG) Slog.v(getTag(), "starting client "
                + mCurrentClient.getClass().getSuperclass().getSimpleName()
                + "(" + mCurrentClient.getOwnerString() + ")"
                + " targetUserId: " + mCurrentClient.getTargetUserId()
                + " currentUserId: " + mCurrentUserId
                + " cookie: " + cookie + "/" + mCurrentClient.getCookie());
        if (cookie != mCurrentClient.getCookie()) {
            Slog.e(getTag(), "Mismatched cookie");
+3 −0
Original line number Diff line number Diff line
@@ -193,6 +193,7 @@ public class FaceService extends BiometricServiceBase {
                        .setAutoCancel(true)
                        .setCategory(Notification.CATEGORY_SYSTEM)
                        .setContentIntent(pendingIntent)
                        .setVisibility(Notification.VISIBILITY_SECRET)
                        .build();

                nm.createNotificationChannel(channel);
@@ -480,6 +481,8 @@ public class FaceService extends BiometricServiceBase {
                return;
            }

            Slog.d(TAG, "Resetting lockout for user: " + mCurrentUserId);

            try {
                mDaemonWrapper.resetLockout(token);
            } catch (RemoteException e) {
Loading