summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--res/drawable-hdpi/ic_go_holo_dark.pngbin633 -> 0 bytes
-rw-r--r--res/drawable-hdpi/ic_voice_search_holo_dark.pngbin961 -> 0 bytes
-rw-r--r--res/drawable-mdpi/ic_go_holo_dark.pngbin458 -> 0 bytes
-rw-r--r--res/drawable-mdpi/ic_voice_search_holo_dark.pngbin687 -> 0 bytes
-rw-r--r--res/drawable-xhdpi/ic_go_holo_dark.pngbin803 -> 0 bytes
-rw-r--r--res/drawable-xhdpi/ic_voice_search_holo_dark.pngbin1239 -> 0 bytes
-rw-r--r--res/layout-sw600dp/title_bar_nav.xml16
-rw-r--r--res/layout/title_bar_nav.xml9
-rw-r--r--res/xml/searchable.xml1
-rw-r--r--src/com/android/browser/BaseUi.java14
-rw-r--r--src/com/android/browser/BrowserSettings.java11
-rw-r--r--src/com/android/browser/Controller.java72
-rw-r--r--src/com/android/browser/IntentHandler.java61
-rw-r--r--src/com/android/browser/NavigationBarBase.java32
-rw-r--r--src/com/android/browser/NavigationBarPhone.java16
-rw-r--r--src/com/android/browser/NavigationBarTablet.java50
-rw-r--r--src/com/android/browser/PhoneUi.java5
-rw-r--r--src/com/android/browser/PreloadController.java12
-rw-r--r--src/com/android/browser/SuggestionsAdapter.java66
-rw-r--r--src/com/android/browser/Tab.java267
-rw-r--r--src/com/android/browser/UI.java4
-rw-r--r--src/com/android/browser/UiController.java6
-rw-r--r--src/com/android/browser/UrlInputView.java8
-rw-r--r--src/com/android/browser/WebViewController.java4
-rw-r--r--src/com/android/browser/XLargeUi.java5
-rw-r--r--src/com/android/browser/provider/BrowserProvider.java118
-rw-r--r--src/com/android/browser/search/DefaultSearchEngine.java4
-rw-r--r--src/com/android/browser/search/OpenSearchSearchEngine.java4
-rw-r--r--src/com/android/browser/search/SearchEngine.java5
29 files changed, 42 insertions, 748 deletions
diff --git a/res/drawable-hdpi/ic_go_holo_dark.png b/res/drawable-hdpi/ic_go_holo_dark.png
deleted file mode 100644
index b1412e81..00000000
--- a/res/drawable-hdpi/ic_go_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_voice_search_holo_dark.png b/res/drawable-hdpi/ic_voice_search_holo_dark.png
deleted file mode 100644
index 73bcafca..00000000
--- a/res/drawable-hdpi/ic_voice_search_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_go_holo_dark.png b/res/drawable-mdpi/ic_go_holo_dark.png
deleted file mode 100644
index 2e2a4499..00000000
--- a/res/drawable-mdpi/ic_go_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_voice_search_holo_dark.png b/res/drawable-mdpi/ic_voice_search_holo_dark.png
deleted file mode 100644
index e7e4f688..00000000
--- a/res/drawable-mdpi/ic_voice_search_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_go_holo_dark.png b/res/drawable-xhdpi/ic_go_holo_dark.png
deleted file mode 100644
index e4b59b3e..00000000
--- a/res/drawable-xhdpi/ic_go_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_voice_search_holo_dark.png b/res/drawable-xhdpi/ic_voice_search_holo_dark.png
deleted file mode 100644
index bfeb7aa9..00000000
--- a/res/drawable-xhdpi/ic_voice_search_holo_dark.png
+++ /dev/null
Binary files differ
diff --git a/res/layout-sw600dp/title_bar_nav.xml b/res/layout-sw600dp/title_bar_nav.xml
index e628a815..300b740f 100644
--- a/res/layout-sw600dp/title_bar_nav.xml
+++ b/res/layout-sw600dp/title_bar_nav.xml
@@ -103,22 +103,6 @@
style="@style/HoloButton" />
</LinearLayout>
<ImageButton
- android:id="@+id/go"
- android:src="@drawable/ic_go_holo_dark"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:visibility="gone"
- android:gravity="center_vertical"
- android:contentDescription="@string/accessibility_button_go"
- style="@style/HoloButton" />
- <ImageButton
- android:id="@+id/voicesearch"
- android:src="@drawable/ic_voice_search_holo_dark"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:contentDescription="@string/accessibility_button_voice"
- style="@style/HoloButton" />
- <ImageButton
android:id="@+id/search"
android:src="@drawable/ic_search_holo_dark"
android:layout_width="wrap_content"
diff --git a/res/layout/title_bar_nav.xml b/res/layout/title_bar_nav.xml
index 15568c35..31e47bc7 100644
--- a/res/layout/title_bar_nav.xml
+++ b/res/layout/title_bar_nav.xml
@@ -89,15 +89,6 @@
style="@style/Suggestions"
android:background="@null" />
<ImageView
- android:id="@+id/voice"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:paddingRight="4dip"
- android:contentDescription="@string/accessibility_button_voice"
- android:src="@drawable/ic_voice_search_holo_dark"
- style="@style/HoloButton"
- android:visibility="gone" />
- <ImageView
android:id="@+id/clear"
android:layout_width="wrap_content"
android:layout_height="match_parent"
diff --git a/res/xml/searchable.xml b/res/xml/searchable.xml
index bb578c62..3397a40e 100644
--- a/res/xml/searchable.xml
+++ b/res/xml/searchable.xml
@@ -26,7 +26,6 @@
android:voiceSearchMode="showVoiceSearchButton|launchWebSearch"
android:inputType="textUri"
android:imeOptions="actionGo"
-
android:searchSuggestAuthority="browser"
android:searchSuggestSelection="url LIKE ?"
android:searchSuggestIntentAction="android.intent.action.VIEW"
diff --git a/src/com/android/browser/BaseUi.java b/src/com/android/browser/BaseUi.java
index 01c7da6e..42c72064 100644
--- a/src/com/android/browser/BaseUi.java
+++ b/src/com/android/browser/BaseUi.java
@@ -500,19 +500,6 @@ public abstract class BaseUi implements UI {
}
@Override
- public void showVoiceTitleBar(String title, List<String> results) {
- mNavigationBar.setInVoiceMode(true, results);
- mNavigationBar.setDisplayTitle(title);
- }
-
- @Override
- public void revertVoiceTitleBar(Tab tab) {
- mNavigationBar.setInVoiceMode(false, null);
- String url = tab.getUrl();
- mNavigationBar.setDisplayTitle(url);
- }
-
- @Override
public void showComboView(ComboViews startingView, Bundle extras) {
Intent intent = new Intent(mActivity, ComboViewActivity.class);
intent.putExtra(ComboViewActivity.EXTRA_INITIAL_VIEW, startingView.name());
@@ -625,7 +612,6 @@ public abstract class BaseUi implements UI {
if (TextUtils.isEmpty(title)) {
title = url;
}
- if (tab.isInVoiceSearchMode()) return;
if (tab.inForeground()) {
mNavigationBar.setDisplayTitle(url);
}
diff --git a/src/com/android/browser/BrowserSettings.java b/src/com/android/browser/BrowserSettings.java
index cddeda64..76dc48fe 100644
--- a/src/com/android/browser/BrowserSettings.java
+++ b/src/com/android/browser/BrowserSettings.java
@@ -429,17 +429,6 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener,
String searchEngineName = getSearchEngineName();
if (force || mSearchEngine == null ||
!mSearchEngine.getName().equals(searchEngineName)) {
- if (mSearchEngine != null) {
- if (mSearchEngine.supportsVoiceSearch()) {
- // One or more tabs could have been in voice search mode.
- // Clear it, since the new SearchEngine may not support
- // it, or may handle it differently.
- for (int i = 0; i < mController.getTabControl().getTabCount(); i++) {
- mController.getTabControl().getTab(i).revertVoiceSearchMode();
- }
- }
- mSearchEngine.close();
- }
mSearchEngine = SearchEngines.get(mContext, searchEngineName);
}
}
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index 0c86988d..ba74e562 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -17,7 +17,6 @@
package com.android.browser;
import android.app.Activity;
-import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DownloadManager;
import android.app.ProgressDialog;
@@ -56,7 +55,6 @@ import android.provider.BrowserContract;
import android.provider.BrowserContract.Images;
import android.provider.ContactsContract;
import android.provider.ContactsContract.Intents.Insert;
-import android.speech.RecognizerIntent;
import android.text.TextUtils;
import android.util.Log;
import android.util.Patterns;
@@ -1107,31 +1105,6 @@ public class Controller
mUi.editUrl(false, true);
}
- public void startVoiceSearch() {
- Intent intent = new Intent(RecognizerIntent.ACTION_WEB_SEARCH);
- intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
- RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
- intent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE,
- mActivity.getComponentName().flattenToString());
- intent.putExtra(SEND_APP_ID_EXTRA, false);
- intent.putExtra(RecognizerIntent.EXTRA_WEB_SEARCH_ONLY, true);
- mActivity.startActivity(intent);
- }
-
- @Override
- public void activateVoiceSearchMode(String title, List<String> results) {
- mUi.showVoiceTitleBar(title, results);
- }
-
- public void revertVoiceSearchMode(Tab tab) {
- mUi.revertVoiceTitleBar(tab);
- }
-
- public boolean supportsVoiceSearch() {
- SearchEngine searchEngine = getSettings().getSearchEngine();
- return (searchEngine != null && searchEngine.supportsVoiceSearch());
- }
-
public void showCustomView(Tab tab, View view, int requestedOrientation,
WebChromeClient.CustomViewCallback callback) {
if (tab.inForeground()) {
@@ -2541,9 +2514,7 @@ public class Controller
*/
protected void loadUrlDataIn(Tab t, UrlData data) {
if (data != null) {
- if (data.mVoiceIntent != null) {
- t.activateVoiceSearchMode(data.mVoiceIntent);
- } else if (data.isPreloaded()) {
+ if (data.isPreloaded()) {
// this isn't called for preloaded tabs
} else {
loadUrl(t, data.mUrl, data.mHeaders);
@@ -2601,47 +2572,6 @@ public class Controller
}
/**
- * Feed the previously stored results strings to the BrowserProvider so that
- * the SearchDialog will show them instead of the standard searches.
- * @param result String to show on the editable line of the SearchDialog.
- */
- @Override
- public void showVoiceSearchResults(String result) {
- ContentProviderClient client = mActivity.getContentResolver()
- .acquireContentProviderClient(Browser.BOOKMARKS_URI);
- ContentProvider prov = client.getLocalContentProvider();
- BrowserProvider bp = (BrowserProvider) prov;
- bp.setQueryResults(mTabControl.getCurrentTab().getVoiceSearchResults());
- client.release();
-
- Bundle bundle = createGoogleSearchSourceBundle(
- GOOGLE_SEARCH_SOURCE_SEARCHKEY);
- bundle.putBoolean(SearchManager.CONTEXT_IS_VOICE, true);
- startSearch(result, false, bundle, false);
- }
-
- private void startSearch(String initialQuery, boolean selectInitialQuery,
- Bundle appSearchData, boolean globalSearch) {
- if (appSearchData == null) {
- appSearchData = createGoogleSearchSourceBundle(
- GOOGLE_SEARCH_SOURCE_TYPE);
- }
-
- SearchEngine searchEngine = mSettings.getSearchEngine();
- if (searchEngine != null && !searchEngine.supportsVoiceSearch()) {
- appSearchData.putBoolean(SearchManager.DISABLE_VOICE_SEARCH, true);
- }
- mActivity.startSearch(initialQuery, selectInitialQuery, appSearchData,
- globalSearch);
- }
-
- private Bundle createGoogleSearchSourceBundle(String source) {
- Bundle bundle = new Bundle();
- bundle.putString(Search.SOURCE, source);
- return bundle;
- }
-
- /**
* helper method for key handler
* returns the current tab if it can't advance
*/
diff --git a/src/com/android/browser/IntentHandler.java b/src/com/android/browser/IntentHandler.java
index b21c688d..47cab70a 100644
--- a/src/com/android/browser/IntentHandler.java
+++ b/src/com/android/browser/IntentHandler.java
@@ -28,14 +28,12 @@ import android.os.AsyncTask;
import android.os.Bundle;
import android.provider.Browser;
import android.provider.MediaStore;
-import android.speech.RecognizerResultsIntent;
import android.text.TextUtils;
import android.util.Patterns;
import com.android.browser.UI.ComboViews;
import com.android.browser.search.SearchEngine;
import com.android.common.Search;
-import com.android.common.speech.LoggingEvents;
import java.util.HashMap;
import java.util.Iterator;
@@ -93,37 +91,11 @@ public class IntentHandler {
// In case the SearchDialog is open.
((SearchManager) mActivity.getSystemService(Context.SEARCH_SERVICE))
.stopSearch();
- boolean activateVoiceSearch = RecognizerResultsIntent
- .ACTION_VOICE_SEARCH_RESULTS.equals(action);
if (Intent.ACTION_VIEW.equals(action)
|| NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action)
|| Intent.ACTION_SEARCH.equals(action)
|| MediaStore.INTENT_ACTION_MEDIA_SEARCH.equals(action)
- || Intent.ACTION_WEB_SEARCH.equals(action)
- || activateVoiceSearch) {
- if (current.isInVoiceSearchMode()) {
- String title = current.getVoiceDisplayTitle();
- if (title != null && title.equals(intent.getStringExtra(
- SearchManager.QUERY))) {
- // The user submitted the same search as the last voice
- // search, so do nothing.
- return;
- }
- if (Intent.ACTION_SEARCH.equals(action)
- && current.voiceSearchSourceIsGoogle()) {
- Intent logIntent = new Intent(
- LoggingEvents.ACTION_LOG_EVENT);
- logIntent.putExtra(LoggingEvents.EXTRA_EVENT,
- LoggingEvents.VoiceSearch.QUERY_UPDATED);
- logIntent.putExtra(
- LoggingEvents.VoiceSearch.EXTRA_QUERY_UPDATED_VALUE,
- intent.getDataString());
- mActivity.sendBroadcast(logIntent);
- // Note, onPageStarted will revert the voice title bar
- // When http://b/issue?id=2379215 is fixed, we should update
- // the title bar here.
- }
- }
+ || Intent.ACTION_WEB_SEARCH.equals(action)) {
// If this was a search request (e.g. search query directly typed into the address bar),
// pass it on to the default web search provider.
if (handleWebSearchIntent(mActivity, mController, intent)) {
@@ -143,11 +115,9 @@ public class IntentHandler {
/*
* TODO: Don't allow javascript URIs
* 0) If this is a javascript: URI, *always* open a new tab
- * 1) If this is a voice search, re-use tab for appId
- * If there is no appId, use current tab
- * 2) If the URL is already opened, switch to that tab
- * 3-phone) Reuse tab with same appId
- * 3-tablet) Open new tab
+ * 1) If the URL is already opened, switch to that tab
+ * 2-phone) Reuse tab with same appId
+ * 2-tablet) Open new tab
*/
final String appId = intent
.getStringExtra(Browser.EXTRA_APPLICATION_ID);
@@ -167,12 +137,9 @@ public class IntentHandler {
return;
}
}
- 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))
- && !mActivity.getPackageName().equals(appId)) {
- if (activateVoiceSearch || !BrowserActivity.isTablet(mActivity)) {
+ if (Intent.ACTION_VIEW.equals(action)
+ && !mActivity.getPackageName().equals(appId)) {
+ if (!BrowserActivity.isTablet(mActivity)) {
Tab appTab = mTabControl.getTabFromAppId(appId);
if (appTab != null) {
mController.reuseTab(appTab, urlData);
@@ -301,10 +268,6 @@ public class IntentHandler {
String url = null;
final String action = intent.getAction();
- if (RecognizerResultsIntent.ACTION_VOICE_SEARCH_RESULTS.equals(
- action)) {
- return false;
- }
if (Intent.ACTION_VIEW.equals(action)) {
Uri data = intent.getData();
if (data != null) url = data.toString();
@@ -369,14 +332,12 @@ public class IntentHandler {
static class UrlData {
final String mUrl;
final Map<String, String> mHeaders;
- final Intent mVoiceIntent;
final PreloadedTabControl mPreloadedTab;
final String mSearchBoxQueryToSubmit;
UrlData(String url) {
this.mUrl = url;
this.mHeaders = null;
- this.mVoiceIntent = null;
this.mPreloadedTab = null;
this.mSearchBoxQueryToSubmit = null;
}
@@ -389,18 +350,12 @@ public class IntentHandler {
PreloadedTabControl preloaded, String searchBoxQueryToSubmit) {
this.mUrl = url;
this.mHeaders = headers;
- if (RecognizerResultsIntent.ACTION_VOICE_SEARCH_RESULTS
- .equals(intent.getAction())) {
- this.mVoiceIntent = intent;
- } else {
- this.mVoiceIntent = null;
- }
this.mPreloadedTab = preloaded;
this.mSearchBoxQueryToSubmit = searchBoxQueryToSubmit;
}
boolean isEmpty() {
- return mVoiceIntent == null && (mUrl == null || mUrl.length() == 0);
+ return (mUrl == null || mUrl.length() == 0);
}
boolean isPreloaded() {
diff --git a/src/com/android/browser/NavigationBarBase.java b/src/com/android/browser/NavigationBarBase.java
index d66c8775..cf61c45c 100644
--- a/src/com/android/browser/NavigationBarBase.java
+++ b/src/com/android/browser/NavigationBarBase.java
@@ -45,7 +45,6 @@ public class NavigationBarBase extends LinearLayout implements
protected TitleBar mTitleBar;
protected UiController mUiController;
protected UrlInputView mUrlInput;
- protected boolean mInVoiceMode = false;
private ImageView mFavicon;
private ImageView mLockIcon;
@@ -108,9 +107,6 @@ public class NavigationBarBase extends LinearLayout implements
}
if (hasFocus) {
mBaseUi.showTitleBar();
- if (mInVoiceMode) {
- mUrlInput.forceFilter();
- }
} else if (!mUrlInput.needsUpdate()) {
mUrlInput.dismissDropDown();
mUrlInput.hideIME();
@@ -128,8 +124,6 @@ public class NavigationBarBase extends LinearLayout implements
protected void setFocusState(boolean focus) {
}
- protected void setSearchMode(boolean voiceSearchEnabled) {}
-
public boolean isEditingUrl() {
return mUrlInput.hasFocus();
}
@@ -144,13 +138,6 @@ public class NavigationBarBase extends LinearLayout implements
}
}
- // voicesearch
-
- public void setInVoiceMode(boolean voicemode, List<String> voiceResults) {
- mInVoiceMode = voicemode;
- mUrlInput.setVoiceResults(voiceResults);
- }
-
void setIncognitoMode(boolean incognito) {
mUrlInput.setIncognitoMode(incognito);
}
@@ -183,13 +170,7 @@ public class NavigationBarBase extends LinearLayout implements
}
}
Intent i = new Intent();
- String action = null;
- if (UrlInputView.VOICE.equals(source)) {
- action = RecognizerResultsIntent.ACTION_VOICE_SEARCH_RESULTS;
- source = null;
- } else {
- action = Intent.ACTION_SEARCH;
- }
+ String action = Intent.ACTION_SEARCH;
i.setAction(action);
i.putExtra(SearchManager.QUERY, text);
if (extra != null) {
@@ -211,7 +192,7 @@ public class NavigationBarBase extends LinearLayout implements
post(new Runnable() {
public void run() {
clearFocus();
- if ((currentTab != null) && !mInVoiceMode) {
+ if (currentTab != null) {
setDisplayTitle(currentTab.getUrl());
}
}
@@ -258,8 +239,6 @@ public class NavigationBarBase extends LinearLayout implements
}
if (clearInput) {
mUrlInput.setText("");
- } else if (mInVoiceMode) {
- mUrlInput.showDropDown();
}
if (forceIME) {
mUrlInput.showIME();
@@ -283,12 +262,7 @@ public class NavigationBarBase extends LinearLayout implements
public void beforeTextChanged(CharSequence s, int start, int count, int after) { }
@Override
- public void onTextChanged(CharSequence s, int start, int before, int count) {
- if (mUrlInput.hasFocus()) {
- // clear voice mode when user types
- setInVoiceMode(false, null);
- }
- }
+ public void onTextChanged(CharSequence s, int start, int before, int count) { }
@Override
public void afterTextChanged(Editable s) { }
diff --git a/src/com/android/browser/NavigationBarPhone.java b/src/com/android/browser/NavigationBarPhone.java
index 60b228dc..2517d624 100644
--- a/src/com/android/browser/NavigationBarPhone.java
+++ b/src/com/android/browser/NavigationBarPhone.java
@@ -36,7 +36,6 @@ public class NavigationBarPhone extends NavigationBarBase implements
StateListener, OnMenuItemClickListener, OnDismissListener {
private ImageView mStopButton;
- private ImageView mVoiceButton;
private ImageView mMagnify;
private ImageView mClearButton;
private Drawable mStopDrawable;
@@ -70,8 +69,6 @@ public class NavigationBarPhone extends NavigationBarBase implements
super.onFinishInflate();
mStopButton = (ImageView) findViewById(R.id.stop);
mStopButton.setOnClickListener(this);
- mVoiceButton = (ImageView) findViewById(R.id.voice);
- mVoiceButton.setOnClickListener(this);
mClearButton = (ImageView) findViewById(R.id.clear);
mClearButton.setOnClickListener(this);
mMagnify = (ImageView) findViewById(R.id.magnify);
@@ -96,14 +93,6 @@ public class NavigationBarPhone extends NavigationBarBase implements
}
@Override
- protected void setSearchMode(boolean voiceSearchEnabled) {
- boolean showvoicebutton = voiceSearchEnabled &&
- mUiController.supportsVoiceSearch();
- mVoiceButton.setVisibility(showvoicebutton ? View.VISIBLE :
- View.GONE);
- }
-
- @Override
public void onProgressStarted() {
super.onProgressStarted();
if (mStopButton.getDrawable() != mStopDrawable) {
@@ -157,8 +146,6 @@ public class NavigationBarPhone extends NavigationBarBase implements
web.reload();
}
}
- } else if (v == mVoiceButton) {
- mUiController.startVoiceSearch();
} else if (v == mTabSwitcher) {
((PhoneUi) mBaseUi).toggleNavScreen();
} else if (mMore == v) {
@@ -229,7 +216,6 @@ public class NavigationBarPhone extends NavigationBarBase implements
mStopButton.setVisibility(View.GONE);
mClearButton.setVisibility(View.GONE);
mMagnify.setVisibility(View.GONE);
- setSearchMode(mInVoiceMode);
mTabSwitcher.setVisibility(View.VISIBLE);
mTitleContainer.setBackgroundDrawable(null);
mMore.setVisibility(mNeedsMenu ? View.VISIBLE : View.GONE);
@@ -239,7 +225,6 @@ public class NavigationBarPhone extends NavigationBarBase implements
mStopButton.setVisibility(View.VISIBLE);
mClearButton.setVisibility(View.GONE);
mMagnify.setVisibility(View.GONE);
- setSearchMode(true);
mTabSwitcher.setVisibility(View.GONE);
mMore.setVisibility(View.GONE);
mTitleContainer.setBackgroundDrawable(mTextfieldBgDrawable);
@@ -249,7 +234,6 @@ public class NavigationBarPhone extends NavigationBarBase implements
mStopButton.setVisibility(View.GONE);
mClearButton.setVisibility(View.VISIBLE);
mMagnify.setVisibility(View.VISIBLE);
- setSearchMode(false);
mTabSwitcher.setVisibility(View.GONE);
mMore.setVisibility(View.GONE);
mTitleContainer.setBackgroundDrawable(mTextfieldBgDrawable);
diff --git a/src/com/android/browser/NavigationBarTablet.java b/src/com/android/browser/NavigationBarTablet.java
index 37b1f172..b9c86e3f 100644
--- a/src/com/android/browser/NavigationBarTablet.java
+++ b/src/com/android/browser/NavigationBarTablet.java
@@ -48,11 +48,9 @@ public class NavigationBarTablet extends NavigationBarBase {
private ImageView mStar;
private ImageView mUrlIcon;
private ImageView mSearchButton;
- private View mGoButton;
private ImageView mStopButton;
private View mAllButton;
private View mClearButton;
- private ImageView mVoiceSearch;
private View mNavButtons;
private Drawable mFocusDrawable;
private Drawable mUnfocusDrawable;
@@ -100,9 +98,7 @@ public class NavigationBarTablet extends NavigationBarBase {
mStar = (ImageView) findViewById(R.id.star);
mStopButton = (ImageView) findViewById(R.id.stop);
mSearchButton = (ImageView) findViewById(R.id.search);
- mGoButton = findViewById(R.id.go);
mClearButton = findViewById(R.id.clear);
- mVoiceSearch = (ImageView) findViewById(R.id.voicesearch);
mUrlContainer = findViewById(R.id.urlbar_focused);
mBackButton.setOnClickListener(this);
mForwardButton.setOnClickListener(this);
@@ -110,9 +106,7 @@ public class NavigationBarTablet extends NavigationBarBase {
mAllButton.setOnClickListener(this);
mStopButton.setOnClickListener(this);
mSearchButton.setOnClickListener(this);
- mGoButton.setOnClickListener(this);
mClearButton.setOnClickListener(this);
- mVoiceSearch.setOnClickListener(this);
mUrlInput.setContainer(mUrlContainer);
}
@@ -177,18 +171,11 @@ public class NavigationBarTablet extends NavigationBarBase {
} else if (mAllButton == v) {
mUiController.bookmarksOrHistoryPicker(ComboViews.Bookmarks);
} else if (mSearchButton == v) {
- mBaseUi.editUrl(true, false);
+ mBaseUi.editUrl(true, true);
} else if (mStopButton == v) {
stopOrRefresh();
- } else if (mGoButton == v) {
- if (!TextUtils.isEmpty(mUrlInput.getText())) {
- onAction(mUrlInput.getText().toString(), null,
- UrlInputView.TYPED);
- }
} else if (mClearButton == v) {
clearOrClose();
- } else if (mVoiceSearch == v) {
- mUiController.startVoiceSearch();
} else {
super.onClick(v);
}
@@ -214,14 +201,10 @@ public class NavigationBarTablet extends NavigationBarBase {
if (mUrlInput.hasFocus()) {
mUrlIcon.setImageResource(R.drawable.ic_search_holo_dark);
} else {
- if (mInVoiceMode) {
- mUrlIcon.setImageResource(R.drawable.ic_search_holo_dark);
- } else {
- if (mFaviconDrawable == null) {
- mFaviconDrawable = mBaseUi.getFaviconDrawable(null);
- }
- mUrlIcon.setImageDrawable(mFaviconDrawable);
+ if (mFaviconDrawable == null) {
+ mFaviconDrawable = mBaseUi.getFaviconDrawable(null);
}
+ mUrlIcon.setImageDrawable(mFaviconDrawable);
}
}
@@ -236,13 +219,10 @@ public class NavigationBarTablet extends NavigationBarBase {
mStar.setVisibility(View.GONE);
mClearButton.setVisibility(View.VISIBLE);
mUrlIcon.setImageResource(R.drawable.ic_search_holo_dark);
- updateSearchMode(false);
} else {
if (mHideNavButtons) {
showNavButtons();
}
- mGoButton.setVisibility(View.GONE);
- mVoiceSearch.setVisibility(View.GONE);
showHideStar(mUiController.getCurrentTab());
mClearButton.setVisibility(View.GONE);
if (mTitleBar.useQuickControls()) {
@@ -279,28 +259,6 @@ public class NavigationBarTablet extends NavigationBarBase {
mStopButton.setContentDescription(mRefreshDescription);
}
- protected void updateSearchMode(boolean userEdited) {
- setSearchMode(!userEdited || TextUtils.isEmpty(mUrlInput.getText()));
- }
-
- @Override
- protected void setSearchMode(boolean voiceSearchEnabled) {
- boolean showvoicebutton = voiceSearchEnabled &&
- mUiController.supportsVoiceSearch();
- mVoiceSearch.setVisibility(showvoicebutton ? View.VISIBLE :
- View.GONE);
- mGoButton.setVisibility(voiceSearchEnabled ? View.GONE :
- View.VISIBLE);
- }
-
- @Override
- public void setInVoiceMode(boolean voicemode, List<String> voiceResults) {
- super.setInVoiceMode(voicemode, voiceResults);
- if (voicemode) {
- mUrlIcon.setImageDrawable(mSearchButton.getDrawable());
- }
- }
-
private void hideNavButtons() {
int awidth = mNavButtons.getMeasuredWidth();
Animator anim1 = ObjectAnimator.ofFloat(mNavButtons, View.TRANSLATION_X, 0, - awidth);
diff --git a/src/com/android/browser/PhoneUi.java b/src/com/android/browser/PhoneUi.java
index ed63daac..eb6032d0 100644
--- a/src/com/android/browser/PhoneUi.java
+++ b/src/com/android/browser/PhoneUi.java
@@ -146,11 +146,6 @@ public class PhoneUi extends BaseUi {
} else {
view.setTitleBar(mTitleBar);
}
- if (tab.isInVoiceSearchMode()) {
- showVoiceTitleBar(tab.getVoiceDisplayTitle(), tab.getVoiceSearchResults());
- } else {
- revertVoiceTitleBar(tab);
- }
// update nav bar state
mNavigationBar.onStateChanged(StateListener.STATE_NORMAL);
updateLockIconToLatest(tab);
diff --git a/src/com/android/browser/PreloadController.java b/src/com/android/browser/PreloadController.java
index 66b89f48..a7feaee9 100644
--- a/src/com/android/browser/PreloadController.java
+++ b/src/com/android/browser/PreloadController.java
@@ -31,8 +31,6 @@ import android.webkit.ValueCallback;
import android.webkit.WebChromeClient.CustomViewCallback;
import android.webkit.WebView;
-import java.util.List;
-
public class PreloadController implements WebViewController {
private static final boolean LOGD_ENABLED = false;
@@ -194,16 +192,6 @@ public class PreloadController implements WebViewController {
}
@Override
- public void activateVoiceSearchMode(String title, List<String> results) {
- if (LOGD_ENABLED) Log.d(LOGTAG, "activateVoiceSearchMode()");
- }
-
- @Override
- public void revertVoiceSearchMode(Tab tab) {
- if (LOGD_ENABLED) Log.d(LOGTAG, "revertVoiceSearchMode()");
- }
-
- @Override
public boolean shouldShowErrorConsole() {
if (LOGD_ENABLED) Log.d(LOGTAG, "shouldShowErrorConsole()");
return false;
diff --git a/src/com/android/browser/SuggestionsAdapter.java b/src/com/android/browser/SuggestionsAdapter.java
index 7400b5d6..9f66e3c4 100644
--- a/src/com/android/browser/SuggestionsAdapter.java
+++ b/src/com/android/browser/SuggestionsAdapter.java
@@ -16,10 +16,6 @@
package com.android.browser;
-import com.android.browser.provider.BrowserProvider2;
-import com.android.browser.provider.BrowserProvider2.OmniboxSuggestions;
-import com.android.browser.search.SearchEngine;
-
import android.app.SearchManager;
import android.content.Context;
import android.database.Cursor;
@@ -38,6 +34,9 @@ import android.widget.Filterable;
import android.widget.ImageView;
import android.widget.TextView;
+import com.android.browser.provider.BrowserProvider2.OmniboxSuggestions;
+import com.android.browser.search.SearchEngine;
+
import java.util.ArrayList;
import java.util.List;
@@ -52,7 +51,6 @@ public class SuggestionsAdapter extends BaseAdapter implements Filterable,
public static final int TYPE_SUGGEST_URL = 2;
public static final int TYPE_SEARCH = 3;
public static final int TYPE_SUGGEST = 4;
- public static final int TYPE_VOICE_SEARCH = 5;
private static final String[] COMBINED_PROJECTION = {
OmniboxSuggestions._ID,
@@ -74,7 +72,6 @@ public class SuggestionsAdapter extends BaseAdapter implements Filterable,
final int mLinesPortrait;
final int mLinesLandscape;
final Object mResultsLock = new Object();
- List<String> mVoiceResults;
boolean mIncognitoMode;
BrowserSettings mSettings;
@@ -99,11 +96,6 @@ public class SuggestionsAdapter extends BaseAdapter implements Filterable,
addSource(new CombinedCursor());
}
- void setVoiceResults(List<String> voiceResults) {
- mVoiceResults = voiceResults;
- notifyDataSetChanged();
- }
-
public void setLandscapeMode(boolean mode) {
mLandscapeMode = mode;
notifyDataSetChanged();
@@ -135,20 +127,11 @@ public class SuggestionsAdapter extends BaseAdapter implements Filterable,
@Override
public int getCount() {
- if (mVoiceResults != null) {
- return mVoiceResults.size();
- }
return (mMixedResults == null) ? 0 : mMixedResults.getLineCount();
}
@Override
public SuggestItem getItem(int position) {
- if (mVoiceResults != null) {
- SuggestItem item = new SuggestItem(mVoiceResults.get(position),
- null, TYPE_VOICE_SEARCH);
- item.extra = Integer.toString(position);
- return item;
- }
if (mMixedResults == null) {
return null;
}
@@ -192,7 +175,6 @@ public class SuggestionsAdapter extends BaseAdapter implements Filterable,
switch (item.type) {
case TYPE_SUGGEST:
case TYPE_SEARCH:
- case TYPE_VOICE_SEARCH:
id = R.drawable.ic_search_category_suggest;
break;
case TYPE_BOOKMARK:
@@ -211,8 +193,7 @@ public class SuggestionsAdapter extends BaseAdapter implements Filterable,
ic1.setImageDrawable(mContext.getResources().getDrawable(id));
}
ic2.setVisibility(((TYPE_SUGGEST == item.type)
- || (TYPE_SEARCH == item.type)
- || (TYPE_VOICE_SEARCH == item.type))
+ || (TYPE_SEARCH == item.type))
? View.VISIBLE : View.GONE);
div.setVisibility(ic2.getVisibility());
ic2.setOnClickListener(this);
@@ -292,30 +273,25 @@ public class SuggestionsAdapter extends BaseAdapter implements Filterable,
@Override
protected FilterResults performFiltering(CharSequence constraint) {
FilterResults res = new FilterResults();
- if (mVoiceResults == null) {
- if (TextUtils.isEmpty(constraint) && !shouldProcessEmptyQuery()) {
- res.count = 0;
- res.values = null;
- return res;
- }
- startSuggestionsAsync(constraint);
- List<SuggestItem> filterResults = new ArrayList<SuggestItem>();
- if (constraint != null) {
- for (CursorSource sc : mSources) {
- sc.runQuery(constraint);
- }
- mixResults(filterResults);
- }
- synchronized (mResultsLock) {
- mFilterResults = filterResults;
+ if (TextUtils.isEmpty(constraint) && !shouldProcessEmptyQuery()) {
+ res.count = 0;
+ res.values = null;
+ return res;
+ }
+ startSuggestionsAsync(constraint);
+ List<SuggestItem> filterResults = new ArrayList<SuggestItem>();
+ if (constraint != null) {
+ for (CursorSource sc : mSources) {
+ sc.runQuery(constraint);
}
- SuggestionResults mixed = buildSuggestionResults();
- res.count = mixed.getLineCount();
- res.values = mixed;
- } else {
- res.count = mVoiceResults.size();
- res.values = mVoiceResults;
+ mixResults(filterResults);
+ }
+ synchronized (mResultsLock) {
+ mFilterResults = filterResults;
}
+ SuggestionResults mixed = buildSuggestionResults();
+ res.count = mixed.getLineCount();
+ res.values = mixed;
return res;
}
diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java
index 73f5b9e6..712e30af 100644
--- a/src/com/android/browser/Tab.java
+++ b/src/com/android/browser/Tab.java
@@ -18,13 +18,11 @@ package com.android.browser;
import android.app.Activity;
import android.app.AlertDialog;
-import android.app.SearchManager;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
-import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;
import android.graphics.BitmapFactory;
@@ -42,7 +40,6 @@ import android.os.Message;
import android.os.SystemClock;
import android.security.KeyChain;
import android.security.KeyChainAliasCallback;
-import android.speech.RecognizerResultsIntent;
import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
@@ -73,16 +70,12 @@ import android.widget.Toast;
import com.android.browser.TabControl.OnThumbnailUpdatedListener;
import com.android.browser.homepages.HomeProvider;
import com.android.browser.provider.SnapshotProvider.Snapshots;
-import com.android.common.speech.LoggingEvents;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map;
import java.util.UUID;
@@ -256,234 +249,6 @@ class Tab implements PictureListener {
static final String USERAGENT = "useragent";
static final String CLOSEFLAG = "closeOnBack";
- // -------------------------------------------------------------------------
-
- /**
- * Private information regarding the latest voice search. If the Tab is not
- * in voice search mode, this will be null.
- */
- private VoiceSearchData mVoiceSearchData;
- /**
- * Remove voice search mode from this tab.
- */
- public void revertVoiceSearchMode() {
- if (mVoiceSearchData != null) {
- mVoiceSearchData = null;
- if (mInForeground) {
- mWebViewController.revertVoiceSearchMode(this);
- }
- }
- }
-
- /**
- * Return whether the tab is in voice search mode.
- */
- public boolean isInVoiceSearchMode() {
- return mVoiceSearchData != null;
- }
- /**
- * Return true if the Tab is in voice search mode and the voice search
- * Intent came with a String identifying that Google provided the Intent.
- */
- public boolean voiceSearchSourceIsGoogle() {
- return mVoiceSearchData != null && mVoiceSearchData.mSourceIsGoogle;
- }
- /**
- * Get the title to display for the current voice search page. If the Tab
- * is not in voice search mode, return null.
- */
- public String getVoiceDisplayTitle() {
- if (mVoiceSearchData == null) return null;
- return mVoiceSearchData.mLastVoiceSearchTitle;
- }
- /**
- * Get the latest array of voice search results, to be passed to the
- * BrowserProvider. If the Tab is not in voice search mode, return null.
- */
- public ArrayList<String> getVoiceSearchResults() {
- if (mVoiceSearchData == null) return null;
- return mVoiceSearchData.mVoiceSearchResults;
- }
- /**
- * Activate voice search mode.
- * @param intent Intent which has the results to use, or an index into the
- * results when reusing the old results.
- */
- /* package */ void activateVoiceSearchMode(Intent intent) {
- int index = 0;
- ArrayList<String> results = intent.getStringArrayListExtra(
- RecognizerResultsIntent.EXTRA_VOICE_SEARCH_RESULT_STRINGS);
- if (results != null) {
- ArrayList<String> urls = intent.getStringArrayListExtra(
- RecognizerResultsIntent.EXTRA_VOICE_SEARCH_RESULT_URLS);
- ArrayList<String> htmls = intent.getStringArrayListExtra(
- RecognizerResultsIntent.EXTRA_VOICE_SEARCH_RESULT_HTML);
- ArrayList<String> baseUrls = intent.getStringArrayListExtra(
- RecognizerResultsIntent
- .EXTRA_VOICE_SEARCH_RESULT_HTML_BASE_URLS);
- // This tab is now entering voice search mode for the first time, or
- // a new voice search was done.
- int size = results.size();
- if (urls == null || size != urls.size()) {
- throw new AssertionError("improper extras passed in Intent");
- }
- if (htmls == null || htmls.size() != size || baseUrls == null ||
- (baseUrls.size() != size && baseUrls.size() != 1)) {
- // If either of these arrays are empty/incorrectly sized, ignore
- // them.
- htmls = null;
- baseUrls = null;
- }
- mVoiceSearchData = new VoiceSearchData(results, urls, htmls,
- baseUrls);
- mVoiceSearchData.mHeaders = intent.getParcelableArrayListExtra(
- RecognizerResultsIntent
- .EXTRA_VOICE_SEARCH_RESULT_HTTP_HEADERS);
- mVoiceSearchData.mSourceIsGoogle = intent.getBooleanExtra(
- VoiceSearchData.SOURCE_IS_GOOGLE, false);
- mVoiceSearchData.mVoiceSearchIntent = new Intent(intent);
- }
- String extraData = intent.getStringExtra(
- SearchManager.EXTRA_DATA_KEY);
- if (extraData != null) {
- index = Integer.parseInt(extraData);
- if (index >= mVoiceSearchData.mVoiceSearchResults.size()) {
- throw new AssertionError("index must be less than "
- + "size of mVoiceSearchResults");
- }
- if (mVoiceSearchData.mSourceIsGoogle) {
- Intent logIntent = new Intent(
- LoggingEvents.ACTION_LOG_EVENT);
- logIntent.putExtra(LoggingEvents.EXTRA_EVENT,
- LoggingEvents.VoiceSearch.N_BEST_CHOOSE);
- logIntent.putExtra(
- LoggingEvents.VoiceSearch.EXTRA_N_BEST_CHOOSE_INDEX,
- index);
- mContext.sendBroadcast(logIntent);
- }
- if (mVoiceSearchData.mVoiceSearchIntent != null) {
- // Copy the Intent, so that each history item will have its own
- // Intent, with different (or none) extra data.
- Intent latest = new Intent(mVoiceSearchData.mVoiceSearchIntent);
- latest.putExtra(SearchManager.EXTRA_DATA_KEY, extraData);
- mVoiceSearchData.mVoiceSearchIntent = latest;
- }
- }
- mVoiceSearchData.mLastVoiceSearchTitle
- = mVoiceSearchData.mVoiceSearchResults.get(index);
- if (mInForeground) {
- mWebViewController.activateVoiceSearchMode(
- mVoiceSearchData.mLastVoiceSearchTitle,
- mVoiceSearchData.mVoiceSearchResults);
- }
- if (mVoiceSearchData.mVoiceSearchHtmls != null) {
- // When index was found it was already ensured that it was valid
- String uriString = mVoiceSearchData.mVoiceSearchHtmls.get(index);
- if (uriString != null) {
- Uri dataUri = Uri.parse(uriString);
- if (RecognizerResultsIntent.URI_SCHEME_INLINE.equals(
- dataUri.getScheme())) {
- // If there is only one base URL, use it. If there are
- // more, there will be one for each index, so use the base
- // URL corresponding to the index.
- String baseUrl = mVoiceSearchData.mVoiceSearchBaseUrls.get(
- mVoiceSearchData.mVoiceSearchBaseUrls.size() > 1 ?
- index : 0);
- mVoiceSearchData.mLastVoiceSearchUrl = baseUrl;
- mMainView.loadDataWithBaseURL(baseUrl,
- uriString.substring(RecognizerResultsIntent
- .URI_SCHEME_INLINE.length() + 1), "text/html",
- "utf-8", baseUrl);
- return;
- }
- }
- }
- mVoiceSearchData.mLastVoiceSearchUrl
- = mVoiceSearchData.mVoiceSearchUrls.get(index);
- if (null == mVoiceSearchData.mLastVoiceSearchUrl) {
- mVoiceSearchData.mLastVoiceSearchUrl = UrlUtils.smartUrlFilter(
- mVoiceSearchData.mLastVoiceSearchTitle);
- }
- Map<String, String> headers = null;
- if (mVoiceSearchData.mHeaders != null) {
- int bundleIndex = mVoiceSearchData.mHeaders.size() == 1 ? 0
- : index;
- Bundle bundle = mVoiceSearchData.mHeaders.get(bundleIndex);
- if (bundle != null && !bundle.isEmpty()) {
- Iterator<String> iter = bundle.keySet().iterator();
- headers = new HashMap<String, String>();
- while (iter.hasNext()) {
- String key = iter.next();
- headers.put(key, bundle.getString(key));
- }
- }
- }
- mMainView.loadUrl(mVoiceSearchData.mLastVoiceSearchUrl, headers);
- }
- /* package */ static class VoiceSearchData {
- public VoiceSearchData(ArrayList<String> results,
- ArrayList<String> urls, ArrayList<String> htmls,
- ArrayList<String> baseUrls) {
- mVoiceSearchResults = results;
- mVoiceSearchUrls = urls;
- mVoiceSearchHtmls = htmls;
- mVoiceSearchBaseUrls = baseUrls;
- }
- /*
- * ArrayList of suggestions to be displayed when opening the
- * SearchManager
- */
- public ArrayList<String> mVoiceSearchResults;
- /*
- * ArrayList of urls, associated with the suggestions in
- * mVoiceSearchResults.
- */
- public ArrayList<String> mVoiceSearchUrls;
- /*
- * ArrayList holding content to load for each item in
- * mVoiceSearchResults.
- */
- public ArrayList<String> mVoiceSearchHtmls;
- /*
- * ArrayList holding base urls for the items in mVoiceSearchResults.
- * If non null, this will either have the same size as
- * mVoiceSearchResults or have a size of 1, in which case all will use
- * the same base url
- */
- public ArrayList<String> mVoiceSearchBaseUrls;
- /*
- * The last url provided by voice search. Used for comparison to see if
- * we are going to a page by some method besides voice search.
- */
- public String mLastVoiceSearchUrl;
- /**
- * The last title used for voice search. Needed to update the title bar
- * when switching tabs.
- */
- public String mLastVoiceSearchTitle;
- /**
- * Whether the Intent which turned on voice search mode contained the
- * String signifying that Google was the source.
- */
- public boolean mSourceIsGoogle;
- /**
- * List of headers to be passed into the WebView containing location
- * information
- */
- public ArrayList<Bundle> mHeaders;
- /**
- * The Intent used to invoke voice search. Placed on the
- * WebHistoryItem so that when coming back to a previous voice search
- * page we can again activate voice search.
- */
- public Intent mVoiceSearchIntent;
- /**
- * String used to identify Google as the source of voice search.
- */
- public static String SOURCE_IS_GOOGLE
- = "android.speech.extras.SOURCE_IS_GOOGLE";
- }
-
// Container class for the next error dialog that needs to be displayed
private class ErrorDialog {
public final int mTitle;
@@ -573,16 +338,6 @@ class Tab implements PictureListener {
mCurrentState = new PageState(mContext,
view.isPrivateBrowsingEnabled(), url, favicon);
mLoadStartTime = SystemClock.uptimeMillis();
- if (mVoiceSearchData != null
- && providersDiffer(url, mVoiceSearchData.mLastVoiceSearchUrl)) {
- if (mVoiceSearchData.mSourceIsGoogle) {
- Intent i = new Intent(LoggingEvents.ACTION_LOG_EVENT);
- i.putExtra(LoggingEvents.EXTRA_FLUSH, true);
- mContext.sendBroadcast(i);
- }
- revertVoiceSearchMode();
- }
-
// If we start a touch icon load and then load a new page, we don't
// want to cancel the current touch icon loader. But, we do want to
@@ -626,18 +381,6 @@ class Tab implements PictureListener {
// return true if want to hijack the url to let another app to handle it
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
- if (voiceSearchSourceIsGoogle()) {
- // This method is called when the user clicks on a link.
- // VoiceSearchMode is turned off when the user leaves the
- // Google results page, so at this point the user must be on
- // that page. If the user clicked a link on that page, assume
- // that the voice search was effective, and broadcast an Intent
- // so a receiver can take note of that fact.
- Intent logIntent = new Intent(LoggingEvents.ACTION_LOG_EVENT);
- logIntent.putExtra(LoggingEvents.EXTRA_EVENT,
- LoggingEvents.VoiceSearch.RESULT_CLICKED);
- mContext.sendBroadcast(logIntent);
- }
if (mInForeground) {
return mWebViewController.shouldOverrideUrlLoading(Tab.this,
view, url);
@@ -1420,9 +1163,6 @@ class Tab implements PictureListener {
mWebBackForwardListClient = new WebBackForwardListClient() {
@Override
public void onNewHistoryItem(WebHistoryItem item) {
- if (isInVoiceSearchMode()) {
- item.setCustomData(mVoiceSearchData.mVoiceSearchIntent);
- }
if (mClearHistoryUrlPattern != null) {
boolean match =
mClearHistoryUrlPattern.matcher(item.getOriginalUrl()).matches();
@@ -1439,13 +1179,6 @@ class Tab implements PictureListener {
mClearHistoryUrlPattern = null;
}
}
- @Override
- public void onIndexChanged(WebHistoryItem item, int index) {
- Object data = item.getCustomData();
- if (data != null && data instanceof Intent) {
- activateVoiceSearchMode((Intent) data);
- }
- }
};
mCaptureWidth = mContext.getResources().getDimensionPixelSize(
diff --git a/src/com/android/browser/UI.java b/src/com/android/browser/UI.java
index 034f136f..aeab7460 100644
--- a/src/com/android/browser/UI.java
+++ b/src/com/android/browser/UI.java
@@ -93,10 +93,6 @@ public interface UI {
public boolean isCustomViewShowing();
- public void showVoiceTitleBar(String title, List<String> results);
-
- public void revertVoiceTitleBar(Tab tab);
-
public boolean onPrepareOptionsMenu(Menu menu);
public void updateMenuState(Tab tab, Menu menu);
diff --git a/src/com/android/browser/UiController.java b/src/com/android/browser/UiController.java
index 46c04321..5be2343d 100644
--- a/src/com/android/browser/UiController.java
+++ b/src/com/android/browser/UiController.java
@@ -67,12 +67,6 @@ public interface UiController {
void bookmarkCurrentPage();
- void startVoiceSearch();
-
- boolean supportsVoiceSearch();
-
- void showVoiceSearchResults(String title);
-
void editUrl();
void handleNewIntent(Intent intent);
diff --git a/src/com/android/browser/UrlInputView.java b/src/com/android/browser/UrlInputView.java
index 1ba26feb..02bba3cb 100644
--- a/src/com/android/browser/UrlInputView.java
+++ b/src/com/android/browser/UrlInputView.java
@@ -55,7 +55,6 @@ public class UrlInputView extends AutoCompleteTextView
static final String TYPED = "browser-type";
static final String SUGGESTED = "browser-suggest";
- static final String VOICE = "voice-search";
static final int POST_DELAY = 100;
@@ -195,10 +194,6 @@ public class UrlInputView extends AutoCompleteTextView
return mState;
}
- void setVoiceResults(List<String> voiceResults) {
- mAdapter.setVoiceResults(voiceResults);
- }
-
@Override
protected void onConfigurationChanged(Configuration config) {
super.onConfigurationChanged(config);
@@ -298,8 +293,7 @@ public class UrlInputView extends AutoCompleteTextView
@Override
public void onSelect(String url, int type, String extra) {
- finishInput(url, extra, (type == SuggestionsAdapter.TYPE_VOICE_SEARCH)
- ? VOICE : SUGGESTED);
+ finishInput(url, extra, SUGGESTED);
}
@Override
diff --git a/src/com/android/browser/WebViewController.java b/src/com/android/browser/WebViewController.java
index 235fe975..fef6964c 100644
--- a/src/com/android/browser/WebViewController.java
+++ b/src/com/android/browser/WebViewController.java
@@ -89,10 +89,6 @@ public interface WebViewController {
void onUserCanceledSsl(Tab tab);
- void activateVoiceSearchMode(String title, List<String> results);
-
- void revertVoiceSearchMode(Tab tab);
-
boolean shouldShowErrorConsole();
void onUpdatedSecurityState(Tab tab);
diff --git a/src/com/android/browser/XLargeUi.java b/src/com/android/browser/XLargeUi.java
index 8e874e98..3b8245a2 100644
--- a/src/com/android/browser/XLargeUi.java
+++ b/src/com/android/browser/XLargeUi.java
@@ -156,11 +156,6 @@ public class XLargeUi extends BaseUi {
return;
}
mTabBar.onSetActiveTab(tab);
- if (tab.isInVoiceSearchMode()) {
- showVoiceTitleBar(tab.getVoiceDisplayTitle(), tab.getVoiceSearchResults());
- } else {
- revertVoiceTitleBar(tab);
- }
updateLockIconToLatest(tab);
mTitleBar.setSkipTitleBarAnimations(false);
}
diff --git a/src/com/android/browser/provider/BrowserProvider.java b/src/com/android/browser/provider/BrowserProvider.java
index b55b84a3..744032c9 100644
--- a/src/com/android/browser/provider/BrowserProvider.java
+++ b/src/com/android/browser/provider/BrowserProvider.java
@@ -16,10 +16,6 @@
package com.android.browser.provider;
-import com.android.browser.BrowserSettings;
-import com.android.browser.R;
-import com.android.browser.search.SearchEngine;
-
import android.app.SearchManager;
import android.app.backup.BackupManager;
import android.content.ContentProvider;
@@ -42,14 +38,16 @@ import android.os.Process;
import android.preference.PreferenceManager;
import android.provider.Browser;
import android.provider.Browser.BookmarkColumns;
-import android.speech.RecognizerResultsIntent;
import android.text.TextUtils;
import android.util.Log;
import android.util.Patterns;
+import com.android.browser.BrowserSettings;
+import com.android.browser.R;
+import com.android.browser.search.SearchEngine;
+
import java.io.File;
import java.io.FilenameFilter;
-import java.util.ArrayList;
import java.util.Date;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -751,105 +749,6 @@ public class BrowserProvider extends ContentProvider {
}
- private static class ResultsCursor extends AbstractCursor {
- // Array indices for RESULTS_COLUMNS
- private static final int RESULT_ACTION_ID = 1;
- private static final int RESULT_DATA_ID = 2;
- private static final int RESULT_TEXT_ID = 3;
- private static final int RESULT_ICON_ID = 4;
- private static final int RESULT_EXTRA_ID = 5;
-
- private static final String[] RESULTS_COLUMNS = new String[] {
- "_id",
- SearchManager.SUGGEST_COLUMN_INTENT_ACTION,
- SearchManager.SUGGEST_COLUMN_INTENT_DATA,
- SearchManager.SUGGEST_COLUMN_TEXT_1,
- SearchManager.SUGGEST_COLUMN_ICON_1,
- SearchManager.SUGGEST_COLUMN_INTENT_EXTRA_DATA
- };
- private final ArrayList<String> mResults;
- public ResultsCursor(ArrayList<String> results) {
- mResults = results;
- }
- @Override
- public int getCount() { return mResults.size(); }
-
- @Override
- public String[] getColumnNames() {
- return RESULTS_COLUMNS;
- }
-
- @Override
- public String getString(int column) {
- switch (column) {
- case RESULT_ACTION_ID:
- return RecognizerResultsIntent.ACTION_VOICE_SEARCH_RESULTS;
- case RESULT_TEXT_ID:
- // The data is used when the phone is in landscape mode. We
- // still want to show the result string.
- case RESULT_DATA_ID:
- return mResults.get(mPos);
- case RESULT_EXTRA_ID:
- // The Intent's extra data will store the index into
- // mResults so the BrowserActivity will know which result to
- // use.
- return Integer.toString(mPos);
- case RESULT_ICON_ID:
- return Integer.valueOf(R.drawable.magnifying_glass)
- .toString();
- default:
- return null;
- }
- }
- @Override
- public short getShort(int column) {
- throw new UnsupportedOperationException();
- }
- @Override
- public int getInt(int column) {
- throw new UnsupportedOperationException();
- }
- @Override
- public long getLong(int column) {
- if ((mPos != -1) && column == 0) {
- return mPos; // use row# as the _id
- }
- throw new UnsupportedOperationException();
- }
- @Override
- public float getFloat(int column) {
- throw new UnsupportedOperationException();
- }
- @Override
- public double getDouble(int column) {
- throw new UnsupportedOperationException();
- }
- @Override
- public boolean isNull(int column) {
- throw new UnsupportedOperationException();
- }
- }
-
- /** Contains custom suggestions results set by the UI */
- private ResultsCursor mResultsCursor;
- /** Locks access to {@link #mResultsCursor} */
- private Object mResultsCursorLock = new Object();
-
- /**
- * Provide a set of results to be returned to query, intended to be used
- * by the SearchDialog when the BrowserActivity is in voice search mode.
- * @param results Strings to display in the dropdown from the SearchDialog
- */
- public /* package */ void setQueryResults(ArrayList<String> results) {
- synchronized (mResultsCursorLock) {
- if (results == null) {
- mResultsCursor = null;
- } else {
- mResultsCursor = new ResultsCursor(results);
- }
- }
- }
-
@Override
public Cursor query(Uri url, String[] projectionIn, String selection,
String[] selectionArgs, String sortOrder)
@@ -859,15 +758,6 @@ public class BrowserProvider extends ContentProvider {
throw new IllegalArgumentException("Unknown URL");
}
- // If results for the suggestion are already ready just return them directly
- synchronized (mResultsCursorLock) {
- if (match == URI_MATCH_SUGGEST && mResultsCursor != null) {
- Cursor results = mResultsCursor;
- mResultsCursor = null;
- return results;
- }
- }
-
if (match == URI_MATCH_SUGGEST || match == URI_MATCH_BOOKMARKS_SUGGEST) {
// Handle suggestions
return doSuggestQuery(selection, selectionArgs, match == URI_MATCH_BOOKMARKS_SUGGEST);
diff --git a/src/com/android/browser/search/DefaultSearchEngine.java b/src/com/android/browser/search/DefaultSearchEngine.java
index a575404f..e4e0e968 100644
--- a/src/com/android/browser/search/DefaultSearchEngine.java
+++ b/src/com/android/browser/search/DefaultSearchEngine.java
@@ -118,10 +118,6 @@ public class DefaultSearchEngine implements SearchEngine {
public void close() {
}
- public boolean supportsVoiceSearch() {
- return getName().equals(SearchEngine.GOOGLE);
- }
-
@Override
public String toString() {
return "ActivitySearchEngine{" + mSearchable + "}";
diff --git a/src/com/android/browser/search/OpenSearchSearchEngine.java b/src/com/android/browser/search/OpenSearchSearchEngine.java
index 50585c05..e600aa98 100644
--- a/src/com/android/browser/search/OpenSearchSearchEngine.java
+++ b/src/com/android/browser/search/OpenSearchSearchEngine.java
@@ -195,10 +195,6 @@ public class OpenSearchSearchEngine implements SearchEngine {
mHttpClient.close();
}
- public boolean supportsVoiceSearch() {
- return getName().equals(SearchEngine.GOOGLE);
- }
-
private boolean isNetworkConnected(Context context) {
NetworkInfo networkInfo = getActiveNetworkInfo(context);
return networkInfo != null && networkInfo.isConnected();
diff --git a/src/com/android/browser/search/SearchEngine.java b/src/com/android/browser/search/SearchEngine.java
index 36430057..8f2d58db 100644
--- a/src/com/android/browser/search/SearchEngine.java
+++ b/src/com/android/browser/search/SearchEngine.java
@@ -58,11 +58,6 @@ public interface SearchEngine {
public void close();
/**
- * Checks whether this search engine supports voice search.
- */
- public boolean supportsVoiceSearch();
-
- /**
* Checks whether this search engine should be sent zero char query.
*/
public boolean wantsEmptyQuery();