Allow start of explicit intents

This change relaxes startActivity* logic to allow for all explicit
intents to be started, even if the package name provided for such intent
is not visible to the caller.

Fixes: 161007330
Bug: 148657387
Test: atest AppEnumerationTests
Change-Id: Iceaee276e8d4c297ace1fe605100f52e4cc49b07
This commit is contained in:
Patrick Baumann
2020-07-10 12:43:50 -07:00
parent c25a56caed
commit df8c82d702

View File

@@ -7161,8 +7161,9 @@ public class PackageManagerService extends IPackageManager.Stub
&& ((!matchInstantApp && !isCallerInstantApp && isTargetInstantApp)
|| (matchVisibleToInstantAppOnly && isCallerInstantApp
&& isTargetHiddenFromInstantApp));
final boolean blockNormalResolution = !isTargetInstantApp && !isCallerInstantApp
&& shouldFilterApplicationLocked(
final boolean blockNormalResolution =
!resolveForStart && !isTargetInstantApp && !isCallerInstantApp
&& shouldFilterApplicationLocked(
getPackageSettingInternal(ai.applicationInfo.packageName,
Process.SYSTEM_UID), filterCallingUid, userId);
if (!blockInstantResolution && !blockNormalResolution) {
@@ -7255,8 +7256,8 @@ public class PackageManagerService extends IPackageManager.Stub
final PackageSetting setting =
getPackageSettingInternal(pkgName, Process.SYSTEM_UID);
result = null;
if (setting != null && setting.pkg != null
&& !shouldFilterApplicationLocked(setting, filterCallingUid, userId)) {
if (setting != null && setting.pkg != null && (resolveForStart
|| !shouldFilterApplicationLocked(setting, filterCallingUid, userId))) {
result = filterIfNotSystemUser(mComponentResolver.queryActivities(
intent, resolvedType, flags, setting.pkg.getActivities(), userId),
userId);