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

Commit b1941f80 authored by Diya Bera's avatar Diya Bera
Browse files

Biometric Scheduler Watchdog

Added a watchdog to kill hung operations within the biometric scheduler.
The watchdog will cancel/remove all pending and the current running
operation if it is not finished with 10 seconds.

Test: Manual
Test: atest BiometricSchedulerTest
Fixes: 243445002
Change-Id: I877fec8d674be204b922088d072afe00f99b6635
parent 2ef2f3f5
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -768,6 +768,20 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
        }
    }

    /**
     * Schedules a watchdog.
     *
     * @hide
     */
    @RequiresPermission(USE_BIOMETRIC_INTERNAL)
    public void scheduleWatchdog() {
        try {
            mService.scheduleWatchdog();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    private void cancelEnrollment(long requestId) {
        if (mService != null) {
            try {
+5 −0
Original line number Diff line number Diff line
@@ -172,4 +172,9 @@ interface IFaceService {

    // Registers BiometricStateListener.
    void registerBiometricStateListener(IBiometricStateListener listener);

    // Internal operation used to clear face biometric scheduler.
    // Ensures that the scheduler is not stuck.
    @EnforcePermission("USE_BIOMETRIC_INTERNAL")
    void scheduleWatchdog();
}
+14 −0
Original line number Diff line number Diff line
@@ -1124,6 +1124,20 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing
        return BIOMETRIC_LOCKOUT_NONE;
    }

    /**
     * Schedules a watchdog.
     *
     * @hide
     */
    @RequiresPermission(USE_BIOMETRIC_INTERNAL)
    public void scheduleWatchdog() {
        try {
            mService.scheduleWatchdog();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * @hide
     */
+5 −0
Original line number Diff line number Diff line
@@ -208,4 +208,9 @@ interface IFingerprintService {
    // Sends a power button pressed event to all listeners.
    @EnforcePermission("USE_BIOMETRIC_INTERNAL")
    oneway void onPowerPressed();

    // Internal operation used to clear fingerprint biometric scheduler.
    // Ensures that the scheduler is not stuck.
    @EnforcePermission("USE_BIOMETRIC_INTERNAL")
    void scheduleWatchdog();
}
+13 −1
Original line number Diff line number Diff line
@@ -106,7 +106,6 @@ import android.os.Looper;
import android.os.Message;
import android.os.PowerManager;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemClock;
import android.os.Trace;
import android.os.UserHandle;
@@ -3796,4 +3795,17 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
        }
        mListenModels.print(pw);
    }

    /**
     * Schedules a watchdog for the face and fingerprint BiometricScheduler.
     * Cancels all operations in the scheduler if it is hung for 10 seconds.
     */
    public void startBiometricWatchdog() {
        if (mFaceManager != null) {
            mFaceManager.scheduleWatchdog();
        }
        if (mFpm != null) {
            mFpm.scheduleWatchdog();
        }
    }
}
Loading