summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeon Scroggins <scroggo@google.com>2010-04-07 17:59:48 -0400
committerLeon Scroggins <scroggo@google.com>2010-04-08 10:02:17 -0400
commit4720868afa09efffadd845019f2d8268ae3f2c78 (patch)
tree734e973072875bee7c628888c75114d24f7c64c4
parentab168ba86162b4e89e74d0a077b9c618437cbce4 (diff)
downloadpackages_apps_Browser-4720868afa09efffadd845019f2d8268ae3f2c78.zip
packages_apps_Browser-4720868afa09efffadd845019f2d8268ae3f2c78.tar.gz
packages_apps_Browser-4720868afa09efffadd845019f2d8268ae3f2c78.tar.bz2
Treat voice searches from within the browser differently
from those initiated from outside the browser. Fix for http://b/issue?id=2546173 For a voice search initiated from outside the browser, an appId will be attached. In that case, try to reuse the application tab. In TabControl.recreateWebView, treat this as if the url does not match the old url, so a new WebView will be created with a fresh history list, and the back key will exit the browser. However, if no appId is provided, simply reuse the current tab. In this case, the history list will be preserved, and pressing the back key will return to earlier voice searches. Change-Id: I9ec1efd56454ba94eb2bc348c4476fb6bd025dad
-rw-r--r--src/com/android/browser/BrowserActivity.java5
-rw-r--r--src/com/android/browser/TabControl.java10
2 files changed, 8 insertions, 7 deletions
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index 1c136b3..1f969af 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -460,7 +460,10 @@ public class BrowserActivity extends Activity
final String appId = intent
.getStringExtra(Browser.EXTRA_APPLICATION_ID);
- if ((Intent.ACTION_VIEW.equals(action) || activateVoiceSearch)
+ if ((Intent.ACTION_VIEW.equals(action)
+ // If a voice search has no appId, it means that it came
+ // from the browser. In that case, reuse the current tab.
+ || (activateVoiceSearch && appId != null))
&& !getPackageName().equals(appId)
&& (flags & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) {
Tab appTab = mTabControl.getTabFromId(appId);
diff --git a/src/com/android/browser/TabControl.java b/src/com/android/browser/TabControl.java
index de32b03..4be777d 100644
--- a/src/com/android/browser/TabControl.java
+++ b/src/com/android/browser/TabControl.java
@@ -497,12 +497,10 @@ class TabControl {
final String url = urlData.mUrl;
final WebView w = t.getWebView();
if (w != null) {
- if (urlData.mVoiceIntent != null) {
- // In the case of a voice search, we do not want to destroy the
- // back forward list, so that we can go back to the prior search
- return true;
- }
- if (url != null && url.equals(t.getOriginalUrl())) {
+ if (url != null && url.equals(t.getOriginalUrl())
+ // Treat a voice intent as though it is a different URL,
+ // since it most likely is.
+ && urlData.mVoiceIntent == null) {
// The original url matches the current url. Just go back to the
// first history item so we can load it faster than if we
// rebuilt the WebView.