Loading services/core/java/com/android/server/pm/Computer.java +2 −1 Original line number Diff line number Diff line Loading @@ -236,7 +236,8 @@ public interface Computer extends PackageDataSnapshot { * existence. * <p> * Package with {@link PackageManager#SYSTEM_APP_STATE_HIDDEN_UNTIL_INSTALLED_HIDDEN} is not * treated as an uninstalled package for the carrier apps customization. * treated as an uninstalled package for the carrier apps customization. Bypassing the * uninstalled package check if the caller is system, shell or root uid. */ boolean shouldFilterApplicationIncludingUninstalled(@Nullable PackageStateInternal ps, int callingUid, int userId); Loading services/core/java/com/android/server/pm/ComputerEngine.java +11 −3 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ import static com.android.server.pm.PackageManagerService.EMPTY_INT_ARRAY; import static com.android.server.pm.PackageManagerService.HIDE_EPHEMERAL_APIS; import static com.android.server.pm.PackageManagerService.TAG; import static com.android.server.pm.PackageManagerServiceUtils.compareSignatures; import static com.android.server.pm.PackageManagerServiceUtils.isSystemOrRootOrShell; import static com.android.server.pm.resolution.ComponentResolver.RESOLVE_PRIORITY_SORTER; import android.Manifest; Loading Loading @@ -2737,8 +2738,12 @@ public class ComputerEngine implements Computer { final String instantAppPkgName = getInstantAppPackageName(callingUid); final boolean callerIsInstantApp = instantAppPkgName != null; // Don't treat hiddenUntilInstalled as an uninstalled state, phone app needs to access // these hidden application details to customize carrier apps. if (ps == null || (filterUninstall && !ps.isHiddenUntilInstalled() // these hidden application details to customize carrier apps. Also, allowing the system // caller accessing to application across users. if (ps == null || (filterUninstall && !isSystemOrRootOrShell(callingUid) && !ps.isHiddenUntilInstalled() && !ps.getUserStateOrDefault(userId).isInstalled())) { // If caller is instant app or sdk sandbox and ps is null, pretend the application // exists, but, needs to be filtered Loading Loading @@ -2837,6 +2842,9 @@ public class ComputerEngine implements Computer { if (shouldFilterApplication(sus, callingUid, userId)) { return true; } if (isSystemOrRootOrShell(callingUid)) { return false; } final ArraySet<PackageStateInternal> packageStates = (ArraySet<PackageStateInternal>) sus.getPackageStates(); for (int index = 0; index < packageStates.size(); index++) { Loading services/core/java/com/android/server/pm/PackageManagerServiceUtils.java +7 −1 Original line number Diff line number Diff line Loading @@ -1271,7 +1271,13 @@ public class PackageManagerServiceUtils { * Check if the Binder caller is system UID, root's UID, or shell's UID. */ public static boolean isSystemOrRootOrShell() { final int uid = Binder.getCallingUid(); return isSystemOrRootOrShell(Binder.getCallingUid()); } /** * @see #isSystemOrRoot() */ public static boolean isSystemOrRootOrShell(int uid) { return uid == Process.SYSTEM_UID || uid == Process.ROOT_UID || uid == Process.SHELL_UID; } Loading Loading
services/core/java/com/android/server/pm/Computer.java +2 −1 Original line number Diff line number Diff line Loading @@ -236,7 +236,8 @@ public interface Computer extends PackageDataSnapshot { * existence. * <p> * Package with {@link PackageManager#SYSTEM_APP_STATE_HIDDEN_UNTIL_INSTALLED_HIDDEN} is not * treated as an uninstalled package for the carrier apps customization. * treated as an uninstalled package for the carrier apps customization. Bypassing the * uninstalled package check if the caller is system, shell or root uid. */ boolean shouldFilterApplicationIncludingUninstalled(@Nullable PackageStateInternal ps, int callingUid, int userId); Loading
services/core/java/com/android/server/pm/ComputerEngine.java +11 −3 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ import static com.android.server.pm.PackageManagerService.EMPTY_INT_ARRAY; import static com.android.server.pm.PackageManagerService.HIDE_EPHEMERAL_APIS; import static com.android.server.pm.PackageManagerService.TAG; import static com.android.server.pm.PackageManagerServiceUtils.compareSignatures; import static com.android.server.pm.PackageManagerServiceUtils.isSystemOrRootOrShell; import static com.android.server.pm.resolution.ComponentResolver.RESOLVE_PRIORITY_SORTER; import android.Manifest; Loading Loading @@ -2737,8 +2738,12 @@ public class ComputerEngine implements Computer { final String instantAppPkgName = getInstantAppPackageName(callingUid); final boolean callerIsInstantApp = instantAppPkgName != null; // Don't treat hiddenUntilInstalled as an uninstalled state, phone app needs to access // these hidden application details to customize carrier apps. if (ps == null || (filterUninstall && !ps.isHiddenUntilInstalled() // these hidden application details to customize carrier apps. Also, allowing the system // caller accessing to application across users. if (ps == null || (filterUninstall && !isSystemOrRootOrShell(callingUid) && !ps.isHiddenUntilInstalled() && !ps.getUserStateOrDefault(userId).isInstalled())) { // If caller is instant app or sdk sandbox and ps is null, pretend the application // exists, but, needs to be filtered Loading Loading @@ -2837,6 +2842,9 @@ public class ComputerEngine implements Computer { if (shouldFilterApplication(sus, callingUid, userId)) { return true; } if (isSystemOrRootOrShell(callingUid)) { return false; } final ArraySet<PackageStateInternal> packageStates = (ArraySet<PackageStateInternal>) sus.getPackageStates(); for (int index = 0; index < packageStates.size(); index++) { Loading
services/core/java/com/android/server/pm/PackageManagerServiceUtils.java +7 −1 Original line number Diff line number Diff line Loading @@ -1271,7 +1271,13 @@ public class PackageManagerServiceUtils { * Check if the Binder caller is system UID, root's UID, or shell's UID. */ public static boolean isSystemOrRootOrShell() { final int uid = Binder.getCallingUid(); return isSystemOrRootOrShell(Binder.getCallingUid()); } /** * @see #isSystemOrRoot() */ public static boolean isSystemOrRootOrShell(int uid) { return uid == Process.SYSTEM_UID || uid == Process.ROOT_UID || uid == Process.SHELL_UID; } Loading