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

Commit dae2442d authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Flag removal: remove_cross_user_permission_hack" into main

parents be544958 dfce98bd
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -235,14 +235,6 @@ flag {
    is_fixed_read_only: true
}

flag {
    name: "remove_cross_user_permission_hack"
    namespace: "package_manager_service"
    description: "Feature flag to remove hack code of using PackageManager.MATCH_ANY_USER flag without cross user permission."
    bug: "332664521"
    is_fixed_read_only: true
}

flag {
    name: "delete_packages_silently_backport"
    namespace: "package_manager_service"
+0 −11
Original line number Diff line number Diff line
@@ -2773,17 +2773,6 @@ public class ComputerEngine implements Computer {
            enforceCrossUserPermission(Binder.getCallingUid(), userId, false, false,
                    !isRecentsAccessingChildProfiles(Binder.getCallingUid(), userId),
                    "MATCH_ANY_USER flag requires INTERACT_ACROSS_USERS permission");
        } else if (!Flags.removeCrossUserPermissionHack()
                && (flags & PackageManager.MATCH_UNINSTALLED_PACKAGES) != 0
                && isCallerSystemUser
                && mUserManager.hasProfile(UserHandle.USER_SYSTEM)) {
            // If the caller wants all packages and has a profile associated with it,
            // then match all users. This is to make sure that launchers that need to access
            //work
            // profile apps don't start breaking. TODO: Remove this hack when launchers stop
            //using
            // MATCH_UNINSTALLED_PACKAGES to query apps in other profiles. b/31000380
            flags |= PackageManager.MATCH_ANY_USER;
        }
        return updateFlags(flags, userId);
    }
+2 −16
Original line number Diff line number Diff line
@@ -8531,23 +8531,9 @@ public class UserManagerService extends IUserManager.Stub {
     * @deprecated
     */
    boolean hasProfile(@UserIdInt int userId) {
        if (!android.content.pm.Flags.removeCrossUserPermissionHack()) {
            synchronized (mUsersLock) {
                UserInfo userInfo = getUserInfoLU(userId);
                final int userSize = mUsers.size();
                for (int i = 0; i < userSize; i++) {
                    UserInfo profile = mUsers.valueAt(i).info;
                    if (userId != profile.id && isSameProfileGroup(userInfo, profile)) {
                        return true;
                    }
                }
                return false;
            }
        } else {
        // TODO(b/332664521): Remove this method entirely. It is no longer used.
        throw new UnsupportedOperationException();
    }
    }

    /**
     * Checks if the calling package name matches with the calling UID, throw