Loading services/core/java/android/content/pm/PackageManagerInternal.java +8 −0 Original line number Diff line number Diff line Loading @@ -221,6 +221,14 @@ public abstract class PackageManagerInternal { @PackageManager.ApplicationInfoFlagsBits long flags, @UserIdInt int userId, int callingUid); /** * Like {@link #getInstalledApplications}, but allows the fetching of apps * cross user. */ public abstract List<ApplicationInfo> getInstalledApplicationsCrossUser( @PackageManager.ApplicationInfoFlagsBits long flags, @UserIdInt int userId, int callingUid); /** * Retrieve launcher extras for a suspended package provided to the system in * {@link PackageManager#setPackagesSuspended(String[], boolean, PersistableBundle, Loading services/core/java/com/android/server/pm/Computer.java +1 −1 Original line number Diff line number Diff line Loading @@ -477,7 +477,7 @@ public interface Computer extends PackageDataSnapshot { @NonNull List<ApplicationInfo> getInstalledApplications( @PackageManager.ApplicationInfoFlagsBits long flags, @UserIdInt int userId, int callingUid); int callingUid, boolean forceAllowCrossUser); @Nullable ProviderInfo resolveContentProvider(@NonNull String name, Loading services/core/java/com/android/server/pm/ComputerEngine.java +9 −7 Original line number Diff line number Diff line Loading @@ -4640,7 +4640,7 @@ public class ComputerEngine implements Computer { @Override public List<ApplicationInfo> getInstalledApplications( @PackageManager.ApplicationInfoFlagsBits long flags, @UserIdInt int userId, int callingUid) { int callingUid, boolean forceAllowCrossUser) { if (getInstantAppPackageName(callingUid) != null) { return Collections.emptyList(); } Loading @@ -4650,12 +4650,14 @@ public class ComputerEngine implements Computer { final boolean listApex = (flags & MATCH_APEX) != 0; final boolean listArchivedOnly = !listUninstalled && (flags & MATCH_ARCHIVED_PACKAGES) != 0; if (!forceAllowCrossUser) { enforceCrossUserPermission( callingUid, userId, false /* requireFullPermission */, false /* checkShell */, "get installed application info"); } ArrayList<ApplicationInfo> list; final ArrayMap<String, ? extends PackageStateInternal> packageStates = Loading services/core/java/com/android/server/pm/IPackageManagerBase.java +2 −1 Original line number Diff line number Diff line Loading @@ -476,7 +476,8 @@ public abstract class IPackageManagerBase extends IPackageManager.Stub { @PackageManager.ApplicationInfoFlagsBits long flags, int userId) { final int callingUid = Binder.getCallingUid(); return new ParceledListSlice<>( snapshot().getInstalledApplications(flags, userId, callingUid)); snapshot().getInstalledApplications(flags, userId, callingUid, /* forceAllowCrossUser= */ false)); } @Override Loading services/core/java/com/android/server/pm/LauncherAppsService.java +10 −6 Original line number Diff line number Diff line Loading @@ -769,6 +769,9 @@ public class LauncherAppsService extends SystemService { @NonNull private List<LauncherActivityInfoInternal> generateLauncherActivitiesForArchivedApp( @Nullable String packageName, UserHandle user) { if (!canAccessProfile(user.getIdentifier(), "Cannot retrieve activities")) { return List.of(); } List<ApplicationInfo> applicationInfoList = (packageName == null) ? getApplicationInfoListForAllArchivedApps(user) Loading Loading @@ -827,7 +830,7 @@ public class LauncherAppsService extends SystemService { private List<ApplicationInfo> getApplicationInfoListForAllArchivedApps(UserHandle user) { final int callingUid = injectBinderCallingUid(); List<ApplicationInfo> installedApplicationInfoList = mPackageManagerInternal.getInstalledApplications( mPackageManagerInternal.getInstalledApplicationsCrossUser( PackageManager.MATCH_ARCHIVED_PACKAGES, user.getIdentifier(), callingUid); Loading @@ -845,11 +848,12 @@ public class LauncherAppsService extends SystemService { private List<ApplicationInfo> getApplicationInfoForArchivedApp( @NonNull String packageName, UserHandle user) { final int callingUid = injectBinderCallingUid(); ApplicationInfo applicationInfo = mPackageManagerInternal.getApplicationInfo( ApplicationInfo applicationInfo = Binder.withCleanCallingIdentity(() -> mPackageManagerInternal.getApplicationInfo( packageName, PackageManager.MATCH_ARCHIVED_PACKAGES, callingUid, user.getIdentifier()); user.getIdentifier())); if (applicationInfo == null || !applicationInfo.isArchived) { return Collections.EMPTY_LIST; } Loading Loading
services/core/java/android/content/pm/PackageManagerInternal.java +8 −0 Original line number Diff line number Diff line Loading @@ -221,6 +221,14 @@ public abstract class PackageManagerInternal { @PackageManager.ApplicationInfoFlagsBits long flags, @UserIdInt int userId, int callingUid); /** * Like {@link #getInstalledApplications}, but allows the fetching of apps * cross user. */ public abstract List<ApplicationInfo> getInstalledApplicationsCrossUser( @PackageManager.ApplicationInfoFlagsBits long flags, @UserIdInt int userId, int callingUid); /** * Retrieve launcher extras for a suspended package provided to the system in * {@link PackageManager#setPackagesSuspended(String[], boolean, PersistableBundle, Loading
services/core/java/com/android/server/pm/Computer.java +1 −1 Original line number Diff line number Diff line Loading @@ -477,7 +477,7 @@ public interface Computer extends PackageDataSnapshot { @NonNull List<ApplicationInfo> getInstalledApplications( @PackageManager.ApplicationInfoFlagsBits long flags, @UserIdInt int userId, int callingUid); int callingUid, boolean forceAllowCrossUser); @Nullable ProviderInfo resolveContentProvider(@NonNull String name, Loading
services/core/java/com/android/server/pm/ComputerEngine.java +9 −7 Original line number Diff line number Diff line Loading @@ -4640,7 +4640,7 @@ public class ComputerEngine implements Computer { @Override public List<ApplicationInfo> getInstalledApplications( @PackageManager.ApplicationInfoFlagsBits long flags, @UserIdInt int userId, int callingUid) { int callingUid, boolean forceAllowCrossUser) { if (getInstantAppPackageName(callingUid) != null) { return Collections.emptyList(); } Loading @@ -4650,12 +4650,14 @@ public class ComputerEngine implements Computer { final boolean listApex = (flags & MATCH_APEX) != 0; final boolean listArchivedOnly = !listUninstalled && (flags & MATCH_ARCHIVED_PACKAGES) != 0; if (!forceAllowCrossUser) { enforceCrossUserPermission( callingUid, userId, false /* requireFullPermission */, false /* checkShell */, "get installed application info"); } ArrayList<ApplicationInfo> list; final ArrayMap<String, ? extends PackageStateInternal> packageStates = Loading
services/core/java/com/android/server/pm/IPackageManagerBase.java +2 −1 Original line number Diff line number Diff line Loading @@ -476,7 +476,8 @@ public abstract class IPackageManagerBase extends IPackageManager.Stub { @PackageManager.ApplicationInfoFlagsBits long flags, int userId) { final int callingUid = Binder.getCallingUid(); return new ParceledListSlice<>( snapshot().getInstalledApplications(flags, userId, callingUid)); snapshot().getInstalledApplications(flags, userId, callingUid, /* forceAllowCrossUser= */ false)); } @Override Loading
services/core/java/com/android/server/pm/LauncherAppsService.java +10 −6 Original line number Diff line number Diff line Loading @@ -769,6 +769,9 @@ public class LauncherAppsService extends SystemService { @NonNull private List<LauncherActivityInfoInternal> generateLauncherActivitiesForArchivedApp( @Nullable String packageName, UserHandle user) { if (!canAccessProfile(user.getIdentifier(), "Cannot retrieve activities")) { return List.of(); } List<ApplicationInfo> applicationInfoList = (packageName == null) ? getApplicationInfoListForAllArchivedApps(user) Loading Loading @@ -827,7 +830,7 @@ public class LauncherAppsService extends SystemService { private List<ApplicationInfo> getApplicationInfoListForAllArchivedApps(UserHandle user) { final int callingUid = injectBinderCallingUid(); List<ApplicationInfo> installedApplicationInfoList = mPackageManagerInternal.getInstalledApplications( mPackageManagerInternal.getInstalledApplicationsCrossUser( PackageManager.MATCH_ARCHIVED_PACKAGES, user.getIdentifier(), callingUid); Loading @@ -845,11 +848,12 @@ public class LauncherAppsService extends SystemService { private List<ApplicationInfo> getApplicationInfoForArchivedApp( @NonNull String packageName, UserHandle user) { final int callingUid = injectBinderCallingUid(); ApplicationInfo applicationInfo = mPackageManagerInternal.getApplicationInfo( ApplicationInfo applicationInfo = Binder.withCleanCallingIdentity(() -> mPackageManagerInternal.getApplicationInfo( packageName, PackageManager.MATCH_ARCHIVED_PACKAGES, callingUid, user.getIdentifier()); user.getIdentifier())); if (applicationInfo == null || !applicationInfo.isArchived) { return Collections.EMPTY_LIST; } Loading