Skip to content

Commit 4a02800

Browse files
committed
Add an option to hide the Voice Search icon.
Some search engines do not support voice search, so provide a flag to disable showing the icon in the SearchDialog. Change-Id: I7ef4ad5d382edb86c08014260defa4af6d5eca0a
1 parent 51c1898 commit 4a02800

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

core/java/android/app/SearchDialog.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,9 @@ private void updateQueryHint() {
588588
*/
589589
private void updateVoiceButton(boolean empty) {
590590
int visibility = View.GONE;
591-
if (mSearchable.getVoiceSearchEnabled() && empty) {
591+
if ((mAppSearchData == null || !mAppSearchData.getBoolean(
592+
SearchManager.DISABLE_VOICE_SEARCH, false))
593+
&& mSearchable.getVoiceSearchEnabled() && empty) {
592594
Intent testIntent = null;
593595
if (mSearchable.getVoiceSearchLaunchWebSearch()) {
594596
testIntent = mVoiceWebSearchIntent;

core/java/android/app/SearchManager.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,14 @@ public class SearchManager
394394
*/
395395
public final static String CONTEXT_IS_VOICE = "android.search.CONTEXT_IS_VOICE";
396396

397+
/**
398+
* This means that the voice icon should not be shown at all, because the
399+
* current search engine does not support voice search.
400+
* @hide
401+
*/
402+
public final static String DISABLE_VOICE_SEARCH
403+
= "android.search.DISABLE_VOICE_SEARCH";
404+
397405
/**
398406
* Reference to the shared system search service.
399407
*/

0 commit comments

Comments
 (0)