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

Commit a272625b authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Wait for current task to complete before revoking challenge" into qt-r1-dev

parents 3d92c138 9dac848d
Loading
Loading
Loading
Loading
+26 −2
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ import com.android.server.SystemServerInitThreadPool;
import com.android.server.biometrics.AuthenticationClient;
import com.android.server.biometrics.BiometricServiceBase;
import com.android.server.biometrics.BiometricUtils;
import com.android.server.biometrics.ClientMonitor;
import com.android.server.biometrics.Constants;
import com.android.server.biometrics.EnumerateClient;
import com.android.server.biometrics.RemovalClient;
@@ -342,7 +343,16 @@ public class FaceService extends BiometricServiceBase {
        @Override // Binder call
        public int revokeChallenge(IBinder token) {
            checkPermission(MANAGE_BIOMETRIC);
            // TODO(b/137106905): Schedule binder calls in FaceService to avoid deadlocks.
            if (getCurrentClient() == null) {
                // if we aren't handling any other HIDL calls (mCurrentClient == null), revoke the
                // challenge right away.
                return startRevokeChallenge(token);
            } else {
                // postpone revoking the challenge until we finish processing the current HIDL call.
                mRevokeChallengePending = true;
                return Status.OK;
            }
        }

        @Override // Binder call
@@ -812,6 +822,7 @@ public class FaceService extends BiometricServiceBase {
    @GuardedBy("this")
    private IBiometricsFace mDaemon;
    private UsageStats mUsageStats;
    private boolean mRevokeChallengePending = false;
    // One of the AuthenticationClient constants
    private int mCurrentUserLockoutMode;

@@ -1040,6 +1051,15 @@ public class FaceService extends BiometricServiceBase {
                .getIntArray(R.array.config_face_acquire_vendor_enroll_ignorelist);
    }

    @Override
    protected void removeClient(ClientMonitor client) {
        super.removeClient(client);
        if (mRevokeChallengePending) {
            startRevokeChallenge(null);
            mRevokeChallengePending = false;
        }
    }

    @Override
    public void onStart() {
        super.onStart();
@@ -1251,7 +1271,11 @@ public class FaceService extends BiometricServiceBase {
            return 0;
        }
        try {
            return daemon.revokeChallenge();
            final int res = daemon.revokeChallenge();
            if (res != Status.OK) {
                Slog.e(TAG, "revokeChallenge returned " + res);
            }
            return res;
        } catch (RemoteException e) {
            Slog.e(TAG, "startRevokeChallenge failed", e);
        }