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

Commit cc5c844c authored by Kevin Chyn's avatar Kevin Chyn Committed by android-build-merger
Browse files

Merge "FP permission checks should not crash system process" into oc-mr1-dev

am: 5f2ba81c

Change-Id: Iaa0c94a9325ef944ddb6b62c2e80e39ef3bbb21a
parents 350b0ed1 5f2ba81c
Loading
Loading
Loading
Loading
+28 −25
Original line number Diff line number Diff line
@@ -1081,18 +1081,19 @@ public class FingerprintService extends SystemService implements IHwBinder.Death
                final IFingerprintServiceReceiver receiver, final int flags,
                final String opPackageName) {
            final int callingUid = Binder.getCallingUid();
            final int callingPid = Binder.getCallingPid();
            final int callingUserId = UserHandle.getCallingUserId();
            final int pid = Binder.getCallingPid();
            final boolean restricted = isRestricted();
            mHandler.post(new Runnable() {
                @Override
                public void run() {
                    if (!canUseFingerprint(opPackageName, true /* foregroundOnly */,
                            callingUid, pid, callingUserId)) {

            if (!canUseFingerprint(opPackageName, true /* foregroundOnly */, callingUid, callingPid,
                    callingUserId)) {
                if (DEBUG) Slog.v(TAG, "authenticate(): reject " + opPackageName);
                return;
            }

            mHandler.post(new Runnable() {
                @Override
                public void run() {
                    MetricsLogger.histogram(mContext, "fingerprint_token", opId != 0L ? 1 : 0);

                    // Get performance stats object for this user.
@@ -1113,16 +1114,19 @@ public class FingerprintService extends SystemService implements IHwBinder.Death

        @Override // Binder call
        public void cancelAuthentication(final IBinder token, final String opPackageName) {
            final int uid = Binder.getCallingUid();
            final int pid = Binder.getCallingPid();
            final int callingUid = Binder.getCallingUid();
            final int callingPid = Binder.getCallingPid();
            final int callingUserId = UserHandle.getCallingUserId();

            if (!canUseFingerprint(opPackageName, true /* foregroundOnly */, callingUid, callingPid,
                    callingUserId)) {
                if (DEBUG) Slog.v(TAG, "cancelAuthentication(): reject " + opPackageName);
                return;
            }

            mHandler.post(new Runnable() {
                @Override
                public void run() {
                    if (!canUseFingerprint(opPackageName, true /* foregroundOnly */, uid, pid,
                            callingUserId)) {
                        if (DEBUG) Slog.v(TAG, "cancelAuthentication(): reject " + opPackageName);
                    } else {
                    ClientMonitor client = mCurrentClient;
                    if (client instanceof AuthenticationClient) {
                        if (client.getToken() == token) {
@@ -1137,7 +1141,6 @@ public class FingerprintService extends SystemService implements IHwBinder.Death
                                + client.getOwnerString());
                    }
                }
                }
            });
        }