From 4c156ec6ec9adcb407189ee57e0c205039b60148 Mon Sep 17 00:00:00 2001 From: Andy Stadler <> Date: Tue, 21 Apr 2009 11:54:45 -0700 Subject: AI 147168: am: CL 147163 Copy documentation for the various search-by-voice flags that were already listed in attrs.xml into SearchManager.java. Add a (brief - no time for more) description about how to add search by voice to apps. JAVADOC ONLY - should be safe change for cupcake sdk. Original author: stadler Merged from: //branches/cupcake/... Automated import of CL 147168 --- core/java/android/app/SearchManager.java | 82 +++++++++++++++++++++++++++++++- core/res/res/values/attrs.xml | 7 +-- 2 files changed, 84 insertions(+), 5 deletions(-) diff --git a/core/java/android/app/SearchManager.java b/core/java/android/app/SearchManager.java index c1d66f4..ecdd3f8 100644 --- a/core/java/android/app/SearchManager.java +++ b/core/java/android/app/SearchManager.java @@ -807,7 +807,7 @@ import android.view.KeyEvent; * this way would be if you wish to partition it into separate sections with different search * behaviors; Otherwise this configuration is not recommended. * - *
Additional Metadata for search suggestions. If you have defined a content provider + *
Additional metadata for search suggestions. If you have defined a content provider * to generate search suggestions, you'll need to publish it to the system, and you'll need to * provide a bit of additional XML metadata in order to configure communications with it. * @@ -880,7 +880,7 @@ import android.view.KeyEvent; * * * - *
Additional Metadata for search action keys. For each action key that you would like to + *
Additional metadata for search action keys. For each action key that you would like to * define, you'll need to add an additional element defining that key, and using the attributes * discussed in Action Keys. A simple example is shown here: * @@ -956,6 +956,84 @@ import android.view.KeyEvent; * * * + *
Additional metadata for enabling voice search. To enable voice search for your + * activity, you can add fields to the metadata that enable and configure voice search. When + * enabled (and available on the device), a voice search button will be displayed in the + * Search UI. Clicking this button will launch a voice search activity. When the user has + * finished speaking, the voice search phrase will be transcribed into text and presented to the + * searchable activity as if it were a typed query. + * + *
Elements of search metadata that support voice search: + *
Attribute | Description | Required? | ||||||
---|---|---|---|---|---|---|---|---|
android:voiceSearchMode | + *If provided and non-zero, enables voice search. (Voice search may not be
+ * provided by the device, in which case these flags will have no effect.) The
+ * following mode bits are defined:
+ *
|
+ * No | + *||||||
android:voiceLanguageModel | + *If provided, this specifies the language model that should be used by the voice + * recognition system. + * See {@link android.speech.RecognizerIntent#EXTRA_LANGUAGE_MODEL} + * for more information. If not provided, the default value + * {@link android.speech.RecognizerIntent#LANGUAGE_MODEL_FREE_FORM} will be used. | + *No | + *||||||
android:voicePromptText | + *If provided, this specifies a prompt that will be displayed during voice input. + * (If not provided, a default prompt will be displayed.) | + *No | + *||||||
android:voiceLanguage | + *If provided, this specifies the spoken language to be expected. This is only + * needed if it is different from the current value of + * {@link java.util.Locale#getDefault()}. + * | + *No | + *||||||
android:voiceMaxResults | + *If provided, enforces the maximum number of results to return, including the "best" + * result which will always be provided as the SEARCH intent's primary query. Must be + * one or greater. Use {@link android.speech.RecognizerIntent#EXTRA_RESULTS} + * to get the results from the intent. If not provided, the recognizer will choose + * how many results to return. | + *No | + *