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 Diff line number Diff line
@@ -5461,13 +5461,19 @@ public class PackageManagerService implements PackageSender, TestUtilityService

            final long callingId = Binder.clearCallingIdentity();
            try {
                final PackageStateInternal packageState =
                        snapshot.getPackageStateForInstalledAndFiltered(
                                packageName, callingUid, userId);
                final PackageStateInternal packageState = snapshot.getPackageStateInternal(
                        packageName);
                if (packageState == null) {
                    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
                // a part of the using app (emulating static linking). Also
                // static libs are installed always on internal storage.
@@ -5497,10 +5503,6 @@ public class PackageManagerService implements PackageSender, TestUtilityService
                    return false;
                }

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

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