android:hint="@string/http"
android:inputType="textUri|textMultiLine" />
- <!-- Entries and values in this list are set dynamically. -->
- <com.android.browser.search.SearchEnginePreference
- android:key="search_engine"
- android:title="@string/pref_content_search_engine"
- android:summary="@string/pref_content_search_engine_summary"
- android:dialogTitle="@string/pref_content_search_engine" />
-
- <CheckBoxPreference
- android:key="show_search_suggestions"
- android:defaultValue="true"
- android:title="@string/pref_content_show_search_suggestions"
- android:summaryOn="@string/pref_content_show_web_suggestions_summary_on"
- android:summaryOff="@string/pref_content_show_web_suggestions_summary_off" />
-
</PreferenceCategory>
<PreferenceCategory
<PreferenceCategory
android:title="@string/pref_extras_title">
+ <!-- Entries and values in this list are set dynamically. -->
+ <com.android.browser.search.SearchEnginePreference
+ android:key="search_engine"
+ android:title="@string/pref_content_search_engine"
+ android:defaultValue="google"
+ android:summary="@string/pref_content_search_engine_summary"
+ android:dialogTitle="@string/pref_content_search_engine" />
+
+ <CheckBoxPreference
+ android:key="show_search_suggestions"
+ android:defaultValue="true"
+ android:title="@string/pref_content_show_search_suggestions"
+ android:summaryOn="@string/pref_content_show_web_suggestions_summary_on"
+ android:summaryOff="@string/pref_content_show_web_suggestions_summary_off" />
+
<PreferenceScreen
android:key="website_settings"
android:title="@string/pref_extras_website_settings"
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);
+ }
+
super.startSearch(initialQuery, selectInitialQuery, appSearchData, globalSearch);
}
String packageName = mSearchable.getSearchActivity().getPackageName();
// Use "google" as name to avoid showing Google twice (app + OpenSearch)
if ("com.google.android.googlequicksearchbox".equals(packageName)) {
- return "google";
+ return SearchEngine.GOOGLE;
} else if ("com.android.quicksearchbox".equals(packageName)) {
- return "google";
+ return SearchEngine.GOOGLE;
} else {
return packageName;
}
public void close() {
}
+ public boolean supportsVoiceSearch() {
+ return getName().equals(SearchEngine.GOOGLE);
+ }
+
@Override
public String toString() {
return "ActivitySearchEngine{" + mSearchable + "}";
*/
public interface SearchEngine {
+ // Used if the search engine is Google
+ static final String GOOGLE = "google";
+
/**
* Gets the unique name of this search engine.
*/
*/
public void close();
+ /**
+ * Checks whether this search engine supports voice search.
+ */
+ public boolean supportsVoiceSearch();
}