Merge "Don't use bilinear filtering on unscaled bitmaps Bug #5198590"
diff --git a/api/current.txt b/api/current.txt
index 8a643fd..ef3d5b5 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -958,6 +958,8 @@
     field public static final int textAppearanceLarge = 16842816; // 0x1010040
     field public static final int textAppearanceLargeInverse = 16842819; // 0x1010043
     field public static final int textAppearanceLargePopupMenu = 16843521; // 0x1010301
+    field public static final int textAppearanceListItem = 16843688; // 0x10103a8
+    field public static final int textAppearanceListItemSmall = 16843689; // 0x10103a9
     field public static final int textAppearanceMedium = 16842817; // 0x1010041
     field public static final int textAppearanceMediumInverse = 16842820; // 0x1010044
     field public static final int textAppearanceSearchResultSubtitle = 16843424; // 0x10102a0
@@ -18401,6 +18403,7 @@
 
   public class WallpaperService.Engine {
     ctor public WallpaperService.Engine();
+    method protected void dump(java.lang.String, java.io.FileDescriptor, java.io.PrintWriter, java.lang.String[]);
     method public int getDesiredMinimumHeight();
     method public int getDesiredMinimumWidth();
     method public android.view.SurfaceHolder getSurfaceHolder();
diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java
index 28bc424..264db19 100644
--- a/core/java/android/bluetooth/BluetoothAdapter.java
+++ b/core/java/android/bluetooth/BluetoothAdapter.java
@@ -774,6 +774,31 @@
     }
 
     /**
+     * Get the current connection state of a profile.
+     * This function can be used to check whether the local Bluetooth adapter
+     * is connected to any remote device for a specific profile.
+     * Profile can be one of {@link BluetoothProfile.HEADSET},
+     * {@link BluetoothProfile.A2DP}.
+     *
+     * <p>Requires {@link android.Manifest.permission#BLUETOOTH}.
+     *
+     * <p> Return value can be one of
+     * {@link * BluetoothProfile.STATE_DISCONNECTED},
+     * {@link * BluetoothProfile.STATE_CONNECTING},
+     * {@link * BluetoothProfile.STATE_CONNECTED},
+     * {@link * BluetoothProfile.STATE_DISCONNECTING}
+     * @hide
+     */
+    public int getProfileConnectionState(int profile) {
+        if (getState() != STATE_ON) return BluetoothProfile.STATE_DISCONNECTED;
+        try {
+            return mService.getProfileConnectionState(profile);
+        } catch (RemoteException e) {Log.e(TAG, "getProfileConnectionState:", e);}
+        return BluetoothProfile.STATE_DISCONNECTED;
+    }
+
+    /**
+    /**
      * Picks RFCOMM channels until none are left.
      * Avoids reserved channels.
      */
diff --git a/core/java/android/bluetooth/BluetoothProfile.java b/core/java/android/bluetooth/BluetoothProfile.java
index 6cd81fd..58b3868 100644
--- a/core/java/android/bluetooth/BluetoothProfile.java
+++ b/core/java/android/bluetooth/BluetoothProfile.java
@@ -83,6 +83,12 @@
     public static final int PAN = 5;
 
     /**
+     * PBAP
+     * @hide
+     */
+    public static final int PBAP = 6;
+
+    /**
      * Default priority for devices that we try to auto-connect to and
      * and allow incoming connections for the profile
      * @hide
diff --git a/core/java/android/bluetooth/IBluetooth.aidl b/core/java/android/bluetooth/IBluetooth.aidl
index 48dfed8..d4e7f7d 100644
--- a/core/java/android/bluetooth/IBluetooth.aidl
+++ b/core/java/android/bluetooth/IBluetooth.aidl
@@ -53,6 +53,7 @@
     byte[] readOutOfBandData();
 
     int getAdapterConnectionState();
+    int getProfileConnectionState(int profile);
     boolean changeApplicationBluetoothState(boolean on,
                                 in IBluetoothStateChangeCallback callback, in
                                 IBinder b);
@@ -121,5 +122,5 @@
     List<BluetoothDevice> getHealthDevicesMatchingConnectionStates(in int[] states);
     int getHealthDeviceConnectionState(in BluetoothDevice device);
 
-    void sendConnectionStateChange(in BluetoothDevice device, int state, int prevState);
+    void sendConnectionStateChange(in BluetoothDevice device, int profile, int state, int prevState);
 }
diff --git a/core/java/android/server/BluetoothA2dpService.java b/core/java/android/server/BluetoothA2dpService.java
index 8c04853..c4cb3a5 100644
--- a/core/java/android/server/BluetoothA2dpService.java
+++ b/core/java/android/server/BluetoothA2dpService.java
@@ -523,7 +523,8 @@
 
             if (DBG) log("A2DP state : device: " + device + " State:" + prevState + "->" + state);
 
-            mBluetoothService.sendConnectionStateChange(device, state, prevState);
+            mBluetoothService.sendConnectionStateChange(device, BluetoothProfile.A2DP, state,
+                                                        prevState);
         }
     }
 
diff --git a/core/java/android/server/BluetoothHealthProfileHandler.java b/core/java/android/server/BluetoothHealthProfileHandler.java
index 105ff332..eafd7bd 100644
--- a/core/java/android/server/BluetoothHealthProfileHandler.java
+++ b/core/java/android/server/BluetoothHealthProfileHandler.java
@@ -20,6 +20,7 @@
 import android.bluetooth.BluetoothDevice;
 import android.bluetooth.BluetoothHealth;
 import android.bluetooth.BluetoothHealthAppConfiguration;
+import android.bluetooth.BluetoothProfile;
 import android.bluetooth.IBluetoothHealthCallback;
 import android.content.Context;
 import android.os.Handler;
@@ -567,7 +568,8 @@
     private void updateAndSendIntent(BluetoothDevice device, int prevDeviceState,
             int newDeviceState) {
         mHealthDevices.put(device, newDeviceState);
-        mBluetoothService.sendConnectionStateChange(device, prevDeviceState, newDeviceState);
+        mBluetoothService.sendConnectionStateChange(device, BluetoothProfile.HEALTH,
+                                                    prevDeviceState, newDeviceState);
     }
 
     /**
diff --git a/core/java/android/server/BluetoothInputProfileHandler.java b/core/java/android/server/BluetoothInputProfileHandler.java
index 247e297..31764b0 100644
--- a/core/java/android/server/BluetoothInputProfileHandler.java
+++ b/core/java/android/server/BluetoothInputProfileHandler.java
@@ -20,6 +20,7 @@
 import android.bluetooth.BluetoothDevice;
 import android.bluetooth.BluetoothDeviceProfileState;
 import android.bluetooth.BluetoothInputDevice;
+import android.bluetooth.BluetoothProfile;
 import android.bluetooth.BluetoothProfileState;
 import android.content.Context;
 import android.content.Intent;
@@ -191,7 +192,8 @@
         mContext.sendBroadcast(intent, BluetoothService.BLUETOOTH_PERM);
 
         debugLog("InputDevice state : device: " + device + " State:" + prevState + "->" + state);
-        mBluetoothService.sendConnectionStateChange(device, state, prevState);
+        mBluetoothService.sendConnectionStateChange(device, BluetoothProfile.INPUT_DEVICE, state,
+                                                    prevState);
     }
 
     void handleInputDevicePropertyChange(String address, boolean connected) {
diff --git a/core/java/android/server/BluetoothPanProfileHandler.java b/core/java/android/server/BluetoothPanProfileHandler.java
index 37cfdc4..bfad747 100644
--- a/core/java/android/server/BluetoothPanProfileHandler.java
+++ b/core/java/android/server/BluetoothPanProfileHandler.java
@@ -19,6 +19,7 @@
 import android.bluetooth.BluetoothAdapter;
 import android.bluetooth.BluetoothDevice;
 import android.bluetooth.BluetoothPan;
+import android.bluetooth.BluetoothProfile;
 import android.bluetooth.BluetoothTetheringDataTracker;
 import android.content.BroadcastReceiver;
 import android.content.Context;
@@ -303,7 +304,8 @@
         mContext.sendBroadcast(intent, BluetoothService.BLUETOOTH_PERM);
 
         debugLog("Pan Device state : device: " + device + " State:" + prevState + "->" + state);
-        mBluetoothService.sendConnectionStateChange(device, state, prevState);
+        mBluetoothService.sendConnectionStateChange(device, BluetoothProfile.PAN, state,
+                                                    prevState);
     }
 
     private class BluetoothPanDevice {
diff --git a/core/java/android/server/BluetoothService.java b/core/java/android/server/BluetoothService.java
index ee14673..9f435fd 100755
--- a/core/java/android/server/BluetoothService.java
+++ b/core/java/android/server/BluetoothService.java
@@ -166,6 +166,7 @@
     private static final String INCOMING_CONNECTION_FILE =
       "/data/misc/bluetooth/incoming_connection.conf";
     private HashMap<String, Pair<Integer, String>> mIncomingConnections;
+    private HashMap<Integer, Pair<Integer, Integer>> mProfileConnectionState;
 
     private static class RemoteService {
         public String address;
@@ -237,6 +238,7 @@
         mBluetoothPanProfileHandler = BluetoothPanProfileHandler.getInstance(mContext, this);
         mBluetoothHealthProfileHandler = BluetoothHealthProfileHandler.getInstance(mContext, this);
         mIncomingConnections = new HashMap<String, Pair<Integer, String>>();
+        mProfileConnectionState = new HashMap<Integer, Pair<Integer, Integer>>();
     }
 
     public static synchronized String readDockBluetoothAddress() {
@@ -1742,6 +1744,19 @@
         dumpInputDeviceProfile(pw);
         dumpPanProfile(pw);
         dumpApplicationServiceRecords(pw);
+        dumpProfileState(pw);
+    }
+
+    private void dumpProfileState(PrintWriter pw) {
+        pw.println("\n--Profile State dump--");
+        pw.println("\n Headset profile state:" +
+                mAdapter.getProfileConnectionState(BluetoothProfile.HEADSET));
+        pw.println("\n A2dp profile state:" +
+                mAdapter.getProfileConnectionState(BluetoothProfile.A2DP));
+        pw.println("\n HID profile state:" +
+                mAdapter.getProfileConnectionState(BluetoothProfile.INPUT_DEVICE));
+        pw.println("\n PAN profile state:" +
+                mAdapter.getProfileConnectionState(BluetoothProfile.PAN));
     }
 
     private void dumpHeadsetService(PrintWriter pw) {
@@ -2443,23 +2458,85 @@
         return mAdapterConnectionState;
     }
 
-    public synchronized void sendConnectionStateChange(BluetoothDevice device, int state,
-                                                        int prevState) {
+    public int getProfileConnectionState(int profile) {
+        mContext.enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
+
+        Pair<Integer, Integer> state = mProfileConnectionState.get(profile);
+        if (state == null) return BluetoothProfile.STATE_DISCONNECTED;
+
+        return state.first;
+    }
+
+    private void updateProfileConnectionState(int profile, int newState, int oldState) {
+        // mProfileConnectionState is a hashmap -
+        // <Integer, Pair<Integer, Integer>>
+        // The key is the profile, the value is a pair. first element
+        // is the state and the second element is the number of devices
+        // in that state.
+        int numDev = 1;
+        int newHashState = newState;
+        boolean update = true;
+
+        // The following conditions are considered in this function:
+        // 1. If there is no record of profile and state - update
+        // 2. If a new device's state is current hash state - increment
+        //    number of devices in the state.
+        // 3. If a state change has happened to Connected or Connecting
+        //    (if current state is not connected), update.
+        // 4. If numDevices is 1 and that device state is being updated, update
+        // 5. If numDevices is > 1 and one of the devices is changing state,
+        //    decrement numDevices but maintain oldState if it is Connected or
+        //    Connecting
+        Pair<Integer, Integer> stateNumDev = mProfileConnectionState.get(profile);
+        if (stateNumDev != null) {
+            int currHashState = stateNumDev.first;
+            numDev = stateNumDev.second;
+
+            if (newState == currHashState) {
+                numDev ++;
+            } else if (newState == BluetoothProfile.STATE_CONNECTED ||
+                   (newState == BluetoothProfile.STATE_CONNECTING &&
+                    currHashState != BluetoothProfile.STATE_CONNECTED)) {
+                 numDev = 1;
+            } else if (numDev == 1 && oldState == currHashState) {
+                 update = true;
+            } else if (numDev > 1 && oldState == currHashState) {
+                 numDev --;
+
+                 if (currHashState == BluetoothProfile.STATE_CONNECTED ||
+                     currHashState == BluetoothProfile.STATE_CONNECTING) {
+                    newHashState = currHashState;
+                 }
+            } else {
+                 update = false;
+            }
+        }
+
+        if (update) {
+            mProfileConnectionState.put(profile, new Pair<Integer, Integer>(newHashState,
+                    numDev));
+        }
+    }
+
+    public synchronized void sendConnectionStateChange(BluetoothDevice
+            device, int profile, int state, int prevState) {
         // Since this is a binder call check if Bluetooth is on still
         if (getBluetoothStateInternal() == BluetoothAdapter.STATE_OFF) return;
 
-        if (updateCountersAndCheckForConnectionStateChange(state, prevState)) {
-            if (!validateProfileConnectionState(state) ||
-                    !validateProfileConnectionState(prevState)) {
-                // Previously, an invalid state was broadcast anyway,
-                // with the invalid state converted to -1 in the intent.
-                // Better to log an error and not send an intent with
-                // invalid contents or set mAdapterConnectionState to -1.
-                Log.e(TAG, "Error in sendConnectionStateChange: "
-                        + "prevState " + prevState + " state " + state);
-                return;
-            }
+        if (!validateProfileConnectionState(state) ||
+                !validateProfileConnectionState(prevState)) {
+            // Previously, an invalid state was broadcast anyway,
+            // with the invalid state converted to -1 in the intent.
+            // Better to log an error and not send an intent with
+            // invalid contents or set mAdapterConnectionState to -1.
+            Log.e(TAG, "Error in sendConnectionStateChange: "
+                    + "prevState " + prevState + " state " + state);
+            return;
+        }
 
+        updateProfileConnectionState(profile, state, prevState);
+
+        if (updateCountersAndCheckForConnectionStateChange(state, prevState)) {
             mAdapterConnectionState = state;
 
             if (state == BluetoothProfile.STATE_DISCONNECTED) {
diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java
index c51ba2a..4c563ce 100644
--- a/core/java/android/service/wallpaper/WallpaperService.java
+++ b/core/java/android/service/wallpaper/WallpaperService.java
@@ -46,7 +46,6 @@
 import android.view.InputDevice;
 import android.view.InputHandler;
 import android.view.InputQueue;
-import android.view.KeyEvent;
 import android.view.MotionEvent;
 import android.view.SurfaceHolder;
 import android.view.View;
@@ -54,8 +53,9 @@
 import android.view.ViewRootImpl;
 import android.view.WindowManager;
 import android.view.WindowManagerImpl;
-import android.view.WindowManagerPolicy;
 
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
 import java.util.ArrayList;
 
 /**
@@ -459,6 +459,44 @@
         public void onSurfaceDestroyed(SurfaceHolder holder) {
         }
         
+        protected void dump(String prefix, FileDescriptor fd, PrintWriter out, String[] args) {
+            out.print(prefix); out.print("mInitializing="); out.print(mInitializing);
+                    out.print(" mDestroyed="); out.println(mDestroyed);
+            out.print(prefix); out.print("mVisible="); out.print(mVisible);
+                    out.print(" mScreenOn="); out.print(mScreenOn);
+                    out.print(" mReportedVisible="); out.println(mReportedVisible);
+            out.print(prefix); out.print("mCreated="); out.print(mCreated);
+                    out.print(" mSurfaceCreated="); out.print(mSurfaceCreated);
+                    out.print(" mIsCreating="); out.print(mIsCreating);
+                    out.print(" mDrawingAllowed="); out.println(mDrawingAllowed);
+            out.print(prefix); out.print("mWidth="); out.print(mWidth);
+                    out.print(" mCurWidth="); out.print(mCurWidth);
+                    out.print(" mHeight="); out.print(mHeight);
+                    out.print(" mCurHeight="); out.println(mCurHeight);
+            out.print(prefix); out.print("mType="); out.print(mType);
+                    out.print(" mWindowFlags="); out.print(mWindowFlags);
+                    out.print(" mCurWindowFlags="); out.println(mCurWindowFlags);
+            out.print(prefix); out.print("mVisibleInsets=");
+                    out.print(mVisibleInsets.toShortString());
+                    out.print(" mWinFrame="); out.print(mWinFrame.toShortString());
+                    out.print(" mContentInsets="); out.println(mContentInsets.toShortString());
+            out.print(prefix); out.print("mConfiguration="); out.println(mConfiguration);
+            out.print(prefix); out.print("mLayout="); out.println(mLayout);
+            synchronized (mLock) {
+                out.print(prefix); out.print("mPendingXOffset="); out.print(mPendingXOffset);
+                        out.print(" mPendingXOffset="); out.println(mPendingXOffset);
+                out.print(prefix); out.print("mPendingXOffsetStep=");
+                        out.print(mPendingXOffsetStep);
+                        out.print(" mPendingXOffsetStep="); out.println(mPendingXOffsetStep);
+                out.print(prefix); out.print("mOffsetMessageEnqueued=");
+                        out.print(mOffsetMessageEnqueued);
+                        out.print(" mPendingSync="); out.println(mPendingSync);
+                if (mPendingMove != null) {
+                    out.print(prefix); out.print("mPendingMove="); out.println(mPendingMove);
+                }
+            }
+        }
+
         private void dispatchPointer(MotionEvent event) {
             if (event.isTouchEvent()) {
                 synchronized (mLock) {
@@ -1012,4 +1050,14 @@
      * is in the wallpaper picker viewing a preview of it as well.
      */
     public abstract Engine onCreateEngine();
+
+    @Override
+    protected void dump(FileDescriptor fd, PrintWriter out, String[] args) {
+        out.print("State of wallpaper "); out.print(this); out.println(":");
+        for (int i=0; i<mActiveEngines.size(); i++) {
+            Engine engine = mActiveEngines.get(i);
+            out.print("  Engine "); out.print(engine); out.println(":");
+            engine.dump("    ", fd, out, args);
+        }
+    }
 }
diff --git a/core/java/android/text/TextDirectionHeuristics.java b/core/java/android/text/TextDirectionHeuristics.java
index 5ed2df4..6debc6b 100644
--- a/core/java/android/text/TextDirectionHeuristics.java
+++ b/core/java/android/text/TextDirectionHeuristics.java
@@ -50,22 +50,6 @@
         new TextDirectionHeuristicInternal(FirstStrong.INSTANCE, true);
 
     /**
-     * If the text contains any strong left to right non-format character, determines
-     * that the direction is left to right, falling back to left to right if it
-     * finds none.
-     */
-    public static final TextDirectionHeuristic ANYLTR_LTR =
-        new TextDirectionHeuristicInternal(AnyStrong.INSTANCE_LTR, false);
-
-    /**
-     * If the text contains any strong left to right non-format character, determines
-     * that the direction is left to right, falling back to right to left if it
-     * finds none.
-     */
-    public static final TextDirectionHeuristic ANYLTR_RTL =
-        new TextDirectionHeuristicInternal(AnyStrong.INSTANCE_LTR, true);
-
-    /**
      * If the text contains any strong right to left non-format character, determines
      * that the direction is right to left, falling back to left to right if it
      * finds none.
@@ -74,14 +58,6 @@
         new TextDirectionHeuristicInternal(AnyStrong.INSTANCE_RTL, false);
 
     /**
-     * If the text contains any strong right to left non-format character, determines
-     * that the direction is right to left, falling back to right to left if it
-     * finds none.
-     */
-    public static final TextDirectionHeuristic ANYRTL_RTL =
-        new TextDirectionHeuristicInternal(AnyStrong.INSTANCE_RTL, true);
-
-    /**
      * Examines only the strong directional non-format characters, and if either
      * left to right or right to left characters are 60% or more of this total,
      * determines that the direction follows the majority of characters.  Falls
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index abd9ad6..17e637c 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -8087,6 +8087,11 @@
             ViewDebug.trace(this, ViewDebug.HierarchyTraceType.INVALIDATE);
         }
 
+        if ((mViewFlags & VISIBILITY_MASK) != VISIBLE && mCurrentAnimation == null) {
+            // Noop for views which are not visible and which are not running an animation. They
+            // will not get drawn and they should not set dirty flags as if they will be drawn
+            return;
+        }
         if ((mPrivateFlags & (DRAWN | HAS_BOUNDS)) == (DRAWN | HAS_BOUNDS) ||
                 (mPrivateFlags & DRAWING_CACHE_VALID) == DRAWING_CACHE_VALID ||
                 (mPrivateFlags & INVALIDATED) != INVALIDATED) {
@@ -8130,6 +8135,11 @@
             ViewDebug.trace(this, ViewDebug.HierarchyTraceType.INVALIDATE);
         }
 
+        if ((mViewFlags & VISIBILITY_MASK) != VISIBLE && mCurrentAnimation == null) {
+            // Noop for views which are not visible and which are not running an animation. They
+            // will not get drawn and they should not set dirty flags as if they will be drawn
+            return;
+        }
         if ((mPrivateFlags & (DRAWN | HAS_BOUNDS)) == (DRAWN | HAS_BOUNDS) ||
                 (mPrivateFlags & DRAWING_CACHE_VALID) == DRAWING_CACHE_VALID ||
                 (mPrivateFlags & INVALIDATED) != INVALIDATED) {
@@ -8182,6 +8192,11 @@
             ViewDebug.trace(this, ViewDebug.HierarchyTraceType.INVALIDATE);
         }
 
+        if ((mViewFlags & VISIBILITY_MASK) != VISIBLE && mCurrentAnimation == null) {
+            // Noop for views which are not visible and which are not running an animation. They
+            // will not get drawn and they should not set dirty flags as if they will be drawn
+            return;
+        }
         if ((mPrivateFlags & (DRAWN | HAS_BOUNDS)) == (DRAWN | HAS_BOUNDS) ||
                 (invalidateCache && (mPrivateFlags & DRAWING_CACHE_VALID) == DRAWING_CACHE_VALID) ||
                 (mPrivateFlags & INVALIDATED) != INVALIDATED || isOpaque() != mLastIsOpaque) {
@@ -8217,6 +8232,11 @@
      * @hide
      */
     public void fastInvalidate() {
+        if ((mViewFlags & VISIBILITY_MASK) != VISIBLE && mCurrentAnimation == null) {
+            // Noop for views which are not visible and which are not running an animation. They
+            // will not get drawn and they should not set dirty flags as if they will be drawn
+            return;
+        }
         if ((mPrivateFlags & (DRAWN | HAS_BOUNDS)) == (DRAWN | HAS_BOUNDS) ||
             (mPrivateFlags & DRAWING_CACHE_VALID) == DRAWING_CACHE_VALID ||
             (mPrivateFlags & INVALIDATED) != INVALIDATED) {
@@ -9165,7 +9185,8 @@
             mPrivateFlags &= ~AWAKEN_SCROLL_BARS_ON_ATTACH;
         }
         jumpDrawablesToCurrentState();
-        // Order is important here: LayoutDirection should be resolved before Padding and TextDirection
+        // Order is important here: LayoutDirection MUST be resolved before Padding
+        // and TextDirection
         resolveLayoutDirectionIfNeeded();
         resolvePadding();
         resolveTextDirection();
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index dae118e..86f061a 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -54,6 +54,7 @@
 import android.view.ViewConfiguration;
 import android.view.ViewDebug;
 import android.view.ViewGroup;
+import android.view.ViewParent;
 import android.view.ViewTreeObserver;
 import android.view.accessibility.AccessibilityEvent;
 import android.view.accessibility.AccessibilityNodeInfo;
@@ -2788,7 +2789,10 @@
             reportScrollStateChange(OnScrollListener.SCROLL_STATE_TOUCH_SCROLL);
             // Time to start stealing events! Once we've stolen them, don't let anyone
             // steal from us
-            requestDisallowInterceptTouchEvent(true);
+            final ViewParent parent = getParent();
+            if (parent != null) {
+                parent.requestDisallowInterceptTouchEvent(true);
+            }
             return true;
         }
 
@@ -2848,9 +2852,7 @@
         View v;
         int deltaY;
 
-        if (mVelocityTracker == null) {
-            mVelocityTracker = VelocityTracker.obtain();
-        }
+        initVelocityTrackerIfNotExists();
         mVelocityTracker.addMovement(ev);
 
         switch (action & MotionEvent.ACTION_MASK) {
@@ -2955,7 +2957,10 @@
                     // Make sure that we do so in case we're in a parent that can intercept.
                     if ((mGroupFlags & FLAG_DISALLOW_INTERCEPT) == 0 &&
                             Math.abs(deltaY) > mTouchSlop) {
-                        requestDisallowInterceptTouchEvent(true);
+                        final ViewParent parent = getParent();
+                        if (parent != null) {
+                            parent.requestDisallowInterceptTouchEvent(true);
+                        }
                     }
 
                     final int rawDeltaY = deltaY;
@@ -2998,7 +3003,9 @@
                                     0, mOverscrollDistance, true);
                             if (Math.abs(mOverscrollDistance) == Math.abs(mScrollY)) {
                                 // Don't allow overfling if we're at the edge.
-                                mVelocityTracker.clear();
+                                if (mVelocityTracker != null) {
+                                    mVelocityTracker.clear();
+                                }
                             }
 
                             final int overscrollMode = getOverScrollMode();
@@ -3259,10 +3266,7 @@
                 handler.removeCallbacks(mPendingCheckForLongPress);
             }
 
-            if (mVelocityTracker != null) {
-                mVelocityTracker.recycle();
-                mVelocityTracker = null;
-            }
+            recycleVelocityTracker();
 
             mActivePointerId = INVALID_POINTER;
 
@@ -3307,10 +3311,7 @@
                     handler.removeCallbacks(mPendingCheckForLongPress);
                 }
 
-                if (mVelocityTracker != null) {
-                    mVelocityTracker.recycle();
-                    mVelocityTracker = null;
-                }
+                recycleVelocityTracker();
             }
 
             if (mEdgeGlowTop != null) {
@@ -3450,6 +3451,35 @@
         mGlowPaddingRight = rightPadding;
     }
 
+    private void initOrResetVelocityTracker() {
+        if (mVelocityTracker == null) {
+            mVelocityTracker = VelocityTracker.obtain();
+        } else {
+            mVelocityTracker.clear();
+        }
+    }
+
+    private void initVelocityTrackerIfNotExists() {
+        if (mVelocityTracker == null) {
+            mVelocityTracker = VelocityTracker.obtain();
+        }
+    }
+
+    private void recycleVelocityTracker() {
+        if (mVelocityTracker != null) {
+            mVelocityTracker.recycle();
+            mVelocityTracker = null;
+        }
+    }
+
+    @Override
+    public void requestDisallowInterceptTouchEvent(boolean disallowIntercept) {
+        if (disallowIntercept) {
+            recycleVelocityTracker();
+        }
+        super.requestDisallowInterceptTouchEvent(disallowIntercept);
+    }
+
     @Override
     public boolean onInterceptTouchEvent(MotionEvent ev) {
         int action = ev.getAction();
@@ -3487,6 +3517,8 @@
                 clearScrollingCache();
             }
             mLastY = Integer.MIN_VALUE;
+            initOrResetVelocityTracker();
+            mVelocityTracker.addMovement(ev);
             if (touchMode == TOUCH_MODE_FLING) {
                 return true;
             }
@@ -3502,6 +3534,8 @@
                     mActivePointerId = ev.getPointerId(pointerIndex);
                 }
                 final int y = (int) ev.getY(pointerIndex);
+                initVelocityTrackerIfNotExists();
+                mVelocityTracker.addMovement(ev);
                 if (startScrollIfNeeded(y - mMotionY)) {
                     return true;
                 }
@@ -3510,9 +3544,11 @@
             break;
         }
 
+        case MotionEvent.ACTION_CANCEL:
         case MotionEvent.ACTION_UP: {
             mTouchMode = TOUCH_MODE_REST;
             mActivePointerId = INVALID_POINTER;
+            recycleVelocityTracker();
             reportScrollStateChange(OnScrollListener.SCROLL_STATE_IDLE);
             break;
         }
diff --git a/core/java/android/widget/HorizontalScrollView.java b/core/java/android/widget/HorizontalScrollView.java
index b428301..d638732 100644
--- a/core/java/android/widget/HorizontalScrollView.java
+++ b/core/java/android/widget/HorizontalScrollView.java
@@ -399,6 +399,35 @@
         return false;
     }
 
+    private void initOrResetVelocityTracker() {
+        if (mVelocityTracker == null) {
+            mVelocityTracker = VelocityTracker.obtain();
+        } else {
+            mVelocityTracker.clear();
+        }
+    }
+
+    private void initVelocityTrackerIfNotExists() {
+        if (mVelocityTracker == null) {
+            mVelocityTracker = VelocityTracker.obtain();
+        }
+    }
+
+    private void recycleVelocityTracker() {
+        if (mVelocityTracker != null) {
+            mVelocityTracker.recycle();
+            mVelocityTracker = null;
+        }
+    }
+
+    @Override
+    public void requestDisallowInterceptTouchEvent(boolean disallowIntercept) {
+        if (disallowIntercept) {
+            recycleVelocityTracker();
+        }
+        super.requestDisallowInterceptTouchEvent(disallowIntercept);
+    }
+
     @Override
     public boolean onInterceptTouchEvent(MotionEvent ev) {
         /*
@@ -440,6 +469,8 @@
                 if (xDiff > mTouchSlop) {
                     mIsBeingDragged = true;
                     mLastMotionX = x;
+                    initVelocityTrackerIfNotExists();
+                    mVelocityTracker.addMovement(ev);
                     if (mParent != null) mParent.requestDisallowInterceptTouchEvent(true);
                 }
                 break;
@@ -449,6 +480,7 @@
                 final float x = ev.getX();
                 if (!inChild((int) x, (int) ev.getY())) {
                     mIsBeingDragged = false;
+                    recycleVelocityTracker();
                     break;
                 }
 
@@ -459,6 +491,9 @@
                 mLastMotionX = x;
                 mActivePointerId = ev.getPointerId(0);
 
+                initOrResetVelocityTracker();
+                mVelocityTracker.addMovement(ev);
+
                 /*
                 * If being flinged and user touches the screen, initiate drag;
                 * otherwise don't.  mScroller.isFinished should be false when
@@ -498,9 +533,7 @@
 
     @Override
     public boolean onTouchEvent(MotionEvent ev) {
-        if (mVelocityTracker == null) {
-            mVelocityTracker = VelocityTracker.obtain();
-        }
+        initVelocityTrackerIfNotExists();
         mVelocityTracker.addMovement(ev);
 
         final int action = ev.getAction();
@@ -584,11 +617,8 @@
 
                     mActivePointerId = INVALID_POINTER;
                     mIsBeingDragged = false;
+                    recycleVelocityTracker();
 
-                    if (mVelocityTracker != null) {
-                        mVelocityTracker.recycle();
-                        mVelocityTracker = null;
-                    }
                     if (mEdgeGlowLeft != null) {
                         mEdgeGlowLeft.onRelease();
                         mEdgeGlowRight.onRelease();
@@ -602,10 +632,8 @@
                     }
                     mActivePointerId = INVALID_POINTER;
                     mIsBeingDragged = false;
-                    if (mVelocityTracker != null) {
-                        mVelocityTracker.recycle();
-                        mVelocityTracker = null;
-                    }
+                    recycleVelocityTracker();
+
                     if (mEdgeGlowLeft != null) {
                         mEdgeGlowLeft.onRelease();
                         mEdgeGlowRight.onRelease();
diff --git a/core/java/android/widget/ScrollView.java b/core/java/android/widget/ScrollView.java
index e59f731..09c875b 100644
--- a/core/java/android/widget/ScrollView.java
+++ b/core/java/android/widget/ScrollView.java
@@ -408,6 +408,36 @@
         return false;
     }
 
+    private void initOrResetVelocityTracker() {
+        if (mVelocityTracker == null) {
+            mVelocityTracker = VelocityTracker.obtain();
+        } else {
+            mVelocityTracker.clear();
+        }
+    }
+
+    private void initVelocityTrackerIfNotExists() {
+        if (mVelocityTracker == null) {
+            mVelocityTracker = VelocityTracker.obtain();
+        }
+    }
+
+    private void recycleVelocityTracker() {
+        if (mVelocityTracker != null) {
+            mVelocityTracker.recycle();
+            mVelocityTracker = null;
+        }
+    }
+
+    @Override
+    public void requestDisallowInterceptTouchEvent(boolean disallowIntercept) {
+        if (disallowIntercept) {
+            recycleVelocityTracker();
+        }
+        super.requestDisallowInterceptTouchEvent(disallowIntercept);
+    }
+
+
     @Override
     public boolean onInterceptTouchEvent(MotionEvent ev) {
         /*
@@ -449,6 +479,8 @@
                 if (yDiff > mTouchSlop) {
                     mIsBeingDragged = true;
                     mLastMotionY = y;
+                    initVelocityTrackerIfNotExists();
+                    mVelocityTracker.addMovement(ev);
                     if (mScrollStrictSpan == null) {
                         mScrollStrictSpan = StrictMode.enterCriticalSpan("ScrollView-scroll");
                     }
@@ -460,6 +492,7 @@
                 final float y = ev.getY();
                 if (!inChild((int) ev.getX(), (int) y)) {
                     mIsBeingDragged = false;
+                    recycleVelocityTracker();
                     break;
                 }
 
@@ -470,6 +503,8 @@
                 mLastMotionY = y;
                 mActivePointerId = ev.getPointerId(0);
 
+                initOrResetVelocityTracker();
+                mVelocityTracker.addMovement(ev);
                 /*
                 * If being flinged and user touches the screen, initiate drag;
                 * otherwise don't.  mScroller.isFinished should be false when
@@ -487,6 +522,7 @@
                 /* Release the drag */
                 mIsBeingDragged = false;
                 mActivePointerId = INVALID_POINTER;
+                recycleVelocityTracker();
                 if (mScroller.springBack(mScrollX, mScrollY, 0, 0, 0, getScrollRange())) {
                     invalidate();
                 }
@@ -505,9 +541,7 @@
 
     @Override
     public boolean onTouchEvent(MotionEvent ev) {
-        if (mVelocityTracker == null) {
-            mVelocityTracker = VelocityTracker.obtain();
-        }
+        initVelocityTrackerIfNotExists();
         mVelocityTracker.addMovement(ev);
 
         final int action = ev.getAction();
@@ -1441,10 +1475,7 @@
     private void endDrag() {
         mIsBeingDragged = false;
 
-        if (mVelocityTracker != null) {
-            mVelocityTracker.recycle();
-            mVelocityTracker = null;
-        }
+        recycleVelocityTracker();
 
         if (mEdgeGlowTop != null) {
             mEdgeGlowTop.onRelease();
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 7a5a091..662b964 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -10745,8 +10745,7 @@
                         TextDirectionHeuristics.FIRSTSTRONG_LTR);
                 break;
             case TEXT_DIRECTION_ANY_RTL:
-                mTextDir = (defaultIsRtl ? TextDirectionHeuristics.ANYRTL_RTL:
-                        TextDirectionHeuristics.ANYRTL_LTR);
+                mTextDir = TextDirectionHeuristics.ANYRTL_LTR;
                 break;
             case TEXT_DIRECTION_CHAR_COUNT:
                 mTextDir = (defaultIsRtl ? TextDirectionHeuristics.CHARCOUNT_RTL:
diff --git a/core/java/com/android/internal/view/menu/ActionMenuPresenter.java b/core/java/com/android/internal/view/menu/ActionMenuPresenter.java
index df4243a..246c4de 100644
--- a/core/java/com/android/internal/view/menu/ActionMenuPresenter.java
+++ b/core/java/com/android/internal/view/menu/ActionMenuPresenter.java
@@ -252,7 +252,7 @@
      * @return true if the overflow menu was shown, false otherwise.
      */
     public boolean showOverflowMenu() {
-        if (mReserveOverflow && !isOverflowMenuShowing() && mMenuView != null &&
+        if (mReserveOverflow && !isOverflowMenuShowing() && mMenu != null && mMenuView != null &&
                 mPostedOpenRunnable == null) {
             OverflowPopup popup = new OverflowPopup(mContext, mMenu, mOverflowButton, true);
             mPostedOpenRunnable = new OpenOverflowRunnable(popup);
diff --git a/core/res/res/layout/activity_list_item.xml b/core/res/res/layout/activity_list_item.xml
index 25d95fd..7022fe1 100644
--- a/core/res/res/layout/activity_list_item.xml
+++ b/core/res/res/layout/activity_list_item.xml
@@ -22,8 +22,8 @@
     android:layout_height="wrap_content"
     android:paddingTop="1dip"
     android:paddingBottom="1dip"
-    android:paddingLeft="6dip"
-    android:paddingRight="6dip">
+    android:paddingLeft="8dip"
+    android:paddingRight="8dip">
 
     <ImageView android:id="@+id/icon"
         android:layout_width="24dip"
diff --git a/core/res/res/layout/input_method_extract_view.xml b/core/res/res/layout/input_method_extract_view.xml
index 60bc24c..a3e4961 100644
--- a/core/res/res/layout/input_method_extract_view.xml
+++ b/core/res/res/layout/input_method_extract_view.xml
@@ -40,7 +40,6 @@
             android:layout_height="match_parent"
             android:paddingLeft="8dip"
             android:paddingRight="8dip"
-            android:background="@android:drawable/keyboard_accessory_bg_landscape"
         >
         
         <android.inputmethodservice.ExtractButton android:id="@+id/inputExtractAction"
diff --git a/core/res/res/layout/list_menu_item_layout.xml b/core/res/res/layout/list_menu_item_layout.xml
index aaff4c7..93bd76b 100644
--- a/core/res/res/layout/list_menu_item_layout.xml
+++ b/core/res/res/layout/list_menu_item_layout.xml
@@ -26,8 +26,8 @@
         android:layout_weight="1"
         android:layout_height="wrap_content"
         android:layout_gravity="center_vertical"
-        android:layout_marginLeft="6dip"
-        android:layout_marginRight="6dip"
+        android:layout_marginLeft="16dip"
+        android:layout_marginRight="16dip"
         android:duplicateParentState="true">
         
         <TextView 
@@ -36,7 +36,7 @@
             android:layout_height="wrap_content"
             android:layout_alignParentTop="true"
             android:layout_alignParentLeft="true"
-            android:textAppearance="?android:attr/textAppearanceLarge"
+            android:textAppearance="?android:attr/textAppearanceListItemSmall"
             android:singleLine="true"
             android:duplicateParentState="true"
             android:ellipsize="marquee"
diff --git a/core/res/res/layout/select_dialog_item_holo.xml b/core/res/res/layout/select_dialog_item_holo.xml
index 0c700cf..3d19c06 100644
--- a/core/res/res/layout/select_dialog_item_holo.xml
+++ b/core/res/res/layout/select_dialog_item_holo.xml
@@ -27,7 +27,7 @@
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:minHeight="?android:attr/listPreferredItemHeightSmall"
-    android:textAppearance="?android:attr/textAppearanceMedium"
+    android:textAppearance="?android:attr/textAppearanceListItemSmall"
     android:textColor="?android:attr/textColorAlertDialogListItem"
     android:gravity="center_vertical"
     android:paddingLeft="16dip"
diff --git a/core/res/res/layout/simple_expandable_list_item_1.xml b/core/res/res/layout/simple_expandable_list_item_1.xml
index dc3e58e..df4324b 100644
--- a/core/res/res/layout/simple_expandable_list_item_1.xml
+++ b/core/res/res/layout/simple_expandable_list_item_1.xml
@@ -19,6 +19,6 @@
     android:layout_width="match_parent"
     android:layout_height="?android:attr/listPreferredItemHeight"
     android:paddingLeft="?android:attr/expandableListPreferredItemPaddingLeft"
-    android:textAppearance="?android:attr/textAppearanceLarge"
+    android:textAppearance="?android:attr/textAppearanceListItem"
     android:gravity="center_vertical"
 />
diff --git a/core/res/res/layout/simple_expandable_list_item_2.xml b/core/res/res/layout/simple_expandable_list_item_2.xml
index b48b444..c0935fa 100644
--- a/core/res/res/layout/simple_expandable_list_item_2.xml
+++ b/core/res/res/layout/simple_expandable_list_item_2.xml
@@ -27,7 +27,7 @@
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_marginTop="6dip"
-        android:textAppearance="?android:attr/textAppearanceLarge"
+        android:textAppearance="?android:attr/textAppearanceListItem"
     />
 
     <TextView android:id="@android:id/text2"
diff --git a/core/res/res/layout/simple_list_item_1.xml b/core/res/res/layout/simple_list_item_1.xml
index c9c77a5..252e006 100644
--- a/core/res/res/layout/simple_list_item_1.xml
+++ b/core/res/res/layout/simple_list_item_1.xml
@@ -18,8 +18,9 @@
     android:id="@android:id/text1"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:textAppearance="?android:attr/textAppearanceLarge"
+    android:textAppearance="?android:attr/textAppearanceListItem"
     android:gravity="center_vertical"
-    android:paddingLeft="6dip"
+    android:paddingLeft="8dip"
+    android:paddingRight="8dip"
     android:minHeight="?android:attr/listPreferredItemHeight"
 />
diff --git a/core/res/res/layout/simple_list_item_2.xml b/core/res/res/layout/simple_list_item_2.xml
index c87922c..9b6c62a 100644
--- a/core/res/res/layout/simple_list_item_2.xml
+++ b/core/res/res/layout/simple_list_item_2.xml
@@ -24,9 +24,9 @@
 	<TextView android:id="@android:id/text1"
 		android:layout_width="match_parent"
 		android:layout_height="wrap_content"
-        android:layout_marginLeft="6dip"
-        android:layout_marginTop="6dip"
-		android:textAppearance="?android:attr/textAppearanceLarge"
+        android:layout_marginLeft="8dip"
+        android:layout_marginTop="8dip"
+		android:textAppearance="?android:attr/textAppearanceListItem"
 	/>
 		
 	<TextView android:id="@android:id/text2"
diff --git a/core/res/res/layout/simple_list_item_activated_1.xml b/core/res/res/layout/simple_list_item_activated_1.xml
index 8416df2..d60f93b 100644
--- a/core/res/res/layout/simple_list_item_activated_1.xml
+++ b/core/res/res/layout/simple_list_item_activated_1.xml
@@ -18,7 +18,7 @@
     android:id="@android:id/text1"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:textAppearance="?android:attr/textAppearanceLarge"
+    android:textAppearance="?android:attr/textAppearanceListItem"
     android:gravity="center_vertical"
     android:background="?android:attr/activatedBackgroundIndicator"
     android:minHeight="?android:attr/listPreferredItemHeight"
diff --git a/core/res/res/layout/simple_list_item_activated_2.xml b/core/res/res/layout/simple_list_item_activated_2.xml
index 2ffbf02..5be5c92 100644
--- a/core/res/res/layout/simple_list_item_activated_2.xml
+++ b/core/res/res/layout/simple_list_item_activated_2.xml
@@ -27,8 +27,8 @@
     <TextView android:id="@android:id/text1"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_marginLeft="6dip"
-        android:layout_marginTop="6dip"
+        android:layout_marginLeft="8dip"
+        android:layout_marginTop="8dip"
         android:textAppearance="?android:attr/textAppearanceLarge"
     />
 
diff --git a/core/res/res/layout/simple_list_item_checked.xml b/core/res/res/layout/simple_list_item_checked.xml
index 5f99044..79d3a18 100644
--- a/core/res/res/layout/simple_list_item_checked.xml
+++ b/core/res/res/layout/simple_list_item_checked.xml
@@ -18,9 +18,9 @@
     android:id="@android:id/text1"
     android:layout_width="match_parent"
     android:layout_height="?android:attr/listPreferredItemHeight"
-    android:textAppearance="?android:attr/textAppearanceLarge"
+    android:textAppearance="?android:attr/textAppearanceListItem"
     android:gravity="center_vertical"
     android:checkMark="?android:attr/textCheckMark"
-    android:paddingLeft="6dip"
-    android:paddingRight="6dip"
+    android:paddingLeft="8dip"
+    android:paddingRight="8dip"
 />
diff --git a/core/res/res/layout/simple_list_item_multiple_choice.xml b/core/res/res/layout/simple_list_item_multiple_choice.xml
index 05c66f3..0305427 100644
--- a/core/res/res/layout/simple_list_item_multiple_choice.xml
+++ b/core/res/res/layout/simple_list_item_multiple_choice.xml
@@ -18,9 +18,9 @@
     android:id="@android:id/text1"
     android:layout_width="match_parent"
     android:layout_height="?android:attr/listPreferredItemHeight"
-    android:textAppearance="?android:attr/textAppearanceLarge"
+    android:textAppearance="?android:attr/textAppearanceListItem"
     android:gravity="center_vertical"
     android:checkMark="?android:attr/listChoiceIndicatorMultiple"
-    android:paddingLeft="6dip"
-    android:paddingRight="6dip"
+    android:paddingLeft="8dip"
+    android:paddingRight="8dip"
 />
diff --git a/core/res/res/layout/simple_list_item_single_choice.xml b/core/res/res/layout/simple_list_item_single_choice.xml
index 27afd1d..ac4a4a8 100644
--- a/core/res/res/layout/simple_list_item_single_choice.xml
+++ b/core/res/res/layout/simple_list_item_single_choice.xml
@@ -18,9 +18,9 @@
     android:id="@android:id/text1"
     android:layout_width="match_parent"
     android:layout_height="?android:attr/listPreferredItemHeight"
-    android:textAppearance="?android:attr/textAppearanceLarge"
+    android:textAppearance="?android:attr/textAppearanceListItem"
     android:gravity="center_vertical"
     android:checkMark="?android:attr/listChoiceIndicatorSingle"
-    android:paddingLeft="6dip"
-    android:paddingRight="6dip"
+    android:paddingLeft="8dip"
+    android:paddingRight="8dip"
 />
diff --git a/core/res/res/layout/simple_selectable_list_item.xml b/core/res/res/layout/simple_selectable_list_item.xml
index 518bcd0..6ce22d6 100644
--- a/core/res/res/layout/simple_selectable_list_item.xml
+++ b/core/res/res/layout/simple_selectable_list_item.xml
@@ -18,9 +18,9 @@
     android:id="@android:id/text1"
     android:layout_width="match_parent"
     android:layout_height="?android:attr/listPreferredItemHeight"
-    android:textAppearance="?android:attr/textAppearanceLarge"
+    android:textAppearance="?android:attr/textAppearanceListItem"
     android:gravity="center_vertical"
     android:background="?android:attr/listChoiceBackgroundIndicator"
-    android:paddingLeft="6dip"
-    android:paddingRight="9dip"
+    android:paddingLeft="8dip"
+    android:paddingRight="8dip"
 />
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index aa3397f..8db6b4f 100755
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -236,6 +236,11 @@
         <!-- The list item height for search results. @hide -->
         <attr name="searchResultListItemHeight" format="dimension" />
 
+        <!-- The preferred TextAppearance for the primary text of list items. -->
+        <attr name="textAppearanceListItem" format="reference" />
+        <!-- The preferred TextAppearance for the primary text of small list items. -->
+        <attr name="textAppearanceListItemSmall" format="reference" />
+
         <!-- The drawable for the list divider. -->
         <attr name="listDivider" format="reference" />
         <!-- The list divider used in alert dialogs. -->
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 730d971..a6bf1e0 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1792,6 +1792,9 @@
   <public type="attr" name="actionBarItemBackground" />
   <public type="attr" name="actionModeSplitBackground" />
 
+  <public type="attr" name="textAppearanceListItem" />
+  <public type="attr" name="textAppearanceListItemSmall" />
+
   <public type="style" name="TextAppearance.SuggestionHighlight" />
 
   <public type="style" name="Theme.Holo.Light.DarkActionBar" />
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index 786cdb5..903fc04 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -122,6 +122,8 @@
         <item name="listPreferredItemHeightSmall">?android:attr/listPreferredItemHeight</item>
         <item name="listPreferredItemHeightLarge">?android:attr/listPreferredItemHeight</item>
         <item name="dropdownListPreferredItemHeight">?android:attr/listPreferredItemHeight</item>
+        <item name="textAppearanceListItem">?android:attr/textAppearanceLarge</item>
+        <item name="textAppearanceListItemSmall">?android:attr/textAppearanceLarge</item>
 
         <!-- @hide -->
         <item name="searchResultListItemHeight">58dip</item>
@@ -715,9 +717,9 @@
          {@link android.inputmethodservice.InputMethodService} class.
          this inherits from Theme.Panel, but sets up IME appropriate animations
          and a few custom attributes. -->
-    <style name="Theme.Holo.InputMethod" parent="Theme.Holo.Panel">
+    <style name="Theme.Holo.InputMethod" parent="Theme.Holo.Light.Panel">
         <item name="android:windowAnimationStyle">@android:style/Animation.InputMethod</item>
-        <item name="android:imeFullscreenBackground">@android:drawable/input_method_fullscreen_background_holo</item>
+        <item name="android:imeFullscreenBackground">@android:drawable/screen_background_selector_light</item>
         <item name="android:imeExtractEnterAnimation">@android:anim/input_method_extract_enter</item>
         <item name="android:imeExtractExitAnimation">@android:anim/input_method_extract_exit</item>
     </style>
@@ -920,6 +922,7 @@
         <item name="listPreferredItemHeightSmall">48dip</item>
         <item name="listPreferredItemHeightLarge">80dip</item>
         <item name="dropdownListPreferredItemHeight">?android:attr/listPreferredItemHeightSmall</item>
+        <item name="textAppearanceListItemSmall">?android:attr/textAppearanceMedium</item>
 
         <!-- @hide -->
         <item name="searchResultListItemHeight">58dip</item>
@@ -1222,6 +1225,7 @@
         <item name="listPreferredItemHeightSmall">48dip</item>
         <item name="listPreferredItemHeightLarge">80dip</item>
         <item name="dropdownListPreferredItemHeight">?android:attr/listPreferredItemHeightSmall</item>
+        <item name="textAppearanceListItemSmall">?android:attr/textAppearanceMedium</item>
 
         <!-- @hide -->
         <item name="searchResultListItemHeight">58dip</item>
diff --git a/media/libstagefright/matroska/MatroskaExtractor.cpp b/media/libstagefright/matroska/MatroskaExtractor.cpp
index e1b9991..3ef7b71 100644
--- a/media/libstagefright/matroska/MatroskaExtractor.cpp
+++ b/media/libstagefright/matroska/MatroskaExtractor.cpp
@@ -493,7 +493,8 @@
     : mDataSource(source),
       mReader(new DataSourceReader(mDataSource)),
       mSegment(NULL),
-      mExtractedThumbnails(false) {
+      mExtractedThumbnails(false),
+      mIsWebm(false) {
     off64_t size;
     mIsLiveStreaming =
         (mDataSource->flags()
@@ -507,6 +508,10 @@
         return;
     }
 
+    if (ebmlHeader.m_docType && !strcmp("webm", ebmlHeader.m_docType)) {
+        mIsWebm = true;
+    }
+
     long long ret =
         mkvparser::Segment::CreateInstance(mReader, pos, mSegment);
 
@@ -757,7 +762,10 @@
 
 sp<MetaData> MatroskaExtractor::getMetaData() {
     sp<MetaData> meta = new MetaData;
-    meta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_CONTAINER_MATROSKA);
+
+    meta->setCString(
+            kKeyMIMEType,
+            mIsWebm ? "video/webm" : MEDIA_MIMETYPE_CONTAINER_MATROSKA);
 
     return meta;
 }
diff --git a/media/libstagefright/matroska/MatroskaExtractor.h b/media/libstagefright/matroska/MatroskaExtractor.h
index 38ebd61..1294b4f 100644
--- a/media/libstagefright/matroska/MatroskaExtractor.h
+++ b/media/libstagefright/matroska/MatroskaExtractor.h
@@ -68,6 +68,7 @@
     mkvparser::Segment *mSegment;
     bool mExtractedThumbnails;
     bool mIsLiveStreaming;
+    bool mIsWebm;
 
     void addTracks();
     void findThumbnails();
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
index 36f1659..8da2db6 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
@@ -120,6 +120,9 @@
     }
 
     public void onBeginDrag(View v) {
+        // We do this so the underlying ScrollView knows that it won't get
+        // the chance to intercept events anymore
+        requestDisallowInterceptTouchEvent(true);
     }
 
     public View getChildAtPosition(MotionEvent ev) {
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
index 959328f..b1a30d9 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
@@ -135,6 +135,9 @@
     }
 
     public void onBeginDrag(View v) {
+        // We do this so the underlying ScrollView knows that it won't get
+        // the chance to intercept events anymore
+        requestDisallowInterceptTouchEvent(true);
     }
 
     public View getChildAtPosition(MotionEvent ev) {