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
This commit is contained in:
@@ -42,13 +42,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.
|
||||
*
|
||||
|
||||
@@ -1945,14 +1945,12 @@ 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;
|
||||
|
||||
@@ -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 {
|
||||
/**
|
||||
@@ -769,14 +767,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();
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user