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

Commit e79d159e authored by Patrick Baumann's avatar Patrick Baumann Committed by android-build-team Robot
Browse files

Early exit when target app ID < FIRST_APP_UID

This change ensures that we also grant visibility to the framework and
other settings that are outside of the APPLICATION_UID space.

Fixes: 159152185
Test: atest com.android.server.pm.UserManagerTest#testAddManagedProfile_withDisallowedPackages
Change-Id: I00c8390dfa748f90c538a57243b472610886be7b
(cherry picked from commit 947d63d1)
parent de5d8f43
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -851,6 +851,7 @@ public class AppsFilter {
        try {
            int callingAppId = UserHandle.getAppId(callingUid);
            if (callingAppId < Process.FIRST_APPLICATION_UID
                    || targetPkgSetting.appId < Process.FIRST_APPLICATION_UID
                    || callingAppId == targetPkgSetting.appId) {
                return false;
            }
+2 −1
Original line number Diff line number Diff line
@@ -806,7 +806,8 @@ public class AppsFilterTest {

        final SparseArray<int[]> systemFilter =
                appsFilter.getVisibilityWhitelist(system, USER_ARRAY, mExisting);
        assertThat(toList(systemFilter.get(SYSTEM_USER)), empty());
        assertThat(toList(systemFilter.get(SYSTEM_USER)),
                contains(seesNothingAppId, hasProviderAppId, queriesProviderAppId));

        final SparseArray<int[]> seesNothingFilter =
                appsFilter.getVisibilityWhitelist(seesNothing, USER_ARRAY, mExisting);