summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorDavid Brown <dab@google.com>2011-10-20 15:36:12 -0700
committerDaisuke Miyakawa <dmiyakawa@google.com>2011-10-26 15:30:25 -0700
commit885adf34b162728a8c9c04fc16abb6b5fba04395 (patch)
tree25ce703d105329bd8c116a831a44747ca4909b0d /src/com
parent5a592c6408cc5460afbdead105f3576543962c28 (diff)
downloadpackages_apps_Stk-885adf34b162728a8c9c04fc16abb6b5fba04395.zip
packages_apps_Stk-885adf34b162728a8c9c04fc16abb6b5fba04395.tar.gz
packages_apps_Stk-885adf34b162728a8c9c04fc16abb6b5fba04395.tar.bz2
DO NOT MERGE. Fix crash in STK app when launching browser
The problem was that StkAppService.launchBrowser() was calling intent.setClassName("com.android.browser", "com.android.browser.BrowserActivity"); when launching the browser. But in ICS, the browser that's actually installed is from the package com.google.android.browser, not com.android.browser. So right now, the STK crashes if it ever tries to view a web page. The fix is for the STK app to just not hardcode the browser package/class name at all, since if you fire off a VIEW intent with an http: URI in the data, you'll get whatever the default browser is. Also, if the STK gets a request with no URI at all, we bring up http://google.com/ as a default "home page". Bug: 5489975 Change-Id: If3f9d1468562a5e7f948156aa8395525665bc9ff
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/stk/StkAppService.java21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/com/android/stk/StkAppService.java b/src/com/android/stk/StkAppService.java
index a21b240..0ffb9c8 100644
--- a/src/com/android/stk/StkAppService.java
+++ b/src/com/android/stk/StkAppService.java
@@ -648,25 +648,30 @@ public class StkAppService extends Service implements Runnable {
if (settings == null) {
return;
}
- // Set browser launch mode
- Intent intent = new Intent();
- intent.setClassName("com.android.browser",
- "com.android.browser.BrowserActivity");
- // to launch home page, make sure that data Uri is null.
- Uri data = null;
+ Intent intent = new Intent(Intent.ACTION_VIEW);
+
+ Uri data;
if (settings.url != null) {
data = Uri.parse(settings.url);
+ } else {
+ // If no URL specified, just bring up the "home page".
+ //
+ // (Note we need to specify *something* in the intent's data field
+ // here, since if you fire off a VIEW intent with no data at all
+ // you'll get an activity chooser rather than the browser. There's
+ // no specific URI that means "use the default home page", so
+ // instead let's just explicitly bring up http://google.com.)
+ data = Uri.parse("http://google.com/");
}
intent.setData(data);
+
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
switch (settings.mode) {
case USE_EXISTING_BROWSER:
- intent.setAction(Intent.ACTION_VIEW);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
break;
case LAUNCH_NEW_BROWSER:
- intent.setAction(Intent.ACTION_VIEW);
intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
break;
case LAUNCH_IF_NOT_ALREADY_LAUNCHED: