From 482c9bb390f1dae8e55806431a960f9df4d2f0b8 Mon Sep 17 00:00:00 2001 From: Jean-Michel Trivi Date: Thu, 17 May 2012 14:18:39 -0700 Subject: [PATCH] New action and extra in RecognizerIntent for "hands free" voice search New action and extra for android.speech.RecognizerIntent: ACTION_VOICE_SEARCH_HANDS_FREE EXTRA_SECURE Change-Id: I1f390ede4f4087bae1781347bb211dc0a093e857 --- api/16.txt | 2 + api/current.txt | 2 + .../java/android/speech/RecognizerIntent.java | 39 +++++++++++++++++++ 3 files changed, 43 insertions(+) diff --git a/api/16.txt b/api/16.txt index 1a694a8b06562..c467c3bb8c2a5 100644 --- a/api/16.txt +++ b/api/16.txt @@ -19690,6 +19690,7 @@ package android.speech { method public static final android.content.Intent getVoiceDetailsIntent(android.content.Context); field public static final java.lang.String ACTION_GET_LANGUAGE_DETAILS = "android.speech.action.GET_LANGUAGE_DETAILS"; field public static final java.lang.String ACTION_RECOGNIZE_SPEECH = "android.speech.action.RECOGNIZE_SPEECH"; + field public static final java.lang.String ACTION_VOICE_SEARCH_HANDS_FREE = "android.speech.action.VOICE_SEARCH_HANDS_FREE"; field public static final java.lang.String ACTION_WEB_SEARCH = "android.speech.action.WEB_SEARCH"; field public static final java.lang.String DETAILS_META_DATA = "android.speech.DETAILS"; field public static final java.lang.String EXTRA_CALLING_PACKAGE = "calling_package"; @@ -19705,6 +19706,7 @@ package android.speech { field public static final java.lang.String EXTRA_RESULTS = "android.speech.extra.RESULTS"; field public static final java.lang.String EXTRA_RESULTS_PENDINGINTENT = "android.speech.extra.RESULTS_PENDINGINTENT"; field public static final java.lang.String EXTRA_RESULTS_PENDINGINTENT_BUNDLE = "android.speech.extra.RESULTS_PENDINGINTENT_BUNDLE"; + field public static final java.lang.String EXTRA_SECURE = "android.speech.extras.EXTRA_SECURE"; field public static final java.lang.String EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS = "android.speech.extras.SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS"; field public static final java.lang.String EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS = "android.speech.extras.SPEECH_INPUT_MINIMUM_LENGTH_MILLIS"; field public static final java.lang.String EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS = "android.speech.extras.SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS"; diff --git a/api/current.txt b/api/current.txt index 1a694a8b06562..c467c3bb8c2a5 100644 --- a/api/current.txt +++ b/api/current.txt @@ -19690,6 +19690,7 @@ package android.speech { method public static final android.content.Intent getVoiceDetailsIntent(android.content.Context); field public static final java.lang.String ACTION_GET_LANGUAGE_DETAILS = "android.speech.action.GET_LANGUAGE_DETAILS"; field public static final java.lang.String ACTION_RECOGNIZE_SPEECH = "android.speech.action.RECOGNIZE_SPEECH"; + field public static final java.lang.String ACTION_VOICE_SEARCH_HANDS_FREE = "android.speech.action.VOICE_SEARCH_HANDS_FREE"; field public static final java.lang.String ACTION_WEB_SEARCH = "android.speech.action.WEB_SEARCH"; field public static final java.lang.String DETAILS_META_DATA = "android.speech.DETAILS"; field public static final java.lang.String EXTRA_CALLING_PACKAGE = "calling_package"; @@ -19705,6 +19706,7 @@ package android.speech { field public static final java.lang.String EXTRA_RESULTS = "android.speech.extra.RESULTS"; field public static final java.lang.String EXTRA_RESULTS_PENDINGINTENT = "android.speech.extra.RESULTS_PENDINGINTENT"; field public static final java.lang.String EXTRA_RESULTS_PENDINGINTENT_BUNDLE = "android.speech.extra.RESULTS_PENDINGINTENT_BUNDLE"; + field public static final java.lang.String EXTRA_SECURE = "android.speech.extras.EXTRA_SECURE"; field public static final java.lang.String EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS = "android.speech.extras.SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS"; field public static final java.lang.String EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS = "android.speech.extras.SPEECH_INPUT_MINIMUM_LENGTH_MILLIS"; field public static final java.lang.String EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS = "android.speech.extras.SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS"; diff --git a/core/java/android/speech/RecognizerIntent.java b/core/java/android/speech/RecognizerIntent.java index fd709f214bb7e..457e66c6dbddb 100644 --- a/core/java/android/speech/RecognizerIntent.java +++ b/core/java/android/speech/RecognizerIntent.java @@ -114,6 +114,45 @@ public class RecognizerIntent { */ public static final String ACTION_WEB_SEARCH = "android.speech.action.WEB_SEARCH"; + /** + * Starts an activity that will prompt the user for speech without requiring the user's + * visual attention or touch input. It will send it through a speech recognizer, + * and either synthesize speech for a web search result or trigger + * another type of action based on the user's speech. + * + * This activity may be launched while device is locked in a secure mode. + * Special care must be taken to ensure that the voice actions that are performed while + * hands free cannot compromise the device's security. + * The activity should check the value of the {@link #EXTRA_SECURE} extra to determine + * whether the device has been securely locked. If so, the activity should either restrict + * the set of voice actions that are permitted or require some form of secure + * authentication before proceeding. + * + * To ensure that the activity's user interface is visible while the lock screen is showing, + * the activity should set the + * {@link android.view.WindowManager.LayoutParams#FLAG_SHOW_WHEN_LOCKED} window flag. + * Otherwise the activity's user interface may be hidden by the lock screen. The activity + * should take care not to leak private information when the device is securely locked. + * + *

Optional extras: + *

+ */ + public static final String ACTION_VOICE_SEARCH_HANDS_FREE = + "android.speech.action.VOICE_SEARCH_HANDS_FREE"; + + /** + * Optional boolean to indicate that a "hands free" voice search was performed while the device + * was in a secure mode. An example of secure mode is when the device's screen lock is active, + * and it requires some form of authentication to be unlocked. + * + * When the device is securely locked, the voice search activity should either restrict + * the set of voice actions that are permitted, or require some form of secure authentication + * before proceeding. + */ + public static final String EXTRA_SECURE = "android.speech.extras.EXTRA_SECURE"; + /** * The minimum length of an utterance. We will not stop recording before this amount of time. *