Merge "Require only ACTION_VIEW for web instant apps"

This commit is contained in:
TreeHugger Robot
2018-02-06 01:29:05 +00:00
committed by Android (Google) Code Review
6 changed files with 9 additions and 10 deletions

View File

@@ -88,7 +88,7 @@ public abstract class InstantAppResolverService extends Service {
public void onGetInstantAppResolveInfo(Intent sanitizedIntent, int[] hostDigestPrefix,
String token, InstantAppResolutionCallback callback) {
// if not overridden, forward to old methods and filter out non-web intents
if (sanitizedIntent.isBrowsableWebIntent()) {
if (sanitizedIntent.isWebIntent()) {
onGetInstantAppResolveInfo(hostDigestPrefix, token, callback);
} else {
callback.onInstantAppResolveInfo(Collections.emptyList());
@@ -107,7 +107,7 @@ public abstract class InstantAppResolverService extends Service {
String token, InstantAppResolutionCallback callback) {
Log.e(TAG, "New onGetInstantAppIntentFilter is not overridden");
// if not overridden, forward to old methods and filter out non-web intents
if (sanitizedIntent.isBrowsableWebIntent()) {
if (sanitizedIntent.isWebIntent()) {
onGetInstantAppIntentFilter(hostDigestPrefix, token, callback);
} else {
callback.onInstantAppResolveInfo(Collections.emptyList());

View File

@@ -10089,9 +10089,8 @@ public class Intent implements Parcelable, Cloneable {
}
/** @hide */
public boolean isBrowsableWebIntent() {
public boolean isWebIntent() {
return ACTION_VIEW.equals(mAction)
&& hasCategory(CATEGORY_BROWSABLE)
&& hasWebURI();
}

View File

@@ -106,7 +106,7 @@ public class ResolverListController {
int flags = PackageManager.MATCH_DEFAULT_ONLY
| (shouldGetResolvedFilter ? PackageManager.GET_RESOLVED_FILTER : 0)
| (shouldGetActivityMetadata ? PackageManager.GET_META_DATA : 0);
if (intent.isBrowsableWebIntent()
if (intent.isWebIntent()
|| (intent.getFlags() & Intent.FLAG_ACTIVITY_MATCH_EXTERNAL) != 0) {
flags |= PackageManager.MATCH_INSTANT;
}