summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorGrace Kloba <klobag@google.com>2009-06-24 20:23:41 -0700
committerGrace Kloba <klobag@google.com>2009-06-25 10:52:12 -0700
commit5b078b5b8f166a14ab88137e478f868959c5befa (patch)
tree25e49fdef7d61b227ed91dffcf56a60c24bd39d8 /src/com
parentd1c2a433c79451aac4340aef8f0d83081977df84 (diff)
downloadpackages_apps_Browser-5b078b5b8f166a14ab88137e478f868959c5befa.zip
packages_apps_Browser-5b078b5b8f166a14ab88137e478f868959c5befa.tar.gz
packages_apps_Browser-5b078b5b8f166a14ab88137e478f868959c5befa.tar.bz2
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.
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/browser/BrowserActivity.java15
1 files changed, 15 insertions, 0 deletions
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 @@ public class BrowserActivity extends Activity
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);