summaryrefslogtreecommitdiffstats
path: root/packages/TtsService/src/android/tts/TtsService.java
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2009-08-31 10:41:55 -0700
committerJean-Michel Trivi <jmtrivi@google.com>2009-08-31 11:39:20 -0700
commit09f8db7ad3963f5fa15f2b99880b2f70e89c30ae (patch)
treee83c6d439d9f345cd0b2415ecf3658d3041f2cdc /packages/TtsService/src/android/tts/TtsService.java
parent1615ccc8a45ea2521339ae6f5b5d543a131915cf (diff)
downloadframeworks_base-09f8db7ad3963f5fa15f2b99880b2f70e89c30ae.zip
frameworks_base-09f8db7ad3963f5fa15f2b99880b2f70e89c30ae.tar.gz
frameworks_base-09f8db7ad3963f5fa15f2b99880b2f70e89c30ae.tar.bz2
Add a synchronous stop method to TTS synth engine so that upon its destruction,
if it was synthesing to a file, the latter can be deleted without still being written to. Clear the hashmap of SpeechItem to be stopped (mKillList) when the speech queue is empty.
Diffstat (limited to 'packages/TtsService/src/android/tts/TtsService.java')
-rwxr-xr-xpackages/TtsService/src/android/tts/TtsService.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/packages/TtsService/src/android/tts/TtsService.java b/packages/TtsService/src/android/tts/TtsService.java
index 2e11698..6094494 100755
--- a/packages/TtsService/src/android/tts/TtsService.java
+++ b/packages/TtsService/src/android/tts/TtsService.java
@@ -188,6 +188,8 @@ public class TtsService extends Service implements OnCompletionListener {
// Unregister all callbacks.
mCallbacks.kill();
+
+ Log.v("TtsService", "onDestroy() completed");
}
@@ -497,14 +499,13 @@ public class TtsService extends Service implements OnCompletionListener {
// clear the current speech item
if (mCurrentSpeechItem != null) {
- result = sNativeSynth.stop();
+ result = sNativeSynth.stopSync();
mKillList.put(mCurrentSpeechItem, true);
mIsSpeaking = false;
// was the engine writing to a file?
if (mCurrentSpeechItem.mType == SpeechItem.TEXT_TO_FILE) {
// delete the file that was being written
- // TODO make sure the synth is not writing to the file anymore
if (mCurrentSpeechItem.mFilename != null) {
File tempFile = new File(mCurrentSpeechItem.mFilename);
Log.v("TtsService", "Leaving behind " + mCurrentSpeechItem.mFilename);
@@ -884,6 +885,7 @@ public class TtsService extends Service implements OnCompletionListener {
}
if (mSpeechQueue.size() < 1) {
mIsSpeaking = false;
+ mKillList.clear();
broadcastTtsQueueProcessingCompleted();
return;
}