summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Todd Kennedy <toddke@google.com> 2018-06-05 20:20:03 -0700
committer android-build-merger <android-build-merger@google.com> 2018-06-05 20:20:03 -0700
commite9cbe916031276d6a3340122c33a9a4286c2ebe0 (patch)
tree9cf68c45baeabdebedf90db8672fe22daeaab492
parentbb966bd945f087802935f3daf4f9ec53fffc07ac (diff)
parenta4155c751f3d96b76800f136b63a999fd0f54fc9 (diff)
Merge "Allow instant apps to launch instant apps" into pi-dev
am: a4155c751f Change-Id: I42451b9d0b8e8dc788289a2dd5f75cde1b353309
-rw-r--r--services/core/java/com/android/server/pm/PackageManagerService.java34
1 files changed, 24 insertions, 10 deletions
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 007cc4be3004..1010ce1f73fa 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -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();
}