Simplify the TTS for Donut release
diff --git a/tts/java/android/tts/ITts.aidl b/tts/java/android/tts/ITts.aidl
index 1fe4a6a..3558f5a 100755
--- a/tts/java/android/tts/ITts.aidl
+++ b/tts/java/android/tts/ITts.aidl
@@ -1,59 +1,57 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.tts;
-
-import android.tts.ITtsCallback;
-
-import android.content.Intent;
-
-/**
- * AIDL for the TTS Service
- * ITts.java is autogenerated from this.
- *
- * {@hide}
- */
-interface ITts {
-    void setEngine(in String engineName, in String[] requestedLanguages, in int strictness);
-
-    void setEngineWithIntent(in Intent engineIntent);
-
-    void setSpeechRate(in int speechRate);
-
-    void speak(in String text, in int queueMode, in String[] params);
-
-    boolean isSpeaking();
-
-    void stop();
-
-    void addSpeech(in String text, in String packageName, in int resId);
-
-    void addSpeechFile(in String text, in String filename);
-
-    void setLanguage(in String language);
-
-    boolean synthesizeToFile(in String text, in String[] params, in String outputDirectory);
-
-    void playEarcon(in String earcon, in int queueMode, in String[] params);
-
-    void addEarcon(in String earcon, in String packageName, in int resId);
-
-    void addEarconFile(in String earcon, in String filename);
-
-    void registerCallback(ITtsCallback cb);
-
-    void unregisterCallback(ITtsCallback cb);
-}
+/*

+ * Copyright (C) 2009 The Android Open Source Project

+ *

+ * Licensed under the Apache License, Version 2.0 (the "License");

+ * you may not use this file except in compliance with the License.

+ * You may obtain a copy of the License at

+ *

+ *      http://www.apache.org/licenses/LICENSE-2.0

+ *

+ * Unless required by applicable law or agreed to in writing, software

+ * distributed under the License is distributed on an "AS IS" BASIS,

+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+ * See the License for the specific language governing permissions and

+ * limitations under the License.

+ */

+

+package android.tts;

+

+import android.tts.ITtsCallback;

+

+import android.content.Intent;

+

+/**

+ * AIDL for the TTS Service

+ * ITts.java is autogenerated from this.

+ *

+ * {@hide}

+ */

+interface ITts {

+    void setSpeechRate(in int speechRate);

+

+    void speak(in String text, in int queueMode, in String[] params);

+

+    boolean isSpeaking();

+

+    void stop();

+

+    void addSpeech(in String text, in String packageName, in int resId);

+

+    void addSpeechFile(in String text, in String filename);

+

+    void setLanguage(in String language);

+

+    boolean synthesizeToFile(in String text, in String[] params, in String outputDirectory);

+

+    void playEarcon(in String earcon, in int queueMode, in String[] params);

+

+    void addEarcon(in String earcon, in String packageName, in int resId);

+

+    void addEarconFile(in String earcon, in String filename);

+

+    void registerCallback(ITtsCallback cb);

+

+    void unregisterCallback(ITtsCallback cb);

+

+    void playSilence(in long duration, in int queueMode, in String[] params);

+}

diff --git a/tts/java/android/tts/TtsService.java b/tts/java/android/tts/TtsService.java
index d3171818..2373e96 100755
--- a/tts/java/android/tts/TtsService.java
+++ b/tts/java/android/tts/TtsService.java
@@ -22,7 +22,6 @@
 import android.content.Intent;
 import android.content.SharedPreferences;
 import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
 import android.content.pm.PackageManager.NameNotFoundException;
 import android.media.MediaPlayer;
 import android.media.MediaPlayer.OnCompletionListener;
@@ -106,7 +105,6 @@
     private final ReentrantLock speechQueueLock = new ReentrantLock();
     private final ReentrantLock synthesizerLock = new ReentrantLock();
 
-    // TODO support multiple SpeechSynthesis objects
     private SynthProxy nativeSynth;
 
     @Override
@@ -114,15 +112,21 @@
         super.onCreate();
         Log.i("TTS", "TTS starting");
 
-
         // TODO: Make this work when the settings are done in the main Settings
         // app.
         prefs = PreferenceManager.getDefaultSharedPreferences(this);
 
-        // TODO: This should be changed to work by requesting the path
-        // from the default engine.
-        nativeSynth = new SynthProxy(prefs.getString("engine_pref", ""));
-
+        PackageManager pm = this.getPackageManager();
+        String soLibPath = "";
+        try {
+            soLibPath = pm.getApplicationInfo("com.svox.pico", 0).dataDir;
+        } catch (NameNotFoundException e) {
+            // This exception cannot actually happen as com.svox.pico is
+            // included with the system image.
+            e.printStackTrace();
+        }
+        soLibPath = soLibPath + "/lib/libttspico.so";
+        nativeSynth = new SynthProxy(soLibPath);
 
         mSelf = this;
         mIsSpeaking = false;
@@ -170,35 +174,6 @@
         nativeSynth.setLanguage(lang);
     }
 
-    private void setEngine(String engineName, String[] requestedLanguages,
-            int strictness) {
-        // TODO: Implement engine selection code here.
-        Intent engineIntent = new Intent(
-        "android.intent.action.START_TTS_ENGINE");
-        if (engineName != null) {
-            engineIntent.addCategory("android.intent.action.tts_engine."
-                    + engineName);
-        }
-        for (int i = 0; i < requestedLanguages.length; i++) {
-            engineIntent.addCategory("android.intent.action.tts_lang."
-                    + requestedLanguages[i]);
-        }
-        ResolveInfo[] enginesArray = new ResolveInfo[0];
-        PackageManager pm = getPackageManager();
-        enginesArray = pm.queryIntentActivities(engineIntent, 0).toArray(
-                enginesArray);
-    }
-
-    private void setEngine(Intent engineIntent) {
-        // TODO: Implement engine selection code here.
-    }
-
-    private int getEngineStatus() {
-        // TODO: Proposal - add a sanity check method that
-        // TTS engine plugins must implement.
-        return 0;
-    }
-
     /**
      * Adds a sound resource to the TTS.
      *
@@ -436,8 +411,7 @@
             if (sr == null) {
                 if (currentSpeechItem.mType == SpeechItem.SPEECH) {
                     // TODO: Split text up into smaller chunks before accepting
-                    // them
-                    // for processing.
+                    // them for processing.
                     speakInternalOnly(currentSpeechItem.mText,
                             currentSpeechItem.mParams);
                 } else {
@@ -576,30 +550,6 @@
         }
 
         /**
-         * Gives a hint about the type of engine that is preferred.
-         *
-         * @param selectedEngine
-         *            The TTS engine that should be used
-         */
-        public void setEngine(String engineName, String[] supportedLanguages,
-                int strictness) {
-            mSelf.setEngine(engineName, supportedLanguages, strictness);
-        }
-
-        /**
-         * Specifies exactly what the engine has to support. Will always be
-         * considered "strict"; can be used for implementing
-         * optional/experimental features that are not supported by all engines.
-         *
-         * @param engineIntent
-         *            An intent that specifies exactly what the engine has to
-         *            support.
-         */
-        public void setEngineWithIntent(Intent engineIntent) {
-            mSelf.setEngine(engineIntent);
-        }
-
-        /**
          * Speaks the given text using the specified queueing mode and
          * parameters.
          *
@@ -658,7 +608,6 @@
             mSelf.playSilence(duration, queueMode, speakingParams);
         }
 
-
         /**
          * Stops all speech output and removes any utterances still in the
          * queue.
@@ -741,16 +690,18 @@
             mSelf.setSpeechRate(speechRate);
         }
 
-        // TODO: Fix comment about language
         /**
          * Sets the speech rate for the TTS. Note that this will only have an
          * effect on synthesized speech; it will not affect pre-recorded speech.
          *
          * @param language
-         *            The language to be used. The languages are specified by
-         *            their IETF language tags as defined by BCP 47. This is the
-         *            same standard used for the lang attribute in HTML. See:
-         *            http://en.wikipedia.org/wiki/IETF_language_tag
+         *            Language values are based on the Android conventions for
+         *            localization as described in the Android platform
+         *            documentation on internationalization. This implies that
+         *            language data is specified in the format xx-rYY, where xx
+         *            is a two letter ISO 639-1 language code in lowercase and
+         *            rYY is a two letter ISO 3166-1-alpha-2 language code in
+         *            uppercase preceded by a lowercase "r".
          */
         public void setLanguage(String language) {
             mSelf.setLanguage(language);