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.
diff --git a/packages/TtsService/src/android/tts/SynthProxy.java b/packages/TtsService/src/android/tts/SynthProxy.java
index a0814aa..b59a626 100755
--- a/packages/TtsService/src/android/tts/SynthProxy.java
+++ b/packages/TtsService/src/android/tts/SynthProxy.java
@@ -52,6 +52,18 @@
     }
 
     /**
+     * Synchronous stop of the synthesizer. This method returns when the synth
+     * has completed the stop procedure and doesn't use any of the resources it
+     * was using while synthesizing.
+     *
+     * @return {@link android.speech.tts.TextToSpeech.SUCCESS} or
+     *         {@link android.speech.tts.TextToSpeech.ERROR}
+     */
+    public int stopSync() {
+        return native_stopSync(mJniData);
+    }
+
+    /**
      * Synthesize speech and speak it directly using AudioTrack.
      */
     public int speak(String text, int streamType) {
@@ -156,6 +168,8 @@
 
     private native final int native_stop(int jniData);
 
+    private native final int native_stopSync(int jniData);
+
     private native final int native_speak(int jniData, String text, int streamType);
 
     private native final int native_synthesizeToFile(int jniData, String text, String filename);