From 457d516dc00ba7fad59be72aee50c6f2554b2b26 Mon Sep 17 00:00:00 2001 From: Lee Shombert Date: Thu, 13 May 2021 10:28:24 -0700 Subject: [PATCH] Cleanup the PM Computer class Bug: 188048343 The Computer exposes a number of interfaces that are no longer needed outside the computer itself. The declarations are removed from the interface. PM trampolines are also removed. If the method is never locked then it is made private in ComputerEngine. Otherwise it is made protected in ComputerEngine (so it can be locked in ComputerEngineLocked) and it is made final in ComputerEngineLocked. Test: atest * CtsContentTestCases:IntentFilterTest * CtsDynamicMimeHostTestCases * CtsRoleTestCases * FrameworksServicesTests:UserSystemPackageInstallerTest * FrameworksServicesTests:PackageManagerSettingsTests * FrameworksServicesTests:PackageManagerServiceTest * FrameworksServicesTests:AppsFilterTest * FrameworksServicesTests:PackageInstallerSessionTest * FrameworksServicesTests:ScanTests * UserLifecycleTests#startUser * UserLifecycleTests#stopUser * UserLifecycleTests#switchUser * FrameworksServicesTests:WatcherTest * android.appsecurity.cts.EphemeralTest * android.appsecurity.cts.InstantAppUserTest Change-Id: I42a70ee2d7a1e1c562db482c30260361afc5b617 --- .../server/pm/PackageManagerService.java | 330 ++---------------- 1 file changed, 30 insertions(+), 300 deletions(-) diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index 20ca949651888..01c89b5da715f 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -1926,20 +1926,13 @@ public class PackageManagerService extends IPackageManager.Stub int flags, int userId); @NonNull List queryIntentServicesInternal(Intent intent, String resolvedType, int flags, int userId, int callingUid, boolean includeInstantApps); - @NonNull List queryIntentServicesInternalBody(Intent intent, - String resolvedType, int flags, int userId, int callingUid, - String instantAppPkgName); @NonNull QueryIntentActivitiesResult queryIntentActivitiesInternalBody(Intent intent, String resolvedType, int flags, int filterCallingUid, int userId, boolean resolveForStart, boolean allowDynamicSplits, String pkgName, String instantAppPkgName); - @Nullable ComponentName findInstallFailureActivity(String packageName, int filterCallingUid, - int userId); ActivityInfo getActivityInfo(ComponentName component, int flags, int userId); ActivityInfo getActivityInfoInternal(ComponentName component, int flags, int filterCallingUid, int userId); - ActivityInfo getActivityInfoInternalBody(ComponentName component, int flags, - int filterCallingUid, int userId); AndroidPackage getPackage(String packageName); AndroidPackage getPackage(int uid); ApplicationInfo generateApplicationInfoFromSettingsLPw(String packageName, int flags, @@ -1947,11 +1940,6 @@ public class PackageManagerService extends IPackageManager.Stub ApplicationInfo getApplicationInfo(String packageName, int flags, int userId); ApplicationInfo getApplicationInfoInternal(String packageName, int flags, int filterCallingUid, int userId); - ApplicationInfo getApplicationInfoInternalBody(String packageName, int flags, - int filterCallingUid, int userId); - ArrayList filterCandidatesWithDomainPreferredActivitiesLPrBody(Intent intent, - int matchFlags, List candidates, CrossProfileDomainInfo xpDomainInfo, - int userId, boolean debug); ComponentName getDefaultHomeActivity(int userId); ComponentName getHomeActivitiesAsUser(List allHomeCandidates, int userId); CrossProfileDomainInfo getCrossProfileDomainPreferredLpr(Intent intent, String resolvedType, @@ -1962,57 +1950,25 @@ public class PackageManagerService extends IPackageManager.Stub List applyPostResolutionFilter(@NonNull List resolveInfos, String ephemeralPkgName, boolean allowDynamicSplits, int filterCallingUid, boolean resolveForStart, int userId, Intent intent); - List applyPostServiceResolutionFilter(List resolveInfos, - String instantAppPkgName, @UserIdInt int userId, int filterCallingUid); - List filterCandidatesWithDomainPreferredActivitiesLPr(Intent intent, - int matchFlags, List candidates, CrossProfileDomainInfo xpDomainInfo, - int userId); - List filterIfNotSystemUser(List resolveInfos, int userId); - List maybeAddInstantAppInstaller(List result, Intent intent, - String resolvedType, int flags, int userId, boolean resolveForStart, - boolean isRequesterInstantApp); PackageInfo generatePackageInfo(PackageSetting ps, int flags, int userId); PackageInfo getPackageInfo(String packageName, int flags, int userId); PackageInfo getPackageInfoInternal(String packageName, long versionCode, int flags, int filterCallingUid, int userId); - PackageInfo getPackageInfoInternalBody(String packageName, long versionCode, int flags, - int filterCallingUid, int userId); PackageSetting getPackageSetting(String packageName); PackageSetting getPackageSettingInternal(String packageName, int callingUid); ParceledListSlice getInstalledPackages(int flags, int userId); - ParceledListSlice getInstalledPackagesBody(int flags, int userId, - int callingUid); - ResolveInfo createForwardingResolveInfo(CrossProfileIntentFilter filter, Intent intent, - String resolvedType, int flags, int sourceUserId); ResolveInfo createForwardingResolveInfoUnchecked(WatchedIntentFilter filter, int sourceUserId, int targetUserId); - ResolveInfo queryCrossProfileIntents(List matchingFilters, - Intent intent, String resolvedType, int flags, int sourceUserId, - boolean matchInCurrentProfile); - ResolveInfo querySkipCurrentProfileIntents(List matchingFilters, - Intent intent, String resolvedType, int flags, int sourceUserId); ServiceInfo getServiceInfo(ComponentName component, int flags, int userId); - ServiceInfo getServiceInfoBody(ComponentName component, int flags, int userId, - int callingUid); SharedLibraryInfo getSharedLibraryInfoLPr(String name, long version); String getInstantAppPackageName(int callingUid); String resolveExternalPackageNameLPr(AndroidPackage pkg); - String resolveInternalPackageNameInternalLocked(String packageName, long versionCode, - int callingUid); String resolveInternalPackageNameLPr(String packageName, long versionCode); String[] getPackagesForUid(int uid); - String[] getPackagesForUidInternal(int uid, int callingUid); - String[] getPackagesForUidInternalBody(int callingUid, int userId, int appId, - boolean isCallerInstantApp); UserInfo getProfileParent(int userId); - boolean areWebInstantAppsDisabled(int userId); boolean canViewInstantApps(int callingUid, int userId); boolean filterSharedLibPackageLPr(@Nullable PackageSetting ps, int uid, int userId, int flags); - boolean hasCrossUserPermission(int callingUid, int callingUserId, int userId, - boolean requireFullPermission, boolean requirePermissionWhenSameUser); - boolean hasNonNegativePriority(List resolveInfos); - boolean hasPermission(String permission); boolean isCallerSameApp(String packageName, int uid); boolean isComponentVisibleToInstantApp(@Nullable ComponentName component); boolean isComponentVisibleToInstantApp(@Nullable ComponentName component, @@ -2021,27 +1977,15 @@ public class PackageManagerService extends IPackageManager.Stub String resolvedType, int flags); boolean isInstantApp(String packageName, int userId); boolean isInstantAppInternal(String packageName, @UserIdInt int userId, int callingUid); - boolean isInstantAppInternalBody(String packageName, @UserIdInt int userId, int callingUid); - boolean isInstantAppResolutionAllowed(Intent intent, List resolvedActivities, - int userId, boolean skipPackageCheck, int flags); - boolean isInstantAppResolutionAllowedBody(Intent intent, - List resolvedActivities, int userId, boolean skipPackageCheck, - int flags); - boolean isPersistentPreferredActivitySetByDpm(Intent intent, int userId, - String resolvedType, int flags); - boolean isRecentsAccessingChildProfiles(int callingUid, int targetUserId); boolean isSameProfileGroup(@UserIdInt int callerUserId, @UserIdInt int userId); - boolean isUserEnabled(int userId); boolean shouldFilterApplicationLocked(@Nullable PackageSetting ps, int callingUid, @Nullable ComponentName component, @ComponentType int componentType, int userId); boolean shouldFilterApplicationLocked(@Nullable PackageSetting ps, int callingUid, int userId); boolean shouldFilterApplicationLocked(@NonNull SharedUserSetting sus, int callingUid, int userId); - int bestDomainVerificationStatus(int status1, int status2); int checkUidPermission(String permName, int uid); int getPackageUidInternal(String packageName, int flags, int userId, int callingUid); - int updateFlags(int flags, int userId); int updateFlagsForApplication(int flags, int userId); int updateFlagsForComponent(int flags, int userId); int updateFlagsForPackage(int flags, int userId); @@ -2348,7 +2292,7 @@ public class PackageManagerService extends IPackageManager.Stub userId, callingUid, instantAppPkgName); } - public @NonNull List queryIntentServicesInternalBody(Intent intent, + protected @NonNull List queryIntentServicesInternalBody(Intent intent, String resolvedType, int flags, int userId, int callingUid, String instantAppPkgName) { // reader @@ -2486,7 +2430,7 @@ public class PackageManagerService extends IPackageManager.Stub * creating an activity with an intent filter that handles the action * {@link Intent#ACTION_INSTALL_FAILURE}. */ - public @Nullable ComponentName findInstallFailureActivity( + private @Nullable ComponentName findInstallFailureActivity( String packageName, int filterCallingUid, int userId) { final Intent failureActivityIntent = new Intent(Intent.ACTION_INSTALL_FAILURE); failureActivityIntent.setPackage(packageName); @@ -2532,7 +2476,7 @@ public class PackageManagerService extends IPackageManager.Stub return getActivityInfoInternalBody(component, flags, filterCallingUid, userId); } - public ActivityInfo getActivityInfoInternalBody(ComponentName component, int flags, + protected ActivityInfo getActivityInfoInternalBody(ComponentName component, int flags, int filterCallingUid, int userId) { ParsedActivity a = mComponentResolver.getActivity(component); @@ -2624,7 +2568,7 @@ public class PackageManagerService extends IPackageManager.Stub return getApplicationInfoInternalBody(packageName, flags, filterCallingUid, userId); } - public ApplicationInfo getApplicationInfoInternalBody(String packageName, int flags, + protected ApplicationInfo getApplicationInfoInternalBody(String packageName, int flags, int filterCallingUid, int userId) { // writer // Normalize package name to handle renamed packages and static libs @@ -2678,7 +2622,7 @@ public class PackageManagerService extends IPackageManager.Stub return null; } - public ArrayList filterCandidatesWithDomainPreferredActivitiesLPrBody( + protected ArrayList filterCandidatesWithDomainPreferredActivitiesLPrBody( Intent intent, int matchFlags, List candidates, CrossProfileDomainInfo xpDomainInfo, int userId, boolean debug) { final ArrayList result = new ArrayList<>(); @@ -3017,7 +2961,7 @@ public class PackageManagerService extends IPackageManager.Stub return resolveInfos; } - public List applyPostServiceResolutionFilter(List resolveInfos, + private List applyPostServiceResolutionFilter(List resolveInfos, String instantAppPkgName, @UserIdInt int userId, int filterCallingUid) { for (int i = resolveInfos.size() - 1; i >= 0; i--) { final ResolveInfo info = resolveInfos.get(i); @@ -3105,7 +3049,8 @@ public class PackageManagerService extends IPackageManager.Stub * * @return filtered list */ - public List filterIfNotSystemUser(List resolveInfos, int userId) { + private List filterIfNotSystemUser(List resolveInfos, + int userId) { if (userId == UserHandle.USER_SYSTEM) { return resolveInfos; } @@ -3118,7 +3063,7 @@ public class PackageManagerService extends IPackageManager.Stub return resolveInfos; } - public List maybeAddInstantAppInstaller(List result, + private List maybeAddInstantAppInstaller(List result, Intent intent, String resolvedType, int flags, int userId, boolean resolveForStart, boolean isRequesterInstantApp) { @@ -3314,7 +3259,7 @@ public class PackageManagerService extends IPackageManager.Stub userId); } - public PackageInfo getPackageInfoInternalBody(String packageName, long versionCode, + protected PackageInfo getPackageInfoInternalBody(String packageName, long versionCode, int flags, int filterCallingUid, int userId) { // reader // Normalize package name to handle renamed packages and static libs @@ -3398,7 +3343,7 @@ public class PackageManagerService extends IPackageManager.Stub return getInstalledPackagesBody(flags, userId, callingUid); } - public ParceledListSlice getInstalledPackagesBody(int flags, int userId, + protected ParceledListSlice getInstalledPackagesBody(int flags, int userId, int callingUid) { // writer final boolean listUninstalled = (flags & MATCH_KNOWN_PACKAGES) != 0; @@ -3473,7 +3418,7 @@ public class PackageManagerService extends IPackageManager.Stub * will forward the intent to the filter's target user. * Otherwise, returns null. */ - public ResolveInfo createForwardingResolveInfo(CrossProfileIntentFilter filter, + private ResolveInfo createForwardingResolveInfo(CrossProfileIntentFilter filter, Intent intent, String resolvedType, int flags, int sourceUserId) { int targetUserId = filter.getTargetUserId(); @@ -3528,7 +3473,7 @@ public class PackageManagerService extends IPackageManager.Stub } // Return matching ResolveInfo in target user if any. - public ResolveInfo queryCrossProfileIntents( + private ResolveInfo queryCrossProfileIntents( List matchingFilters, Intent intent, String resolvedType, int flags, int sourceUserId, boolean matchInCurrentProfile) { if (matchingFilters != null) { @@ -3558,7 +3503,7 @@ public class PackageManagerService extends IPackageManager.Stub return null; } - public ResolveInfo querySkipCurrentProfileIntents( + private ResolveInfo querySkipCurrentProfileIntents( List matchingFilters, Intent intent, String resolvedType, int flags, int sourceUserId) { if (matchingFilters != null) { @@ -3589,7 +3534,7 @@ public class PackageManagerService extends IPackageManager.Stub return getServiceInfoBody(component, flags, userId, callingUid); } - public ServiceInfo getServiceInfoBody(ComponentName component, int flags, int userId, + protected ServiceInfo getServiceInfoBody(ComponentName component, int flags, int userId, int callingUid) { ParsedService s = mComponentResolver.getService(component); if (DEBUG_PACKAGE_INFO) Log.v( @@ -3656,7 +3601,7 @@ public class PackageManagerService extends IPackageManager.Stub return pkg.getPackageName(); } - public String resolveInternalPackageNameInternalLocked( + private String resolveInternalPackageNameInternalLocked( String packageName, long versionCode, int callingUid) { // Handle renamed packages String normalizedPackageName = mSettings.getRenamedPackageLPr(packageName); @@ -3748,14 +3693,14 @@ public class PackageManagerService extends IPackageManager.Stub return getPackagesForUidInternal(uid, Binder.getCallingUid()); } - public String[] getPackagesForUidInternal(int uid, int callingUid) { + private String[] getPackagesForUidInternal(int uid, int callingUid) { final boolean isCallerInstantApp = getInstantAppPackageName(callingUid) != null; final int userId = UserHandle.getUserId(uid); final int appId = UserHandle.getAppId(uid); return getPackagesForUidInternalBody(callingUid, userId, appId, isCallerInstantApp); } - public String[] getPackagesForUidInternalBody(int callingUid, int userId, int appId, + protected String[] getPackagesForUidInternalBody(int callingUid, int userId, int appId, boolean isCallerInstantApp) { // reader final Object obj = mSettings.getSettingLPr(appId); @@ -3797,7 +3742,7 @@ public class PackageManagerService extends IPackageManager.Stub /** * Returns whether or not instant apps have been disabled remotely. */ - public boolean areWebInstantAppsDisabled(int userId) { + private boolean areWebInstantAppsDisabled(int userId) { return mWebInstantAppsDisabled.get(userId); } @@ -3894,7 +3839,7 @@ public class PackageManagerService extends IPackageManager.Stub return true; } - public boolean hasCrossUserPermission( + private boolean hasCrossUserPermission( int callingUid, int callingUserId, int userId, boolean requireFullPermission, boolean requirePermissionWhenSameUser) { if (!requirePermissionWhenSameUser && userId == callingUserId) { @@ -3914,11 +3859,11 @@ public class PackageManagerService extends IPackageManager.Stub * @param resolveInfos list of resolve infos in descending priority order * @return if the list contains a resolve info with non-negative priority */ - public boolean hasNonNegativePriority(List resolveInfos) { + private boolean hasNonNegativePriority(List resolveInfos) { return resolveInfos.size() > 0 && resolveInfos.get(0).priority >= 0; } - public boolean hasPermission(String permission) { + private boolean hasPermission(String permission) { return mContext.checkCallingOrSelfPermission(permission) == PackageManager.PERMISSION_GRANTED; } @@ -4012,7 +3957,7 @@ public class PackageManagerService extends IPackageManager.Stub return isInstantAppInternalBody(packageName, userId, callingUid); } - public boolean isInstantAppInternalBody(String packageName, @UserIdInt int userId, + protected boolean isInstantAppInternalBody(String packageName, @UserIdInt int userId, int callingUid) { if (Process.isIsolated(callingUid)) { callingUid = getIsolatedOwner(callingUid); @@ -4030,7 +3975,7 @@ public class PackageManagerService extends IPackageManager.Stub return false; } - public boolean isInstantAppResolutionAllowed( + private boolean isInstantAppResolutionAllowed( Intent intent, List resolvedActivities, int userId, boolean skipPackageCheck, int flags) { if (mInstantAppResolverConnection == null) { @@ -4070,7 +4015,7 @@ public class PackageManagerService extends IPackageManager.Stub // Deny ephemeral apps if the user chose _ALWAYS or _ALWAYS_ASK for intent resolution. // Or if there's already an ephemeral app installed that handles the action - public boolean isInstantAppResolutionAllowedBody( + protected boolean isInstantAppResolutionAllowedBody( Intent intent, List resolvedActivities, int userId, boolean skipPackageCheck, int flags) { final int count = (resolvedActivities == null ? 0 : resolvedActivities.size()); @@ -4103,7 +4048,7 @@ public class PackageManagerService extends IPackageManager.Stub return true; } - public boolean isPersistentPreferredActivitySetByDpm(Intent intent, int userId, + private boolean isPersistentPreferredActivitySetByDpm(Intent intent, int userId, String resolvedType, int flags) { PersistentPreferredIntentResolver ppir = mSettings.getPersistentPreferredActivities(userId); @@ -4121,7 +4066,7 @@ public class PackageManagerService extends IPackageManager.Stub return false; } - public boolean isRecentsAccessingChildProfiles(int callingUid, int targetUserId) { + private boolean isRecentsAccessingChildProfiles(int callingUid, int targetUserId) { if (!mInjector.getLocalService(ActivityTaskManagerInternal.class) .isCallerRecents(callingUid)) { return false; @@ -4147,7 +4092,7 @@ public class PackageManagerService extends IPackageManager.Stub } } - public boolean isUserEnabled(int userId) { + private boolean isUserEnabled(int userId) { final long callingId = Binder.clearCallingIdentity(); try { UserInfo userInfo = mUserManager.getUserInfo(userId); @@ -4247,7 +4192,7 @@ public class PackageManagerService extends IPackageManager.Stub * Verification statuses are ordered from the worse to the best, except for * INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER, which is the worse. */ - public int bestDomainVerificationStatus(int status1, int status2) { + private int bestDomainVerificationStatus(int status1, int status2) { if (status1 == INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER) { return status2; } @@ -4287,7 +4232,7 @@ public class PackageManagerService extends IPackageManager.Stub /** * Update given flags based on encryption status of current user. */ - public int updateFlags(int flags, int userId) { + private int updateFlags(int flags, int userId) { if ((flags & (PackageManager.MATCH_DIRECT_BOOT_UNAWARE | PackageManager.MATCH_DIRECT_BOOT_AWARE)) != 0) { // Caller expressed an explicit opinion about what encryption @@ -7892,12 +7837,6 @@ public class PackageManagerService extends IPackageManager.Stub flags, filterCallingUid, userId); } - private PackageInfo getPackageInfoInternalBody(String packageName, long versionCode, - int flags, int filterCallingUid, int userId) { - return liveComputer().getPackageInfoInternalBody(packageName, versionCode, - flags, filterCallingUid, userId); - } - private boolean isComponentVisibleToInstantApp(@Nullable ComponentName component) { return liveComputer().isComponentVisibleToInstantApp(component); } @@ -8084,12 +8023,6 @@ public class PackageManagerService extends IPackageManager.Stub filterCallingUid, userId); } - private ApplicationInfo getApplicationInfoInternalBody(String packageName, int flags, - int filterCallingUid, int userId) { - return liveComputer().getApplicationInfoInternalBody(packageName, flags, - filterCallingUid, userId); - } - @GuardedBy("mLock") private String normalizePackageNameLPr(String packageName) { String normalizedPackageName = mSettings.getRenamedPackageLPr(packageName); @@ -8316,13 +8249,6 @@ public class PackageManagerService extends IPackageManager.Stub return false; } - /** - * Update given flags based on encryption status of current user. - */ - private int updateFlags(int flags, int userId) { - return liveComputer().updateFlags(flags, userId); - } - /** * Update given flags when being used to request {@link PackageInfo}. */ @@ -8417,16 +8343,6 @@ public class PackageManagerService extends IPackageManager.Stub filterCallingUid, userId); } - private ActivityInfo getActivityInfoInternalBody(ComponentName component, int flags, - int filterCallingUid, int userId) { - return liveComputer().getActivityInfoInternalBody(component, flags, - filterCallingUid, userId); - } - - private boolean isRecentsAccessingChildProfiles(int callingUid, int targetUserId) { - return liveComputer().isRecentsAccessingChildProfiles(callingUid, targetUserId); - } - @Override public boolean activitySupportsIntent(ComponentName component, Intent intent, String resolvedType) { @@ -8692,12 +8608,6 @@ public class PackageManagerService extends IPackageManager.Stub return snapshotComputer().getServiceInfo(component, flags, userId); } - private ServiceInfo getServiceInfoBody(ComponentName component, int flags, int userId, - int callingUid) { - return liveComputer().getServiceInfoBody(component, flags, userId, - callingUid); - } - @Override public ProviderInfo getProviderInfo(ComponentName component, int flags, int userId) { if (!mUserManager.exists(userId)) return null; @@ -9245,16 +9155,6 @@ public class PackageManagerService extends IPackageManager.Stub return snapshotComputer().getPackagesForUid(uid); } - private String[] getPackagesForUidInternal(int uid, int callingUid) { - return liveComputer().getPackagesForUidInternal(uid, callingUid); - } - - private String[] getPackagesForUidInternalBody(int callingUid, int userId, int appId, - boolean isCallerInstantApp) { - return liveComputer().getPackagesForUidInternalBody(callingUid, userId, appId, - isCallerInstantApp); - } - @Override public String getNameForUid(int uid) { final int callingUid = Binder.getCallingUid(); @@ -9558,31 +9458,6 @@ public class PackageManagerService extends IPackageManager.Stub intent, resolvedType, flags, query, 0, false, false, false, userId); } - /** - * Returns whether or not instant apps have been disabled remotely. - */ - private boolean areWebInstantAppsDisabled(int userId) { - return liveComputer().areWebInstantAppsDisabled(userId); - } - - private boolean isInstantAppResolutionAllowed( - Intent intent, List resolvedActivities, int userId, - boolean skipPackageCheck, int flags) { - return liveComputer().isInstantAppResolutionAllowed( - intent, resolvedActivities, userId, - skipPackageCheck, flags); - } - - // Deny ephemeral apps if the user chose _ALWAYS or _ALWAYS_ASK for intent resolution. - // Or if there's already an ephemeral app installed that handles the action - private boolean isInstantAppResolutionAllowedBody( - Intent intent, List resolvedActivities, int userId, - boolean skipPackageCheck, int flags) { - return liveComputer().isInstantAppResolutionAllowedBody( - intent, resolvedActivities, userId, - skipPackageCheck, flags); - } - private void requestInstantAppResolutionPhaseTwo(AuxiliaryResolveInfo responseObj, Intent origIntent, String resolvedType, String callingPackage, @Nullable String callingFeatureId, boolean isRequesterInstantApp, @@ -9734,12 +9609,6 @@ public class PackageManagerService extends IPackageManager.Stub resolvedType, flags); } - private boolean isPersistentPreferredActivitySetByDpm(Intent intent, int userId, - String resolvedType, int flags) { - return liveComputer().isPersistentPreferredActivitySetByDpm(intent, userId, - resolvedType, flags); - } - @GuardedBy("mLock") private ResolveInfo findPersistentPreferredActivityLP(Intent intent, String resolvedType, int flags, List query, boolean debug, int userId) { @@ -10133,14 +10002,6 @@ public class PackageManagerService extends IPackageManager.Stub instantAppPkgName); } - private List maybeAddInstantAppInstaller(List result, Intent intent, - String resolvedType, int flags, int userId, boolean resolveForStart, - boolean isRequesterInstantApp) { - return liveComputer().maybeAddInstantAppInstaller(result, intent, - resolvedType, flags, userId, resolveForStart, - isRequesterInstantApp); - } - private static class CrossProfileDomainInfo { /* ResolveInfo for IntentForwarderActivity to send the intent to the other profile */ ResolveInfo resolveInfo; @@ -10153,27 +10014,6 @@ public class PackageManagerService extends IPackageManager.Stub resolvedType, flags, sourceUserId, parentUserId); } - /** - * Verification statuses are ordered from the worse to the best, except for - * INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER, which is the worse. - */ - private int bestDomainVerificationStatus(int status1, int status2) { - return liveComputer().bestDomainVerificationStatus(status1, status2); - } - - private boolean isUserEnabled(int userId) { - return liveComputer().isUserEnabled(userId); - } - - /** - * Filter out activities with systemUserOnly flag set, when current user is not System. - * - * @return filtered list - */ - private List filterIfNotSystemUser(List resolveInfos, int userId) { - return liveComputer().filterIfNotSystemUser(resolveInfos, userId); - } - /** * Filters out ephemeral activities. *

When resolving for an ephemeral app, only activities that 1) are defined in the @@ -10193,72 +10033,6 @@ public class PackageManagerService extends IPackageManager.Stub resolveForStart, userId, intent); } - /** - * Returns the activity component that can handle install failures. - *

By default, the instant application installer handles failures. However, an - * application may want to handle failures on its own. Applications do this by - * creating an activity with an intent filter that handles the action - * {@link Intent#ACTION_INSTALL_FAILURE}. - */ - private @Nullable ComponentName findInstallFailureActivity( - String packageName, int filterCallingUid, int userId) { - return liveComputer().findInstallFailureActivity( - packageName, filterCallingUid, userId); - } - - /** - * @param resolveInfos list of resolve infos in descending priority order - * @return if the list contains a resolve info with non-negative priority - */ - private boolean hasNonNegativePriority(List resolveInfos) { - return liveComputer().hasNonNegativePriority(resolveInfos); - } - - private List filterCandidatesWithDomainPreferredActivitiesLPr(Intent intent, - int matchFlags, List candidates, CrossProfileDomainInfo xpDomainInfo, - int userId) { - return liveComputer().filterCandidatesWithDomainPreferredActivitiesLPr(intent, - matchFlags, candidates, xpDomainInfo, - userId); - } - - private ArrayList filterCandidatesWithDomainPreferredActivitiesLPrBody( - Intent intent, int matchFlags, List candidates, - CrossProfileDomainInfo xpDomainInfo, int userId, boolean debug) { - return liveComputer().filterCandidatesWithDomainPreferredActivitiesLPrBody( - intent, matchFlags, candidates, - xpDomainInfo, userId, debug); - } - - - private ResolveInfo querySkipCurrentProfileIntents( - List matchingFilters, Intent intent, String resolvedType, - int flags, int sourceUserId) { - return liveComputer().querySkipCurrentProfileIntents( - matchingFilters, intent, resolvedType, - flags, sourceUserId); - } - - // Return matching ResolveInfo in target user if any. - private ResolveInfo queryCrossProfileIntents( - List matchingFilters, Intent intent, String resolvedType, - int flags, int sourceUserId, boolean matchInCurrentProfile) { - return liveComputer().queryCrossProfileIntents( - matchingFilters, intent, resolvedType, - flags, sourceUserId, matchInCurrentProfile); - } - - /** - * If the filter's target user can handle the intent and is enabled: returns a ResolveInfo that - * will forward the intent to the filter's target user. - * Otherwise, returns null. - */ - private ResolveInfo createForwardingResolveInfo(CrossProfileIntentFilter filter, Intent intent, - String resolvedType, int flags, int sourceUserId) { - return liveComputer().createForwardingResolveInfo(filter, intent, - resolvedType, flags, sourceUserId); - } - @Override public @NonNull ParceledListSlice queryIntentActivityOptions(ComponentName caller, Intent[] specifics, String[] specificTypes, Intent intent, @@ -10580,20 +10354,6 @@ public class PackageManagerService extends IPackageManager.Stub includeInstantApps); } - private @NonNull List queryIntentServicesInternalBody(Intent intent, - String resolvedType, int flags, int userId, int callingUid, - String instantAppPkgName) { - return liveComputer().queryIntentServicesInternalBody(intent, - resolvedType, flags, userId, callingUid, - instantAppPkgName); - } - - private List applyPostServiceResolutionFilter(List resolveInfos, - String instantAppPkgName, @UserIdInt int userId, int filterCallingUid) { - return liveComputer().applyPostServiceResolutionFilter(resolveInfos, - instantAppPkgName, userId, filterCallingUid); - } - @Override public @NonNull ParceledListSlice queryIntentContentProviders(Intent intent, String resolvedType, int flags, int userId) { @@ -10746,12 +10506,6 @@ public class PackageManagerService extends IPackageManager.Stub return snapshotComputer().getInstalledPackages(flags, userId); } - private ParceledListSlice getInstalledPackagesBody(int flags, int userId, - int callingUid) { - return liveComputer().getInstalledPackagesBody(flags, userId, - callingUid); - } - private void addPackageHoldingPermissions(ArrayList list, PackageSetting ps, String[] permissions, boolean[] tmp, int flags, int userId) { int numMatch = 0; @@ -10935,12 +10689,6 @@ public class PackageManagerService extends IPackageManager.Stub callingUid); } - private boolean isInstantAppInternalBody(String packageName, @UserIdInt int userId, - int callingUid) { - return liveComputer().isInstantAppInternalBody(packageName, userId, - callingUid); - } - @Override public byte[] getInstantAppCookie(String packageName, int userId) { if (HIDE_EPHEMERAL_APIS) { @@ -11796,18 +11544,6 @@ public class PackageManagerService extends IPackageManager.Stub requireFullPermission, checkShell, message); } - private boolean hasCrossUserPermission( - int callingUid, int callingUserId, int userId, boolean requireFullPermission, - boolean requirePermissionWhenSameUser) { - return liveComputer().hasCrossUserPermission( - callingUid, callingUserId, userId, requireFullPermission, - requirePermissionWhenSameUser); - } - - private boolean hasPermission(String permission) { - return liveComputer().hasPermission(permission); - } - private boolean isSameProfileGroup(@UserIdInt int callerUserId, @UserIdInt int userId) { return liveComputer().isSameProfileGroup(callerUserId, userId); } @@ -20681,12 +20417,6 @@ public class PackageManagerService extends IPackageManager.Stub return liveComputer().resolveInternalPackageNameLPr(packageName, versionCode); } - private String resolveInternalPackageNameInternalLocked( - String packageName, long versionCode, int callingUid) { - return liveComputer().resolveInternalPackageNameInternalLocked( - packageName, versionCode, callingUid); - } - boolean isCallerVerifier(int callingUid) { final int callingUserId = UserHandle.getUserId(callingUid); return mRequiredVerifierPackage != null &&