diff options
-rw-r--r-- | core/java/android/speech/tts/AudioPlaybackHandler.java | 14 | ||||
-rwxr-xr-x | core/java/android/speech/tts/TextToSpeech.java | 8 | ||||
-rw-r--r-- | core/java/android/speech/tts/TextToSpeechService.java | 4 |
3 files changed, 14 insertions, 12 deletions
diff --git a/core/java/android/speech/tts/AudioPlaybackHandler.java b/core/java/android/speech/tts/AudioPlaybackHandler.java index 506b2b9..96864c4 100644 --- a/core/java/android/speech/tts/AudioPlaybackHandler.java +++ b/core/java/android/speech/tts/AudioPlaybackHandler.java @@ -94,14 +94,12 @@ class AudioPlaybackHandler { // // (Even if it did, all it would result in is a warning message). mQueue.add(new ListEntry(SYNTHESIS_DONE, token, HIGH_PRIORITY)); - } else { - if (token != null) { - if (token.getType() == MessageParams.TYPE_AUDIO) { - ((AudioMessageParams) token).getPlayer().stop(); - } else if (token.getType() == MessageParams.TYPE_SILENCE) { - ((SilenceMessageParams) token).getConditionVariable().open(); - } - } + } else if (token.getType() == MessageParams.TYPE_AUDIO) { + ((AudioMessageParams) token).getPlayer().stop(); + // No cleanup required for audio messages. + } else if (token.getType() == MessageParams.TYPE_SILENCE) { + ((SilenceMessageParams) token).getConditionVariable().open(); + // No cleanup required for silence messages. } } diff --git a/core/java/android/speech/tts/TextToSpeech.java b/core/java/android/speech/tts/TextToSpeech.java index a9e5bbb..5126e48 100755 --- a/core/java/android/speech/tts/TextToSpeech.java +++ b/core/java/android/speech/tts/TextToSpeech.java @@ -581,6 +581,14 @@ public class TextToSpeech { service.setCallback(getPackageName(), null); service.stop(getPackageName()); mServiceConnection.disconnect(); + // Context#unbindService does not result in a call to + // ServiceConnection#onServiceDisconnected. As a result, the + // service ends up being destroyed (if there are no other open + // connections to it) but the process lives on and the + // ServiceConnection continues to refer to the destroyed service. + // + // This leads to tons of log spam about SynthThread being dead. + mServiceConnection = null; mCurrentEngine = null; return null; } diff --git a/core/java/android/speech/tts/TextToSpeechService.java b/core/java/android/speech/tts/TextToSpeechService.java index 94708d2..1926c92 100644 --- a/core/java/android/speech/tts/TextToSpeechService.java +++ b/core/java/android/speech/tts/TextToSpeechService.java @@ -767,10 +767,6 @@ public abstract class TextToSpeechService extends Service { mCallbacks.setCallback(packageName, cb); } - private boolean isDefault(String lang, String country, String variant) { - return Locale.getDefault().equals(new Locale(lang, country, variant)); - } - private String intern(String in) { // The input parameter will be non null. return in.intern(); |