Do not destroy the backforward list when doing another voice search.
Fix for http://b/issue?id=2516327
Change-Id: I0daf8ba6e24be6682d849107914877fb0c31ec4f
diff --git a/src/com/android/browser/TabControl.java b/src/com/android/browser/TabControl.java
index e64f3fb..de32b03 100644
--- a/src/com/android/browser/TabControl.java
+++ b/src/com/android/browser/TabControl.java
@@ -490,11 +490,18 @@
/**
* Recreate the main WebView of the given tab. Returns true if the WebView
- * was deleted.
+ * requires a load, whether it was due to the fact that it was deleted, or
+ * it is because it was a voice search.
*/
- boolean recreateWebView(Tab t, String url) {
+ boolean recreateWebView(Tab t, BrowserActivity.UrlData urlData) {
+ 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())) {
// The original url matches the current url. Just go back to the
// first history item so we can load it faster than if we