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

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

Merge "Listen to task stack only when AuthenticationClient is running" into pi-dev

parents fbb4b821 d4f43c2f
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -74,6 +74,17 @@ public abstract class AuthenticationClient extends ClientMonitor {
        }
    };

    /**
     * This method is called when authentication starts.
     */
    public abstract void onStart();

    /**
     * This method is called when a fingerprint is authenticated or authentication is stopped
     * (cancelled by the user, or an error such as lockout has occurred).
     */
    public abstract void onStop();

    public AuthenticationClient(Context context, long halDeviceId, IBinder token,
            IFingerprintServiceReceiver receiver, int targetUserId, int groupId, long opId,
            boolean restricted, String owner, Bundle bundle,
@@ -220,6 +231,7 @@ public abstract class AuthenticationClient extends ClientMonitor {
            }
            result |= true; // we have a valid fingerprint, done
            resetFailedAttempts();
            onStop();
        }
        return result;
    }
@@ -234,6 +246,7 @@ public abstract class AuthenticationClient extends ClientMonitor {
            Slog.w(TAG, "start authentication: no fingerprint HAL!");
            return ERROR_ESRCH;
        }
        onStart();
        try {
            final int result = daemon.authenticate(mOpId, getGroupId());
            if (result != 0) {
@@ -266,6 +279,7 @@ public abstract class AuthenticationClient extends ClientMonitor {
            return 0;
        }

        onStop();
        IBiometricsFingerprint daemon = getFingerprintDaemon();
        if (daemon == null) {
            Slog.w(TAG, "stopAuthentication: no fingerprint HAL!");
+18 −5
Original line number Diff line number Diff line
@@ -259,11 +259,6 @@ public class FingerprintService extends SystemService implements IHwBinder.Death
                ServiceManager.getService(Context.STATUS_BAR_SERVICE));
        mActivityManager = ((ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE))
                .getService();
        try {
            mActivityManager.registerTaskStackListener(mTaskStackListener);
        } catch (RemoteException e) {
            Slog.e(TAG, "Could not register task stack listener", e);
        }
    }

    @Override
@@ -858,6 +853,24 @@ public class FingerprintService extends SystemService implements IHwBinder.Death
        AuthenticationClient client = new AuthenticationClient(getContext(), mHalDeviceId, token,
                receiver, mCurrentUserId, groupId, opId, restricted, opPackageName, bundle,
                dialogReceiver, mStatusBarService) {
            @Override
            public void onStart() {
                try {
                    mActivityManager.registerTaskStackListener(mTaskStackListener);
                } catch (RemoteException e) {
                    Slog.e(TAG, "Could not register task stack listener", e);
                }
            }

            @Override
            public void onStop() {
                try {
                    mActivityManager.unregisterTaskStackListener(mTaskStackListener);
                } catch (RemoteException e) {
                    Slog.e(TAG, "Could not unregister task stack listener", e);
                }
            }

            @Override
            public int handleFailedAttempt() {
                final int currentUser = ActivityManager.getCurrentUser();