summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/com/android/internal/app/ResolverActivity.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java
index 2c2f69585956..011cc041f0c1 100644
--- a/core/java/com/android/internal/app/ResolverActivity.java
+++ b/core/java/com/android/internal/app/ResolverActivity.java
@@ -195,7 +195,7 @@ public class ResolverActivity extends Activity {
com.android.internal.R.string.whichHomeApplicationNamed,
com.android.internal.R.string.whichHomeApplicationLabel);
- // SpR.id.buttonecial titles for BROWSABLE components
+ // titles for layout that deals with http(s) intents
public static final int BROWSABLE_TITLE_RES =
com.android.internal.R.string.whichGiveAccessToApplication;
public static final int BROWSABLE_NAMED_TITLE_RES =
@@ -303,7 +303,7 @@ public class ResolverActivity extends Activity {
mUseLayoutForBrowsables = getTargetIntent() == null
? false
- : getTargetIntent().hasCategory(Intent.CATEGORY_BROWSABLE);
+ : isHttpSchemeAndViewAction(getTargetIntent());
// We don't want to support Always Use if browsable layout is being used,
// as to mitigate Intent Capturing vulnerability
@@ -474,8 +474,8 @@ public class ResolverActivity extends Activity {
final boolean named = mAdapter.getFilteredPosition() >= 0;
if (title == ActionTitle.DEFAULT && defaultTitleRes != 0) {
return getString(defaultTitleRes);
- } else if (intent.hasCategory(Intent.CATEGORY_BROWSABLE)) {
- // If the Intent is BROWSABLE then we need to warn the user that
+ } else if (isHttpSchemeAndViewAction(intent)) {
+ // If the Intent's scheme is http(s) then we need to warn the user that
// they're giving access for the activity to open URLs from this specific host
return named
? getString(ActionTitle.BROWSABLE_NAMED_TITLE_RES, intent.getData().getHost(),
@@ -584,6 +584,12 @@ public class ResolverActivity extends Activity {
resetButtonBar();
}
+ private boolean isHttpSchemeAndViewAction(Intent intent) {
+ return (IntentFilter.SCHEME_HTTP.equals(intent.getScheme())
+ || IntentFilter.SCHEME_HTTPS.equals(intent.getScheme()))
+ && Intent.ACTION_VIEW.equals(intent.getAction());
+ }
+
private boolean hasManagedProfile() {
UserManager userManager = (UserManager) getSystemService(Context.USER_SERVICE);
if (userManager == null) {