RecognizerResultsIntent.java revision 41b14e8ff7a1774fc69dfcf1261f87e50dd55a03
141b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau/* 241b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * Copyright (C) 2010 The Android Open Source Project 341b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * 441b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * Licensed under the Apache License, Version 2.0 (the "License"); 541b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * you may not use this file except in compliance with the License. 641b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * You may obtain a copy of the License at 741b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * 841b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * http://www.apache.org/licenses/LICENSE-2.0 941b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * 1041b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * Unless required by applicable law or agreed to in writing, software 1141b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * distributed under the License is distributed on an "AS IS" BASIS, 1241b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1341b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * See the License for the specific language governing permissions and 1441b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * limitations under the License. 1541b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau */ 1641b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau 1741b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeaupackage android.speech; 1841b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau 1941b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeauimport java.util.ArrayList; 2041b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau 2141b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau/** 2241b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * Constants for intents related to showing speech recognition results. 2341b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * 2441b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * These constants should not be needed for normal utilization of speech recognition. They 2541b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * would only be called if you wanted to trigger a view of voice search results in your 2641b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * application, or implemented if you wanted to offer a different view for voice search results 2741b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * with your application. 2841b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * 2941b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * The standard behavior here for someone receiving an {@link #ACTION_VOICE_SEARCH_RESULTS} is to 3041b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * first retrieve the list of {@link #EXTRA_VOICE_SEARCH_RESULT_STRINGS}, and use any provided 3141b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * HTML for that result in {@link #EXTRA_VOICE_SEARCH_RESULT_HTML}, if available, to display 3241b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * the search results. If that is not available, then the corresponding url for that result in 3341b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * {@link #EXTRA_VOICE_SEARCH_RESULT_URLS} should be used. And if even that is not available, 3441b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * then a search url should be constructed from the actual recognition result string. 3541b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * 3641b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * @hide for making public in a later release 3741b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau */ 3841b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeaupublic class RecognizerResultsIntent { 3941b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau private RecognizerResultsIntent() { 4041b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau // Not for instantiating. 4141b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau } 4241b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau 4341b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau /** 4441b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * Intent that can be sent by implementations of voice search to display the results of 4541b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * a search in, for example, a web browser. 4641b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * 4741b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * This intent should always be accompanied by at least 4841b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * {@link #EXTRA_VOICE_SEARCH_RESULT_STRINGS}, and optionally but recommended, 4941b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * {@link #EXTRA_VOICE_SEARCH_RESULT_URLS}, and sometimes 5041b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * {@link #EXTRA_VOICE_SEARCH_RESULT_HTML}. These are three parallel arrays, where a 5141b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * recognition result string at index N of {@link #EXTRA_VOICE_SEARCH_RESULT_STRINGS} should 5241b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * be accompanied by a url to use for searching based on that string at index N of 5341b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * {@link #EXTRA_VOICE_SEARCH_RESULT_URLS}, and, possibly, the full html to display for 5441b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * that result at index N of {@link #EXTRA_VOICE_SEARCH_RESULT_HTML}. 5541b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * 5641b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * @hide for making public in a later release 5741b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau */ 5841b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau public static final String ACTION_VOICE_SEARCH_RESULTS = 5941b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau "android.speech.action.VOICE_SEARCH_RESULTS"; 6041b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau 6141b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau /** 6241b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * The key to an extra {@link ArrayList} of {@link String}s that contains the list of 6341b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * recognition alternates from voice search, in order from highest to lowest confidence. 6441b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * 6541b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * @hide for making public in a later release 6641b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau */ 6741b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau public static final String EXTRA_VOICE_SEARCH_RESULT_STRINGS = 6841b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau "android.speech.extras.VOICE_SEARCH_RESULT_STRINGS"; 6941b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau 7041b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau /** 7141b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * The key to an extra {@link ArrayList} of {@link String}s that contains the search urls 7241b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * to use, if available, for the recognition alternates provided in 7341b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * {@link #EXTRA_VOICE_SEARCH_RESULT_STRINGS}. This list should always be the same size as the 7441b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * one provided in {@link #EXTRA_VOICE_SEARCH_RESULT_STRINGS} - if a result cannot provide a 7541b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * search url, that entry in this ArrayList should be <code>null</code>, and the implementor of 7641b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * {@link #ACTION_VOICE_SEARCH_RESULTS} should execute a search of its own choosing, 7741b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * based on the recognition result string. 7841b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * 7941b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * @hide for making public in a later release 8041b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau */ 8141b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau public static final String EXTRA_VOICE_SEARCH_RESULT_URLS = 8241b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau "android.speech.extras.VOICE_SEARCH_RESULT_URLS"; 8341b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau 8441b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau /** 8541b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * The key to an extra {@link ArrayList} of {@link String}s that contains the html content to 8641b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * use, if available, for the recognition alternates provided in 8741b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * {@link #EXTRA_VOICE_SEARCH_RESULT_STRINGS}. This list should always be the same size as the 8841b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * one provided in {@link #EXTRA_VOICE_SEARCH_RESULT_STRINGS} - if a result cannot provide 8941b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * html, that entry in this list should be <code>null</code>, and the implementor of 9041b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * {@link #ACTION_VOICE_SEARCH_RESULTS} should back off to the corresponding url provided in 9141b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * {@link #EXTRA_VOICE_SEARCH_RESULT_URLS}, if available, or else should execute a search of 9241b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * its own choosing, based on the recognition result string. 9341b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * 9441b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * Currently this html content should be expected in the form of an "inline:" uri for the 9541b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * Browser. In the future this may change to a "content://" uri or some other identifier. 9641b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * Anyone who reads this extra should confirm that a result is in fact an "inline:" uri and 9741b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * back off to the urls or strings gracefully if it is not, thus maintaining future backwards 9841b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * compatibility if this changes. 9941b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * 10041b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau * @hide not to be exposed immediately as the implementation details may change 10141b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau */ 10241b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau public static final String EXTRA_VOICE_SEARCH_RESULT_HTML = 10341b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau "android.speech.extras.VOICE_SEARCH_RESULT_HTML"; 10441b14e8ff7a1774fc69dfcf1261f87e50dd55a03Mike LeBeau} 105