diff options
author | Przemyslaw Szczepaniak <pszczepaniak@google.com> | 2014-07-08 12:56:35 +0100 |
---|---|---|
committer | Przemyslaw Szczepaniak <pszczepaniak@google.com> | 2014-07-10 14:32:31 +0000 |
commit | cafd15216ee66a302ee69c0ea0c6c63b07a2f68c (patch) | |
tree | e5c37b0fc57490a51211abc6107e615d8aae9062 /core/java/android/speech | |
parent | c09a04da297ff85b97aa6ec0a457e9292b8bf7fa (diff) | |
download | frameworks_base-cafd15216ee66a302ee69c0ea0c6c63b07a2f68c.zip frameworks_base-cafd15216ee66a302ee69c0ea0c6c63b07a2f68c.tar.gz frameworks_base-cafd15216ee66a302ee69c0ea0c6c63b07a2f68c.tar.bz2 |
Fix TTS regression, TTS#stop can result in #onDone callback.
Regressinon in the L, side effect of the rewrite. In pre-L android,
UtteranceProgressListener#onDone was called (but only if client
received UtteranceProgressListener#onStart for the utterance in progress)
after client called TextToSpeech#stop. This changeset reinstates
this behaviour.
+ Removed not used fallback callback
Bug: 16149006
Change-Id: I2eb5ede0abe6f5717b07f09adad861465575c238
Diffstat (limited to 'core/java/android/speech')
-rw-r--r-- | core/java/android/speech/tts/ITextToSpeechCallback.aidl | 7 | ||||
-rw-r--r-- | core/java/android/speech/tts/TextToSpeech.java | 10 | ||||
-rw-r--r-- | core/java/android/speech/tts/TextToSpeechService.java | 20 |
3 files changed, 4 insertions, 33 deletions
diff --git a/core/java/android/speech/tts/ITextToSpeechCallback.aidl b/core/java/android/speech/tts/ITextToSpeechCallback.aidl index 96f7e0e..899515f 100644 --- a/core/java/android/speech/tts/ITextToSpeechCallback.aidl +++ b/core/java/android/speech/tts/ITextToSpeechCallback.aidl @@ -43,13 +43,6 @@ oneway interface ITextToSpeechCallback { void onStop(String utteranceId); /** - * Tells the client that the synthesis failed, and fallback synthesis will be attempted. - * - * @param utteranceId Unique id identifying synthesis request. - */ - void onFallback(String utteranceId); - - /** * Tells the client that the synthesis has failed. * * @param utteranceId Unique id identifying synthesis request. diff --git a/core/java/android/speech/tts/TextToSpeech.java b/core/java/android/speech/tts/TextToSpeech.java index ac9044a..46077ed 100644 --- a/core/java/android/speech/tts/TextToSpeech.java +++ b/core/java/android/speech/tts/TextToSpeech.java @@ -1945,15 +1945,13 @@ public class TextToSpeech { private final ITextToSpeechCallback.Stub mCallback = new ITextToSpeechCallback.Stub() { public void onStop(String utteranceId) throws RemoteException { - // do nothing + UtteranceProgressListener listener = mUtteranceProgressListener; + if (listener != null) { + listener.onDone(utteranceId); + } }; @Override - public void onFallback(String utteranceId) throws RemoteException { - // do nothing - } - - @Override public void onSuccess(String utteranceId) { UtteranceProgressListener listener = mUtteranceProgressListener; if (listener != null) { diff --git a/core/java/android/speech/tts/TextToSpeechService.java b/core/java/android/speech/tts/TextToSpeechService.java index ecfb8e0..a0743f7 100644 --- a/core/java/android/speech/tts/TextToSpeechService.java +++ b/core/java/android/speech/tts/TextToSpeechService.java @@ -592,14 +592,12 @@ public abstract class TextToSpeechService extends Service { } interface UtteranceProgressDispatcher { - public void dispatchOnFallback(); public void dispatchOnStop(); public void dispatchOnSuccess(); public void dispatchOnStart(); public void dispatchOnError(int errorCode); } - /** Set of parameters affecting audio output. */ static class AudioOutputParams { /** @@ -770,14 +768,6 @@ public abstract class TextToSpeechService extends Service { } @Override - public void dispatchOnFallback() { - final String utteranceId = getUtteranceId(); - if (utteranceId != null) { - mCallbacks.dispatchOnFallback(getCallerIdentity(), utteranceId); - } - } - - @Override public void dispatchOnStart() { final String utteranceId = getUtteranceId(); if (utteranceId != null) { @@ -1336,16 +1326,6 @@ public abstract class TextToSpeechService extends Service { } } - public void dispatchOnFallback(Object callerIdentity, String utteranceId) { - ITextToSpeechCallback cb = getCallbackFor(callerIdentity); - if (cb == null) return; - try { - cb.onFallback(utteranceId); - } catch (RemoteException e) { - Log.e(TAG, "Callback onFallback failed: " + e); - } - } - public void dispatchOnStop(Object callerIdentity, String utteranceId) { ITextToSpeechCallback cb = getCallbackFor(callerIdentity); if (cb == null) return; |