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

Commit 37368581 authored by Kevin Chyn's avatar Kevin Chyn
Browse files

ClientMonitor should only send cancel() once to fp daemon

This is already done for AuthenticationClient.

This should be done for all ClientMonitor subclasses which override
stop(), otherwise hardware and framework will be in inconsistent states.

Fixes: 38463417

Test: 1) Open fp settings in background, enter keyguard, dismiss
keyguard with fp and make sure settings can "authenticate"/highlight
fp when touched

2) Enroll fp and go back/forth between FingerprintEnrollFindSensor
and FingerprintEnrollEnrolling. Make sure touching fp sensor
will always bring you to FingerprintEnrollEnrolling

Change-Id: Iee3d03c8a8b3445073740fbfbe411f12172afe23
parent b6d1a198
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -41,8 +41,6 @@ public abstract class AuthenticationClient extends ClientMonitor {
    public static final int LOCKOUT_TIMED = 1;
    public static final int LOCKOUT_PERMANENT = 2;

    private boolean mAlreadyCancelled;

    public AuthenticationClient(Context context, long halDeviceId, IBinder token,
            IFingerprintServiceReceiver receiver, int targetUserId, int groupId, long opId,
            boolean restricted, String owner) {
+1 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ public abstract class ClientMonitor implements IBinder.DeathRecipient {
    private String mOwner;
    private Context mContext;
    private long mHalDeviceId;
    protected boolean mAlreadyCancelled;

    /**
     * @param context context of FingerprintService
+5 −0
Original line number Diff line number Diff line
@@ -100,6 +100,10 @@ public abstract class EnrollClient extends ClientMonitor {

    @Override
    public int stop(boolean initiatedByClient) {
        if (mAlreadyCancelled) {
            Slog.w(TAG, "stopEnroll: already cancelled!");
            return 0;
        }
        IBiometricsFingerprint daemon = getFingerprintDaemon();
        if (daemon == null) {
            Slog.w(TAG, "stopEnrollment: no fingerprint HAL!");
@@ -117,6 +121,7 @@ public abstract class EnrollClient extends ClientMonitor {
        if (initiatedByClient) {
            onError(FingerprintManager.FINGERPRINT_ERROR_CANCELED, 0 /* vendorCode */);
        }
        mAlreadyCancelled = true;
        return 0;
    }

+5 −0
Original line number Diff line number Diff line
@@ -56,6 +56,10 @@ public abstract class EnumerateClient extends ClientMonitor {

    @Override
    public int stop(boolean initiatedByClient) {
        if (mAlreadyCancelled) {
            Slog.w(TAG, "stopEnumerate: already cancelled!");
            return 0;
        }
        IBiometricsFingerprint daemon = getFingerprintDaemon();
        if (daemon == null) {
            Slog.w(TAG, "stopEnumeration: no fingerprint HAL!");
@@ -77,6 +81,7 @@ public abstract class EnumerateClient extends ClientMonitor {
        if (initiatedByClient) {
            onError(FingerprintManager.FINGERPRINT_ERROR_CANCELED, 0 /* vendorCode */);
        }
        mAlreadyCancelled = true;
        return 0; // success
    }

+5 −0
Original line number Diff line number Diff line
@@ -59,6 +59,10 @@ public abstract class RemovalClient extends ClientMonitor {

    @Override
    public int stop(boolean initiatedByClient) {
        if (mAlreadyCancelled) {
            Slog.w(TAG, "stopRemove: already cancelled!");
            return 0;
        }
        IBiometricsFingerprint daemon = getFingerprintDaemon();
        if (daemon == null) {
            Slog.w(TAG, "stopRemoval: no fingerprint HAL!");
@@ -75,6 +79,7 @@ public abstract class RemovalClient extends ClientMonitor {
            Slog.e(TAG, "stopRemoval failed", e);
            return ERROR_ESRCH;
        }
        mAlreadyCancelled = true;
        return 0; // success
    }