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

Commit 086a91fc authored by Perumaal S's avatar Perumaal S
Browse files

Allow same-package associations

Test: m -j and adb pull /product/etc/sysconfig/google.xml
Test: AiAi webref entities work now

I will send the sysconfig.xml revert next.

Bug: 121375791

Change-Id: I770336d03848a44a8db6122bb2580e595043273b
parent c54ffd28
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -2417,16 +2417,21 @@ public class ActivityManagerService extends IActivityManager.Stub
        return mBackgroundLaunchBroadcasts;
    }
    /**
     * Returns true if the package {@code pkg1} running under user handle {@code uid1} is
     * allowed association with the package {@code pkg2} running under user handle {@code uid2}.
     * <p> If either of the packages are running as  part of the core system, then the
     * association is implicitly allowed.
     */
    boolean validateAssociationAllowedLocked(String pkg1, int uid1, String pkg2, int uid2) {
        if (mAllowedAssociations == null) {
            mAllowedAssociations = SystemConfig.getInstance().getAllowedAssociations();
        }
        // Interactions with the system uid are always allowed, since that is the core system
        // that everyone needs to be able to interact with.
        if (UserHandle.getAppId(uid1) == SYSTEM_UID) {
            return true;
        }
        if (UserHandle.getAppId(uid2) == SYSTEM_UID) {
        // that everyone needs to be able to interact with. Also allow reflexive associations
        // within the same uid.
        if (uid1 == uid2 || UserHandle.getAppId(uid1) == SYSTEM_UID
                || UserHandle.getAppId(uid2) == SYSTEM_UID) {
            return true;
        }
        // We won't allow this association if either pkg1 or pkg2 has a limit on the
@@ -2442,6 +2447,8 @@ public class ActivityManagerService extends IActivityManager.Stub
        if (pkgs != null) {
            return pkgs.contains(pkg1);
        }
        // If no explicit associations are provided in the manifest, then assume the app is
        // allowed associations with any package.
        return true;
    }