Allow any app to dynamically install a split

Any application starting an activity resolved to a dyanmic split
should initiate split installation. Previously, only the application
defining the split could start installation of the split.

Bug: 62872325
Test: Manual; install instant app and start intent using 'adb shell am' and see that dynamic split installation occurs
Change-Id: I232dc5df82fb2c04653015a4a6b9f07c9e382205
This commit is contained in:
Todd Kennedy
2017-06-22 12:40:39 -07:00
parent ba003a97f8
commit 739af1876b

View File

@@ -7181,16 +7181,13 @@ public class PackageManagerService extends IPackageManager.Stub
*/
private List<ResolveInfo> applyPostResolutionFilter(List<ResolveInfo> resolveInfos,
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--) {
final ResolveInfo info = resolveInfos.get(i);
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
if (isEphemeralApp && ephemeralPkgName.equals(info.activityInfo.packageName)) {
if (isEphemeralApp) {
if (info.activityInfo.splitName != null
&& !ArrayUtils.contains(info.activityInfo.applicationInfo.splitNames,
info.activityInfo.splitName)) {
@@ -7215,6 +7212,10 @@ public class PackageManagerService extends IPackageManager.Stub
}
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
if (!isEphemeralApp
&& ((info.activityInfo.flags & ActivityInfo.FLAG_VISIBLE_TO_INSTANT_APP) != 0)) {