Merge "Allow instant apps to launch instant apps" into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
a4155c751f
@@ -6629,7 +6629,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
}
|
||||
}
|
||||
return applyPostResolutionFilter(
|
||||
list, instantAppPkgName, allowDynamicSplits, filterCallingUid, userId, intent);
|
||||
list, instantAppPkgName, allowDynamicSplits, filterCallingUid, resolveForStart,
|
||||
userId, intent);
|
||||
}
|
||||
|
||||
// reader
|
||||
@@ -6648,7 +6649,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
xpResult.add(xpResolveInfo);
|
||||
return applyPostResolutionFilter(
|
||||
filterIfNotSystemUser(xpResult, userId), instantAppPkgName,
|
||||
allowDynamicSplits, filterCallingUid, userId, intent);
|
||||
allowDynamicSplits, filterCallingUid, resolveForStart, userId, intent);
|
||||
}
|
||||
|
||||
// Check for results in the current profile.
|
||||
@@ -6688,14 +6689,16 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
// result straight away.
|
||||
result.add(xpDomainInfo.resolveInfo);
|
||||
return applyPostResolutionFilter(result, instantAppPkgName,
|
||||
allowDynamicSplits, filterCallingUid, userId, intent);
|
||||
allowDynamicSplits, filterCallingUid, resolveForStart, userId,
|
||||
intent);
|
||||
}
|
||||
} else if (result.size() <= 1 && !addInstant) {
|
||||
// No result in parent user and <= 1 result in current profile, and we
|
||||
// are not going to add emphemeral app, so we can return the result without
|
||||
// further processing.
|
||||
return applyPostResolutionFilter(result, instantAppPkgName,
|
||||
allowDynamicSplits, filterCallingUid, userId, intent);
|
||||
allowDynamicSplits, filterCallingUid, resolveForStart, userId,
|
||||
intent);
|
||||
}
|
||||
// We have more than one candidate (combining results from current and parent
|
||||
// profile), so we need filtering and sorting.
|
||||
@@ -6731,7 +6734,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
Collections.sort(result, mResolvePrioritySorter);
|
||||
}
|
||||
return applyPostResolutionFilter(
|
||||
result, instantAppPkgName, allowDynamicSplits, filterCallingUid, userId, intent);
|
||||
result, instantAppPkgName, allowDynamicSplits, filterCallingUid, resolveForStart,
|
||||
userId, intent);
|
||||
}
|
||||
|
||||
private List<ResolveInfo> maybeAddInstantAppInstaller(List<ResolveInfo> result, Intent intent,
|
||||
@@ -6941,8 +6945,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
* @return A filtered list of resolved activities.
|
||||
*/
|
||||
private List<ResolveInfo> applyPostResolutionFilter(List<ResolveInfo> resolveInfos,
|
||||
String ephemeralPkgName, boolean allowDynamicSplits, int filterCallingUid, int userId,
|
||||
Intent intent) {
|
||||
String ephemeralPkgName, boolean allowDynamicSplits, int filterCallingUid,
|
||||
boolean resolveForStart, int userId, Intent intent) {
|
||||
final boolean blockInstant = intent.isWebIntent() && areWebInstantAppsDisabled();
|
||||
for (int i = resolveInfos.size() - 1; i >= 0; i--) {
|
||||
final ResolveInfo info = resolveInfos.get(i);
|
||||
@@ -7001,6 +7005,13 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
} else if (ephemeralPkgName.equals(info.activityInfo.packageName)) {
|
||||
// caller is same app; don't need to apply any other filtering
|
||||
continue;
|
||||
} else if (resolveForStart
|
||||
&& (intent.isWebIntent()
|
||||
|| (intent.getFlags() & Intent.FLAG_ACTIVITY_MATCH_EXTERNAL) != 0)
|
||||
&& intent.getPackage() == null
|
||||
&& intent.getComponent() == null) {
|
||||
// ephemeral apps can launch other ephemeral apps indirectly
|
||||
continue;
|
||||
}
|
||||
// allow activities that have been explicitly exposed to ephemeral apps
|
||||
final boolean isEphemeralApp = info.activityInfo.applicationInfo.isInstantApp();
|
||||
@@ -7579,7 +7590,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
}
|
||||
}
|
||||
return applyPostResolutionFilter(
|
||||
list, instantAppPkgName, allowDynamicSplits, callingUid, userId, intent);
|
||||
list, instantAppPkgName, allowDynamicSplits, callingUid, false, userId,
|
||||
intent);
|
||||
}
|
||||
|
||||
// reader
|
||||
@@ -7589,14 +7601,16 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
final List<ResolveInfo> result =
|
||||
mReceivers.queryIntent(intent, resolvedType, flags, userId);
|
||||
return applyPostResolutionFilter(
|
||||
result, instantAppPkgName, allowDynamicSplits, callingUid, userId, intent);
|
||||
result, instantAppPkgName, allowDynamicSplits, callingUid, false, userId,
|
||||
intent);
|
||||
}
|
||||
final PackageParser.Package pkg = mPackages.get(pkgName);
|
||||
if (pkg != null) {
|
||||
final List<ResolveInfo> result = mReceivers.queryIntentForPackage(
|
||||
intent, resolvedType, flags, pkg.receivers, userId);
|
||||
return applyPostResolutionFilter(
|
||||
result, instantAppPkgName, allowDynamicSplits, callingUid, userId, intent);
|
||||
result, instantAppPkgName, allowDynamicSplits, callingUid, false, userId,
|
||||
intent);
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user