Handle unsupported schema case better
Bug: 3442811 3443962
Fix it so that the check for specialized handlers takes into
account whether or not webkit can even handle the schema. If it
can't handle the schema, we always want to call startActivity
Change-Id: Ib7667f9fe6c3ea0602ccc1fdfce09b5920757a63
diff --git a/src/com/android/browser/UrlHandler.java b/src/com/android/browser/UrlHandler.java
index 686ed7b..03bab9b 100644
--- a/src/com/android/browser/UrlHandler.java
+++ b/src/com/android/browser/UrlHandler.java
@@ -20,7 +20,6 @@
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.IntentFilter;
-import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.database.Cursor;
@@ -31,6 +30,7 @@
import java.net.URISyntaxException;
import java.util.List;
+import java.util.regex.Matcher;
/**
*
@@ -156,7 +156,11 @@
// security (only access to BROWSABLE activities).
intent.addCategory(Intent.CATEGORY_BROWSABLE);
intent.setComponent(null);
- if (!isSpecializedHandlerAvailable(intent)) {
+ // Make sure webkit can handle it internally before checking for specialized
+ // handlers. If webkit can't handle it internally, we need to call
+ // startActivityIfNeeded
+ Matcher m = UrlUtils.ACCEPTED_URI_SCHEMA.matcher(url);
+ if (m.matches() && !isSpecializedHandlerAvailable(intent)) {
return false;
}
try {