Merge "Cleanup the PM Computer class" into sc-dev am: ec0e59ec1b

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14532868

Change-Id: I887020290ed8025e354ed5f239af3c6bfbdb955d
This commit is contained in:
Lee Shombert
2021-05-14 18:07:49 +00:00
committed by Automerger Merge Worker

View File

@@ -1926,20 +1926,13 @@ public class PackageManagerService extends IPackageManager.Stub
int flags, int userId); int flags, int userId);
@NonNull List<ResolveInfo> queryIntentServicesInternal(Intent intent, String resolvedType, @NonNull List<ResolveInfo> queryIntentServicesInternal(Intent intent, String resolvedType,
int flags, int userId, int callingUid, boolean includeInstantApps); int flags, int userId, int callingUid, boolean includeInstantApps);
@NonNull List<ResolveInfo> queryIntentServicesInternalBody(Intent intent,
String resolvedType, int flags, int userId, int callingUid,
String instantAppPkgName);
@NonNull QueryIntentActivitiesResult queryIntentActivitiesInternalBody(Intent intent, @NonNull QueryIntentActivitiesResult queryIntentActivitiesInternalBody(Intent intent,
String resolvedType, int flags, int filterCallingUid, int userId, String resolvedType, int flags, int filterCallingUid, int userId,
boolean resolveForStart, boolean allowDynamicSplits, String pkgName, boolean resolveForStart, boolean allowDynamicSplits, String pkgName,
String instantAppPkgName); String instantAppPkgName);
@Nullable ComponentName findInstallFailureActivity(String packageName, int filterCallingUid,
int userId);
ActivityInfo getActivityInfo(ComponentName component, int flags, int userId); ActivityInfo getActivityInfo(ComponentName component, int flags, int userId);
ActivityInfo getActivityInfoInternal(ComponentName component, int flags, ActivityInfo getActivityInfoInternal(ComponentName component, int flags,
int filterCallingUid, int userId); int filterCallingUid, int userId);
ActivityInfo getActivityInfoInternalBody(ComponentName component, int flags,
int filterCallingUid, int userId);
AndroidPackage getPackage(String packageName); AndroidPackage getPackage(String packageName);
AndroidPackage getPackage(int uid); AndroidPackage getPackage(int uid);
ApplicationInfo generateApplicationInfoFromSettingsLPw(String packageName, int flags, 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 getApplicationInfo(String packageName, int flags, int userId);
ApplicationInfo getApplicationInfoInternal(String packageName, int flags, ApplicationInfo getApplicationInfoInternal(String packageName, int flags,
int filterCallingUid, int userId); int filterCallingUid, int userId);
ApplicationInfo getApplicationInfoInternalBody(String packageName, int flags,
int filterCallingUid, int userId);
ArrayList<ResolveInfo> filterCandidatesWithDomainPreferredActivitiesLPrBody(Intent intent,
int matchFlags, List<ResolveInfo> candidates, CrossProfileDomainInfo xpDomainInfo,
int userId, boolean debug);
ComponentName getDefaultHomeActivity(int userId); ComponentName getDefaultHomeActivity(int userId);
ComponentName getHomeActivitiesAsUser(List<ResolveInfo> allHomeCandidates, int userId); ComponentName getHomeActivitiesAsUser(List<ResolveInfo> allHomeCandidates, int userId);
CrossProfileDomainInfo getCrossProfileDomainPreferredLpr(Intent intent, String resolvedType, CrossProfileDomainInfo getCrossProfileDomainPreferredLpr(Intent intent, String resolvedType,
@@ -1962,57 +1950,25 @@ public class PackageManagerService extends IPackageManager.Stub
List<ResolveInfo> applyPostResolutionFilter(@NonNull List<ResolveInfo> resolveInfos, List<ResolveInfo> applyPostResolutionFilter(@NonNull List<ResolveInfo> resolveInfos,
String ephemeralPkgName, boolean allowDynamicSplits, int filterCallingUid, String ephemeralPkgName, boolean allowDynamicSplits, int filterCallingUid,
boolean resolveForStart, int userId, Intent intent); boolean resolveForStart, int userId, Intent intent);
List<ResolveInfo> applyPostServiceResolutionFilter(List<ResolveInfo> resolveInfos,
String instantAppPkgName, @UserIdInt int userId, int filterCallingUid);
List<ResolveInfo> filterCandidatesWithDomainPreferredActivitiesLPr(Intent intent,
int matchFlags, List<ResolveInfo> candidates, CrossProfileDomainInfo xpDomainInfo,
int userId);
List<ResolveInfo> filterIfNotSystemUser(List<ResolveInfo> resolveInfos, int userId);
List<ResolveInfo> maybeAddInstantAppInstaller(List<ResolveInfo> result, Intent intent,
String resolvedType, int flags, int userId, boolean resolveForStart,
boolean isRequesterInstantApp);
PackageInfo generatePackageInfo(PackageSetting ps, int flags, int userId); PackageInfo generatePackageInfo(PackageSetting ps, int flags, int userId);
PackageInfo getPackageInfo(String packageName, int flags, int userId); PackageInfo getPackageInfo(String packageName, int flags, int userId);
PackageInfo getPackageInfoInternal(String packageName, long versionCode, int flags, PackageInfo getPackageInfoInternal(String packageName, long versionCode, int flags,
int filterCallingUid, int userId); int filterCallingUid, int userId);
PackageInfo getPackageInfoInternalBody(String packageName, long versionCode, int flags,
int filterCallingUid, int userId);
PackageSetting getPackageSetting(String packageName); PackageSetting getPackageSetting(String packageName);
PackageSetting getPackageSettingInternal(String packageName, int callingUid); PackageSetting getPackageSettingInternal(String packageName, int callingUid);
ParceledListSlice<PackageInfo> getInstalledPackages(int flags, int userId); ParceledListSlice<PackageInfo> getInstalledPackages(int flags, int userId);
ParceledListSlice<PackageInfo> getInstalledPackagesBody(int flags, int userId,
int callingUid);
ResolveInfo createForwardingResolveInfo(CrossProfileIntentFilter filter, Intent intent,
String resolvedType, int flags, int sourceUserId);
ResolveInfo createForwardingResolveInfoUnchecked(WatchedIntentFilter filter, ResolveInfo createForwardingResolveInfoUnchecked(WatchedIntentFilter filter,
int sourceUserId, int targetUserId); int sourceUserId, int targetUserId);
ResolveInfo queryCrossProfileIntents(List<CrossProfileIntentFilter> matchingFilters,
Intent intent, String resolvedType, int flags, int sourceUserId,
boolean matchInCurrentProfile);
ResolveInfo querySkipCurrentProfileIntents(List<CrossProfileIntentFilter> matchingFilters,
Intent intent, String resolvedType, int flags, int sourceUserId);
ServiceInfo getServiceInfo(ComponentName component, int flags, int userId); ServiceInfo getServiceInfo(ComponentName component, int flags, int userId);
ServiceInfo getServiceInfoBody(ComponentName component, int flags, int userId,
int callingUid);
SharedLibraryInfo getSharedLibraryInfoLPr(String name, long version); SharedLibraryInfo getSharedLibraryInfoLPr(String name, long version);
String getInstantAppPackageName(int callingUid); String getInstantAppPackageName(int callingUid);
String resolveExternalPackageNameLPr(AndroidPackage pkg); String resolveExternalPackageNameLPr(AndroidPackage pkg);
String resolveInternalPackageNameInternalLocked(String packageName, long versionCode,
int callingUid);
String resolveInternalPackageNameLPr(String packageName, long versionCode); String resolveInternalPackageNameLPr(String packageName, long versionCode);
String[] getPackagesForUid(int uid); String[] getPackagesForUid(int uid);
String[] getPackagesForUidInternal(int uid, int callingUid);
String[] getPackagesForUidInternalBody(int callingUid, int userId, int appId,
boolean isCallerInstantApp);
UserInfo getProfileParent(int userId); UserInfo getProfileParent(int userId);
boolean areWebInstantAppsDisabled(int userId);
boolean canViewInstantApps(int callingUid, int userId); boolean canViewInstantApps(int callingUid, int userId);
boolean filterSharedLibPackageLPr(@Nullable PackageSetting ps, int uid, int userId, boolean filterSharedLibPackageLPr(@Nullable PackageSetting ps, int uid, int userId,
int flags); int flags);
boolean hasCrossUserPermission(int callingUid, int callingUserId, int userId,
boolean requireFullPermission, boolean requirePermissionWhenSameUser);
boolean hasNonNegativePriority(List<ResolveInfo> resolveInfos);
boolean hasPermission(String permission);
boolean isCallerSameApp(String packageName, int uid); boolean isCallerSameApp(String packageName, int uid);
boolean isComponentVisibleToInstantApp(@Nullable ComponentName component); boolean isComponentVisibleToInstantApp(@Nullable ComponentName component);
boolean isComponentVisibleToInstantApp(@Nullable ComponentName component, boolean isComponentVisibleToInstantApp(@Nullable ComponentName component,
@@ -2021,27 +1977,15 @@ public class PackageManagerService extends IPackageManager.Stub
String resolvedType, int flags); String resolvedType, int flags);
boolean isInstantApp(String packageName, int userId); boolean isInstantApp(String packageName, int userId);
boolean isInstantAppInternal(String packageName, @UserIdInt int userId, int callingUid); boolean isInstantAppInternal(String packageName, @UserIdInt int userId, int callingUid);
boolean isInstantAppInternalBody(String packageName, @UserIdInt int userId, int callingUid);
boolean isInstantAppResolutionAllowed(Intent intent, List<ResolveInfo> resolvedActivities,
int userId, boolean skipPackageCheck, int flags);
boolean isInstantAppResolutionAllowedBody(Intent intent,
List<ResolveInfo> 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 isSameProfileGroup(@UserIdInt int callerUserId, @UserIdInt int userId);
boolean isUserEnabled(int userId);
boolean shouldFilterApplicationLocked(@Nullable PackageSetting ps, int callingUid, boolean shouldFilterApplicationLocked(@Nullable PackageSetting ps, int callingUid,
@Nullable ComponentName component, @ComponentType int componentType, int userId); @Nullable ComponentName component, @ComponentType int componentType, int userId);
boolean shouldFilterApplicationLocked(@Nullable PackageSetting ps, int callingUid, boolean shouldFilterApplicationLocked(@Nullable PackageSetting ps, int callingUid,
int userId); int userId);
boolean shouldFilterApplicationLocked(@NonNull SharedUserSetting sus, int callingUid, boolean shouldFilterApplicationLocked(@NonNull SharedUserSetting sus, int callingUid,
int userId); int userId);
int bestDomainVerificationStatus(int status1, int status2);
int checkUidPermission(String permName, int uid); int checkUidPermission(String permName, int uid);
int getPackageUidInternal(String packageName, int flags, int userId, int callingUid); int getPackageUidInternal(String packageName, int flags, int userId, int callingUid);
int updateFlags(int flags, int userId);
int updateFlagsForApplication(int flags, int userId); int updateFlagsForApplication(int flags, int userId);
int updateFlagsForComponent(int flags, int userId); int updateFlagsForComponent(int flags, int userId);
int updateFlagsForPackage(int flags, int userId); int updateFlagsForPackage(int flags, int userId);
@@ -2348,7 +2292,7 @@ public class PackageManagerService extends IPackageManager.Stub
userId, callingUid, instantAppPkgName); userId, callingUid, instantAppPkgName);
} }
public @NonNull List<ResolveInfo> queryIntentServicesInternalBody(Intent intent, protected @NonNull List<ResolveInfo> queryIntentServicesInternalBody(Intent intent,
String resolvedType, int flags, int userId, int callingUid, String resolvedType, int flags, int userId, int callingUid,
String instantAppPkgName) { String instantAppPkgName) {
// reader // reader
@@ -2486,7 +2430,7 @@ public class PackageManagerService extends IPackageManager.Stub
* creating an activity with an intent filter that handles the action * creating an activity with an intent filter that handles the action
* {@link Intent#ACTION_INSTALL_FAILURE}. * {@link Intent#ACTION_INSTALL_FAILURE}.
*/ */
public @Nullable ComponentName findInstallFailureActivity( private @Nullable ComponentName findInstallFailureActivity(
String packageName, int filterCallingUid, int userId) { String packageName, int filterCallingUid, int userId) {
final Intent failureActivityIntent = new Intent(Intent.ACTION_INSTALL_FAILURE); final Intent failureActivityIntent = new Intent(Intent.ACTION_INSTALL_FAILURE);
failureActivityIntent.setPackage(packageName); failureActivityIntent.setPackage(packageName);
@@ -2532,7 +2476,7 @@ public class PackageManagerService extends IPackageManager.Stub
return getActivityInfoInternalBody(component, flags, filterCallingUid, userId); return getActivityInfoInternalBody(component, flags, filterCallingUid, userId);
} }
public ActivityInfo getActivityInfoInternalBody(ComponentName component, int flags, protected ActivityInfo getActivityInfoInternalBody(ComponentName component, int flags,
int filterCallingUid, int userId) { int filterCallingUid, int userId) {
ParsedActivity a = mComponentResolver.getActivity(component); ParsedActivity a = mComponentResolver.getActivity(component);
@@ -2624,7 +2568,7 @@ public class PackageManagerService extends IPackageManager.Stub
return getApplicationInfoInternalBody(packageName, flags, filterCallingUid, userId); return getApplicationInfoInternalBody(packageName, flags, filterCallingUid, userId);
} }
public ApplicationInfo getApplicationInfoInternalBody(String packageName, int flags, protected ApplicationInfo getApplicationInfoInternalBody(String packageName, int flags,
int filterCallingUid, int userId) { int filterCallingUid, int userId) {
// writer // writer
// Normalize package name to handle renamed packages and static libs // Normalize package name to handle renamed packages and static libs
@@ -2678,7 +2622,7 @@ public class PackageManagerService extends IPackageManager.Stub
return null; return null;
} }
public ArrayList<ResolveInfo> filterCandidatesWithDomainPreferredActivitiesLPrBody( protected ArrayList<ResolveInfo> filterCandidatesWithDomainPreferredActivitiesLPrBody(
Intent intent, int matchFlags, List<ResolveInfo> candidates, Intent intent, int matchFlags, List<ResolveInfo> candidates,
CrossProfileDomainInfo xpDomainInfo, int userId, boolean debug) { CrossProfileDomainInfo xpDomainInfo, int userId, boolean debug) {
final ArrayList<ResolveInfo> result = new ArrayList<>(); final ArrayList<ResolveInfo> result = new ArrayList<>();
@@ -3017,7 +2961,7 @@ public class PackageManagerService extends IPackageManager.Stub
return resolveInfos; return resolveInfos;
} }
public List<ResolveInfo> applyPostServiceResolutionFilter(List<ResolveInfo> resolveInfos, private List<ResolveInfo> applyPostServiceResolutionFilter(List<ResolveInfo> resolveInfos,
String instantAppPkgName, @UserIdInt int userId, int filterCallingUid) { String instantAppPkgName, @UserIdInt int userId, int filterCallingUid) {
for (int i = resolveInfos.size() - 1; i >= 0; i--) { for (int i = resolveInfos.size() - 1; i >= 0; i--) {
final ResolveInfo info = resolveInfos.get(i); final ResolveInfo info = resolveInfos.get(i);
@@ -3105,7 +3049,8 @@ public class PackageManagerService extends IPackageManager.Stub
* *
* @return filtered list * @return filtered list
*/ */
public List<ResolveInfo> filterIfNotSystemUser(List<ResolveInfo> resolveInfos, int userId) { private List<ResolveInfo> filterIfNotSystemUser(List<ResolveInfo> resolveInfos,
int userId) {
if (userId == UserHandle.USER_SYSTEM) { if (userId == UserHandle.USER_SYSTEM) {
return resolveInfos; return resolveInfos;
} }
@@ -3118,7 +3063,7 @@ public class PackageManagerService extends IPackageManager.Stub
return resolveInfos; return resolveInfos;
} }
public List<ResolveInfo> maybeAddInstantAppInstaller(List<ResolveInfo> result, private List<ResolveInfo> maybeAddInstantAppInstaller(List<ResolveInfo> result,
Intent intent, Intent intent,
String resolvedType, int flags, int userId, boolean resolveForStart, String resolvedType, int flags, int userId, boolean resolveForStart,
boolean isRequesterInstantApp) { boolean isRequesterInstantApp) {
@@ -3314,7 +3259,7 @@ public class PackageManagerService extends IPackageManager.Stub
userId); userId);
} }
public PackageInfo getPackageInfoInternalBody(String packageName, long versionCode, protected PackageInfo getPackageInfoInternalBody(String packageName, long versionCode,
int flags, int filterCallingUid, int userId) { int flags, int filterCallingUid, int userId) {
// reader // reader
// Normalize package name to handle renamed packages and static libs // 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); return getInstalledPackagesBody(flags, userId, callingUid);
} }
public ParceledListSlice<PackageInfo> getInstalledPackagesBody(int flags, int userId, protected ParceledListSlice<PackageInfo> getInstalledPackagesBody(int flags, int userId,
int callingUid) { int callingUid) {
// writer // writer
final boolean listUninstalled = (flags & MATCH_KNOWN_PACKAGES) != 0; 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. * will forward the intent to the filter's target user.
* Otherwise, returns null. * Otherwise, returns null.
*/ */
public ResolveInfo createForwardingResolveInfo(CrossProfileIntentFilter filter, private ResolveInfo createForwardingResolveInfo(CrossProfileIntentFilter filter,
Intent intent, Intent intent,
String resolvedType, int flags, int sourceUserId) { String resolvedType, int flags, int sourceUserId) {
int targetUserId = filter.getTargetUserId(); int targetUserId = filter.getTargetUserId();
@@ -3528,7 +3473,7 @@ public class PackageManagerService extends IPackageManager.Stub
} }
// Return matching ResolveInfo in target user if any. // Return matching ResolveInfo in target user if any.
public ResolveInfo queryCrossProfileIntents( private ResolveInfo queryCrossProfileIntents(
List<CrossProfileIntentFilter> matchingFilters, Intent intent, String resolvedType, List<CrossProfileIntentFilter> matchingFilters, Intent intent, String resolvedType,
int flags, int sourceUserId, boolean matchInCurrentProfile) { int flags, int sourceUserId, boolean matchInCurrentProfile) {
if (matchingFilters != null) { if (matchingFilters != null) {
@@ -3558,7 +3503,7 @@ public class PackageManagerService extends IPackageManager.Stub
return null; return null;
} }
public ResolveInfo querySkipCurrentProfileIntents( private ResolveInfo querySkipCurrentProfileIntents(
List<CrossProfileIntentFilter> matchingFilters, Intent intent, String resolvedType, List<CrossProfileIntentFilter> matchingFilters, Intent intent, String resolvedType,
int flags, int sourceUserId) { int flags, int sourceUserId) {
if (matchingFilters != null) { if (matchingFilters != null) {
@@ -3589,7 +3534,7 @@ public class PackageManagerService extends IPackageManager.Stub
return getServiceInfoBody(component, flags, userId, callingUid); 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) { int callingUid) {
ParsedService s = mComponentResolver.getService(component); ParsedService s = mComponentResolver.getService(component);
if (DEBUG_PACKAGE_INFO) Log.v( if (DEBUG_PACKAGE_INFO) Log.v(
@@ -3656,7 +3601,7 @@ public class PackageManagerService extends IPackageManager.Stub
return pkg.getPackageName(); return pkg.getPackageName();
} }
public String resolveInternalPackageNameInternalLocked( private String resolveInternalPackageNameInternalLocked(
String packageName, long versionCode, int callingUid) { String packageName, long versionCode, int callingUid) {
// Handle renamed packages // Handle renamed packages
String normalizedPackageName = mSettings.getRenamedPackageLPr(packageName); String normalizedPackageName = mSettings.getRenamedPackageLPr(packageName);
@@ -3748,14 +3693,14 @@ public class PackageManagerService extends IPackageManager.Stub
return getPackagesForUidInternal(uid, Binder.getCallingUid()); 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 boolean isCallerInstantApp = getInstantAppPackageName(callingUid) != null;
final int userId = UserHandle.getUserId(uid); final int userId = UserHandle.getUserId(uid);
final int appId = UserHandle.getAppId(uid); final int appId = UserHandle.getAppId(uid);
return getPackagesForUidInternalBody(callingUid, userId, appId, isCallerInstantApp); 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) { boolean isCallerInstantApp) {
// reader // reader
final Object obj = mSettings.getSettingLPr(appId); 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. * Returns whether or not instant apps have been disabled remotely.
*/ */
public boolean areWebInstantAppsDisabled(int userId) { private boolean areWebInstantAppsDisabled(int userId) {
return mWebInstantAppsDisabled.get(userId); return mWebInstantAppsDisabled.get(userId);
} }
@@ -3894,7 +3839,7 @@ public class PackageManagerService extends IPackageManager.Stub
return true; return true;
} }
public boolean hasCrossUserPermission( private boolean hasCrossUserPermission(
int callingUid, int callingUserId, int userId, boolean requireFullPermission, int callingUid, int callingUserId, int userId, boolean requireFullPermission,
boolean requirePermissionWhenSameUser) { boolean requirePermissionWhenSameUser) {
if (!requirePermissionWhenSameUser && userId == callingUserId) { if (!requirePermissionWhenSameUser && userId == callingUserId) {
@@ -3914,11 +3859,11 @@ public class PackageManagerService extends IPackageManager.Stub
* @param resolveInfos list of resolve infos in descending priority order * @param resolveInfos list of resolve infos in descending priority order
* @return if the list contains a resolve info with non-negative priority * @return if the list contains a resolve info with non-negative priority
*/ */
public boolean hasNonNegativePriority(List<ResolveInfo> resolveInfos) { private boolean hasNonNegativePriority(List<ResolveInfo> resolveInfos) {
return resolveInfos.size() > 0 && resolveInfos.get(0).priority >= 0; return resolveInfos.size() > 0 && resolveInfos.get(0).priority >= 0;
} }
public boolean hasPermission(String permission) { private boolean hasPermission(String permission) {
return mContext.checkCallingOrSelfPermission(permission) return mContext.checkCallingOrSelfPermission(permission)
== PackageManager.PERMISSION_GRANTED; == PackageManager.PERMISSION_GRANTED;
} }
@@ -4012,7 +3957,7 @@ public class PackageManagerService extends IPackageManager.Stub
return isInstantAppInternalBody(packageName, userId, callingUid); return isInstantAppInternalBody(packageName, userId, callingUid);
} }
public boolean isInstantAppInternalBody(String packageName, @UserIdInt int userId, protected boolean isInstantAppInternalBody(String packageName, @UserIdInt int userId,
int callingUid) { int callingUid) {
if (Process.isIsolated(callingUid)) { if (Process.isIsolated(callingUid)) {
callingUid = getIsolatedOwner(callingUid); callingUid = getIsolatedOwner(callingUid);
@@ -4030,7 +3975,7 @@ public class PackageManagerService extends IPackageManager.Stub
return false; return false;
} }
public boolean isInstantAppResolutionAllowed( private boolean isInstantAppResolutionAllowed(
Intent intent, List<ResolveInfo> resolvedActivities, int userId, Intent intent, List<ResolveInfo> resolvedActivities, int userId,
boolean skipPackageCheck, int flags) { boolean skipPackageCheck, int flags) {
if (mInstantAppResolverConnection == null) { 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. // 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 // Or if there's already an ephemeral app installed that handles the action
public boolean isInstantAppResolutionAllowedBody( protected boolean isInstantAppResolutionAllowedBody(
Intent intent, List<ResolveInfo> resolvedActivities, int userId, Intent intent, List<ResolveInfo> resolvedActivities, int userId,
boolean skipPackageCheck, int flags) { boolean skipPackageCheck, int flags) {
final int count = (resolvedActivities == null ? 0 : resolvedActivities.size()); final int count = (resolvedActivities == null ? 0 : resolvedActivities.size());
@@ -4103,7 +4048,7 @@ public class PackageManagerService extends IPackageManager.Stub
return true; return true;
} }
public boolean isPersistentPreferredActivitySetByDpm(Intent intent, int userId, private boolean isPersistentPreferredActivitySetByDpm(Intent intent, int userId,
String resolvedType, int flags) { String resolvedType, int flags) {
PersistentPreferredIntentResolver ppir = PersistentPreferredIntentResolver ppir =
mSettings.getPersistentPreferredActivities(userId); mSettings.getPersistentPreferredActivities(userId);
@@ -4121,7 +4066,7 @@ public class PackageManagerService extends IPackageManager.Stub
return false; return false;
} }
public boolean isRecentsAccessingChildProfiles(int callingUid, int targetUserId) { private boolean isRecentsAccessingChildProfiles(int callingUid, int targetUserId) {
if (!mInjector.getLocalService(ActivityTaskManagerInternal.class) if (!mInjector.getLocalService(ActivityTaskManagerInternal.class)
.isCallerRecents(callingUid)) { .isCallerRecents(callingUid)) {
return false; 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(); final long callingId = Binder.clearCallingIdentity();
try { try {
UserInfo userInfo = mUserManager.getUserInfo(userId); 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 * Verification statuses are ordered from the worse to the best, except for
* INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER, which is the worse. * 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) { if (status1 == INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER) {
return status2; return status2;
} }
@@ -4287,7 +4232,7 @@ public class PackageManagerService extends IPackageManager.Stub
/** /**
* Update given flags based on encryption status of current user. * 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 if ((flags & (PackageManager.MATCH_DIRECT_BOOT_UNAWARE
| PackageManager.MATCH_DIRECT_BOOT_AWARE)) != 0) { | PackageManager.MATCH_DIRECT_BOOT_AWARE)) != 0) {
// Caller expressed an explicit opinion about what encryption // Caller expressed an explicit opinion about what encryption
@@ -7892,12 +7837,6 @@ public class PackageManagerService extends IPackageManager.Stub
flags, filterCallingUid, userId); 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) { private boolean isComponentVisibleToInstantApp(@Nullable ComponentName component) {
return liveComputer().isComponentVisibleToInstantApp(component); return liveComputer().isComponentVisibleToInstantApp(component);
} }
@@ -8084,12 +8023,6 @@ public class PackageManagerService extends IPackageManager.Stub
filterCallingUid, userId); filterCallingUid, userId);
} }
private ApplicationInfo getApplicationInfoInternalBody(String packageName, int flags,
int filterCallingUid, int userId) {
return liveComputer().getApplicationInfoInternalBody(packageName, flags,
filterCallingUid, userId);
}
@GuardedBy("mLock") @GuardedBy("mLock")
private String normalizePackageNameLPr(String packageName) { private String normalizePackageNameLPr(String packageName) {
String normalizedPackageName = mSettings.getRenamedPackageLPr(packageName); String normalizedPackageName = mSettings.getRenamedPackageLPr(packageName);
@@ -8316,13 +8249,6 @@ public class PackageManagerService extends IPackageManager.Stub
return false; 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}. * Update given flags when being used to request {@link PackageInfo}.
*/ */
@@ -8417,16 +8343,6 @@ public class PackageManagerService extends IPackageManager.Stub
filterCallingUid, userId); 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 @Override
public boolean activitySupportsIntent(ComponentName component, Intent intent, public boolean activitySupportsIntent(ComponentName component, Intent intent,
String resolvedType) { String resolvedType) {
@@ -8692,12 +8608,6 @@ public class PackageManagerService extends IPackageManager.Stub
return snapshotComputer().getServiceInfo(component, flags, userId); 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 @Override
public ProviderInfo getProviderInfo(ComponentName component, int flags, int userId) { public ProviderInfo getProviderInfo(ComponentName component, int flags, int userId) {
if (!mUserManager.exists(userId)) return null; if (!mUserManager.exists(userId)) return null;
@@ -9245,16 +9155,6 @@ public class PackageManagerService extends IPackageManager.Stub
return snapshotComputer().getPackagesForUid(uid); 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 @Override
public String getNameForUid(int uid) { public String getNameForUid(int uid) {
final int callingUid = Binder.getCallingUid(); final int callingUid = Binder.getCallingUid();
@@ -9558,31 +9458,6 @@ public class PackageManagerService extends IPackageManager.Stub
intent, resolvedType, flags, query, 0, false, false, false, userId); 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<ResolveInfo> 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<ResolveInfo> resolvedActivities, int userId,
boolean skipPackageCheck, int flags) {
return liveComputer().isInstantAppResolutionAllowedBody(
intent, resolvedActivities, userId,
skipPackageCheck, flags);
}
private void requestInstantAppResolutionPhaseTwo(AuxiliaryResolveInfo responseObj, private void requestInstantAppResolutionPhaseTwo(AuxiliaryResolveInfo responseObj,
Intent origIntent, String resolvedType, String callingPackage, Intent origIntent, String resolvedType, String callingPackage,
@Nullable String callingFeatureId, boolean isRequesterInstantApp, @Nullable String callingFeatureId, boolean isRequesterInstantApp,
@@ -9734,12 +9609,6 @@ public class PackageManagerService extends IPackageManager.Stub
resolvedType, flags); resolvedType, flags);
} }
private boolean isPersistentPreferredActivitySetByDpm(Intent intent, int userId,
String resolvedType, int flags) {
return liveComputer().isPersistentPreferredActivitySetByDpm(intent, userId,
resolvedType, flags);
}
@GuardedBy("mLock") @GuardedBy("mLock")
private ResolveInfo findPersistentPreferredActivityLP(Intent intent, String resolvedType, private ResolveInfo findPersistentPreferredActivityLP(Intent intent, String resolvedType,
int flags, List<ResolveInfo> query, boolean debug, int userId) { int flags, List<ResolveInfo> query, boolean debug, int userId) {
@@ -10133,14 +10002,6 @@ public class PackageManagerService extends IPackageManager.Stub
instantAppPkgName); instantAppPkgName);
} }
private List<ResolveInfo> maybeAddInstantAppInstaller(List<ResolveInfo> 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 { private static class CrossProfileDomainInfo {
/* ResolveInfo for IntentForwarderActivity to send the intent to the other profile */ /* ResolveInfo for IntentForwarderActivity to send the intent to the other profile */
ResolveInfo resolveInfo; ResolveInfo resolveInfo;
@@ -10153,27 +10014,6 @@ public class PackageManagerService extends IPackageManager.Stub
resolvedType, flags, sourceUserId, parentUserId); 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<ResolveInfo> filterIfNotSystemUser(List<ResolveInfo> resolveInfos, int userId) {
return liveComputer().filterIfNotSystemUser(resolveInfos, userId);
}
/** /**
* Filters out ephemeral activities. * Filters out ephemeral activities.
* <p>When resolving for an ephemeral app, only activities that 1) are defined in the * <p>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); resolveForStart, userId, intent);
} }
/**
* Returns the activity component that can handle install failures.
* <p>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<ResolveInfo> resolveInfos) {
return liveComputer().hasNonNegativePriority(resolveInfos);
}
private List<ResolveInfo> filterCandidatesWithDomainPreferredActivitiesLPr(Intent intent,
int matchFlags, List<ResolveInfo> candidates, CrossProfileDomainInfo xpDomainInfo,
int userId) {
return liveComputer().filterCandidatesWithDomainPreferredActivitiesLPr(intent,
matchFlags, candidates, xpDomainInfo,
userId);
}
private ArrayList<ResolveInfo> filterCandidatesWithDomainPreferredActivitiesLPrBody(
Intent intent, int matchFlags, List<ResolveInfo> candidates,
CrossProfileDomainInfo xpDomainInfo, int userId, boolean debug) {
return liveComputer().filterCandidatesWithDomainPreferredActivitiesLPrBody(
intent, matchFlags, candidates,
xpDomainInfo, userId, debug);
}
private ResolveInfo querySkipCurrentProfileIntents(
List<CrossProfileIntentFilter> 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<CrossProfileIntentFilter> 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 @Override
public @NonNull ParceledListSlice<ResolveInfo> queryIntentActivityOptions(ComponentName caller, public @NonNull ParceledListSlice<ResolveInfo> queryIntentActivityOptions(ComponentName caller,
Intent[] specifics, String[] specificTypes, Intent intent, Intent[] specifics, String[] specificTypes, Intent intent,
@@ -10580,20 +10354,6 @@ public class PackageManagerService extends IPackageManager.Stub
includeInstantApps); includeInstantApps);
} }
private @NonNull List<ResolveInfo> queryIntentServicesInternalBody(Intent intent,
String resolvedType, int flags, int userId, int callingUid,
String instantAppPkgName) {
return liveComputer().queryIntentServicesInternalBody(intent,
resolvedType, flags, userId, callingUid,
instantAppPkgName);
}
private List<ResolveInfo> applyPostServiceResolutionFilter(List<ResolveInfo> resolveInfos,
String instantAppPkgName, @UserIdInt int userId, int filterCallingUid) {
return liveComputer().applyPostServiceResolutionFilter(resolveInfos,
instantAppPkgName, userId, filterCallingUid);
}
@Override @Override
public @NonNull ParceledListSlice<ResolveInfo> queryIntentContentProviders(Intent intent, public @NonNull ParceledListSlice<ResolveInfo> queryIntentContentProviders(Intent intent,
String resolvedType, int flags, int userId) { String resolvedType, int flags, int userId) {
@@ -10746,12 +10506,6 @@ public class PackageManagerService extends IPackageManager.Stub
return snapshotComputer().getInstalledPackages(flags, userId); return snapshotComputer().getInstalledPackages(flags, userId);
} }
private ParceledListSlice<PackageInfo> getInstalledPackagesBody(int flags, int userId,
int callingUid) {
return liveComputer().getInstalledPackagesBody(flags, userId,
callingUid);
}
private void addPackageHoldingPermissions(ArrayList<PackageInfo> list, PackageSetting ps, private void addPackageHoldingPermissions(ArrayList<PackageInfo> list, PackageSetting ps,
String[] permissions, boolean[] tmp, int flags, int userId) { String[] permissions, boolean[] tmp, int flags, int userId) {
int numMatch = 0; int numMatch = 0;
@@ -10935,12 +10689,6 @@ public class PackageManagerService extends IPackageManager.Stub
callingUid); callingUid);
} }
private boolean isInstantAppInternalBody(String packageName, @UserIdInt int userId,
int callingUid) {
return liveComputer().isInstantAppInternalBody(packageName, userId,
callingUid);
}
@Override @Override
public byte[] getInstantAppCookie(String packageName, int userId) { public byte[] getInstantAppCookie(String packageName, int userId) {
if (HIDE_EPHEMERAL_APIS) { if (HIDE_EPHEMERAL_APIS) {
@@ -11796,18 +11544,6 @@ public class PackageManagerService extends IPackageManager.Stub
requireFullPermission, checkShell, message); 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) { private boolean isSameProfileGroup(@UserIdInt int callerUserId, @UserIdInt int userId) {
return liveComputer().isSameProfileGroup(callerUserId, userId); return liveComputer().isSameProfileGroup(callerUserId, userId);
} }
@@ -20681,12 +20417,6 @@ public class PackageManagerService extends IPackageManager.Stub
return liveComputer().resolveInternalPackageNameLPr(packageName, versionCode); return liveComputer().resolveInternalPackageNameLPr(packageName, versionCode);
} }
private String resolveInternalPackageNameInternalLocked(
String packageName, long versionCode, int callingUid) {
return liveComputer().resolveInternalPackageNameInternalLocked(
packageName, versionCode, callingUid);
}
boolean isCallerVerifier(int callingUid) { boolean isCallerVerifier(int callingUid) {
final int callingUserId = UserHandle.getUserId(callingUid); final int callingUserId = UserHandle.getUserId(callingUid);
return mRequiredVerifierPackage != null && return mRequiredVerifierPackage != null &&