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

Commit 12a1d81d authored by Amith Yamasani's avatar Amith Yamasani
Browse files

Check for singleUser attribute even for persistent apps

This enables Nfc to start a service on a different user.

Bug: 17462401

Change-Id: I92b2bcc2867a380ee18f77a40032bc43e4672c23
parent 5e6e52a0
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -14645,13 +14645,10 @@ public final class ActivityManagerService extends ActivityManagerNative
            }
        } else if ("system".equals(componentProcessName)) {
            result = true;
        } else if (UserHandle.isSameApp(aInfo.uid, Process.PHONE_UID)
                && (flags & ServiceInfo.FLAG_SINGLE_USER) != 0) {
            // Phone app is allowed to export singleuser providers.
            result = true;
        } else {
            // App with pre-defined UID, check if it's a persistent app
            result = (aInfo.flags & ApplicationInfo.FLAG_PERSISTENT) != 0;
        } else if ((flags & ServiceInfo.FLAG_SINGLE_USER) != 0) {
            // Phone app and persistent apps are allowed to export singleuser providers.
            result = UserHandle.isSameApp(aInfo.uid, Process.PHONE_UID)
                    || (aInfo.flags & ApplicationInfo.FLAG_PERSISTENT) != 0;
        }
        if (DEBUG_MU) {
            Slog.v(TAG, "isSingleton(" + componentProcessName + ", " + aInfo