Fix #1705293. When we about to hijack the url, we check the intent first. If it is not resolved to any activity, we will try to download it from the Market.
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index 8e79573..eddcb28 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -3044,6 +3044,21 @@
return false;
}
+ // check whether the intent can be resolved. If not, we will see
+ // whether we can download it from the Market.
+ if (getPackageManager().resolveActivity(intent, 0) == null) {
+ String packagename = intent.getPackage();
+ if (packagename != null) {
+ intent = new Intent(Intent.ACTION_VIEW, Uri
+ .parse("market://search?q=pname:" + packagename));
+ intent.addCategory(Intent.CATEGORY_BROWSABLE);
+ startActivity(intent);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
// sanitize the Intent, ensuring web pages can not bypass browser
// security (only access to BROWSABLE activities).
intent.addCategory(Intent.CATEGORY_BROWSABLE);