diff --git a/api/current.xml b/api/current.xml index b7a04dafc48b9..7004eeb90aa39 100644 --- a/api/current.xml +++ b/api/current.xml @@ -138315,225 +138315,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/java/android/speech/IRecognitionListener.aidl b/core/java/android/speech/IRecognitionListener.aidl index 2a0f986ffd92d..3d3c44bf1efe6 100644 --- a/core/java/android/speech/IRecognitionListener.aidl +++ b/core/java/android/speech/IRecognitionListener.aidl @@ -59,7 +59,7 @@ oneway interface IRecognitionListener { /** * A network or recognition error occurred. * - * @param error code is defined in {@link RecognitionManager} + * @param error code is defined in {@link SpeechRecognizer} */ void onError(in int error); diff --git a/core/java/android/speech/IRecognitionService.aidl b/core/java/android/speech/IRecognitionService.aidl index 8b27e63395fb9..be6ef6d20e104 100644 --- a/core/java/android/speech/IRecognitionService.aidl +++ b/core/java/android/speech/IRecognitionService.aidl @@ -25,7 +25,7 @@ import android.speech.IRecognitionListener; * you want to begin capturing audio; RecognitionService will automatically * determine when the user has finished speaking, stream the audio to the * recognition servers, and notify you when results are ready. In most of the cases, -* this class should not be used directly, instead use {@link RecognitionManager} for +* this class should not be used directly, instead use {@link SpeechRecognizer} for * accessing recognition service. * {@hide} */ diff --git a/core/java/android/speech/RecognitionListener.java b/core/java/android/speech/RecognitionListener.java index 2f5bcc3ddb53e..5eb71d7eb9396 100644 --- a/core/java/android/speech/RecognitionListener.java +++ b/core/java/android/speech/RecognitionListener.java @@ -19,7 +19,7 @@ import android.content.Intent; import android.os.Bundle; /** - * Used for receiving notifications from the RecognitionManager when the + * Used for receiving notifications from the SpeechRecognizer when the * recognition related events occur. All the callbacks are executed on the * Application main thread. */ @@ -61,7 +61,7 @@ public interface RecognitionListener { /** * A network or recognition error occurred. * - * @param error code is defined in {@link RecognitionManager} + * @param error code is defined in {@link SpeechRecognizer} */ void onError(int error); @@ -70,7 +70,7 @@ public interface RecognitionListener { * * @param results the recognition results. To retrieve the results in {@code * ArrayList<String>} format use {@link Bundle#getStringArrayList(String)} with - * {@link RecognitionManager#RESULTS_RECOGNITION} as a parameter + * {@link SpeechRecognizer#RESULTS_RECOGNITION} as a parameter */ void onResults(Bundle results); @@ -78,13 +78,13 @@ public interface RecognitionListener { * Called when partial recognition results are available. The callback might be called at any * time between {@link #onBeginningOfSpeech()} and {@link #onResults(Bundle)} when partial * results are ready. This method may be called zero, one or multiple times for each call to - * {@link RecognitionManager#startListening(Intent)}, depending on the speech recognition + * {@link SpeechRecognizer#startListening(Intent)}, depending on the speech recognition * service implementation. To request partial results, use * {@link RecognizerIntent#EXTRA_PARTIAL_RESULTS} * * @param partialResults the returned results. To retrieve the results in * ArrayList<String> format use {@link Bundle#getStringArrayList(String)} with - * {@link RecognitionManager#RESULTS_RECOGNITION} as a parameter + * {@link SpeechRecognizer#RESULTS_RECOGNITION} as a parameter */ void onPartialResults(Bundle partialResults); diff --git a/core/java/android/speech/RecognitionService.java b/core/java/android/speech/RecognitionService.java index 941b70c065f63..5a0959a2272d0 100644 --- a/core/java/android/speech/RecognitionService.java +++ b/core/java/android/speech/RecognitionService.java @@ -89,7 +89,7 @@ public abstract class RecognitionService extends Service { RecognitionService.this.onStartListening(intent, mCurrentCallback); } else { try { - listener.onError(RecognitionManager.ERROR_RECOGNIZER_BUSY); + listener.onError(SpeechRecognizer.ERROR_RECOGNIZER_BUSY); } catch (RemoteException e) { Log.d(TAG, "onError call from startListening failed"); } @@ -100,10 +100,10 @@ public abstract class RecognitionService extends Service { private void dispatchStopListening(IRecognitionListener listener) { try { if (mCurrentCallback == null) { - listener.onError(RecognitionManager.ERROR_CLIENT); + listener.onError(SpeechRecognizer.ERROR_CLIENT); Log.w(TAG, "stopListening called with no preceding startListening - ignoring"); } else if (mCurrentCallback.mListener.asBinder() != listener.asBinder()) { - listener.onError(RecognitionManager.ERROR_RECOGNIZER_BUSY); + listener.onError(SpeechRecognizer.ERROR_RECOGNIZER_BUSY); Log.w(TAG, "stopListening called by other caller than startListening - ignoring"); } else { // the correct state RecognitionService.this.onStopListening(mCurrentCallback); @@ -175,7 +175,7 @@ public abstract class RecognitionService extends Service { } try { Log.e(TAG, "call for recognition service without RECORD_AUDIO permissions"); - listener.onError(RecognitionManager.ERROR_INSUFFICIENT_PERMISSIONS); + listener.onError(SpeechRecognizer.ERROR_INSUFFICIENT_PERMISSIONS); } catch (RemoteException re) { Log.e(TAG, "sending ERROR_INSUFFICIENT_PERMISSIONS message failed", re); } @@ -252,7 +252,7 @@ public abstract class RecognitionService extends Service { /** * The service should call this method when a network or recognition error occurred. * - * @param error code is defined in {@link RecognitionManager} + * @param error code is defined in {@link SpeechRecognizer} */ public void error(int error) throws RemoteException { mCurrentCallback = null; @@ -263,12 +263,12 @@ public abstract class RecognitionService extends Service { * The service should call this method when partial recognition results are available. This * method can be called at any time between {@link #beginningOfSpeech()} and * {@link #results(Bundle)} when partial results are ready. This method may be called zero, - * one or multiple times for each call to {@link RecognitionManager#startListening(Intent)}, + * one or multiple times for each call to {@link SpeechRecognizer#startListening(Intent)}, * depending on the speech recognition service implementation. * * @param partialResults the returned results. To retrieve the results in * ArrayList<String> format use {@link Bundle#getStringArrayList(String)} with - * {@link RecognitionManager#RESULTS_RECOGNITION} as a parameter + * {@link SpeechRecognizer#RESULTS_RECOGNITION} as a parameter */ public void partialResults(Bundle partialResults) throws RemoteException { mListener.onPartialResults(partialResults); @@ -289,7 +289,7 @@ public abstract class RecognitionService extends Service { * * @param results the recognition results. To retrieve the results in {@code * ArrayList<String>} format use {@link Bundle#getStringArrayList(String)} with - * {@link RecognitionManager#RESULTS_RECOGNITION} as a parameter + * {@link SpeechRecognizer#RESULTS_RECOGNITION} as a parameter */ public void results(Bundle results) throws RemoteException { mCurrentCallback = null; diff --git a/core/java/android/speech/RecognitionManager.java b/core/java/android/speech/SpeechRecognizer.java similarity index 89% rename from core/java/android/speech/RecognitionManager.java rename to core/java/android/speech/SpeechRecognizer.java index 9ed9941ad568b..7f9a12bf742f1 100644 --- a/core/java/android/speech/RecognitionManager.java +++ b/core/java/android/speech/SpeechRecognizer.java @@ -38,16 +38,16 @@ import java.util.Queue; /** * This class provides access to the speech recognition service. This service allows access to the * speech recognizer. Do not instantiate this class directly, instead, call - * {@link RecognitionManager#createRecognitionManager(Context)}. This class's methods must be + * {@link SpeechRecognizer#createSpeechRecognizer(Context)}. This class's methods must be * invoked only from the main application thread. Please note that the application must have * {@link android.Manifest.permission#RECORD_AUDIO} permission to use this class. */ -public class RecognitionManager { +public class SpeechRecognizer { /** DEBUG value to enable verbose debug prints */ private final static boolean DBG = false; /** Log messages identifier */ - private static final String TAG = "RecognitionManager"; + private static final String TAG = "SpeechRecognizer"; /** * Used to retrieve an {@code ArrayList<String>} from the {@link Bundle} passed to the @@ -133,10 +133,10 @@ public class RecognitionManager { private final InternalListener mListener = new InternalListener(); /** - * The right way to create a {@code RecognitionManager} is by using - * {@link #createRecognitionManager} static factory method + * The right way to create a {@code SpeechRecognizer} is by using + * {@link #createSpeechRecognizer} static factory method */ - private RecognitionManager(final Context context, final ComponentName serviceComponent) { + private SpeechRecognizer(final Context context, final ComponentName serviceComponent) { mContext = context; mServiceComponent = serviceComponent; } @@ -167,10 +167,10 @@ public class RecognitionManager { /** * Checks whether a speech recognition service is available on the system. If this method - * returns {@code false}, {@link RecognitionManager#createRecognitionManager(Context)} will + * returns {@code false}, {@link SpeechRecognizer#createSpeechRecognizer(Context)} will * fail. * - * @param context with which {@code RecognitionManager} will be created + * @param context with which {@code SpeechRecognizer} will be created * @return {@code true} if recognition is available, {@code false} otherwise */ public static boolean isRecognitionAvailable(final Context context) { @@ -180,41 +180,41 @@ public class RecognitionManager { } /** - * Factory method to create a new {@code RecognitionManager}. Please note that + * Factory method to create a new {@code SpeechRecognizer}. Please note that * {@link #setRecognitionListener(RecognitionListener)} should be called before dispatching any - * command to the created {@code RecognitionManager}, otherwise no notifications will be + * command to the created {@code SpeechRecognizer}, otherwise no notifications will be * received. * - * @param context in which to create {@code RecognitionManager} - * @return a new {@code RecognitionManager} + * @param context in which to create {@code SpeechRecognizer} + * @return a new {@code SpeechRecognizer} */ - public static RecognitionManager createRecognitionManager(final Context context) { - return createRecognitionManager(context, null); + public static SpeechRecognizer createSpeechRecognizer(final Context context) { + return createSpeechRecognizer(context, null); } /** - * Factory method to create a new {@code RecognitionManager}. Please note that + * Factory method to create a new {@code SpeechRecognizer}. Please note that * {@link #setRecognitionListener(RecognitionListener)} should be called before dispatching any - * command to the created {@code RecognitionManager}, otherwise no notifications will be + * command to the created {@code SpeechRecognizer}, otherwise no notifications will be * received. * * Use this version of the method to specify a specific service to direct this - * {@link RecognitionManager} to. Normally you would not use this; use - * {@link #createRecognitionManager(Context)} instead to use the system default recognition + * {@link SpeechRecognizer} to. Normally you would not use this; use + * {@link #createSpeechRecognizer(Context)} instead to use the system default recognition * service. * - * @param context in which to create {@code RecognitionManager} + * @param context in which to create {@code SpeechRecognizer} * @param serviceComponent the {@link ComponentName} of a specific service to direct this - * {@code RecognitionManager} to - * @return a new {@code RecognitionManager} + * {@code SpeechRecognizer} to + * @return a new {@code SpeechRecognizer} */ - public static RecognitionManager createRecognitionManager(final Context context, + public static SpeechRecognizer createSpeechRecognizer(final Context context, final ComponentName serviceComponent) { if (context == null) { throw new IllegalArgumentException("Context cannot be null)"); } checkIsCalledFromMainThread(); - return new RecognitionManager(context, serviceComponent); + return new SpeechRecognizer(context, serviceComponent); } /** @@ -223,7 +223,7 @@ public class RecognitionManager { * listener. * * @param listener listener that will receive all the callbacks from the created - * {@link RecognitionManager}, this must not be null. + * {@link SpeechRecognizer}, this must not be null. */ public void setRecognitionListener(RecognitionListener listener) { checkIsCalledFromMainThread(); @@ -303,7 +303,7 @@ public class RecognitionManager { private static void checkIsCalledFromMainThread() { if (Looper.myLooper() != Looper.getMainLooper()) { throw new RuntimeException( - "RecognitionManager should be used only from the application's main thread"); + "SpeechRecognizer should be used only from the application's main thread"); } } @@ -373,7 +373,7 @@ public class RecognitionManager { } /** - * Destroys the {@code RecognitionManager} object. + * Destroys the {@code SpeechRecognizer} object. */ public void destroy() { if (mConnection != null) {