summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorMike LeBeau <mlebeau@android.com>2010-02-24 14:08:18 -0800
committerMike LeBeau <mlebeau@android.com>2010-02-25 07:19:55 -0800
commit2f5fc454c82e61df135d5faa46b77f75107386d2 (patch)
tree5724f462dbbdc987345212a6ba580d888017c6fd /common
parente575d3dff5b06cb5a4aae0fa0626f884297eb15d (diff)
downloadframeworks_base-2f5fc454c82e61df135d5faa46b77f75107386d2.zip
frameworks_base-2f5fc454c82e61df135d5faa46b77f75107386d2.tar.gz
frameworks_base-2f5fc454c82e61df135d5faa46b77f75107386d2.tar.bz2
Add the API constants to support providing hint strings in the response to
RecognizerIntent.ACTION_GET_LANGUAGE_DETAILS. This will use the new support for ArrayList<CharSequence> bundles added in http://b/2468093. This and the corresponding VoiceSearch CL should not be submitted until that is.
Diffstat (limited to 'common')
-rw-r--r--common/java/com/android/common/speech/Recognition.java37
1 files changed, 35 insertions, 2 deletions
diff --git a/common/java/com/android/common/speech/Recognition.java b/common/java/com/android/common/speech/Recognition.java
index 6f164a9..bf60c9a 100644
--- a/common/java/com/android/common/speech/Recognition.java
+++ b/common/java/com/android/common/speech/Recognition.java
@@ -19,7 +19,8 @@ package com.android.common.speech;
/**
* Utilities for voice recognition implementations.
*
- * @see android.app.RecognitionService
+ * @see android.speech.RecognitionService
+ * @see android.speech.RecognizerIntent
*/
public class Recognition {
@@ -30,7 +31,39 @@ public class Recognition {
* is set by anyone but the system process, it should be overridden by the voice search
* implementation.
*/
- public final static String EXTRA_CALLING_PACKAGE = "calling_package";
+ public static final String EXTRA_CALLING_PACKAGE = "calling_package";
+
+ /**
+ * The key to the extra in the Bundle returned by
+ * android.speech.RecognizerIntent#ACTION_GET_LANGUAGE_DETAILS
+ * which is an ArrayList of CharSequences which are hints that can be shown to
+ * the user for voice actions currently supported by voice search for the user's current
+ * language preference for voice search (i.e., the one defined in the extra
+ * android.speech.RecognizerIntent#EXTRA_LANGUAGE_PREFERENCE).
+ *
+ * If this is paired with EXTRA_HINT_CONTEXT, should return a set of hints that are
+ * appropriate for the provided context.
+ *
+ * The CharSequences are SpannedStrings and will contain segments wrapped in
+ * <annotation action="true"></annotation>. This is to indicate the section of the text
+ * which represents the voice action, to be highlighted in the UI if so desired.
+ */
+ public static final String EXTRA_HINT_STRINGS = "android.speech.extra.HINT_STRINGS";
+
+ /**
+ * The key to an extra to be included in the request intent for
+ * android.speech.RecognizerIntent#ACTION_GET_LANGUAGE_DETAILS.
+ * Should be an int of one of the values defined below. If an
+ * unknown int value is provided, it should be ignored.
+ */
+ public static final String EXTRA_HINT_CONTEXT = "android.speech.extra.HINT_CONTEXT";
+
+ /**
+ * A set of values for EXTRA_HINT_CONTEXT.
+ */
+ public static final int HINT_CONTEXT_UNKNOWN = 0;
+ public static final int HINT_CONTEXT_VOICE_SEARCH_HELP = 1;
+ public static final int HINT_CONTEXT_CAR_HOME = 2;
private Recognition() { } // don't instantiate
}