am 5b078b5b: 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.
Merge commit '5b078b5b8f166a14ab88137e478f868959c5befa'
* commit '5b078b5b8f166a14ab88137e478f868959c5befa':
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 00e7c69..b676437 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -3187,6 +3187,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);