Merge "DO NOT MERGE A library for encoding and decoding ETC1 textures." into eclair
diff --git a/core/java/android/database/sqlite/SQLiteDatabase.java b/core/java/android/database/sqlite/SQLiteDatabase.java
index f621483..9ebf5d9 100644
--- a/core/java/android/database/sqlite/SQLiteDatabase.java
+++ b/core/java/android/database/sqlite/SQLiteDatabase.java
@@ -286,6 +286,7 @@
             close();
         } finally {
             Log.e(TAG, "Removing corrupt database: " + mPath);
+            EventLog.writeEvent(EVENT_DB_CORRUPT, mPath);
             // Delete the corrupt file.  Don't re-create it now -- that would just confuse people
             // -- but the next time someone tries to open it, they can set it up from scratch.
             new File(mPath).delete();
diff --git a/core/java/android/server/BluetoothA2dpService.java b/core/java/android/server/BluetoothA2dpService.java
index 46145b9..8859339 100644
--- a/core/java/android/server/BluetoothA2dpService.java
+++ b/core/java/android/server/BluetoothA2dpService.java
@@ -459,10 +459,6 @@
             checkSinkSuspendState(state);
             mTargetA2dpState = -1;
 
-            if (state == BluetoothA2dp.STATE_CONNECTING) {
-                mAudioManager.setParameters("A2dpSuspended=false");
-            }
-
             if (getSinkPriority(device) > BluetoothA2dp.PRIORITY_OFF &&
                     state == BluetoothA2dp.STATE_CONNECTING ||
                     state == BluetoothA2dp.STATE_CONNECTED) {
diff --git a/core/java/android/widget/ImageButton.java b/core/java/android/widget/ImageButton.java
index d417e40..5c05170 100644
--- a/core/java/android/widget/ImageButton.java
+++ b/core/java/android/widget/ImageButton.java
@@ -44,11 +44,11 @@
  * <pre>
  * &lt;?xml version="1.0" encoding="utf-8"?&gt;
  * &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt;
- *     &lt;item android:drawable="@drawable/button_normal" /&gt; &lt;!-- default --&gt;
  *     &lt;item android:state_pressed="true"
  *           android:drawable="@drawable/button_pressed" /&gt; &lt;!-- pressed --&gt;
  *     &lt;item android:state_focused="true"
  *           android:drawable="@drawable/button_focused" /&gt; &lt;!-- focused --&gt;
+ *     &lt;item android:drawable="@drawable/button_normal" /&gt; &lt;!-- default --&gt;
  * &lt;/selector&gt;</pre>
  *
  * <p>Save the XML file in your project {@code res/drawable/} folder and then 
@@ -57,6 +57,11 @@
  * based on the state of the button and the corresponding images
  * defined in the XML.</p>
  *
+ * <p>The order of the {@code &lt;item>} elements is important because they are
+ * evaluated in order. This is why the "normal" button image comes last, because
+ * it will only be applied after {@code android:state_pressed} and {@code
+ * android:state_focused} have both evaluated false.</p>
+ *
  * <p><strong>XML attributes</strong></p>
  * <p>
  * See {@link android.R.styleable#ImageView Button Attributes},
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index 4a1c2a5..d62f6c3 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -1438,6 +1438,8 @@
                     AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP,
                                                          AudioSystem.DEVICE_STATE_AVAILABLE,
                                                          address);
+                    // Reset A2DP suspend state each time a new sink is connected
+                    AudioSystem.setParameters("A2dpSuspended=false");
                     mConnectedDevices.put( new Integer(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP),
                             address);
                 }
diff --git a/services/java/com/android/server/status/StatusBarService.java b/services/java/com/android/server/status/StatusBarService.java
index a103dcb..34921d6 100644
--- a/services/java/com/android/server/status/StatusBarService.java
+++ b/services/java/com/android/server/status/StatusBarService.java
@@ -1672,7 +1672,10 @@
         // act accordingly
         if ((diff & StatusBarManager.DISABLE_EXPAND) != 0) {
             if ((net & StatusBarManager.DISABLE_EXPAND) != 0) {
-                animateCollapse();
+                Log.d(TAG, "DISABLE_EXPAND: yes");
+                mAnimating = false;
+                updateExpandedViewPos(0);
+                performCollapse();
             }
         }
         if ((diff & StatusBarManager.DISABLE_NOTIFICATION_ICONS) != 0) {