Merge "Implicitly expose SEND intents to Instant Apps" into oc-dev

This commit is contained in:
Chad Brubaker
2017-04-14 16:07:11 +00:00
committed by Android (Google) Code Review

View File

@ -4273,7 +4273,7 @@ public class PackageParser {
a.intents.add(intent); a.intents.add(intent);
} }
// adjust activity flags when we implicitly expose it via a browsable filter // adjust activity flags when we implicitly expose it via a browsable filter
intent.setVisibleToInstantApp(visibleToEphemeral || isWebBrowsableIntent(intent)); intent.setVisibleToInstantApp(visibleToEphemeral || isImplicitlyExposedIntent(intent));
if (intent.isVisibleToInstantApp()) { if (intent.isVisibleToInstantApp()) {
a.info.flags |= ActivityInfo.FLAG_VISIBLE_TO_EPHEMERAL; a.info.flags |= ActivityInfo.FLAG_VISIBLE_TO_EPHEMERAL;
} }
@ -4306,7 +4306,7 @@ public class PackageParser {
owner.preferredActivityFilters.add(intent); owner.preferredActivityFilters.add(intent);
} }
// adjust activity flags when we implicitly expose it via a browsable filter // adjust activity flags when we implicitly expose it via a browsable filter
intent.setVisibleToInstantApp(visibleToEphemeral || isWebBrowsableIntent(intent)); intent.setVisibleToInstantApp(visibleToEphemeral || isImplicitlyExposedIntent(intent));
if (intent.isVisibleToInstantApp()) { if (intent.isVisibleToInstantApp()) {
a.info.flags |= ActivityInfo.FLAG_VISIBLE_TO_EPHEMERAL; a.info.flags |= ActivityInfo.FLAG_VISIBLE_TO_EPHEMERAL;
} }
@ -4634,7 +4634,7 @@ public class PackageParser {
+ parser.getPositionDescription()); + parser.getPositionDescription());
} else { } else {
intent.setVisibleToInstantApp( intent.setVisibleToInstantApp(
visibleToEphemeral || isWebBrowsableIntent(intent)); visibleToEphemeral || isImplicitlyExposedIntent(intent));
a.intents.add(intent); a.intents.add(intent);
} }
// adjust activity flags when we implicitly expose it via a browsable filter // adjust activity flags when we implicitly expose it via a browsable filter
@ -4836,7 +4836,7 @@ public class PackageParser {
} }
outInfo.intents.add(intent); outInfo.intents.add(intent);
// adjust provider flags when we implicitly expose it via a browsable filter // adjust provider flags when we implicitly expose it via a browsable filter
intent.setVisibleToInstantApp(visibleToEphemeral || isWebBrowsableIntent(intent)); intent.setVisibleToInstantApp(visibleToEphemeral || isImplicitlyExposedIntent(intent));
if (intent.isVisibleToInstantApp()) { if (intent.isVisibleToInstantApp()) {
outInfo.info.flags |= ProviderInfo.FLAG_VISIBLE_TO_EPHEMERAL; outInfo.info.flags |= ProviderInfo.FLAG_VISIBLE_TO_EPHEMERAL;
} }
@ -5141,7 +5141,7 @@ public class PackageParser {
return null; return null;
} }
// adjust activity flags when we implicitly expose it via a browsable filter // adjust activity flags when we implicitly expose it via a browsable filter
intent.setVisibleToInstantApp(visibleToEphemeral || isWebBrowsableIntent(intent)); intent.setVisibleToInstantApp(visibleToEphemeral || isImplicitlyExposedIntent(intent));
if (intent.isVisibleToInstantApp()) { if (intent.isVisibleToInstantApp()) {
s.info.flags |= ServiceInfo.FLAG_VISIBLE_TO_EPHEMERAL; s.info.flags |= ServiceInfo.FLAG_VISIBLE_TO_EPHEMERAL;
} }
@ -5182,8 +5182,11 @@ public class PackageParser {
return s; return s;
} }
private boolean isWebBrowsableIntent(IntentInfo intent) { private boolean isImplicitlyExposedIntent(IntentInfo intent) {
return intent.hasCategory(Intent.CATEGORY_BROWSABLE); return intent.hasCategory(Intent.CATEGORY_BROWSABLE)
|| intent.hasAction(Intent.ACTION_SEND)
|| intent.hasAction(Intent.ACTION_SENDTO)
|| intent.hasAction(Intent.ACTION_SEND_MULTIPLE);
} }
private boolean parseAllMetaData(Resources res, XmlResourceParser parser, String tag, private boolean parseAllMetaData(Resources res, XmlResourceParser parser, String tag,