Merge change 7645 into donut

* changes:
  Make the SearchDialog's AutoCompleteTextView dropdown respect the IME again when the user presses right or left from a query-jammed suggestion to continue editing. Previously we required the user to press on the text field again in order to get the IME to show.
diff --git a/api/current.xml b/api/current.xml
index afba894..a088664 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -32173,6 +32173,39 @@
  visibility="public"
 >
 </field>
+<field name="ACTION_TTS_CHECK_TTS_DATA"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.intent.action.CHECK_TTS_DATA&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="ACTION_TTS_INSTALL_TTS_DATA"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.intent.action.INSTALL_TTS_DATA&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="ACTION_TTS_QUEUE_PROCESSING_COMPLETED"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.intent.action.TTS_QUEUE_PROCESSING_COMPLETED&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="ACTION_UID_REMOVED"
  type="java.lang.String"
  transient="false"
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index 9202b9a..b0dbfcb 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -1683,10 +1683,47 @@
     @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
     public static final String ACTION_REBOOT =
             "android.intent.action.REBOOT";
+    /**
+     * Broadcast Action: Triggers the platform Text-To-Speech engine to
+     * start the activity that installs the resource files on the device
+     * that are required for TTS to be operational. Since the installation
+     * of the data can be interrupted or declined by the user, the application
+     * shouldn't expect successful installation upon return from that intent,
+     * and if need be, should check installation status with 
+     * {@link #ACTION_TTS_CHECK_TTS_DATA}.
+     */
+    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
+    public static final String ACTION_TTS_INSTALL_TTS_DATA =
+            "android.intent.action.INSTALL_TTS_DATA";
 
     /**
-     * @hide
-     * TODO: This will be unhidden in a later CL.
+     * Broadcast Action: Starts the activity from the platform Text-To-Speech
+     * engine to verify the proper installation and availability of the
+     * resource files on the system. Upon completion, the activity will
+     * return one of the following codes: 
+     * {@link android.speech.tts.TextToSpeech.Engine#CHECK_VOICE_DATA_PASS},
+     * {@link android.speech.tts.TextToSpeech.Engine#CHECK_VOICE_DATA_FAIL},
+     * {@link android.speech.tts.TextToSpeech.Engine#CHECK_VOICE_DATA_BAD_DATA},
+     * {@link android.speech.tts.TextToSpeech.Engine#CHECK_VOICE_DATA_MISSING_DATA}, or
+     * {@link android.speech.tts.TextToSpeech.Engine#CHECK_VOICE_DATA_MISSING_VOLUME}.
+     * <p> Moreover, the data received in the activity result will contain the following
+     * fields:
+     * <ul>
+     *   <li>{@link android.speech.tts.TextToSpeech.Engine#VOICE_DATA_ROOT_DIRECTORY} which
+     *       indicates the path to the location of the resource files</li>,
+     *   <li>{@link android.speech.tts.TextToSpeech.Engine#VOICE_DATA_FILES} which contains
+     *       the list of all the resource files</li>,
+     *   <li>and {@link android.speech.tts.TextToSpeech.Engine#VOICE_DATA_FILES_INFO} which
+     *       contains, for each resource file, the description of the language covered by
+     *       the file in the xxx-YYY format, where xxx is the 3-letter ISO language code,
+     *       and YYY is the 3-letter ISO country code.</li>
+     * </ul>
+     */
+    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
+    public static final String ACTION_TTS_CHECK_TTS_DATA =
+            "android.intent.action.CHECK_TTS_DATA";
+
+    /**
      * Broadcast Action: The TextToSpeech synthesizer has completed processing 
      * all of the text in the speech queue.
      */
diff --git a/core/jni/android_media_AudioTrack.cpp b/core/jni/android_media_AudioTrack.cpp
index e7d4694..fd92fbe 100644
--- a/core/jni/android_media_AudioTrack.cpp
+++ b/core/jni/android_media_AudioTrack.cpp
@@ -75,6 +75,9 @@
         int                        mStreamType;
 
     AudioTrackJniStorage() {
+        mCallbackData.audioTrack_class = 0;
+        mCallbackData.audioTrack_ref = 0;
+        mStreamType = AudioSystem::DEFAULT;
     }
 
     ~AudioTrackJniStorage() {
@@ -318,6 +321,8 @@
     env->SetIntField(thiz, javaAudioTrackFields.nativeTrackInJavaObj, 0);
     
 native_track_failure:
+    env->DeleteGlobalRef(lpJniStorage->mCallbackData.audioTrack_class);
+    env->DeleteGlobalRef(lpJniStorage->mCallbackData.audioTrack_ref);
     delete lpJniStorage;
     env->SetIntField(thiz, javaAudioTrackFields.jniData, 0);
     return AUDIOTRACK_ERROR_SETUP_NATIVEINITFAILED;
@@ -415,6 +420,9 @@
     AudioTrackJniStorage* pJniStorage = (AudioTrackJniStorage *)env->GetIntField(
         thiz, javaAudioTrackFields.jniData);
     if (pJniStorage) {
+        // delete global refs created in native_setup
+        env->DeleteGlobalRef(pJniStorage->mCallbackData.audioTrack_class);
+        env->DeleteGlobalRef(pJniStorage->mCallbackData.audioTrack_ref);
         //LOGV("deleting pJniStorage: %x\n", (int)pJniStorage);
         delete pJniStorage;
     }