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

Commit f96d7c11 authored by Jim Miller's avatar Jim Miller Committed by android-build-merger
Browse files

Fix bug where foreground activity fails to cancel auth/enrollment am: 37979c9d am: b08d7677

am: 32fd2383

Change-Id: Id4ed58cc08ee3c7bbe9dc0a87a9e31c107d8a839
parents 0f1445ba 32fd2383
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -470,10 +470,10 @@ public class FingerprintService extends SystemService implements IBinder.DeathRe

    /**
     * @param opPackageName name of package for caller
     * @param foregroundOnly only allow this call while app is in the foreground
     * @param requireForeground only allow this call while app is in the foreground
     * @return true if caller can use fingerprint API
     */
    private boolean canUseFingerprint(String opPackageName, boolean foregroundOnly, int uid,
    private boolean canUseFingerprint(String opPackageName, boolean requireForeground, int uid,
            int pid) {
        checkPermission(USE_FINGERPRINT);
        if (isKeyguard(opPackageName)) {
@@ -488,13 +488,21 @@ public class FingerprintService extends SystemService implements IBinder.DeathRe
            Slog.w(TAG, "Rejecting " + opPackageName + " ; permission denied");
            return false;
        }
        if (foregroundOnly && !isForegroundActivity(uid, pid)) {
        if (requireForeground && !(isForegroundActivity(uid, pid) || currentClient(opPackageName))){
            Slog.w(TAG, "Rejecting " + opPackageName + " ; not in foreground");
            return false;
        }
        return true;
    }

    /**
     * @param opPackageName package of the caller
     * @return true if this is the same client currently using fingerprint
     */
    private boolean currentClient(String opPackageName) {
        return mCurrentClient != null && mCurrentClient.getOwnerString().equals(opPackageName);
    }

    /**
     * @param clientPackage
     * @return true if this is keyguard package