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

Commit 7915aa66 authored by Jackal Guo's avatar Jackal Guo Committed by Android (Google) Code Review
Browse files

Merge "Fix cross user app visibility gap for setApplicationHidden"

parents 4c9a5aae 30554003
Loading
Loading
Loading
Loading
+9 −7
Original line number Original line Diff line number Diff line
@@ -5461,13 +5461,19 @@ public class PackageManagerService implements PackageSender, TestUtilityService


            final long callingId = Binder.clearCallingIdentity();
            final long callingId = Binder.clearCallingIdentity();
            try {
            try {
                final PackageStateInternal packageState =
                final PackageStateInternal packageState = snapshot.getPackageStateInternal(
                        snapshot.getPackageStateForInstalledAndFiltered(
                        packageName);
                                packageName, callingUid, userId);
                if (packageState == null) {
                if (packageState == null) {
                    return false;
                    return false;
                }
                }


                final PackageUserStateInternal userState = packageState.getUserStateOrDefault(
                        userId);
                if (userState.isHidden() == hidden || !userState.isInstalled()
                        || snapshot.shouldFilterApplication(packageState, callingUid, userId)) {
                    return false;
                }

                // Cannot hide static shared libs as they are considered
                // Cannot hide static shared libs as they are considered
                // a part of the using app (emulating static linking). Also
                // a part of the using app (emulating static linking). Also
                // static libs are installed always on internal storage.
                // static libs are installed always on internal storage.
@@ -5497,10 +5503,6 @@ public class PackageManagerService implements PackageSender, TestUtilityService
                    return false;
                    return false;
                }
                }


                if (packageState.getUserStateOrDefault(userId).isHidden() == hidden) {
                    return false;
                }

                commitPackageStateMutation(null, packageName, packageState1 ->
                commitPackageStateMutation(null, packageName, packageState1 ->
                        packageState1.userState(userId).setHidden(hidden));
                        packageState1.userState(userId).setHidden(hidden));