Add SERVICE_INTERFACE and SERVICE_META_DATA constants to RecognitionService,
to be used by anyone implementing a voice recognition service. Also define
a new <recognition-service> styleable to be used in such service's metadata
xml.
Still to do: Change VoiceSearch's GoogleRecognitionService to respond to this
intent, and actually use this intent instead of ACTION_RECOGNIZE_SPEECH here
in RecognitionService.
diff --git a/api/current.xml b/api/current.xml
index b2a2bc1..b62cc9a 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -135928,6 +135928,28 @@
<parameter name="listener" type="android.speech.RecognitionService.Callback">
</parameter>
</method>
+<field name="SERVICE_INTERFACE"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""android.speech.RecognitionService""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="SERVICE_META_DATA"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value=""android.speech""
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
</class>
<class name="RecognitionService.Callback"
extends="java.lang.Object"
diff --git a/core/java/android/speech/RecognitionService.java b/core/java/android/speech/RecognitionService.java
index 0d74960..5de6cf0 100644
--- a/core/java/android/speech/RecognitionService.java
+++ b/core/java/android/speech/RecognitionService.java
@@ -16,6 +16,8 @@
package android.speech;
+import android.annotation.SdkConstant;
+import android.annotation.SdkConstant.SdkConstantType;
import android.app.Service;
import android.content.Intent;
import android.content.pm.PackageManager;
@@ -32,6 +34,18 @@
* implementation of this service is state-less.
*/
public abstract class RecognitionService extends Service {
+ /**
+ * The {@link Intent} that must be declared as handled by the service.
+ */
+ @SdkConstant(SdkConstantType.SERVICE_ACTION)
+ public static final String SERVICE_INTERFACE = "android.speech.RecognitionService";
+
+ /**
+ * Name under which a RecognitionService component publishes information about itself.
+ * This meta-data should reference an XML resource containing a
+ * <code><{@link android.R.styleable#RecognitionService recognition-service}></code> tag.
+ */
+ public static final String SERVICE_META_DATA = "android.speech";
/** Log messages identifier */
private static final String TAG = "RecognitionService";
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 794a9f0..ff8cdc9 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -1452,7 +1452,7 @@
included in that tag. -->
<declare-styleable name="InputMethod">
<!-- Component name of an activity that allows the user to modify
- the settings for this input method. -->
+ the settings for this service. -->
<attr name="settingsActivity" format="string" />
<!-- Set to true in all of the configurations for which this input
method should be considered an option as the default. -->
@@ -3494,8 +3494,6 @@
meta-data entry. Described here are the attributes that can be
included in that tag. -->
<declare-styleable name="Wallpaper">
- <!-- Component name of an activity that allows the user to modify
- the current settings for this wallpaper. -->
<attr name="settingsActivity" />
<!-- Reference to a the wallpaper's thumbnail bitmap. -->
@@ -3586,5 +3584,13 @@
<!-- Use "horizontal" for a row, "vertical" for a column. The default is horizontal. -->
<attr name="orientation" />
</declare-styleable>
+
+ <!-- Use <code>recognition-service</code> as the root tag of the XML resource that
+ describes a {@link android.speech.RecognitionService}, which is reference from
+ its {@link android.speech.RecognitionService#SERVICE_META_DATA} meta-data entry.
+ Described here are the attributes that can be included in that tag. -->
+ <declare-styleable name="RecognitionService">
+ <attr name="settingsActivity" />
+ </declare-styleable>
</resources>