Merge "Allow any app to dynamically install a split" into oc-dev

This commit is contained in:
TreeHugger Robot
2017-06-22 22:11:44 +00:00
committed by Android (Google) Code Review

View File

@@ -7179,16 +7179,13 @@ public class PackageManagerService extends IPackageManager.Stub
*/ */
private List<ResolveInfo> applyPostResolutionFilter(List<ResolveInfo> resolveInfos, private List<ResolveInfo> applyPostResolutionFilter(List<ResolveInfo> resolveInfos,
String ephemeralPkgName) { String ephemeralPkgName) {
// TODO: When adding on-demand split support for non-instant apps, remove this check
// and always apply post filtering
if (ephemeralPkgName == null) {
return resolveInfos;
}
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);
final boolean isEphemeralApp = info.activityInfo.applicationInfo.isInstantApp(); final boolean isEphemeralApp = info.activityInfo.applicationInfo.isInstantApp();
// TODO: When adding on-demand split support for non-instant apps, remove this check
// and always apply post filtering
// allow activities that are defined in the provided package // allow activities that are defined in the provided package
if (isEphemeralApp && ephemeralPkgName.equals(info.activityInfo.packageName)) { if (isEphemeralApp) {
if (info.activityInfo.splitName != null if (info.activityInfo.splitName != null
&& !ArrayUtils.contains(info.activityInfo.applicationInfo.splitNames, && !ArrayUtils.contains(info.activityInfo.applicationInfo.splitNames,
info.activityInfo.splitName)) { info.activityInfo.splitName)) {
@@ -7213,6 +7210,10 @@ public class PackageManagerService extends IPackageManager.Stub
} }
continue; continue;
} }
// caller is a full app, don't need to apply any other filtering
if (ephemeralPkgName == null) {
continue;
}
// allow activities that have been explicitly exposed to ephemeral apps // allow activities that have been explicitly exposed to ephemeral apps
if (!isEphemeralApp if (!isEphemeralApp
&& ((info.activityInfo.flags & ActivityInfo.FLAG_VISIBLE_TO_INSTANT_APP) != 0)) { && ((info.activityInfo.flags & ActivityInfo.FLAG_VISIBLE_TO_INSTANT_APP) != 0)) {