Merge "Cleaning up StackView" into honeycomb
diff --git a/api/current.xml b/api/current.xml
index de121e2..ad9fe5d 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -53808,6 +53808,17 @@
  visibility="public"
 >
 </field>
+<field name="EXTRA_LOCAL_ONLY"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.intent.extra.LOCAL_ONLY&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="EXTRA_PHONE_NUMBER"
  type="java.lang.String"
  transient="false"
diff --git a/core/java/android/accounts/AccountManager.java b/core/java/android/accounts/AccountManager.java
index 6388dc5..5bdc79d 100644
--- a/core/java/android/accounts/AccountManager.java
+++ b/core/java/android/accounts/AccountManager.java
@@ -195,6 +195,13 @@
     public static final String KEY_CALLER_UID = "callerUid";
     public static final String KEY_CALLER_PID = "callerPid";
 
+    /**
+     * Boolean, if set and 'customTokens' the authenticator is responsible for
+     * notifications.
+     * @hide
+     */
+    public static final String KEY_NOTIFY_ON_FAILURE = "notifyOnAuthFailure";
+
     public static final String ACTION_AUTHENTICATOR_INTENT =
             "android.accounts.AccountAuthenticator";
     public static final String AUTHENTICATOR_META_DATA_NAME =
diff --git a/core/java/android/accounts/AccountManagerService.java b/core/java/android/accounts/AccountManagerService.java
index 2c99f14..fb16609 100644
--- a/core/java/android/accounts/AccountManagerService.java
+++ b/core/java/android/accounts/AccountManagerService.java
@@ -897,6 +897,9 @@
             // let authenticator know the identity of the caller
             loginOptions.putInt(AccountManager.KEY_CALLER_UID, callerUid);
             loginOptions.putInt(AccountManager.KEY_CALLER_PID, callerPid);
+            if (notifyOnAuthFailure) {
+                loginOptions.putBoolean(AccountManager.KEY_NOTIFY_ON_FAILURE, true);
+            }
         }
 
         long identityToken = clearCallingIdentity();
@@ -964,7 +967,7 @@
                         }
 
                         Intent intent = result.getParcelable(AccountManager.KEY_INTENT);
-                        if (intent != null && notifyOnAuthFailure) {
+                        if (intent != null && notifyOnAuthFailure && !customTokens) {
                             doNotification(
                                     account, result.getString(AccountManager.KEY_AUTH_FAILED_MESSAGE),
                                     intent);
diff --git a/core/java/android/app/Dialog.java b/core/java/android/app/Dialog.java
index 7365670..f4fa567 100644
--- a/core/java/android/app/Dialog.java
+++ b/core/java/android/app/Dialog.java
@@ -85,6 +85,7 @@
      */
     protected boolean mCancelable = true;
 
+    private String mCancelAndDismissTaken;
     private Message mCancelMessage;
     private Message mDismissMessage;
     private Message mShowMessage;
@@ -1029,6 +1030,11 @@
      * @param listener The {@link DialogInterface.OnCancelListener} to use.
      */
     public void setOnCancelListener(final OnCancelListener listener) {
+        if (mCancelAndDismissTaken != null) {
+            throw new IllegalStateException(
+                    "OnCancelListener is already taken by "
+                    + mCancelAndDismissTaken + " and can not be replaced.");
+        }
         if (listener != null) {
             mCancelMessage = mListenersHandler.obtainMessage(CANCEL, listener);
         } else {
@@ -1050,6 +1056,11 @@
      * @param listener The {@link DialogInterface.OnDismissListener} to use.
      */
     public void setOnDismissListener(final OnDismissListener listener) {
+        if (mCancelAndDismissTaken != null) {
+            throw new IllegalStateException(
+                    "OnDismissListener is already taken by "
+                    + mCancelAndDismissTaken + " and can not be replaced.");
+        }
         if (listener != null) {
             mDismissMessage = mListenersHandler.obtainMessage(DISMISS, listener);
         } else {
@@ -1077,6 +1088,22 @@
         mDismissMessage = msg;
     }
 
+    /** @hide */
+    public boolean takeCancelAndDismissListeners(String msg, final OnCancelListener cancel,
+            final OnDismissListener dismiss) {
+        if (mCancelAndDismissTaken != null) {
+            mCancelAndDismissTaken = null;
+        } else if (mCancelMessage != null || mDismissMessage != null) {
+            return false;
+        }
+        
+        setOnCancelListener(cancel);
+        setOnDismissListener(dismiss);
+        mCancelAndDismissTaken = msg;
+        
+        return true;
+    }
+    
     /**
      * By default, this will use the owner Activity's suggested stream type.
      * 
diff --git a/core/java/android/app/DialogFragment.java b/core/java/android/app/DialogFragment.java
index 8bdd086..50953d7 100644
--- a/core/java/android/app/DialogFragment.java
+++ b/core/java/android/app/DialogFragment.java
@@ -378,6 +378,12 @@
      * default implementation simply instantiates and returns a {@link Dialog}
      * class.
      * 
+     * <p><em>Note: DialogFragment own the {@link Dialog#setOnCancelListener
+     * Dialog.setOnCancelListener} and {@link Dialog#setOnDismissListener
+     * Dialog.setOnDismissListener} callbacks.  You must not set them yourself.</em>
+     * To find out about these events, override {@link #onCancel(DialogInterface)}
+     * and {@link #onDismiss(DialogInterface)}.</p>
+     * 
      * @param savedInstanceState The last saved instance state of the Fragment,
      * or null if this is a freshly created Fragment.
      * 
@@ -417,8 +423,10 @@
         }
         mDialog.setOwnerActivity(getActivity());
         mDialog.setCancelable(mCancelable);
-        mDialog.setOnCancelListener(this);
-        mDialog.setOnDismissListener(this);
+        if (!mDialog.takeCancelAndDismissListeners("DialogFragment", this, this)) {
+            throw new IllegalStateException(
+                    "You can not set Dialog's OnCancelListener or OnDismissListener");
+        }
         if (savedInstanceState != null) {
             Bundle dialogState = savedInstanceState.getBundle(SAVED_DIALOG_STATE_TAG);
             if (dialogState != null) {
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index ca5ff24..6e3663e 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -859,11 +859,19 @@
      * only pick from data that can be represented as a stream.  This is
      * accomplished by requiring the {@link #CATEGORY_OPENABLE} in the Intent.
      * <p>
+     * Callers can optionally specify {@link #EXTRA_LOCAL_ONLY} to request that
+     * the launched content chooser only return results representing data that
+     * is locally available on the device.  For example, if this extra is set
+     * to true then an image picker should not show any pictures that are available
+     * from a remote server but not already on the local device (thus requiring
+     * they be downloaded when opened).
+     * <p>
      * Input: {@link #getType} is the desired MIME type to retrieve.  Note
      * that no URI is supplied in the intent, as there are no constraints on
      * where the returned data originally comes from.  You may also include the
      * {@link #CATEGORY_OPENABLE} if you can only accept data that can be
-     * opened as a stream.
+     * opened as a stream.  You may use {@link #EXTRA_LOCAL_ONLY} to limit content
+     * selection to local data.
      * <p>
      * Output: The URI of the item that was picked.  This must be a content:
      * URI so that any receiver can access it.
@@ -2397,6 +2405,18 @@
     public static final String EXTRA_CLIENT_INTENT =
             "android.intent.extra.client_intent";
 
+    /**
+     * Used to indicate that a {@link #ACTION_GET_CONTENT} intent should only return
+     * data that is on the local device.  This is a boolean extra; the default
+     * is false.  If true, an implementation of ACTION_GET_CONTENT should only allow
+     * the user to select media that is already on the device, not requiring it
+     * be downloaded from a remote service when opened.  Another way to look
+     * at it is that such content should generally have a "_data" column to the
+     * path of the content on local external storage.
+     */
+    public static final String EXTRA_LOCAL_ONLY =
+        "android.intent.extra.LOCAL_ONLY";
+    
     // ---------------------------------------------------------------------
     // ---------------------------------------------------------------------
     // Intent flags (see mFlags variable).
diff --git a/core/java/android/server/BluetoothEventLoop.java b/core/java/android/server/BluetoothEventLoop.java
index cd3bc3e..7456acd 100644
--- a/core/java/android/server/BluetoothEventLoop.java
+++ b/core/java/android/server/BluetoothEventLoop.java
@@ -648,7 +648,8 @@
             } else {
                 Log.i(TAG, "Rejecting incoming A2DP / AVRCP connection from " + address);
             }
-        } else if (BluetoothUuid.isInputDevice(uuid) && !isOtherInputDeviceConnected(address)) {
+        } else if (BluetoothUuid.isInputDevice(uuid) && !isOtherInputDeviceConnected(address) &&
+                   isKeyboard(address)) {
             BluetoothInputDevice inputDevice = new BluetoothInputDevice(mContext);
             authorized = inputDevice.getInputDevicePriority(device) >
                          BluetoothInputDevice.PRIORITY_OFF;
@@ -667,6 +668,17 @@
         return authorized;
     }
 
+    private boolean isKeyboard(String address) {
+        BluetoothClass btClass = new BluetoothClass(mBluetoothService.getRemoteClass(address));
+        int btDeviceClass = btClass.getDeviceClass();
+        if (btDeviceClass == BluetoothClass.Device.PERIPHERAL_KEYBOARD ||
+            btDeviceClass == BluetoothClass.Device.PERIPHERAL_KEYBOARD_POINTING) {
+            return true;
+        }
+        log("Incoming Connect: Input device class: " + btDeviceClass + " Not a keyboard");
+        return false;
+    }
+
     private boolean isOtherInputDeviceConnected(String address) {
         List<BluetoothDevice> devices =
             mBluetoothService.lookupInputDevicesMatchingStates(new int[] {
diff --git a/core/java/android/server/BluetoothService.java b/core/java/android/server/BluetoothService.java
index dd88838..5608603 100644
--- a/core/java/android/server/BluetoothService.java
+++ b/core/java/android/server/BluetoothService.java
@@ -1729,6 +1729,15 @@
             getInputDevicePriority(device) == BluetoothInputDevice.PRIORITY_OFF) {
             return false;
         }
+
+        BluetoothClass btClass = new BluetoothClass(getRemoteClass(device.getAddress()));
+        int btDeviceClass = btClass.getDeviceClass();
+        if (btDeviceClass != BluetoothClass.Device.PERIPHERAL_KEYBOARD &&
+            btDeviceClass != BluetoothClass.Device.PERIPHERAL_KEYBOARD_POINTING) {
+            log("Input device btDeviceClass: " + btDeviceClass + " Not a keyboard");
+            return false;
+        }
+
         BluetoothDeviceProfileState state = mDeviceProfileState.get(device.getAddress());
         if (state != null) {
             Message msg = new Message();
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index ae6ecfb..fedda68 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -8596,7 +8596,6 @@
         private long mTouchTimer;
         private boolean mIsInsertionHandle = false;
         private PastePopupMenu mPastePopupWindow;
-        private Runnable mLongPressCallback;
 
         // Touch-up filter: number of previous positions remembered
         private static final int HISTORY_SIZE = 5;
@@ -8839,73 +8838,49 @@
         @Override
         public boolean onTouchEvent(MotionEvent ev) {
             switch (ev.getActionMasked()) {
-            case MotionEvent.ACTION_DOWN: {
-                startTouchUpFilter(mController.getCurrentOffset(this));
-                mDownPositionX = ev.getRawX();
-                mDownPositionY = ev.getRawY();
-                mTouchToWindowOffsetX = mDownPositionX - mPositionX;
-                mTouchToWindowOffsetY = mDownPositionY - mPositionY;
-                final int[] coords = mTempCoords;
-                TextView.this.getLocationInWindow(coords);
-                mLastParentX = coords[0];
-                mLastParentY = coords[1];
-                mIsDragging = true;
-                if (mIsInsertionHandle) {
-                    mTouchTimer = SystemClock.uptimeMillis();
-                    if (mLongPressCallback == null) {
-                        mLongPressCallback = new Runnable() {
-                            public void run() {
-                                mController.hide();
-                                startSelectionActionMode();
+                case MotionEvent.ACTION_DOWN: {
+                    startTouchUpFilter(mController.getCurrentOffset(this));
+                    mDownPositionX = ev.getRawX();
+                    mDownPositionY = ev.getRawY();
+                    mTouchToWindowOffsetX = mDownPositionX - mPositionX;
+                    mTouchToWindowOffsetY = mDownPositionY - mPositionY;
+                    final int[] coords = mTempCoords;
+                    TextView.this.getLocationInWindow(coords);
+                    mLastParentX = coords[0];
+                    mLastParentY = coords[1];
+                    mIsDragging = true;
+                    break;
+                }
+
+                case MotionEvent.ACTION_MOVE: {
+                    final float rawX = ev.getRawX();
+                    final float rawY = ev.getRawY();
+                    final float newPosX = rawX - mTouchToWindowOffsetX + mHotspotX;
+                    final float newPosY = rawY - mTouchToWindowOffsetY + mHotspotY + mTouchOffsetY;
+
+                    mController.updatePosition(this, Math.round(newPosX), Math.round(newPosY));
+                    break;
+                }
+
+                case MotionEvent.ACTION_UP:
+                    if (mIsInsertionHandle) {
+                        long delay = SystemClock.uptimeMillis() - mTouchTimer;
+                        if (delay < ViewConfiguration.getTapTimeout()) {
+                            if (mPastePopupWindow != null && mPastePopupWindow.isShowing()) {
+                                // Tapping on the handle dismisses the displayed paste view,
+                                mPastePopupWindow.hide();
+                            } else {
+                                ((InsertionPointCursorController) mController).show(0);
                             }
-                        };
-                    }
-                    postDelayed(mLongPressCallback, ViewConfiguration.getLongPressTimeout());
-                }
-                break;
-            }
-
-            case MotionEvent.ACTION_MOVE: {
-                final float rawX = ev.getRawX();
-                final float rawY = ev.getRawY();
-                final float newPosX = rawX - mTouchToWindowOffsetX + mHotspotX;
-                final float newPosY = rawY - mTouchToWindowOffsetY + mHotspotY + mTouchOffsetY;
-
-                mController.updatePosition(this, Math.round(newPosX), Math.round(newPosY));
-
-                if (mIsInsertionHandle) {
-                    final float dx = rawX - mDownPositionX;
-                    final float dy = rawY - mDownPositionY;
-                    final float distanceSquared = dx * dx + dy * dy;
-                    if (distanceSquared >= mSquaredTouchSlopDistance) {
-                        removeLongPressCallback();
-                    }
-                }
-                break;
-            }
-
-            case MotionEvent.ACTION_UP:
-                if (mIsInsertionHandle) {
-                    removeLongPressCallback();
-                    long delay = SystemClock.uptimeMillis() - mTouchTimer;
-                    if (delay < ViewConfiguration.getTapTimeout()) {
-                        if (mPastePopupWindow != null && mPastePopupWindow.isShowing()) {
-                            // Tapping on the handle dismisses the displayed paste view,
-                            mPastePopupWindow.hide();
-                        } else {
-                            ((InsertionPointCursorController) mController).show(0);
                         }
                     }
-                }
-                filterOnTouchUp();
-                mIsDragging = false;
-                break;
+                    filterOnTouchUp();
+                    mIsDragging = false;
+                    break;
 
-            case MotionEvent.ACTION_CANCEL:
-                if (mIsInsertionHandle) {
-                    removeLongPressCallback();
-                }
-                mIsDragging = false;
+                case MotionEvent.ACTION_CANCEL:
+                    mIsDragging = false;
+                    break;
             }
             return true;
         }
@@ -8943,16 +8918,6 @@
                 mPastePopupWindow.show();
             }
         }
-
-        private void removeLongPressCallback() {
-            if (mLongPressCallback != null) {
-                removeCallbacks(mLongPressCallback);
-            }
-        }
-
-        void onDetached() {
-            removeLongPressCallback();
-        }
     }
 
     private class InsertionPointCursorController implements CursorController {
@@ -9079,9 +9044,6 @@
         public void onDetached() {
             removeHiderCallback();
             removePastePopupCallback();
-            if (mHandle != null) {
-                mHandle.onDetached();
-            }
         }
     }
 
diff --git a/core/res/res/drawable-hdpi/btn_default_disabled_focused_holo_dark.9.png b/core/res/res/drawable-hdpi/btn_default_disabled_focused_holo_dark.9.png
index 3007a84..8ea94e1 100644
--- a/core/res/res/drawable-hdpi/btn_default_disabled_focused_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/btn_default_disabled_focused_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_default_disabled_focused_holo_light.9.png b/core/res/res/drawable-hdpi/btn_default_disabled_focused_holo_light.9.png
index 5a108454..8ea94e1 100644
--- a/core/res/res/drawable-hdpi/btn_default_disabled_focused_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/btn_default_disabled_focused_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_default_disabled_holo_dark.9.png b/core/res/res/drawable-hdpi/btn_default_disabled_holo_dark.9.png
index bc35a36..bee345e 100644
--- a/core/res/res/drawable-hdpi/btn_default_disabled_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/btn_default_disabled_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_default_disabled_holo_light.9.png b/core/res/res/drawable-hdpi/btn_default_disabled_holo_light.9.png
index bc35a36..bee345e 100644
--- a/core/res/res/drawable-hdpi/btn_default_disabled_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/btn_default_disabled_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_default_focused_holo_dark.9.png b/core/res/res/drawable-hdpi/btn_default_focused_holo_dark.9.png
index f6380fa..e83686a 100644
--- a/core/res/res/drawable-hdpi/btn_default_focused_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/btn_default_focused_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_default_focused_holo_light.9.png b/core/res/res/drawable-hdpi/btn_default_focused_holo_light.9.png
index f6380fa..e83686a 100644
--- a/core/res/res/drawable-hdpi/btn_default_focused_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/btn_default_focused_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_default_normal_holo_dark.9.png b/core/res/res/drawable-hdpi/btn_default_normal_holo_dark.9.png
index 7016db1..42e8ba4 100644
--- a/core/res/res/drawable-hdpi/btn_default_normal_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/btn_default_normal_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_default_normal_holo_light.9.png b/core/res/res/drawable-hdpi/btn_default_normal_holo_light.9.png
index 228af2e..42e8ba4 100644
--- a/core/res/res/drawable-hdpi/btn_default_normal_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/btn_default_normal_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_default_pressed_holo_dark.9.png b/core/res/res/drawable-hdpi/btn_default_pressed_holo_dark.9.png
index bc3bfc2..a24b13b 100644
--- a/core/res/res/drawable-hdpi/btn_default_pressed_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/btn_default_pressed_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_default_pressed_holo_light.9.png b/core/res/res/drawable-hdpi/btn_default_pressed_holo_light.9.png
index 8a4759b..a24b13b 100644
--- a/core/res/res/drawable-hdpi/btn_default_pressed_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/btn_default_pressed_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_toggle_off_disabled_focused_holo_dark.9.png b/core/res/res/drawable-hdpi/btn_toggle_off_disabled_focused_holo_dark.9.png
index 8f95407..63a9219 100755
--- a/core/res/res/drawable-hdpi/btn_toggle_off_disabled_focused_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/btn_toggle_off_disabled_focused_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_toggle_off_disabled_focused_holo_light.9.png b/core/res/res/drawable-hdpi/btn_toggle_off_disabled_focused_holo_light.9.png
index 408d3d7..d977914 100755
--- a/core/res/res/drawable-hdpi/btn_toggle_off_disabled_focused_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/btn_toggle_off_disabled_focused_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_toggle_off_disabled_holo_dark.9.png b/core/res/res/drawable-hdpi/btn_toggle_off_disabled_holo_dark.9.png
index 092fea0..c04393c 100755
--- a/core/res/res/drawable-hdpi/btn_toggle_off_disabled_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/btn_toggle_off_disabled_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_toggle_off_disabled_holo_light.9.png b/core/res/res/drawable-hdpi/btn_toggle_off_disabled_holo_light.9.png
index 2e310a4..96bd351 100755
--- a/core/res/res/drawable-hdpi/btn_toggle_off_disabled_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/btn_toggle_off_disabled_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_toggle_off_focused_holo_dark.9.png b/core/res/res/drawable-hdpi/btn_toggle_off_focused_holo_dark.9.png
index 127b7e2..c30b993 100755
--- a/core/res/res/drawable-hdpi/btn_toggle_off_focused_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/btn_toggle_off_focused_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_toggle_off_focused_holo_light.9.png b/core/res/res/drawable-hdpi/btn_toggle_off_focused_holo_light.9.png
index a5bde58..730c113 100755
--- a/core/res/res/drawable-hdpi/btn_toggle_off_focused_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/btn_toggle_off_focused_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_toggle_off_normal_holo_dark.9.png b/core/res/res/drawable-hdpi/btn_toggle_off_normal_holo_dark.9.png
index e46c1af..17de0eb 100755
--- a/core/res/res/drawable-hdpi/btn_toggle_off_normal_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/btn_toggle_off_normal_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_toggle_off_normal_holo_light.9.png b/core/res/res/drawable-hdpi/btn_toggle_off_normal_holo_light.9.png
index 8756b62..7e62cf9 100755
--- a/core/res/res/drawable-hdpi/btn_toggle_off_normal_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/btn_toggle_off_normal_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_toggle_off_pressed_holo_dark.9.png b/core/res/res/drawable-hdpi/btn_toggle_off_pressed_holo_dark.9.png
index b5e1e9c..a06f1fc 100755
--- a/core/res/res/drawable-hdpi/btn_toggle_off_pressed_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/btn_toggle_off_pressed_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_toggle_off_pressed_holo_light.9.png b/core/res/res/drawable-hdpi/btn_toggle_off_pressed_holo_light.9.png
index 46ea0d6..21ad0d8 100755
--- a/core/res/res/drawable-hdpi/btn_toggle_off_pressed_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/btn_toggle_off_pressed_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_toggle_on_disabled_focused_holo_dark.9.png b/core/res/res/drawable-hdpi/btn_toggle_on_disabled_focused_holo_dark.9.png
index 4593375..c0f6f74 100755
--- a/core/res/res/drawable-hdpi/btn_toggle_on_disabled_focused_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/btn_toggle_on_disabled_focused_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_toggle_on_disabled_focused_holo_light.9.png b/core/res/res/drawable-hdpi/btn_toggle_on_disabled_focused_holo_light.9.png
index 4593375..c0f6f74 100755
--- a/core/res/res/drawable-hdpi/btn_toggle_on_disabled_focused_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/btn_toggle_on_disabled_focused_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_toggle_on_disabled_holo_dark.9.png b/core/res/res/drawable-hdpi/btn_toggle_on_disabled_holo_dark.9.png
index df2e203..44a2f8bb 100755
--- a/core/res/res/drawable-hdpi/btn_toggle_on_disabled_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/btn_toggle_on_disabled_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_toggle_on_disabled_holo_light.9.png b/core/res/res/drawable-hdpi/btn_toggle_on_disabled_holo_light.9.png
index cd4d819..44a2f8bb 100755
--- a/core/res/res/drawable-hdpi/btn_toggle_on_disabled_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/btn_toggle_on_disabled_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_toggle_on_focused_holo_dark.9.png b/core/res/res/drawable-hdpi/btn_toggle_on_focused_holo_dark.9.png
index 785a9d8..53eb636f 100755
--- a/core/res/res/drawable-hdpi/btn_toggle_on_focused_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/btn_toggle_on_focused_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_toggle_on_focused_holo_light.9.png b/core/res/res/drawable-hdpi/btn_toggle_on_focused_holo_light.9.png
index b1a190c..53eb636f 100755
--- a/core/res/res/drawable-hdpi/btn_toggle_on_focused_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/btn_toggle_on_focused_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_toggle_on_normal_holo_dark.9.png b/core/res/res/drawable-hdpi/btn_toggle_on_normal_holo_dark.9.png
index 25a144b..baab86f 100755
--- a/core/res/res/drawable-hdpi/btn_toggle_on_normal_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/btn_toggle_on_normal_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_toggle_on_normal_holo_light.9.png b/core/res/res/drawable-hdpi/btn_toggle_on_normal_holo_light.9.png
index 1cf6fcd..baab86f 100755
--- a/core/res/res/drawable-hdpi/btn_toggle_on_normal_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/btn_toggle_on_normal_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_toggle_on_pressed_holo_dark.9.png b/core/res/res/drawable-hdpi/btn_toggle_on_pressed_holo_dark.9.png
index 126dc28..6a954a6 100755
--- a/core/res/res/drawable-hdpi/btn_toggle_on_pressed_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/btn_toggle_on_pressed_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/btn_toggle_on_pressed_holo_light.9.png b/core/res/res/drawable-hdpi/btn_toggle_on_pressed_holo_light.9.png
index d4d3f41..6a954a6 100755
--- a/core/res/res/drawable-hdpi/btn_toggle_on_pressed_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/btn_toggle_on_pressed_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_contact_picture.png b/core/res/res/drawable-hdpi/ic_contact_picture.png
index a60565a..e29e63a 100644
--- a/core/res/res/drawable-hdpi/ic_contact_picture.png
+++ b/core/res/res/drawable-hdpi/ic_contact_picture.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/notify_panel_notification_icon_bg.png b/core/res/res/drawable-hdpi/notify_panel_notification_icon_bg.png
new file mode 100644
index 0000000..f5b762e
--- /dev/null
+++ b/core/res/res/drawable-hdpi/notify_panel_notification_icon_bg.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_default_disabled_focused_holo_dark.9.png b/core/res/res/drawable-mdpi/btn_default_disabled_focused_holo_dark.9.png
index ab5d68b..5ce7321 100644
--- a/core/res/res/drawable-mdpi/btn_default_disabled_focused_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/btn_default_disabled_focused_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_default_disabled_focused_holo_light.9.png b/core/res/res/drawable-mdpi/btn_default_disabled_focused_holo_light.9.png
index 9421b1b..5ce7321 100644
--- a/core/res/res/drawable-mdpi/btn_default_disabled_focused_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/btn_default_disabled_focused_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_default_disabled_holo_dark.9.png b/core/res/res/drawable-mdpi/btn_default_disabled_holo_dark.9.png
index a2c9b3f..34f69d3f 100644
--- a/core/res/res/drawable-mdpi/btn_default_disabled_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/btn_default_disabled_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_default_disabled_holo_light.9.png b/core/res/res/drawable-mdpi/btn_default_disabled_holo_light.9.png
index a2c9b3f..34f69d3f 100644
--- a/core/res/res/drawable-mdpi/btn_default_disabled_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/btn_default_disabled_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_default_focused_holo_dark.9.png b/core/res/res/drawable-mdpi/btn_default_focused_holo_dark.9.png
index 02e3323..0629efe 100644
--- a/core/res/res/drawable-mdpi/btn_default_focused_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/btn_default_focused_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_default_focused_holo_light.9.png b/core/res/res/drawable-mdpi/btn_default_focused_holo_light.9.png
index 02e3323..0629efe 100644
--- a/core/res/res/drawable-mdpi/btn_default_focused_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/btn_default_focused_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_default_normal_holo_dark.9.png b/core/res/res/drawable-mdpi/btn_default_normal_holo_dark.9.png
index 5b05722..a2f411e 100644
--- a/core/res/res/drawable-mdpi/btn_default_normal_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/btn_default_normal_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_default_normal_holo_light.9.png b/core/res/res/drawable-mdpi/btn_default_normal_holo_light.9.png
index e7f1690..a2f411e 100644
--- a/core/res/res/drawable-mdpi/btn_default_normal_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/btn_default_normal_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_default_pressed_holo_dark.9.png b/core/res/res/drawable-mdpi/btn_default_pressed_holo_dark.9.png
index b49a583..231997a 100644
--- a/core/res/res/drawable-mdpi/btn_default_pressed_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/btn_default_pressed_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_default_pressed_holo_light.9.png b/core/res/res/drawable-mdpi/btn_default_pressed_holo_light.9.png
index e6f1362..231997a 100644
--- a/core/res/res/drawable-mdpi/btn_default_pressed_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/btn_default_pressed_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_toggle_off_disabled_focused_holo_dark.9.png b/core/res/res/drawable-mdpi/btn_toggle_off_disabled_focused_holo_dark.9.png
index a087fb3..1964085 100755
--- a/core/res/res/drawable-mdpi/btn_toggle_off_disabled_focused_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/btn_toggle_off_disabled_focused_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_toggle_off_disabled_focused_holo_light.9.png b/core/res/res/drawable-mdpi/btn_toggle_off_disabled_focused_holo_light.9.png
index 4f0572b..d86a9e6 100755
--- a/core/res/res/drawable-mdpi/btn_toggle_off_disabled_focused_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/btn_toggle_off_disabled_focused_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_toggle_off_disabled_holo_dark.9.png b/core/res/res/drawable-mdpi/btn_toggle_off_disabled_holo_dark.9.png
index a0693778..f3f1ab2 100755
--- a/core/res/res/drawable-mdpi/btn_toggle_off_disabled_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/btn_toggle_off_disabled_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_toggle_off_disabled_holo_light.9.png b/core/res/res/drawable-mdpi/btn_toggle_off_disabled_holo_light.9.png
index bbb7eb7..d157fed 100755
--- a/core/res/res/drawable-mdpi/btn_toggle_off_disabled_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/btn_toggle_off_disabled_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_toggle_off_focused_holo_dark.9.png b/core/res/res/drawable-mdpi/btn_toggle_off_focused_holo_dark.9.png
index 0fc02cc..f99d946 100755
--- a/core/res/res/drawable-mdpi/btn_toggle_off_focused_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/btn_toggle_off_focused_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_toggle_off_focused_holo_light.9.png b/core/res/res/drawable-mdpi/btn_toggle_off_focused_holo_light.9.png
index eec3980..a313744 100755
--- a/core/res/res/drawable-mdpi/btn_toggle_off_focused_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/btn_toggle_off_focused_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_toggle_off_normal_holo_dark.9.png b/core/res/res/drawable-mdpi/btn_toggle_off_normal_holo_dark.9.png
index 9732a84..00a589f 100755
--- a/core/res/res/drawable-mdpi/btn_toggle_off_normal_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/btn_toggle_off_normal_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_toggle_off_normal_holo_light.9.png b/core/res/res/drawable-mdpi/btn_toggle_off_normal_holo_light.9.png
index 043d35a..e16e470c 100755
--- a/core/res/res/drawable-mdpi/btn_toggle_off_normal_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/btn_toggle_off_normal_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_toggle_off_pressed_holo_dark.9.png b/core/res/res/drawable-mdpi/btn_toggle_off_pressed_holo_dark.9.png
index 0763b23..6f7dd45 100755
--- a/core/res/res/drawable-mdpi/btn_toggle_off_pressed_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/btn_toggle_off_pressed_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_toggle_off_pressed_holo_light.9.png b/core/res/res/drawable-mdpi/btn_toggle_off_pressed_holo_light.9.png
index ba93aa3..490c83d 100755
--- a/core/res/res/drawable-mdpi/btn_toggle_off_pressed_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/btn_toggle_off_pressed_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_toggle_on_disabled_focused_holo_dark.9.png b/core/res/res/drawable-mdpi/btn_toggle_on_disabled_focused_holo_dark.9.png
index dcf4436..45dc08f 100755
--- a/core/res/res/drawable-mdpi/btn_toggle_on_disabled_focused_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/btn_toggle_on_disabled_focused_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_toggle_on_disabled_focused_holo_light.9.png b/core/res/res/drawable-mdpi/btn_toggle_on_disabled_focused_holo_light.9.png
index dcf4436..45dc08f 100755
--- a/core/res/res/drawable-mdpi/btn_toggle_on_disabled_focused_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/btn_toggle_on_disabled_focused_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_toggle_on_disabled_holo_dark.9.png b/core/res/res/drawable-mdpi/btn_toggle_on_disabled_holo_dark.9.png
index 41c3bb0..11dc01d 100755
--- a/core/res/res/drawable-mdpi/btn_toggle_on_disabled_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/btn_toggle_on_disabled_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_toggle_on_disabled_holo_light.9.png b/core/res/res/drawable-mdpi/btn_toggle_on_disabled_holo_light.9.png
index d7c7d9f..11dc01d 100755
--- a/core/res/res/drawable-mdpi/btn_toggle_on_disabled_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/btn_toggle_on_disabled_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_toggle_on_focused_holo_dark.9.png b/core/res/res/drawable-mdpi/btn_toggle_on_focused_holo_dark.9.png
index d3d2575..2c95ebd 100755
--- a/core/res/res/drawable-mdpi/btn_toggle_on_focused_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/btn_toggle_on_focused_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_toggle_on_focused_holo_light.9.png b/core/res/res/drawable-mdpi/btn_toggle_on_focused_holo_light.9.png
index 7802e39..2c95ebd 100755
--- a/core/res/res/drawable-mdpi/btn_toggle_on_focused_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/btn_toggle_on_focused_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_toggle_on_normal_holo_dark.9.png b/core/res/res/drawable-mdpi/btn_toggle_on_normal_holo_dark.9.png
index 8f46c38..7c410c0 100755
--- a/core/res/res/drawable-mdpi/btn_toggle_on_normal_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/btn_toggle_on_normal_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_toggle_on_normal_holo_light.9.png b/core/res/res/drawable-mdpi/btn_toggle_on_normal_holo_light.9.png
index a38eb12..7c410c0 100755
--- a/core/res/res/drawable-mdpi/btn_toggle_on_normal_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/btn_toggle_on_normal_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_toggle_on_pressed_holo_dark.9.png b/core/res/res/drawable-mdpi/btn_toggle_on_pressed_holo_dark.9.png
index a216e35..afb31e1 100755
--- a/core/res/res/drawable-mdpi/btn_toggle_on_pressed_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/btn_toggle_on_pressed_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/btn_toggle_on_pressed_holo_light.9.png b/core/res/res/drawable-mdpi/btn_toggle_on_pressed_holo_light.9.png
index c9af9b2..afb31e1 100755
--- a/core/res/res/drawable-mdpi/btn_toggle_on_pressed_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/btn_toggle_on_pressed_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_contact_picture.png b/core/res/res/drawable-mdpi/ic_contact_picture.png
index 3a338e8..faa3dc0 100644
--- a/core/res/res/drawable-mdpi/ic_contact_picture.png
+++ b/core/res/res/drawable-mdpi/ic_contact_picture.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/notify_panel_notification_icon_bg.png b/core/res/res/drawable-mdpi/notify_panel_notification_icon_bg.png
new file mode 100644
index 0000000..9ecb8af
--- /dev/null
+++ b/core/res/res/drawable-mdpi/notify_panel_notification_icon_bg.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/password_keyboard_background_holo.9.png b/core/res/res/drawable-mdpi/password_keyboard_background_holo.9.png
new file mode 100644
index 0000000..c56c704
--- /dev/null
+++ b/core/res/res/drawable-mdpi/password_keyboard_background_holo.9.png
Binary files differ
diff --git a/core/res/res/drawable-xlarge-mdpi/sym_keyboard_delete_holo.png b/core/res/res/drawable-xlarge-mdpi/sym_keyboard_delete_holo.png
new file mode 100644
index 0000000..1555791
--- /dev/null
+++ b/core/res/res/drawable-xlarge-mdpi/sym_keyboard_delete_holo.png
Binary files differ
diff --git a/core/res/res/drawable-xlarge-mdpi/sym_keyboard_shift.png b/core/res/res/drawable-xlarge-mdpi/sym_keyboard_shift.png
new file mode 100644
index 0000000..91d6e32
--- /dev/null
+++ b/core/res/res/drawable-xlarge-mdpi/sym_keyboard_shift.png
Binary files differ
diff --git a/core/res/res/drawable-xlarge-mdpi/sym_keyboard_shift_locked.png b/core/res/res/drawable-xlarge-mdpi/sym_keyboard_shift_locked.png
new file mode 100644
index 0000000..2bd0536
--- /dev/null
+++ b/core/res/res/drawable-xlarge-mdpi/sym_keyboard_shift_locked.png
Binary files differ
diff --git a/core/res/res/drawable/btn_default_small_holo_dark.xml b/core/res/res/drawable/btn_default_small_holo_dark.xml
deleted file mode 100644
index a5f5d46..0000000
--- a/core/res/res/drawable/btn_default_small_holo_dark.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 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.
--->
-
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-    <item android:state_window_focused="false" android:state_enabled="true"
-        android:drawable="@drawable/btn_default_small_normal_holo_dark" />
-    <item android:state_window_focused="false" android:state_enabled="false"
-        android:drawable="@drawable/btn_default_small_disabled_holo_dark" />
-    <item android:state_pressed="true" 
-        android:drawable="@drawable/btn_default_small_pressed_holo_dark" />
-    <item android:state_focused="true" android:state_enabled="true"
-        android:drawable="@drawable/btn_default_small_focused_holo_dark" />
-    <item android:state_enabled="true"
-        android:drawable="@drawable/btn_default_small_normal_holo_dark" />
-    <item android:state_focused="true"
-        android:drawable="@drawable/btn_default_small_disabled_focused_holo_dark" />
-    <item
-         android:drawable="@drawable/btn_default_small_disabled_holo_dark" />
-</selector>
diff --git a/core/res/res/drawable/btn_default_small_holo_light.xml b/core/res/res/drawable/btn_default_small_holo_light.xml
deleted file mode 100644
index ed86f78..0000000
--- a/core/res/res/drawable/btn_default_small_holo_light.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 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.
--->
-
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-    <item android:state_window_focused="false" android:state_enabled="true"
-        android:drawable="@drawable/btn_default_small_normal_holo_light" />
-    <item android:state_window_focused="false" android:state_enabled="false"
-        android:drawable="@drawable/btn_default_small_disabled_holo_light" />
-    <item android:state_pressed="true" 
-        android:drawable="@drawable/btn_default_small_pressed_holo_light" />
-    <item android:state_focused="true" android:state_enabled="true"
-        android:drawable="@drawable/btn_default_small_focused_holo_light" />
-    <item android:state_enabled="true"
-        android:drawable="@drawable/btn_default_small_normal_holo_light" />
-    <item android:state_focused="true"
-        android:drawable="@drawable/btn_default_small_disabled_focused_holo_light" />
-    <item
-         android:drawable="@drawable/btn_default_small_disabled_holo_light" />
-</selector>
diff --git a/core/res/res/layout-xlarge/keyguard_screen_password_landscape.xml b/core/res/res/layout-xlarge/keyguard_screen_password_landscape.xml
index c1149e3..16bfc31 100644
--- a/core/res/res/layout-xlarge/keyguard_screen_password_landscape.xml
+++ b/core/res/res/layout-xlarge/keyguard_screen_password_landscape.xml
@@ -69,7 +69,7 @@
             <com.android.internal.widget.PasswordEntryKeyboardView android:id="@+id/keyboard"
                 android:layout_width="330dip"
                 android:layout_height="330dip"
-                android:background="#00000000"
+                android:background="#40000000"
                 android:layout_marginTop="5dip"
                 android:keyBackground="@drawable/btn_keyboard_key_fulltrans"
                 android:visibility="gone"
@@ -88,8 +88,9 @@
     <com.android.internal.widget.PasswordEntryKeyboardView android:id="@+id/keyboardAlpha"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:background="#00000000"
+        android:background="@drawable/password_keyboard_background_holo"
         android:keyBackground="@drawable/btn_keyboard_key_fulltrans"
+        android:keyTextSize="28dip"
         android:visibility="gone"
     />
 
diff --git a/core/res/res/layout-xlarge/keyguard_screen_password_portrait.xml b/core/res/res/layout-xlarge/keyguard_screen_password_portrait.xml
index e4a1b81..b87b51f 100644
--- a/core/res/res/layout-xlarge/keyguard_screen_password_portrait.xml
+++ b/core/res/res/layout-xlarge/keyguard_screen_password_portrait.xml
@@ -61,19 +61,28 @@
             android:textColor="#ffffffff"
             />
 
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="0dip"
+            android:layout_weight="1"
+        />
+
         <!-- Numeric keyboard -->
         <com.android.internal.widget.PasswordEntryKeyboardView android:id="@+id/keyboard"
             android:layout_width="330dip"
             android:layout_height="260dip"
-            android:background="#00000000"
+            android:background="#40000000"
             android:keyBackground="@drawable/btn_keyboard_key_fulltrans"
+            android:layout_marginBottom="80dip"
         />
+
         <!-- Alphanumeric keyboard -->
         <com.android.internal.widget.PasswordEntryKeyboardView android:id="@+id/keyboardAlpha"
             android:layout_width="match_parent"
             android:layout_height="230dip"
-            android:background="#00000000"
+            android:background="@drawable/password_keyboard_background_holo"
             android:keyBackground="@drawable/btn_keyboard_key_fulltrans"
+            android:keyTextSize="28dip"
             android:visibility="gone"
         />
 
diff --git a/core/res/res/layout-xlarge/status_bar_latest_event_content.xml b/core/res/res/layout-xlarge/status_bar_latest_event_content.xml
index dca2c57..1a3ee82 100644
--- a/core/res/res/layout-xlarge/status_bar_latest_event_content.xml
+++ b/core/res/res/layout-xlarge/status_bar_latest_event_content.xml
@@ -3,9 +3,9 @@
     android:layout_height="match_parent"
     >
     <ImageView android:id="@+id/icon"
-        android:layout_width="48dp"
-        android:layout_height="64dp"
-        android:layout_marginLeft="4dp"
+        android:layout_width="@dimen/notification_large_icon_width"
+        android:layout_height="@dimen/notification_large_icon_height"
+        android:background="@drawable/notify_panel_notification_icon_bg"
         android:scaleType="center"
         />
     <LinearLayout
@@ -14,7 +14,7 @@
         android:layout_gravity="center_vertical"
         android:layout_weight="1"
         android:orientation="vertical"
-        android:paddingLeft="8dp"
+        android:paddingLeft="16dp"
         >
         <TextView android:id="@+id/title"
             android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Title"
@@ -23,6 +23,7 @@
             android:singleLine="true"
             android:ellipsize="marquee"
             android:fadingEdge="horizontal"
+            android:layout_marginBottom="-4dp"
             />
         <TextView android:id="@+id/text"
             android:textAppearance="@style/TextAppearance.StatusBar.EventContent"
diff --git a/core/res/res/layout-xlarge/status_bar_latest_event_content_large_icon.xml b/core/res/res/layout-xlarge/status_bar_latest_event_content_large_icon.xml
index 144fa0d..e9b106d 100644
--- a/core/res/res/layout-xlarge/status_bar_latest_event_content_large_icon.xml
+++ b/core/res/res/layout-xlarge/status_bar_latest_event_content_large_icon.xml
@@ -8,6 +8,7 @@
         android:layout_gravity="center_vertical"
         android:layout_weight="1"
         android:orientation="vertical"
+        android:paddingLeft="16dp"
         >
         <TextView android:id="@+id/title"
             android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Title"
@@ -16,6 +17,7 @@
             android:singleLine="true"
             android:ellipsize="marquee"
             android:fadingEdge="horizontal"
+            android:layout_marginBottom="-4dp"
             />
         <TextView android:id="@+id/text"
             android:textAppearance="@style/TextAppearance.StatusBar.EventContent"
@@ -28,20 +30,27 @@
             android:fadingEdge="horizontal"
             />
     </LinearLayout>
-    <TextView android:id="@+id/info"
-        android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Info"
+    <RelativeLayout
         android:layout_width="wrap_content"
         android:layout_height="match_parent"
-        android:singleLine="true"
-        android:gravity="center_vertical"
-        android:paddingLeft="8dp"
-        />
-    <ImageView android:id="@+id/icon"
-        android:layout_width="48dp"
-        android:layout_height="32dp"
-        android:layout_gravity="top"
-        android:layout_marginTop="8dp"
-        android:scaleType="center"
-        />
+        >
+        <TextView android:id="@+id/info"
+            android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Info"
+            android:layout_width="wrap_content"
+            android:layout_height="match_parent"
+            android:singleLine="true"
+            android:gravity="center_vertical"
+            android:layout_alignParentLeft="true"
+            android:paddingLeft="8dp"
+            />
+        <ImageView android:id="@+id/icon"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignParentBottom="true"
+            android:layout_alignRight="@id/info"
+            android:layout_marginBottom="8dip"
+            android:scaleType="center"
+            />
+    </RelativeLayout>
 </LinearLayout>
 
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index a404fba..260c7c6 100755
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -1832,7 +1832,7 @@
         </attr>
         
         <!-- Specifies the type of layer backing this view. The default value is none.
-             Refer to {@link android.view.View#setLayerType(int, android.graphics.Paint)
+             Refer to {@link android.view.View#setLayerType(int, android.graphics.Paint)}
              for more information.-->
         <attr name="layerType">
             <!-- Don't use a layer. -->
diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml
index d094bad..8a590cd 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -70,9 +70,9 @@
     <item type="dimen" name="dialog_min_width_minor">95%</item>
 
     <!-- The width of the big icons in notifications. -->
-    <dimen name="notification_large_icon_width">60dp</dimen>
+    <dimen name="notification_large_icon_width">64dp</dimen>
     <!-- The width of the big icons in notifications. -->
-    <dimen name="notification_large_icon_height">60dp</dimen>
+    <dimen name="notification_large_icon_height">64dp</dimen>
 
     <!-- Minimum width of the search view text entry area. -->
     <dimen name="search_view_text_min_width">160dip</dimen>
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index 25a43e0..1534101 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -224,7 +224,7 @@
         <item name="android:textStyle">bold</item>
     </style>
     <style name="TextAppearance.StatusBar.EventContent">
-        <item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
+        <item name="android:textSize">10sp</item>
         <item name="android:textColor">?android:attr/textColorPrimaryInverse</item>
     </style>
     <style name="TextAppearance.StatusBar.EventContent.Title">
@@ -1399,6 +1399,7 @@
         <item name="android:textAppearance">?android:attr/textAppearanceMedium</item>
         <item name="android:textColor">@android:color/primary_text_holo_dark</item>
         <item name="android:minHeight">48dip</item>
+        <item name="android:minWidth">64dip</item>
     </style>
 
     <style name="Widget.Holo.Button.Borderless">
@@ -1406,10 +1407,11 @@
     </style>
 
     <style name="Widget.Holo.Button.Small">
-        <item name="android:background">@android:drawable/btn_default_small_holo_dark</item>
+        <item name="android:background">@android:drawable/btn_default_holo_dark</item>
         <item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
         <item name="android:textColor">@android:color/primary_text_holo_dark</item>
         <item name="android:minHeight">48dip</item>
+        <item name="android:minWidth">48dip</item>
     </style>
 
     <style name="Widget.Holo.Button.Inset">
@@ -1788,6 +1790,7 @@
         <item name="android:textAppearance">?android:attr/textAppearanceMediumInverse</item>
         <item name="android:textColor">@android:color/primary_text_holo_light</item>
         <item name="android:minHeight">48dip</item>
+        <item name="android:minWidth">64dip</item>
     </style>
 
     <style name="Widget.Holo.Light.Button.Borderless">
@@ -1795,10 +1798,11 @@
     </style>
 
     <style name="Widget.Holo.Light.Button.Small">
-        <item name="android:background">@android:drawable/btn_default_small_holo_light</item>
+        <item name="android:background">@android:drawable/btn_default_holo_light</item>
         <item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
         <item name="android:textColor">@android:color/primary_text_holo_light</item>
         <item name="android:minHeight">48dip</item>
+        <item name="android:minWidth">48dip</item>
     </style>
 
     <style name="Widget.Holo.Light.Button.Inset">
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index 03eca1c..ddaeb82 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -522,6 +522,7 @@
         <item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
         <item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
         <item name="android:windowCloseOnTouchOutside">@bool/config_closeDialogWhenTouchOutside</item>
+        <item name="android:windowActionModeOverlay">true</item>
 
         <item name="android:colorBackgroundCacheHint">@null</item>
         
diff --git a/core/res/res/xml-xlarge/password_kbd_numeric.xml b/core/res/res/xml-xlarge/password_kbd_numeric.xml
new file mode 100755
index 0000000..0253122
--- /dev/null
+++ b/core/res/res/xml-xlarge/password_kbd_numeric.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2011, 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.
+*/
+-->
+<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
+    android:keyWidth="33.33%p"
+    android:verticalGap="0px"
+    android:keyHeight="@dimen/password_keyboard_key_height_numeric"
+    >
+
+    <Row android:rowEdgeFlags="top">
+        <Key android:codes="49" android:keyIcon="@drawable/sym_keyboard_num1"
+             android:keyEdgeFlags="left"/>
+        <Key android:codes="50" android:keyIcon="@drawable/sym_keyboard_num2"/>
+        <Key android:codes="51" android:keyIcon="@drawable/sym_keyboard_num3"
+             android:keyEdgeFlags="right"/>
+    </Row>
+
+    <Row>
+        <Key android:codes="52" android:keyIcon="@drawable/sym_keyboard_num4"
+             android:keyEdgeFlags="left"/>
+        <Key android:codes="53" android:keyIcon="@drawable/sym_keyboard_num5"/>
+        <Key android:codes="54" android:keyIcon="@drawable/sym_keyboard_num6"
+             android:keyEdgeFlags="right"/>
+    </Row>
+
+    <Row>
+        <Key android:codes="55" android:keyIcon="@drawable/sym_keyboard_num7"
+             android:keyEdgeFlags="left"/>
+        <Key android:codes="56" android:keyIcon="@drawable/sym_keyboard_num8"/>
+        <Key android:codes="57" android:keyIcon="@drawable/sym_keyboard_num9"
+             android:keyEdgeFlags="right"/>
+    </Row>
+
+    <Row android:rowEdgeFlags="bottom">
+        <Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_ok"
+             android:keyEdgeFlags="left"/>
+        <Key android:codes="48" android:keyIcon="@drawable/sym_keyboard_num0_no_plus"/>
+        <Key android:codes="-5" android:keyIcon="@drawable/sym_keyboard_delete"
+             android:iconPreview="@drawable/sym_keyboard_feedback_delete"
+             android:isRepeatable="true" android:keyEdgeFlags="right"/>
+    </Row>
+
+</Keyboard>
diff --git a/core/res/res/xml-xlarge/password_kbd_qwerty.xml b/core/res/res/xml-xlarge/password_kbd_qwerty.xml
index fd1d5f1..1009c9a 100755
--- a/core/res/res/xml-xlarge/password_kbd_qwerty.xml
+++ b/core/res/res/xml-xlarge/password_kbd_qwerty.xml
@@ -38,10 +38,9 @@
         <Key android:keyLabel="i"/>
         <Key android:keyLabel="o"/>
         <Key android:keyLabel="p"/>
-        <Key android:keyIcon="@drawable/sym_keyboard_delete"
+        <Key android:keyIcon="@drawable/sym_keyboard_delete_holo"
             android:codes="-5"
             android:keyWidth="9.331%p"
-            android:iconPreview="@drawable/sym_keyboard_feedback_delete"
             android:isRepeatable="true"
             android:keyEdgeFlags="right"/>
     </Row>
@@ -62,7 +61,6 @@
         <Key android:keyLabel="l"/>
         <Key android:codes="10"
             android:keyIcon="@drawable/sym_keyboard_ok"
-            android:iconPreview="@drawable/sym_keyboard_feedback_ok"
             android:keyWidth="15.750%p"
             android:keyEdgeFlags="right"/>
     </Row>
@@ -72,7 +70,6 @@
             android:keyIcon="@drawable/sym_keyboard_shift"
             android:keyWidth="15.192%p"
             android:isModifier="true"
-            android:iconPreview="@drawable/sym_keyboard_feedback_shift"
             android:isSticky="true"
             android:keyEdgeFlags="left"/>
         <Key android:keyLabel="z"/>
@@ -88,7 +85,6 @@
             android:keyIcon="@drawable/sym_keyboard_shift"
             android:keyWidth="12.530%p"
             android:isModifier="true"
-            android:iconPreview="@drawable/sym_keyboard_feedback_shift"
             android:isSticky="true"
             android:keyEdgeFlags="right"/>
     </Row>
@@ -96,9 +92,7 @@
     <Row android:keyWidth="8.042%p"
         android:keyboardMode="@+id/mode_normal">
         <Key android:keyLabel="/" android:horizontalGap="24.126%p"/>
-        <Key android:codes="32"
-            android:keyIcon="@drawable/sym_keyboard_space"
-            android:iconPreview="@drawable/sym_keyboard_feedback_space"
+        <Key android:keyLabel=" "
             android:keyWidth="37.454%p"/>
         <Key android:keyLabel="'" />
         <Key android:keyLabel="-" />
diff --git a/core/res/res/xml-xlarge/password_kbd_qwerty_shifted.xml b/core/res/res/xml-xlarge/password_kbd_qwerty_shifted.xml
index 671d87f..cbf17c3 100755
--- a/core/res/res/xml-xlarge/password_kbd_qwerty_shifted.xml
+++ b/core/res/res/xml-xlarge/password_kbd_qwerty_shifted.xml
@@ -38,10 +38,9 @@
         <Key android:keyLabel="I"/>
         <Key android:keyLabel="O"/>
         <Key android:keyLabel="P"/>
-        <Key android:keyIcon="@drawable/sym_keyboard_delete"
+        <Key android:keyIcon="@drawable/sym_keyboard_delete_holo"
             android:codes="-5"
             android:keyWidth="9.331%p"
-            android:iconPreview="@drawable/sym_keyboard_feedback_delete"
             android:isRepeatable="true"
             android:keyEdgeFlags="right"/>
     </Row>
@@ -62,7 +61,6 @@
         <Key android:keyLabel="L"/>
         <Key android:codes="10"
             android:keyIcon="@drawable/sym_keyboard_ok"
-            android:iconPreview="@drawable/sym_keyboard_feedback_ok"
             android:keyWidth="15.750%p"
             android:keyEdgeFlags="right"/>
     </Row>
@@ -72,7 +70,6 @@
             android:keyIcon="@drawable/sym_keyboard_shift"
             android:keyWidth="15.192%p"
             android:isModifier="true"
-            android:iconPreview="@drawable/sym_keyboard_feedback_shift"
             android:isSticky="true"
             android:keyEdgeFlags="left"/>
         <Key android:keyLabel="Z"/>
@@ -88,7 +85,6 @@
             android:keyIcon="@drawable/sym_keyboard_shift"
             android:keyWidth="12.530%p"
             android:isModifier="true"
-            android:iconPreview="@drawable/sym_keyboard_feedback_shift"
             android:isSticky="true"
             android:keyEdgeFlags="right"/>
     </Row>
@@ -96,9 +92,7 @@
     <Row android:keyWidth="8.042%p"
         android:keyboardMode="@+id/mode_normal">
         <Key android:keyLabel="\@" android:horizontalGap="24.126%p"/>
-        <Key android:codes="32"
-            android:keyIcon="@drawable/sym_keyboard_space"
-            android:iconPreview="@drawable/sym_keyboard_feedback_space"
+        <Key android:keyLabel=" "
             android:keyWidth="37.454%p"/>
         <Key android:keyLabel="&quot;" />
         <Key android:keyLabel="_" />
diff --git a/core/res/res/xml-xlarge/password_kbd_symbols.xml b/core/res/res/xml-xlarge/password_kbd_symbols.xml
index 5ae5577..a58a023 100755
--- a/core/res/res/xml-xlarge/password_kbd_symbols.xml
+++ b/core/res/res/xml-xlarge/password_kbd_symbols.xml
@@ -38,10 +38,9 @@
         <Key android:keyLabel="8"/>
         <Key android:keyLabel="9"/>
         <Key android:keyLabel="0"/>
-        <Key android:keyIcon="@drawable/sym_keyboard_delete"
+        <Key android:keyIcon="@drawable/sym_keyboard_delete_holo"
             android:codes="-5"
             android:keyWidth="9.331%p"
-            android:iconPreview="@drawable/sym_keyboard_feedback_delete"
             android:isRepeatable="true"
             android:keyEdgeFlags="right"/>
     </Row>
@@ -62,7 +61,6 @@
         <Key android:keyLabel=")"/>
         <Key android:codes="10"
             android:keyIcon="@drawable/sym_keyboard_ok"
-            android:iconPreview="@drawable/sym_keyboard_feedback_ok"
             android:keyWidth="15.750%p"
             android:keyEdgeFlags="right"/>
     </Row>
@@ -94,9 +92,7 @@
     <Row android:keyWidth="8.042%p">
         <Key android:keyLabel="\@" android:horizontalGap="16.084%p"/>
         <Key android:keyLabel="/" />
-        <Key android:codes="32"
-            android:keyIcon="@drawable/sym_keyboard_space"
-            android:iconPreview="@drawable/sym_keyboard_feedback_space"
+        <Key android:keyLabel=" "
             android:keyWidth="37.454%p"/>
         <Key android:keyLabel="\'" />
         <Key android:keyLabel="-" />
diff --git a/core/res/res/xml-xlarge/password_kbd_symbols_shift.xml b/core/res/res/xml-xlarge/password_kbd_symbols_shift.xml
index 26ade76..9d9acf5 100755
--- a/core/res/res/xml-xlarge/password_kbd_symbols_shift.xml
+++ b/core/res/res/xml-xlarge/password_kbd_symbols_shift.xml
@@ -37,10 +37,9 @@
         <Key android:keyLabel="×" />
         <Key android:keyLabel="§" />
         <Key android:keyLabel="Δ" />
-        <Key android:keyIcon="@drawable/sym_keyboard_delete"
+        <Key android:keyIcon="@drawable/sym_keyboard_delete_holo"
             android:codes="-5"
             android:keyWidth="9.331%p"
-            android:iconPreview="@drawable/sym_keyboard_feedback_delete"
             android:isRepeatable="true"
             android:keyEdgeFlags="right"/>
     </Row>
@@ -61,7 +60,6 @@
         <Key android:keyLabel="}" />
         <Key android:codes="10"
             android:keyIcon="@drawable/sym_keyboard_ok"
-            android:iconPreview="@drawable/sym_keyboard_feedback_ok"
             android:keyWidth="15.750%p"
             android:keyEdgeFlags="right"/>
     </Row>
@@ -92,9 +90,7 @@
 
     <!-- This row is intentionally not marked as a bottom row -->
     <Row android:keyWidth="8.042%p">
-        <Key android:codes="32" android:horizontalGap="32.168%p"
-            android:keyIcon="@drawable/sym_keyboard_space"
-            android:iconPreview="@drawable/sym_keyboard_feedback_space"
+        <Key android:keyLabel=" " android:horizontalGap="32.168%p"
             android:keyWidth="37.454%p"/>
     </Row>
 </Keyboard>
diff --git a/data/fonts/AndroidClock-Solid.ttf b/data/fonts/AndroidClock_Solid.ttf
similarity index 100%
rename from data/fonts/AndroidClock-Solid.ttf
rename to data/fonts/AndroidClock_Solid.ttf
Binary files differ
diff --git a/data/fonts/fonts.mk b/data/fonts/fonts.mk
index b8a93e8..faecfee 100644
--- a/data/fonts/fonts.mk
+++ b/data/fonts/fonts.mk
@@ -28,4 +28,5 @@
     frameworks/base/data/fonts/Clockopia.ttf:system/fonts/Clockopia.ttf \
     frameworks/base/data/fonts/DroidSansFallback.ttf:system/fonts/DroidSansFallback.ttf \
     frameworks/base/data/fonts/AndroidClock.ttf:system/fonts/AndroidClock.ttf \
-    frameworks/base/data/fonts/AndroidClock_Highlight.ttf:system/fonts/AndroidClock_Highlight.ttf 
+    frameworks/base/data/fonts/AndroidClock_Highlight.ttf:system/fonts/AndroidClock_Highlight.ttf \
+    frameworks/base/data/fonts/AndroidClock_Highlight.ttf:system/fonts/AndroidClock_Solid.ttf 
diff --git a/include/media/stagefright/StagefrightMediaScanner.h b/include/media/stagefright/StagefrightMediaScanner.h
index 4437eee..108acb4 100644
--- a/include/media/stagefright/StagefrightMediaScanner.h
+++ b/include/media/stagefright/StagefrightMediaScanner.h
@@ -22,8 +22,6 @@
 
 namespace android {
 
-struct MediaMetadataRetriever;
-
 struct StagefrightMediaScanner : public MediaScanner {
     StagefrightMediaScanner();
     virtual ~StagefrightMediaScanner();
@@ -35,8 +33,6 @@
     virtual char *extractAlbumArt(int fd);
 
 private:
-    sp<MediaMetadataRetriever> mRetriever;
-
     StagefrightMediaScanner(const StagefrightMediaScanner &);
     StagefrightMediaScanner &operator=(const StagefrightMediaScanner &);
 };
diff --git a/include/ui/Input.h b/include/ui/Input.h
index 30b45f7..2012fcc 100644
--- a/include/ui/Input.h
+++ b/include/ui/Input.h
@@ -50,8 +50,10 @@
 /*
  * Maximum number of pointers supported per motion event.
  * Smallest number of pointers is 1.
+ * (We want at least 10 but some touch controllers obstensibly configured for 10 pointers
+ * will occasionally emit 11.  There is not much harm making this constant bigger.)
  */
-#define MAX_POINTERS 10
+#define MAX_POINTERS 16
 
 /*
  * Maximum pointer id value supported in a motion event.
diff --git a/media/java/android/mtp/MtpPropertyGroup.java b/media/java/android/mtp/MtpPropertyGroup.java
index fff96c7..57e2304 100644
--- a/media/java/android/mtp/MtpPropertyGroup.java
+++ b/media/java/android/mtp/MtpPropertyGroup.java
@@ -282,7 +282,7 @@
     }
 
     MtpPropertyList getPropertyList(int handle, int format, int depth, int storageID) {
-        Log.d(TAG, "getPropertyList handle: " + handle + " format: " + format + " depth: " + depth);
+        //Log.d(TAG, "getPropertyList handle: " + handle + " format: " + format + " depth: " + depth);
         if (depth > 1) {
             // we only support depth 0 and 1
             // depth 0: single object, depth 1: immediate children
diff --git a/media/java/android/mtp/MtpServer.java b/media/java/android/mtp/MtpServer.java
index 2e69373..d433887 100644
--- a/media/java/android/mtp/MtpServer.java
+++ b/media/java/android/mtp/MtpServer.java
@@ -54,12 +54,8 @@
         native_set_ptp_mode(usePtp);
     }
 
-    // used by the JNI code
-    private int mNativeContext;
-
     private native final void native_setup(MtpDatabase database, String storagePath,
             long reserveSpace);
-    private native final void native_finalize();
     private native final void native_start();
     private native final void native_stop();
     private native final void native_send_object_added(int handle);
diff --git a/media/jni/android_mtp_MtpServer.cpp b/media/jni/android_mtp_MtpServer.cpp
index 1452d21..3883fb2 100644
--- a/media/jni/android_mtp_MtpServer.cpp
+++ b/media/jni/android_mtp_MtpServer.cpp
@@ -40,9 +40,6 @@
 
 // ----------------------------------------------------------------------------
 
-static jfieldID field_context;
-static Mutex    sMutex;
-
 // in android_mtp_MtpDatabase.cpp
 extern MtpDatabase* getMtpDatabase(JNIEnv *env, jobject database);
 
@@ -61,96 +58,74 @@
     MtpServer*      mServer;
     String8         mStoragePath;
     uint64_t        mReserveSpace;
-    jobject         mJavaServer;
-    bool            mDone;
+    Mutex           mMutex;
+    bool            mUsePtp;
     int             mFd;
 
 public:
-    MtpThread(MtpDatabase* database, const char* storagePath, uint64_t reserveSpace,
-                jobject javaServer)
+    MtpThread(MtpDatabase* database, const char* storagePath, uint64_t reserveSpace)
         :   mDatabase(database),
             mServer(NULL),
             mStoragePath(storagePath),
             mReserveSpace(reserveSpace),
-            mJavaServer(javaServer),
-            mDone(false),
             mFd(-1)
     {
     }
 
     void setPtpMode(bool usePtp) {
-        sMutex.lock();
-        if (mFd >= 0) {
-            ioctl(mFd, MTP_SET_INTERFACE_MODE,
-                    (usePtp ? MTP_INTERFACE_MODE_PTP : MTP_INTERFACE_MODE_MTP));
-        } else {
-            int fd = open("/dev/mtp_usb", O_RDWR);
-            if (fd >= 0) {
-                ioctl(fd, MTP_SET_INTERFACE_MODE,
-                        (usePtp ? MTP_INTERFACE_MODE_PTP : MTP_INTERFACE_MODE_MTP));
-                close(fd);
-            }
-        }
-        sMutex.unlock();
+        mMutex.lock();
+        mUsePtp = usePtp;
+        mMutex.unlock();
     }
 
     virtual bool threadLoop() {
-        sMutex.lock();
-
-        while (!mDone) {
-            mFd = open("/dev/mtp_usb", O_RDWR);
-            printf("open returned %d\n", mFd);
-            if (mFd < 0) {
-                LOGE("could not open MTP driver\n");
-                sMutex.unlock();
-                return false;
-            }
+        mMutex.lock();
+        mFd = open("/dev/mtp_usb", O_RDWR);
+        if (mFd >= 0) {
+            ioctl(mFd, MTP_SET_INTERFACE_MODE,
+                    (mUsePtp ? MTP_INTERFACE_MODE_PTP : MTP_INTERFACE_MODE_MTP));
 
             mServer = new MtpServer(mFd, mDatabase, AID_MEDIA_RW, 0664, 0775);
             mServer->addStorage(mStoragePath, mReserveSpace);
 
-            sMutex.unlock();
-
+            mMutex.unlock();
             mServer->run();
-            sleep(1);
-
-            sMutex.lock();
+            mMutex.lock();
 
             close(mFd);
             mFd = -1;
             delete mServer;
             mServer = NULL;
+        } else {
+            LOGE("could not open MTP driver, errno: %d", errno);
+        }
+        mMutex.unlock();
+        // delay a bit before retrying to avoid excessive spin
+        if (!exitPending()) {
+            sleep(1);
         }
 
-        JNIEnv* env = AndroidRuntime::getJNIEnv();
-        env->SetIntField(mJavaServer, field_context, 0);
-        env->DeleteGlobalRef(mJavaServer);
-        sMutex.unlock();
-
-        return false;
-    }
-
-    void stop() {
-        sMutex.lock();
-        mDone = true;
-        sMutex.unlock();
+        return true;
     }
 
     void sendObjectAdded(MtpObjectHandle handle) {
-        sMutex.lock();
+        mMutex.lock();
         if (mServer)
             mServer->sendObjectAdded(handle);
-        sMutex.unlock();
+        mMutex.unlock();
     }
 
     void sendObjectRemoved(MtpObjectHandle handle) {
-        sMutex.lock();
+        mMutex.lock();
         if (mServer)
             mServer->sendObjectRemoved(handle);
-        sMutex.unlock();
+        mMutex.unlock();
     }
 };
 
+// This smart pointer is necessary for preventing MtpThread from exiting too early
+static sp<MtpThread> sThread;
+
 #endif // HAVE_ANDROID_OS
 
 static void
@@ -161,9 +136,8 @@
     MtpDatabase* database = getMtpDatabase(env, javaDatabase);
     const char *storagePathStr = env->GetStringUTFChars(storagePath, NULL);
 
-    MtpThread* thread = new MtpThread(database, storagePathStr,
-            reserveSpace, env->NewGlobalRef(thiz));
-    env->SetIntField(thiz, field_context, (int)thread);
+    // create the thread and assign it to the smart pointer
+    sThread = new MtpThread(database, storagePathStr, reserveSpace);
 
     env->ReleaseStringUTFChars(storagePath, storagePathStr);
 #endif
@@ -173,8 +147,9 @@
 android_mtp_MtpServer_start(JNIEnv *env, jobject thiz)
 {
 #ifdef HAVE_ANDROID_OS
-    MtpThread *thread = (MtpThread *)env->GetIntField(thiz, field_context);
-    thread->run("MtpThread");
+    MtpThread *thread = sThread.get();
+    if (thread)
+        thread->run("MtpThread");
 #endif // HAVE_ANDROID_OS
 }
 
@@ -182,9 +157,11 @@
 android_mtp_MtpServer_stop(JNIEnv *env, jobject thiz)
 {
 #ifdef HAVE_ANDROID_OS
-    MtpThread *thread = (MtpThread *)env->GetIntField(thiz, field_context);
-    if (thread)
-        thread->stop();
+    MtpThread *thread = sThread.get();
+    if (thread) {
+        thread->requestExitAndWait();
+        sThread = NULL;
+    }
 #endif
 }
 
@@ -192,7 +169,7 @@
 android_mtp_MtpServer_send_object_added(JNIEnv *env, jobject thiz, jint handle)
 {
 #ifdef HAVE_ANDROID_OS
-    MtpThread *thread = (MtpThread *)env->GetIntField(thiz, field_context);
+    MtpThread *thread = sThread.get();
     if (thread)
         thread->sendObjectAdded(handle);
 #endif
@@ -202,7 +179,7 @@
 android_mtp_MtpServer_send_object_removed(JNIEnv *env, jobject thiz, jint handle)
 {
 #ifdef HAVE_ANDROID_OS
-    MtpThread *thread = (MtpThread *)env->GetIntField(thiz, field_context);
+    MtpThread *thread = sThread.get();
     if (thread)
         thread->sendObjectRemoved(handle);
 #endif
@@ -212,7 +189,7 @@
 android_mtp_MtpServer_set_ptp_mode(JNIEnv *env, jobject thiz, jboolean usePtp)
 {
 #ifdef HAVE_ANDROID_OS
-    MtpThread *thread = (MtpThread *)env->GetIntField(thiz, field_context);
+    MtpThread *thread = sThread.get();
     if (thread)
         thread->setPtpMode(usePtp);
 #endif
@@ -241,11 +218,6 @@
         LOGE("Can't find android/mtp/MtpServer");
         return -1;
     }
-    field_context = env->GetFieldID(clazz, "mNativeContext", "I");
-    if (field_context == NULL) {
-        LOGE("Can't find MtpServer.mNativeContext");
-        return -1;
-    }
 
     return AndroidRuntime::registerNativeMethods(env,
                 "android/mtp/MtpServer", gMethods, NELEM(gMethods));
diff --git a/media/libstagefright/AudioSource.cpp b/media/libstagefright/AudioSource.cpp
index 235d752..f96df18 100644
--- a/media/libstagefright/AudioSource.cpp
+++ b/media/libstagefright/AudioSource.cpp
@@ -91,14 +91,17 @@
         mStartTimeUs = startTimeUs;
     }
     status_t err = mRecord->start();
-
     if (err == OK) {
         mGroup = new MediaBufferGroup;
         mGroup->add_buffer(new MediaBuffer(kMaxBufferSize));
 
         mStarted = true;
+    } else {
+        delete mRecord;
+        mRecord = NULL;
     }
 
+
     return err;
 }
 
diff --git a/media/libstagefright/MPEG4Writer.cpp b/media/libstagefright/MPEG4Writer.cpp
index a47ee3a..d1a497f8 100644
--- a/media/libstagefright/MPEG4Writer.cpp
+++ b/media/libstagefright/MPEG4Writer.cpp
@@ -78,6 +78,7 @@
     volatile bool mDone;
     volatile bool mPaused;
     volatile bool mResumed;
+    volatile bool mStarted;
     bool mIsAvc;
     bool mIsAudio;
     bool mIsMPEG4;
@@ -951,6 +952,7 @@
       mDone(false),
       mPaused(false),
       mResumed(false),
+      mStarted(false),
       mTrackDurationUs(0),
       mEstimatedTrackSizeBytes(0),
       mSamplesHaveSameSize(true),
@@ -1279,6 +1281,7 @@
     pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
 
     mDone = false;
+    mStarted = true;
     mTrackDurationUs = 0;
     mReachedEOS = false;
     mEstimatedTrackSizeBytes = 0;
@@ -1307,10 +1310,14 @@
 
 status_t MPEG4Writer::Track::stop() {
     LOGD("Stopping %s track", mIsAudio? "Audio": "Video");
+    if (!mStarted) {
+        LOGE("Stop() called but track is not started");
+        return ERROR_END_OF_STREAM;
+    }
+
     if (mDone) {
         return OK;
     }
-
     mDone = true;
 
     void *dummy;
diff --git a/media/libstagefright/StagefrightMediaScanner.cpp b/media/libstagefright/StagefrightMediaScanner.cpp
index 39b0021..be3df7c 100644
--- a/media/libstagefright/StagefrightMediaScanner.cpp
+++ b/media/libstagefright/StagefrightMediaScanner.cpp
@@ -28,9 +28,7 @@
 
 namespace android {
 
-StagefrightMediaScanner::StagefrightMediaScanner()
-    : mRetriever(new MediaMetadataRetriever) {
-}
+StagefrightMediaScanner::StagefrightMediaScanner() {}
 
 StagefrightMediaScanner::~StagefrightMediaScanner() {}
 
@@ -131,37 +129,41 @@
         if (status != OK) {
             return status;
         }
-    } else if (mRetriever->setDataSource(path) == OK) {
-        const char *value;
-        if ((value = mRetriever->extractMetadata(
-                        METADATA_KEY_MIMETYPE)) != NULL) {
-            client.setMimeType(value);
-        }
+    } else {
+        sp<MediaMetadataRetriever> mRetriever(new MediaMetadataRetriever);
 
-        struct KeyMap {
-            const char *tag;
-            int key;
-        };
-        static const KeyMap kKeyMap[] = {
-            { "tracknumber", METADATA_KEY_CD_TRACK_NUMBER },
-            { "discnumber", METADATA_KEY_DISC_NUMBER },
-            { "album", METADATA_KEY_ALBUM },
-            { "artist", METADATA_KEY_ARTIST },
-            { "albumartist", METADATA_KEY_ALBUMARTIST },
-            { "composer", METADATA_KEY_COMPOSER },
-            { "genre", METADATA_KEY_GENRE },
-            { "title", METADATA_KEY_TITLE },
-            { "year", METADATA_KEY_YEAR },
-            { "duration", METADATA_KEY_DURATION },
-            { "writer", METADATA_KEY_WRITER },
-            { "compilation", METADATA_KEY_COMPILATION },
-        };
-        static const size_t kNumEntries = sizeof(kKeyMap) / sizeof(kKeyMap[0]);
-
-        for (size_t i = 0; i < kNumEntries; ++i) {
+         if (mRetriever->setDataSource(path) == OK) {
             const char *value;
-            if ((value = mRetriever->extractMetadata(kKeyMap[i].key)) != NULL) {
-                client.addStringTag(kKeyMap[i].tag, value);
+            if ((value = mRetriever->extractMetadata(
+                            METADATA_KEY_MIMETYPE)) != NULL) {
+                client.setMimeType(value);
+            }
+
+            struct KeyMap {
+                const char *tag;
+                int key;
+            };
+            static const KeyMap kKeyMap[] = {
+                { "tracknumber", METADATA_KEY_CD_TRACK_NUMBER },
+                { "discnumber", METADATA_KEY_DISC_NUMBER },
+                { "album", METADATA_KEY_ALBUM },
+                { "artist", METADATA_KEY_ARTIST },
+                { "albumartist", METADATA_KEY_ALBUMARTIST },
+                { "composer", METADATA_KEY_COMPOSER },
+                { "genre", METADATA_KEY_GENRE },
+                { "title", METADATA_KEY_TITLE },
+                { "year", METADATA_KEY_YEAR },
+                { "duration", METADATA_KEY_DURATION },
+                { "writer", METADATA_KEY_WRITER },
+                { "compilation", METADATA_KEY_COMPILATION },
+            };
+            static const size_t kNumEntries = sizeof(kKeyMap) / sizeof(kKeyMap[0]);
+
+            for (size_t i = 0; i < kNumEntries; ++i) {
+                const char *value;
+                if ((value = mRetriever->extractMetadata(kKeyMap[i].key)) != NULL) {
+                    client.addStringTag(kKeyMap[i].tag, value);
+                }
             }
         }
     }
@@ -180,6 +182,7 @@
     }
     lseek64(fd, 0, SEEK_SET);
 
+    sp<MediaMetadataRetriever> mRetriever(new MediaMetadataRetriever);
     if (mRetriever->setDataSource(fd, 0, size) == OK) {
         sp<IMemory> mem = mRetriever->extractAlbumArt();
 
diff --git a/media/libstagefright/codecs/aacenc/AACEncoder.cpp b/media/libstagefright/codecs/aacenc/AACEncoder.cpp
index 9524884..a8b1292 100644
--- a/media/libstagefright/codecs/aacenc/AACEncoder.cpp
+++ b/media/libstagefright/codecs/aacenc/AACEncoder.cpp
@@ -151,7 +151,11 @@
     mInputFrame = new int16_t[mChannels * kNumSamplesPerFrame];
     CHECK(mInputFrame != NULL);
 
-    mSource->start(params);
+    status_t err = mSource->start(params);
+    if (err != OK) {
+         LOGE("AudioSource is not available");
+        return err;
+    }
 
     mStarted = true;
 
@@ -159,11 +163,6 @@
 }
 
 status_t AACEncoder::stop() {
-    if (!mStarted) {
-        LOGW("Call stop() when encoder has not started");
-        return OK;
-    }
-
     if (mInputBuffer) {
         mInputBuffer->release();
         mInputBuffer = NULL;
@@ -172,8 +171,17 @@
     delete mBufferGroup;
     mBufferGroup = NULL;
 
-    mSource->stop();
+    if (mInputFrame) {
+        delete[] mInputFrame;
+        mInputFrame = NULL;
+    }
 
+    if (!mStarted) {
+        LOGW("Call stop() when encoder has not started");
+        return ERROR_END_OF_STREAM;
+    }
+
+    mSource->stop();
     if (mEncoderHandle) {
         CHECK_EQ(VO_ERR_NONE, mApiHandle->Uninit(mEncoderHandle));
         mEncoderHandle = NULL;
@@ -182,10 +190,6 @@
     mApiHandle = NULL;
 
     mStarted = false;
-    if (mInputFrame) {
-        delete[] mInputFrame;
-        mInputFrame = NULL;
-    }
 
     return OK;
 }
diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp
index ed36171..8977fbf 100644
--- a/opengl/libs/EGL/egl.cpp
+++ b/opengl/libs/EGL/egl.cpp
@@ -388,6 +388,13 @@
     return tls;
 }
 
+static inline void clearError() {
+    if (gEGLThreadLocalStorageKey != -1) {
+        tls_t* tls = getTLS();
+        tls->error = EGL_SUCCESS;
+    }
+}
+
 template<typename T>
 static __attribute__((noinline))
 T setErrorEtc(const char* caller, int line, EGLint error, T returnValue) {
@@ -708,6 +715,8 @@
 
 EGLDisplay eglGetDisplay(NativeDisplayType display)
 {
+    clearError();
+
     uint32_t index = uint32_t(display);
     if (index >= NUM_DISPLAYS) {
         return setError(EGL_BAD_PARAMETER, EGL_NO_DISPLAY);
@@ -727,6 +736,8 @@
 
 EGLBoolean eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
 {
+    clearError();
+
     egl_display_t * const dp = get_display(dpy);
     if (!dp) return setError(EGL_BAD_DISPLAY, EGL_FALSE);
 
@@ -858,6 +869,8 @@
     // after eglTerminate() has been called. eglTerminate() only
     // terminates an EGLDisplay, not a EGL itself.
 
+    clearError();
+
     egl_display_t* const dp = get_display(dpy);
     if (!dp) return setError(EGL_BAD_DISPLAY, EGL_FALSE);
 
@@ -909,6 +922,8 @@
                             EGLConfig *configs,
                             EGLint config_size, EGLint *num_config)
 {
+    clearError();
+
     egl_display_t const * const dp = get_display(dpy);
     if (!dp) return setError(EGL_BAD_DISPLAY, EGL_FALSE);
 
@@ -933,6 +948,8 @@
                             EGLConfig *configs, EGLint config_size,
                             EGLint *num_config)
 {
+    clearError();
+
     egl_display_t const * const dp = get_display(dpy);
     if (!dp) return setError(EGL_BAD_DISPLAY, EGL_FALSE);
 
@@ -1046,6 +1063,8 @@
 EGLBoolean eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config,
         EGLint attribute, EGLint *value)
 {
+    clearError();
+
     egl_display_t const* dp = 0;
     egl_connection_t* cnx = validate_display_config(dpy, config, dp);
     if (!cnx) return EGL_FALSE;
@@ -1067,6 +1086,8 @@
                                     NativeWindowType window,
                                     const EGLint *attrib_list)
 {
+    clearError();
+
     egl_display_t const* dp = 0;
     egl_connection_t* cnx = validate_display_config(dpy, config, dp);
     if (cnx) {
@@ -1097,6 +1118,8 @@
                                     NativePixmapType pixmap,
                                     const EGLint *attrib_list)
 {
+    clearError();
+
     egl_display_t const* dp = 0;
     egl_connection_t* cnx = validate_display_config(dpy, config, dp);
     if (cnx) {
@@ -1115,6 +1138,8 @@
 EGLSurface eglCreatePbufferSurface( EGLDisplay dpy, EGLConfig config,
                                     const EGLint *attrib_list)
 {
+    clearError();
+
     egl_display_t const* dp = 0;
     egl_connection_t* cnx = validate_display_config(dpy, config, dp);
     if (cnx) {
@@ -1132,6 +1157,8 @@
                                     
 EGLBoolean eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
 {
+    clearError();
+
     SurfaceRef _s(surface);
     if (!_s.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE);
 
@@ -1154,6 +1181,8 @@
 EGLBoolean eglQuerySurface( EGLDisplay dpy, EGLSurface surface,
                             EGLint attribute, EGLint *value)
 {
+    clearError();
+
     SurfaceRef _s(surface);
     if (!_s.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE);
 
@@ -1181,6 +1210,8 @@
 EGLContext eglCreateContext(EGLDisplay dpy, EGLConfig config,
                             EGLContext share_list, const EGLint *attrib_list)
 {
+    clearError();
+
     egl_display_t const* dp = 0;
     egl_connection_t* cnx = validate_display_config(dpy, config, dp);
     if (cnx) {
@@ -1218,6 +1249,8 @@
 
 EGLBoolean eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
 {
+    clearError();
+
     ContextRef _c(ctx);
     if (!_c.get()) return setError(EGL_BAD_CONTEXT, EGL_FALSE);
     
@@ -1257,6 +1290,8 @@
 EGLBoolean eglMakeCurrent(  EGLDisplay dpy, EGLSurface draw,
                             EGLSurface read, EGLContext ctx)
 {
+    clearError();
+
     // get a reference to the object passed in
     ContextRef _c(ctx);
     SurfaceRef _d(draw);
@@ -1353,6 +1388,8 @@
 EGLBoolean eglQueryContext( EGLDisplay dpy, EGLContext ctx,
                             EGLint attribute, EGLint *value)
 {
+    clearError();
+
     ContextRef _c(ctx);
     if (!_c.get()) return setError(EGL_BAD_CONTEXT, EGL_FALSE);
 
@@ -1379,6 +1416,8 @@
     // could be called before eglInitialize(), but we wouldn't have a context
     // then, and this function would correctly return EGL_NO_CONTEXT.
 
+    clearError();
+
     EGLContext ctx = getContext();
     return ctx;
 }
@@ -1388,6 +1427,8 @@
     // could be called before eglInitialize(), but we wouldn't have a context
     // then, and this function would correctly return EGL_NO_SURFACE.
 
+    clearError();
+
     EGLContext ctx = getContext();
     if (ctx) {
         egl_context_t const * const c = get_context(ctx);
@@ -1406,6 +1447,8 @@
     // could be called before eglInitialize(), but we wouldn't have a context
     // then, and this function would correctly return EGL_NO_DISPLAY.
 
+    clearError();
+
     EGLContext ctx = getContext();
     if (ctx) {
         egl_context_t const * const c = get_context(ctx);
@@ -1420,6 +1463,8 @@
     // could be called before eglInitialize(), but we wouldn't have a context
     // then, and this function would return GL_TRUE, which isn't wrong.
 
+    clearError();
+
     EGLBoolean res = EGL_TRUE;
     EGLContext ctx = getContext();
     if (ctx) {
@@ -1439,7 +1484,9 @@
 {
     // could be called before eglInitialize(), but we wouldn't have a context
     // then, and this function would return GL_TRUE, which isn't wrong.
-    
+
+    clearError();
+
     EGLBoolean res = EGL_TRUE;
     EGLContext ctx = getContext();
     if (ctx) {
@@ -1502,6 +1549,8 @@
     // in which case we must make sure we've initialized ourselves, this
     // happens the first time egl_get_display() is called.
 
+    clearError();
+
     if (egl_init_drivers() == EGL_FALSE) {
         setError(EGL_BAD_PARAMETER, NULL);
         return  NULL;
@@ -1577,6 +1626,8 @@
 
 EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface draw)
 {
+    clearError();
+
     SurfaceRef _s(draw);
     if (!_s.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE);
 
@@ -1590,6 +1641,8 @@
 EGLBoolean eglCopyBuffers(  EGLDisplay dpy, EGLSurface surface,
                             NativePixmapType target)
 {
+    clearError();
+
     SurfaceRef _s(surface);
     if (!_s.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE);
 
@@ -1603,6 +1656,8 @@
 
 const char* eglQueryString(EGLDisplay dpy, EGLint name)
 {
+    clearError();
+
     egl_display_t const * const dp = get_display(dpy);
     switch (name) {
         case EGL_VENDOR:
@@ -1625,6 +1680,8 @@
 EGLBoolean eglSurfaceAttrib(
         EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value)
 {
+    clearError();
+
     SurfaceRef _s(surface);
     if (!_s.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE);
 
@@ -1642,6 +1699,8 @@
 EGLBoolean eglBindTexImage(
         EGLDisplay dpy, EGLSurface surface, EGLint buffer)
 {
+    clearError();
+
     SurfaceRef _s(surface);
     if (!_s.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE);
 
@@ -1659,6 +1718,8 @@
 EGLBoolean eglReleaseTexImage(
         EGLDisplay dpy, EGLSurface surface, EGLint buffer)
 {
+    clearError();
+
     SurfaceRef _s(surface);
     if (!_s.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE);
 
@@ -1675,6 +1736,8 @@
 
 EGLBoolean eglSwapInterval(EGLDisplay dpy, EGLint interval)
 {
+    clearError();
+
     egl_display_t * const dp = get_display(dpy);
     if (!dp) return setError(EGL_BAD_DISPLAY, EGL_FALSE);
 
@@ -1700,6 +1763,8 @@
 
 EGLBoolean eglWaitClient(void)
 {
+    clearError();
+
     // could be called before eglInitialize(), but we wouldn't have a context
     // then, and this function would return GL_TRUE, which isn't wrong.
     EGLBoolean res = EGL_TRUE;
@@ -1723,6 +1788,8 @@
 
 EGLBoolean eglBindAPI(EGLenum api)
 {
+    clearError();
+
     if (egl_init_drivers() == EGL_FALSE) {
         return setError(EGL_BAD_PARAMETER, EGL_FALSE);
     }
@@ -1744,6 +1811,8 @@
 
 EGLenum eglQueryAPI(void)
 {
+    clearError();
+
     if (egl_init_drivers() == EGL_FALSE) {
         return setError(EGL_BAD_PARAMETER, EGL_FALSE);
     }
@@ -1764,6 +1833,8 @@
 
 EGLBoolean eglReleaseThread(void)
 {
+    clearError();
+
     // If there is context bound to the thread, release it
     loseCurrent(get_context(getContext()));
 
@@ -1783,6 +1854,8 @@
           EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer,
           EGLConfig config, const EGLint *attrib_list)
 {
+    clearError();
+
     egl_display_t const* dp = 0;
     egl_connection_t* cnx = validate_display_config(dpy, config, dp);
     if (!cnx) return EGL_FALSE;
@@ -1802,6 +1875,8 @@
 EGLBoolean eglLockSurfaceKHR(EGLDisplay dpy, EGLSurface surface,
         const EGLint *attrib_list)
 {
+    clearError();
+
     SurfaceRef _s(surface);
     if (!_s.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE);
 
@@ -1820,6 +1895,8 @@
 
 EGLBoolean eglUnlockSurfaceKHR(EGLDisplay dpy, EGLSurface surface)
 {
+    clearError();
+
     SurfaceRef _s(surface);
     if (!_s.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE);
 
@@ -1839,6 +1916,8 @@
 EGLImageKHR eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target,
         EGLClientBuffer buffer, const EGLint *attrib_list)
 {
+    clearError();
+
     if (ctx != EGL_NO_CONTEXT) {
         ContextRef _c(ctx);
         if (!_c.get()) return setError(EGL_BAD_CONTEXT, EGL_NO_IMAGE_KHR);
@@ -1910,6 +1989,8 @@
 
 EGLBoolean eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR img)
 {
+    clearError();
+
     egl_display_t const * const dp = get_display(dpy);
      if (dp == 0) {
          return setError(EGL_BAD_DISPLAY, EGL_FALSE);
@@ -1948,6 +2029,8 @@
 
 EGLSyncKHR eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list)
 {
+    clearError();
+
     EGLContext ctx = eglGetCurrentContext();
     ContextRef _c(ctx);
     if (!_c.get()) return setError(EGL_BAD_CONTEXT, EGL_NO_SYNC_KHR);
@@ -1968,6 +2051,8 @@
 
 EGLBoolean eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync)
 {
+    clearError();
+
     egl_display_t const * const dp = get_display(dpy);
     if (dp == 0) {
         return setError(EGL_BAD_DISPLAY, EGL_FALSE);
@@ -1995,6 +2080,8 @@
 
 EGLint eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout)
 {
+    clearError();
+
     egl_display_t const * const dp = get_display(dpy);
     if (dp == 0) {
         return setError(EGL_BAD_DISPLAY, EGL_FALSE);
@@ -2022,6 +2109,8 @@
 
 EGLBoolean eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value)
 {
+    clearError();
+
     egl_display_t const * const dp = get_display(dpy);
     if (dp == 0) {
         return setError(EGL_BAD_DISPLAY, EGL_FALSE);
@@ -2054,6 +2143,8 @@
 EGLBoolean eglSetSwapRectangleANDROID(EGLDisplay dpy, EGLSurface draw,
         EGLint left, EGLint top, EGLint width, EGLint height)
 {
+    clearError();
+
     SurfaceRef _s(draw);
     if (!_s.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE);
 
diff --git a/packages/SystemUI/res/drawable-mdpi/button_frame_default.9.png b/packages/SystemUI/res/drawable-mdpi/button_frame_default.9.png
deleted file mode 100644
index 7ab1f26..0000000
--- a/packages/SystemUI/res/drawable-mdpi/button_frame_default.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/button_frame_pressed.9.png b/packages/SystemUI/res/drawable-mdpi/button_frame_pressed.9.png
deleted file mode 100644
index 08f7a4d..0000000
--- a/packages/SystemUI/res/drawable-mdpi/button_frame_pressed.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/scrubber_control_disabled_holo.png b/packages/SystemUI/res/drawable-mdpi/scrubber_control_disabled_holo.png
index b8adc97..177ddb8 100644
--- a/packages/SystemUI/res/drawable-mdpi/scrubber_control_disabled_holo.png
+++ b/packages/SystemUI/res/drawable-mdpi/scrubber_control_disabled_holo.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/signal_0.png b/packages/SystemUI/res/drawable-mdpi/signal_0.png
deleted file mode 100644
index 00fb261..0000000
--- a/packages/SystemUI/res/drawable-mdpi/signal_0.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable/button_frame.xml b/packages/SystemUI/res/drawable/button_frame.xml
deleted file mode 100644
index 5db39a5..0000000
--- a/packages/SystemUI/res/drawable/button_frame.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2008 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.
--->
-
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-    <item android:state_pressed="true" android:drawable="@drawable/button_frame_pressed" />
-    <item android:drawable="@drawable/button_frame_default" />
-</selector>
-
diff --git a/packages/SystemUI/res/layout-xlarge/status_bar_notification_area.xml b/packages/SystemUI/res/layout-xlarge/status_bar_notification_area.xml
index faae62c..2ee2ac4 100644
--- a/packages/SystemUI/res/layout-xlarge/status_bar_notification_area.xml
+++ b/packages/SystemUI/res/layout-xlarge/status_bar_notification_area.xml
@@ -68,20 +68,16 @@
             android:id="@+id/clock"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_marginBottom="4dp"
+            android:layout_marginBottom="2dip"
+            android:layout_marginLeft="4dip"
+            android:layout_marginRight="4dip"
             >
-            <TextView android:id="@+id/time_bg"
+            <TextView android:id="@+id/time_solid"
                 android:layout_width="wrap_content"
-                android:layout_height="match_parent"
+                android:layout_height="wrap_content"
                 android:singleLine="true"
                 android:textSize="40sp"
-                android:textColor="#1f1f1f" />
-            <TextView android:id="@+id/time_fg"
-                android:layout_width="wrap_content"
-                android:layout_height="match_parent"
-                android:singleLine="true"
-                android:textSize="40sp"
-                android:textColor="#2e2e2e" />
+                android:textColor="#8cffffff" />
         </com.android.systemui.statusbar.tablet.HoloClock>
 
         <TextView
diff --git a/packages/SystemUI/res/layout-xlarge/status_bar_notification_panel.xml b/packages/SystemUI/res/layout-xlarge/status_bar_notification_panel.xml
index 821cf6a..ef57228 100644
--- a/packages/SystemUI/res/layout-xlarge/status_bar_notification_panel.xml
+++ b/packages/SystemUI/res/layout-xlarge/status_bar_notification_panel.xml
@@ -57,7 +57,7 @@
                 android:layout_width="match_parent"
                 android:layout_weight="1"
                 >
-                <com.android.systemui.statusbar.tablet.NotificationLinearLayout
+                <LinearLayout
                     android:id="@+id/content"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
@@ -66,21 +66,9 @@
                     android:clickable="true"
                     android:focusable="true"
                     android:descendantFocusability="afterDescendants"
-                    >
-                </com.android.systemui.statusbar.tablet.NotificationLinearLayout>
+                    />
             </ScrollView>
         </LinearLayout>
     </RelativeLayout>
 
-    <View
-        android:id="@+id/glow"
-        android:background="@drawable/notify_glow_back"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_alignTop="@id/content_parent"
-        android:layout_alignLeft="@id/content_parent"
-        android:layout_marginLeft="100dip"
-        android:layout_marginTop="50dip"
-        />
-
 </com.android.systemui.statusbar.tablet.NotificationPanel>
diff --git a/packages/SystemUI/res/layout-xlarge/status_bar_notification_row.xml b/packages/SystemUI/res/layout-xlarge/status_bar_notification_row.xml
index 233cb46..0f3f5f0 100644
--- a/packages/SystemUI/res/layout-xlarge/status_bar_notification_row.xml
+++ b/packages/SystemUI/res/layout-xlarge/status_bar_notification_row.xml
@@ -1,7 +1,6 @@
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="65dp"
-    android:background="@drawable/status_bar_item_background"
     >
 
     <ImageButton
@@ -12,8 +11,9 @@
         android:layout_alignParentRight="true"
         android:src="@drawable/status_bar_veto"
         android:scaleType="center"
-        android:background="#ff000000"
+        android:background="@null"
         android:paddingRight="8dp"
+        android:paddingLeft="8dp"
         />
 
     <ImageView
@@ -24,7 +24,6 @@
         android:layout_alignParentLeft="true"
         android:scaleType="center"
         />
-        <!-- TODO: scaleType should be top-left but ImageView doesn't support that. -->
 
     <com.android.systemui.statusbar.LatestItemView android:id="@+id/content"
         android:layout_width="match_parent"
diff --git a/packages/SystemUI/res/layout/status_bar_toggle_slider.xml b/packages/SystemUI/res/layout/status_bar_toggle_slider.xml
index cdf56c5..3105dab 100644
--- a/packages/SystemUI/res/layout/status_bar_toggle_slider.xml
+++ b/packages/SystemUI/res/layout/status_bar_toggle_slider.xml
@@ -27,7 +27,7 @@
         android:layout_alignParentLeft="true"
         android:layout_alignParentTop="true"
         android:layout_alignParentBottom="true"
-        android:button="@drawable/status_bar_toggle_button"
+        android:button="@null"
         />
     <SeekBar
         android:id="@+id/slider"
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/HoloClock.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/HoloClock.java
index 3b76434..0121211 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/HoloClock.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/HoloClock.java
@@ -52,8 +52,13 @@
     private String mClockFormatString;
     private SimpleDateFormat mClockFormat;
 
-    private static Typeface sBackgroundType, sForegroundType;
-    private TextView mBgText, mFgText;
+    private static final String FONT_DIR = "/system/fonts/";
+    private static final String CLOCK_FONT = FONT_DIR + "AndroidClock_Solid.ttf"; 
+    private static final String CLOCK_FG_FONT = FONT_DIR + "AndroidClock.ttf"; 
+    private static final String CLOCK_BG_FONT = FONT_DIR + "AndroidClock_Highlight.ttf"; 
+
+    private static Typeface sBackgroundType, sForegroundType, sSolidType;
+    private TextView mSolidText, mBgText, mFgText;
 
     public HoloClock(Context context) {
         this(context, null);
@@ -71,13 +76,10 @@
     protected void onFinishInflate() {
         super.onFinishInflate();
 
-        if (sBackgroundType == null) {
-            AssetManager assets = getContext().getAssets();
-
-            sBackgroundType = Typeface.createFromAsset(assets,
-                "fonts/AndroidClock.ttf");
-            sForegroundType = Typeface.createFromAsset(assets,
-                "fonts/AndroidClock2.ttf");
+        if (sSolidType == null) {
+            sSolidType = Typeface.createFromFile(CLOCK_FONT);
+            sBackgroundType = Typeface.createFromFile(CLOCK_BG_FONT);
+            sForegroundType = Typeface.createFromFile(CLOCK_FG_FONT);
         }
         mBgText = (TextView) findViewById(R.id.time_bg);
         if (mBgText != null) {
@@ -87,6 +89,10 @@
         if (mFgText != null) {
             mFgText.setTypeface(sForegroundType);
         }
+        mSolidText = (TextView) findViewById(R.id.time_solid);
+        if (mSolidText != null) {
+            mSolidText.setTypeface(sSolidType);
+        }
     }
 
     @Override
@@ -142,8 +148,9 @@
     final void updateClock() {
         mCalendar.setTimeInMillis(System.currentTimeMillis());
         CharSequence txt = getTimeText();
-        mBgText.setText(txt);
-        mFgText.setText(txt);
+        if (mBgText != null) mBgText.setText(txt);
+        if (mFgText != null) mFgText.setText(txt);
+        if (mSolidText != null) mSolidText.setText(txt);
     }
 
     private final CharSequence getTimeText() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java
index 092f0b8..1004e18 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java
@@ -58,7 +58,6 @@
     ViewGroup mContentFrame;
     Rect mContentArea = new Rect();
     View mSettingsView;
-    View mGlow;
     ViewGroup mContentParent;
 
     Choreographer mChoreo = new Choreographer();
@@ -83,8 +82,6 @@
         mModeToggle = findViewById(R.id.mode_toggle);
         mModeToggle.setOnClickListener(this);
 
-        mGlow = findViewById(R.id.glow);
-
         mSettingsButton = (ImageView)findViewById(R.id.settings_button);
         mNotificationButton = (ImageView)findViewById(R.id.notification_button);
 
@@ -306,18 +303,15 @@
                     ? new android.view.animation.DecelerateInterpolator(1.0f)
                     : new android.view.animation.AccelerateInterpolator(1.0f));
 
-            Animator glowAnim = ObjectAnimator.ofInt(mGlow.getBackground(), "alpha",
-                    mVisible ? 255 : 0, appearing ? 255 : 0);
-            glowAnim.setInterpolator(appearing
-                    ? new android.view.animation.AccelerateInterpolator(1.0f)
-                    : new android.view.animation.DecelerateInterpolator(1.0f));
+            if (mContentAnim != null && mContentAnim.isRunning()) {
+                mContentAnim.cancel();
+            }
 
             mContentAnim = new AnimatorSet();
             mContentAnim
                 .play(ObjectAnimator.ofFloat(mContentParent, "alpha",
                     mContentParent.getAlpha(), appearing ? 1.0f : 0.0f))
                 .with(bgAnim)
-                .with(glowAnim)
                 .with(posAnim)
                 ;
             mContentAnim.setDuration((DEBUG?10:1)*(appearing ? OPEN_DURATION : CLOSE_DURATION));
@@ -330,7 +324,6 @@
             createAnimation(appearing);
 
             mContentParent.setLayerType(View.LAYER_TYPE_HARDWARE, null);
-            mGlow.setLayerType(View.LAYER_TYPE_HARDWARE, null);
             mContentAnim.start();
 
             mVisible = appearing;
@@ -338,8 +331,6 @@
 
         public void onAnimationCancel(Animator animation) {
             if (DEBUG) Slog.d(TAG, "onAnimationCancel");
-            // force this to zero so we close the window
-            mVisible = false;
         }
 
         public void onAnimationEnd(Animator animation) {
@@ -348,7 +339,6 @@
                 setVisibility(View.GONE);
             }
             mContentParent.setLayerType(View.LAYER_TYPE_NONE, null);
-            mGlow.setLayerType(View.LAYER_TYPE_NONE, null);
             mContentAnim = null;
         }
 
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/RecentAppsPanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/RecentAppsPanel.java
index 7544f46..a5e2fda 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/RecentAppsPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/RecentAppsPanel.java
@@ -98,10 +98,12 @@
     };
 
     public boolean isInContentArea(int x, int y) {
-        final int l = mRecentsContainer.getPaddingLeft();
-        final int r = mRecentsContainer.getWidth() - mRecentsContainer.getPaddingRight();
-        final int t = mRecentsContainer.getPaddingTop();
-        final int b = mRecentsContainer.getHeight() - mRecentsContainer.getPaddingBottom();
+        // use mRecentsContainer's exact bounds to determine horizontal position
+        final int l = mRecentsContainer.getLeft();
+        final int r = mRecentsContainer.getRight();
+        // use surrounding mRecentsGlowView's position in parent determine vertical bounds
+        final int t = mRecentsGlowView.getTop();
+        final int b = mRecentsGlowView.getBottom();
         return x >= l && x < r && y >= t && y < b;
     }
 
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
index 9549930..d46de15 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
@@ -1222,6 +1222,7 @@
 
     void workAroundBadLayerDrawableOpacity(View v) {
         LayerDrawable d = (LayerDrawable)v.getBackground();
+        if (d == null) return;
         v.setBackgroundDrawable(null);
         d.setOpacity(PixelFormat.TRANSLUCENT);
         v.setBackgroundDrawable(d);
diff --git a/services/input/EventHub.cpp b/services/input/EventHub.cpp
index 487e73f..41dbe2f 100644
--- a/services/input/EventHub.cpp
+++ b/services/input/EventHub.cpp
@@ -778,12 +778,12 @@
         // Is this a new modern multi-touch driver?
         if (test_bit(ABS_MT_POSITION_X, abs_bitmask)
                 && test_bit(ABS_MT_POSITION_Y, abs_bitmask)) {
-            device->classes |= INPUT_DEVICE_CLASS_TOUCHSCREEN | INPUT_DEVICE_CLASS_TOUCHSCREEN_MT;
+            device->classes |= INPUT_DEVICE_CLASS_TOUCH | INPUT_DEVICE_CLASS_TOUCH_MT;
 
         // Is this an old style single-touch driver?
         } else if (test_bit(BTN_TOUCH, key_bitmask)
                 && test_bit(ABS_X, abs_bitmask) && test_bit(ABS_Y, abs_bitmask)) {
-            device->classes |= INPUT_DEVICE_CLASS_TOUCHSCREEN;
+            device->classes |= INPUT_DEVICE_CLASS_TOUCH;
         }
     }
 
@@ -808,7 +808,7 @@
     }
 #endif
 
-    if ((device->classes & INPUT_DEVICE_CLASS_TOUCHSCREEN)) {
+    if ((device->classes & INPUT_DEVICE_CLASS_TOUCH)) {
         // Load the virtual keys for the touch screen, if any.
         // We do this now so that we can make sure to load the keymap if necessary.
         status_t status = loadVirtualKeyMap(device);
diff --git a/services/input/EventHub.h b/services/input/EventHub.h
index 74b7ec5..0ee0b9b 100644
--- a/services/input/EventHub.h
+++ b/services/input/EventHub.h
@@ -106,14 +106,14 @@
     /* The input device is an alpha-numeric keyboard (not just a dial pad). */
     INPUT_DEVICE_CLASS_ALPHAKEY      = 0x00000002,
 
-    /* The input device is a touchscreen (either single-touch or multi-touch). */
-    INPUT_DEVICE_CLASS_TOUCHSCREEN   = 0x00000004,
+    /* The input device is a touchscreen or a touchpad (either single-touch or multi-touch). */
+    INPUT_DEVICE_CLASS_TOUCH         = 0x00000004,
 
     /* The input device is a cursor device such as a trackball or mouse. */
     INPUT_DEVICE_CLASS_CURSOR        = 0x00000008,
 
     /* The input device is a multi-touch touchscreen. */
-    INPUT_DEVICE_CLASS_TOUCHSCREEN_MT= 0x00000010,
+    INPUT_DEVICE_CLASS_TOUCH_MT      = 0x00000010,
 
     /* The input device is a directional pad (implies keyboard, has DPAD keys). */
     INPUT_DEVICE_CLASS_DPAD          = 0x00000020,
diff --git a/services/input/InputDispatcher.cpp b/services/input/InputDispatcher.cpp
index e314145..cbfdd75 100644
--- a/services/input/InputDispatcher.cpp
+++ b/services/input/InputDispatcher.cpp
@@ -1165,12 +1165,15 @@
         mTempTouchState.reset();
         mTempTouchState.down = true;
         mTempTouchState.deviceId = entry->deviceId;
+        mTempTouchState.source = entry->source;
         isSplit = false;
         wrongDevice = false;
     } else {
         mTempTouchState.copyFrom(mTouchState);
         isSplit = mTempTouchState.split;
-        wrongDevice = mTempTouchState.down && mTempTouchState.deviceId != entry->deviceId;
+        wrongDevice = mTempTouchState.down
+                && (mTempTouchState.deviceId != entry->deviceId
+                        || mTempTouchState.source != entry->source);
         if (wrongDevice) {
 #if DEBUG_INPUT_DISPATCHER_POLICY
             LOGD("Dropping event because a pointer for a different device is already down.");
@@ -1599,6 +1602,9 @@
         if (inputTarget->pointerIds.count() != originalMotionEntry->pointerCount) {
             MotionEntry* splitMotionEntry = splitMotionEvent(
                     originalMotionEntry, inputTarget->pointerIds);
+            if (!splitMotionEntry) {
+                return; // split event was dropped
+            }
 #if DEBUG_FOCUS
             LOGD("channel '%s' ~ Split motion event.",
                     connection->getInputChannelName());
@@ -2120,7 +2126,19 @@
             splitPointerCount += 1;
         }
     }
-    assert(splitPointerCount == pointerIds.count());
+
+    if (splitPointerCount != pointerIds.count()) {
+        // This is bad.  We are missing some of the pointers that we expected to deliver.
+        // Most likely this indicates that we received an ACTION_MOVE events that has
+        // different pointer ids than we expected based on the previous ACTION_DOWN
+        // or ACTION_POINTER_DOWN events that caused us to decide to split the pointers
+        // in this way.
+        LOGW("Dropping split motion event because the pointer count is %d but "
+                "we expected there to be %d pointers.  This probably means we received "
+                "a broken sequence of pointer ids from the input device.",
+                splitPointerCount, pointerIds.count());
+        return NULL;
+    }
 
     int32_t action = originalMotionEntry->action;
     int32_t maskedAction = action & AMOTION_EVENT_ACTION_MASK;
@@ -2196,7 +2214,7 @@
     }
 }
 
-void InputDispatcher::notifyKey(nsecs_t eventTime, int32_t deviceId, int32_t source,
+void InputDispatcher::notifyKey(nsecs_t eventTime, int32_t deviceId, uint32_t source,
         uint32_t policyFlags, int32_t action, int32_t flags,
         int32_t keyCode, int32_t scanCode, int32_t metaState, nsecs_t downTime) {
 #if DEBUG_INBOUND_EVENT_DETAILS
@@ -2243,7 +2261,7 @@
     }
 }
 
-void InputDispatcher::notifyMotion(nsecs_t eventTime, int32_t deviceId, int32_t source,
+void InputDispatcher::notifyMotion(nsecs_t eventTime, int32_t deviceId, uint32_t source,
         uint32_t policyFlags, int32_t action, int32_t flags, int32_t metaState, int32_t edgeFlags,
         uint32_t pointerCount, const int32_t* pointerIds, const PointerCoords* pointerCoords,
         float xPrecision, float yPrecision, nsecs_t downTime) {
@@ -2296,6 +2314,7 @@
                 }
 
                 if (motionEntry->action != AMOTION_EVENT_ACTION_MOVE
+                        || motionEntry->source != source
                         || motionEntry->pointerCount != pointerCount
                         || motionEntry->isInjected()) {
                     // Last motion event in the queue for this device is not compatible for
@@ -2355,6 +2374,7 @@
                             dispatchEntry->eventEntry);
                     if (motionEntry->action != AMOTION_EVENT_ACTION_MOVE
                             || motionEntry->deviceId != deviceId
+                            || motionEntry->source != source
                             || motionEntry->pointerCount != pointerCount
                             || motionEntry->isInjected()) {
                         // The motion event is not compatible with this move.
@@ -2883,6 +2903,7 @@
     dump.appendFormat(INDENT "TouchDown: %s\n", toString(mTouchState.down));
     dump.appendFormat(INDENT "TouchSplit: %s\n", toString(mTouchState.split));
     dump.appendFormat(INDENT "TouchDeviceId: %d\n", mTouchState.deviceId);
+    dump.appendFormat(INDENT "TouchSource: 0x%08x\n", mTouchState.source);
     if (!mTouchState.windows.isEmpty()) {
         dump.append(INDENT "TouchedWindows:\n");
         for (size_t i = 0; i < mTouchState.windows.size(); i++) {
@@ -3308,7 +3329,7 @@
 }
 
 InputDispatcher::KeyEntry* InputDispatcher::Allocator::obtainKeyEntry(nsecs_t eventTime,
-        int32_t deviceId, int32_t source, uint32_t policyFlags, int32_t action,
+        int32_t deviceId, uint32_t source, uint32_t policyFlags, int32_t action,
         int32_t flags, int32_t keyCode, int32_t scanCode, int32_t metaState,
         int32_t repeatCount, nsecs_t downTime) {
     KeyEntry* entry = mKeyEntryPool.alloc();
@@ -3329,7 +3350,7 @@
 }
 
 InputDispatcher::MotionEntry* InputDispatcher::Allocator::obtainMotionEntry(nsecs_t eventTime,
-        int32_t deviceId, int32_t source, uint32_t policyFlags, int32_t action, int32_t flags,
+        int32_t deviceId, uint32_t source, uint32_t policyFlags, int32_t action, int32_t flags,
         int32_t metaState, int32_t edgeFlags, float xPrecision, float yPrecision,
         nsecs_t downTime, uint32_t pointerCount,
         const int32_t* pointerIds, const PointerCoords* pointerCoords) {
@@ -3757,7 +3778,7 @@
 // --- InputDispatcher::TouchState ---
 
 InputDispatcher::TouchState::TouchState() :
-    down(false), split(false), deviceId(-1) {
+    down(false), split(false), deviceId(-1), source(0) {
 }
 
 InputDispatcher::TouchState::~TouchState() {
@@ -3767,6 +3788,7 @@
     down = false;
     split = false;
     deviceId = -1;
+    source = 0;
     windows.clear();
 }
 
@@ -3774,6 +3796,7 @@
     down = other.down;
     split = other.split;
     deviceId = other.deviceId;
+    source = other.source;
     windows.clear();
     windows.appendVector(other.windows);
 }
diff --git a/services/input/InputDispatcher.h b/services/input/InputDispatcher.h
index 11e5117..006c6b8 100644
--- a/services/input/InputDispatcher.h
+++ b/services/input/InputDispatcher.h
@@ -227,10 +227,10 @@
      * These methods should only be called on the input reader thread.
      */
     virtual void notifyConfigurationChanged(nsecs_t eventTime) = 0;
-    virtual void notifyKey(nsecs_t eventTime, int32_t deviceId, int32_t source,
+    virtual void notifyKey(nsecs_t eventTime, int32_t deviceId, uint32_t source,
             uint32_t policyFlags, int32_t action, int32_t flags, int32_t keyCode,
             int32_t scanCode, int32_t metaState, nsecs_t downTime) = 0;
-    virtual void notifyMotion(nsecs_t eventTime, int32_t deviceId, int32_t source,
+    virtual void notifyMotion(nsecs_t eventTime, int32_t deviceId, uint32_t source,
             uint32_t policyFlags, int32_t action, int32_t flags,
             int32_t metaState, int32_t edgeFlags,
             uint32_t pointerCount, const int32_t* pointerIds, const PointerCoords* pointerCoords,
@@ -313,10 +313,10 @@
     virtual void dispatchOnce();
 
     virtual void notifyConfigurationChanged(nsecs_t eventTime);
-    virtual void notifyKey(nsecs_t eventTime, int32_t deviceId, int32_t source,
+    virtual void notifyKey(nsecs_t eventTime, int32_t deviceId, uint32_t source,
             uint32_t policyFlags, int32_t action, int32_t flags, int32_t keyCode,
             int32_t scanCode, int32_t metaState, nsecs_t downTime);
-    virtual void notifyMotion(nsecs_t eventTime, int32_t deviceId, int32_t source,
+    virtual void notifyMotion(nsecs_t eventTime, int32_t deviceId, uint32_t source,
             uint32_t policyFlags, int32_t action, int32_t flags,
             int32_t metaState, int32_t edgeFlags,
             uint32_t pointerCount, const int32_t* pointerIds, const PointerCoords* pointerCoords,
@@ -379,7 +379,7 @@
 
     struct KeyEntry : EventEntry {
         int32_t deviceId;
-        int32_t source;
+        uint32_t source;
         int32_t action;
         int32_t flags;
         int32_t keyCode;
@@ -407,7 +407,7 @@
 
     struct MotionEntry : EventEntry {
         int32_t deviceId;
-        int32_t source;
+        uint32_t source;
         int32_t action;
         int32_t flags;
         int32_t metaState;
@@ -549,11 +549,11 @@
         InjectionState* obtainInjectionState(int32_t injectorPid, int32_t injectorUid);
         ConfigurationChangedEntry* obtainConfigurationChangedEntry(nsecs_t eventTime);
         KeyEntry* obtainKeyEntry(nsecs_t eventTime,
-                int32_t deviceId, int32_t source, uint32_t policyFlags, int32_t action,
+                int32_t deviceId, uint32_t source, uint32_t policyFlags, int32_t action,
                 int32_t flags, int32_t keyCode, int32_t scanCode, int32_t metaState,
                 int32_t repeatCount, nsecs_t downTime);
         MotionEntry* obtainMotionEntry(nsecs_t eventTime,
-                int32_t deviceId, int32_t source, uint32_t policyFlags, int32_t action,
+                int32_t deviceId, uint32_t source, uint32_t policyFlags, int32_t action,
                 int32_t flags, int32_t metaState, int32_t edgeFlags,
                 float xPrecision, float yPrecision,
                 nsecs_t downTime, uint32_t pointerCount,
@@ -645,7 +645,7 @@
     private:
         struct KeyMemento {
             int32_t deviceId;
-            int32_t source;
+            uint32_t source;
             int32_t keyCode;
             int32_t scanCode;
             int32_t flags;
@@ -654,7 +654,7 @@
 
         struct MotionMemento {
             int32_t deviceId;
-            int32_t source;
+            uint32_t source;
             float xPrecision;
             float yPrecision;
             nsecs_t downTime;
@@ -846,6 +846,7 @@
         bool down;
         bool split;
         int32_t deviceId; // id of the device that is currently down, others are rejected
+        uint32_t source;  // source of the device that is current down, others are rejected
         Vector<TouchedWindow> windows;
 
         TouchState();
diff --git a/services/input/InputReader.cpp b/services/input/InputReader.cpp
index 2e83256..46d374d 100644
--- a/services/input/InputReader.cpp
+++ b/services/input/InputReader.cpp
@@ -260,10 +260,10 @@
         device->addMapper(new CursorInputMapper(device));
     }
 
-    // Touchscreen-like devices.
-    if (classes & INPUT_DEVICE_CLASS_TOUCHSCREEN_MT) {
+    // Touchscreens and touchpad devices.
+    if (classes & INPUT_DEVICE_CLASS_TOUCH_MT) {
         device->addMapper(new MultiTouchInputMapper(device));
-    } else if (classes & INPUT_DEVICE_CLASS_TOUCHSCREEN) {
+    } else if (classes & INPUT_DEVICE_CLASS_TOUCH) {
         device->addMapper(new SingleTouchInputMapper(device));
     }
 
@@ -605,11 +605,19 @@
 
     mSources = 0;
 
-    size_t numMappers = mMappers.size();
-    for (size_t i = 0; i < numMappers; i++) {
+    for (size_t i = 0; i < mMappers.size(); i++) {
         InputMapper* mapper = mMappers[i];
         mapper->configure();
-        mSources |= mapper->getSources();
+
+        uint32_t sources = mapper->getSources();
+        if (sources) {
+            mSources |= sources;
+        } else {
+            // The input mapper does not provide any sources.  Remove it from the list.
+            mMappers.removeAt(i);
+            delete mapper;
+            i -= 1;
+        }
     }
 }
 
@@ -1074,7 +1082,7 @@
     // Configure device mode.
     switch (mParameters.mode) {
     case Parameters::MODE_POINTER:
-        mSources = AINPUT_SOURCE_MOUSE;
+        mSources = 0; // AINPUT_SOURCE_MOUSE; disable mouse support
         mXPrecision = 1.0f;
         mYPrecision = 1.0f;
         mXScale = 1.0f;
@@ -1455,12 +1463,12 @@
     mParameters.virtualKeyQuietTime = getPolicy()->getVirtualKeyQuietTime();
 
     String8 deviceTypeString;
-    mParameters.deviceType = Parameters::DEVICE_TYPE_TOUCH_SCREEN;
+    mParameters.deviceType = Parameters::DEVICE_TYPE_TOUCH_PAD;
     if (getDevice()->getConfiguration().tryGetProperty(String8("touch.deviceType"),
             deviceTypeString)) {
-        if (deviceTypeString == "touchPad") {
-            mParameters.deviceType = Parameters::DEVICE_TYPE_TOUCH_PAD;
-        } else if (deviceTypeString != "touchScreen") {
+        if (deviceTypeString == "touchScreen") {
+            mParameters.deviceType = Parameters::DEVICE_TYPE_TOUCH_SCREEN;
+        } else if (deviceTypeString != "touchPad") {
             LOGW("Invalid value for touch.deviceType: '%s'", deviceTypeString.string());
         }
     }
diff --git a/services/input/tests/InputReader_test.cpp b/services/input/tests/InputReader_test.cpp
index 98d627d..25030d8 100644
--- a/services/input/tests/InputReader_test.cpp
+++ b/services/input/tests/InputReader_test.cpp
@@ -188,7 +188,7 @@
     struct NotifyKeyArgs {
         nsecs_t eventTime;
         int32_t deviceId;
-        int32_t source;
+        uint32_t source;
         uint32_t policyFlags;
         int32_t action;
         int32_t flags;
@@ -201,7 +201,7 @@
     struct NotifyMotionArgs {
         nsecs_t eventTime;
         int32_t deviceId;
-        int32_t source;
+        uint32_t source;
         uint32_t policyFlags;
         int32_t action;
         int32_t flags;
@@ -288,7 +288,7 @@
         mNotifyConfigurationChangedArgs.push_back(args);
     }
 
-    virtual void notifyKey(nsecs_t eventTime, int32_t deviceId, int32_t source,
+    virtual void notifyKey(nsecs_t eventTime, int32_t deviceId, uint32_t source,
             uint32_t policyFlags, int32_t action, int32_t flags, int32_t keyCode,
             int32_t scanCode, int32_t metaState, nsecs_t downTime) {
         NotifyKeyArgs args;
@@ -305,7 +305,7 @@
         mNotifyKeyArgs.push_back(args);
     }
 
-    virtual void notifyMotion(nsecs_t eventTime, int32_t deviceId, int32_t source,
+    virtual void notifyMotion(nsecs_t eventTime, int32_t deviceId, uint32_t source,
             uint32_t policyFlags, int32_t action, int32_t flags,
             int32_t metaState, int32_t edgeFlags,
             uint32_t pointerCount, const int32_t* pointerIds, const PointerCoords* pointerCoords,
@@ -976,8 +976,10 @@
 }
 
 TEST_F(InputReaderTest, GetInputConfiguration_WhenTouchScreenPresent_ReturnsFingerTouchScreen) {
+    PropertyMap configuration;
+    configuration.addProperty(String8("touch.deviceType"), String8("touchScreen"));
     ASSERT_NO_FATAL_FAILURE(addDevice(0, String8("touchscreen"),
-            INPUT_DEVICE_CLASS_TOUCHSCREEN, NULL));
+            INPUT_DEVICE_CLASS_TOUCH, &configuration));
 
     InputConfiguration config;
     mReader->getInputConfiguration(&config);
@@ -987,6 +989,18 @@
     ASSERT_EQ(InputConfiguration::TOUCHSCREEN_FINGER, config.touchScreen);
 }
 
+TEST_F(InputReaderTest, GetInputConfiguration_WhenTouchPadPresent_ReturnsFingerNoTouch) {
+    ASSERT_NO_FATAL_FAILURE(addDevice(0, String8("touchpad"),
+            INPUT_DEVICE_CLASS_TOUCH, NULL));
+
+    InputConfiguration config;
+    mReader->getInputConfiguration(&config);
+
+    ASSERT_EQ(InputConfiguration::KEYBOARD_NOKEYS, config.keyboard);
+    ASSERT_EQ(InputConfiguration::NAVIGATION_NONAV, config.navigation);
+    ASSERT_EQ(InputConfiguration::TOUCHSCREEN_NOTOUCH, config.touchScreen);
+}
+
 TEST_F(InputReaderTest, GetInputConfiguration_WhenMousePresent_ReturnsNoNavigation) {
     sp<FakePointerController> controller = new FakePointerController();
     mFakePolicy->setPointerController(0, controller);
@@ -2385,6 +2399,14 @@
 }
 
 
+TEST_F(SingleTouchInputMapperTest, GetSources_WhenDeviceTypeIsNotSpecified_ReturnsTouchPad) {
+    SingleTouchInputMapper* mapper = new SingleTouchInputMapper(mDevice);
+    prepareAxes(POSITION);
+    addMapperAndConfigure(mapper);
+
+    ASSERT_EQ(AINPUT_SOURCE_TOUCHPAD, mapper->getSources());
+}
+
 TEST_F(SingleTouchInputMapperTest, GetSources_WhenDeviceTypeIsTouchPad_ReturnsTouchPad) {
     SingleTouchInputMapper* mapper = new SingleTouchInputMapper(mDevice);
     prepareAxes(POSITION);
@@ -2405,6 +2427,7 @@
 
 TEST_F(SingleTouchInputMapperTest, GetKeyCodeState) {
     SingleTouchInputMapper* mapper = new SingleTouchInputMapper(mDevice);
+    addConfigurationProperty("touch.deviceType", "touchScreen");
     prepareDisplay(DISPLAY_ORIENTATION_0);
     prepareAxes(POSITION);
     prepareVirtualKeys();
@@ -2432,6 +2455,7 @@
 
 TEST_F(SingleTouchInputMapperTest, GetScanCodeState) {
     SingleTouchInputMapper* mapper = new SingleTouchInputMapper(mDevice);
+    addConfigurationProperty("touch.deviceType", "touchScreen");
     prepareDisplay(DISPLAY_ORIENTATION_0);
     prepareAxes(POSITION);
     prepareVirtualKeys();
@@ -2459,6 +2483,7 @@
 
 TEST_F(SingleTouchInputMapperTest, MarkSupportedKeyCodes) {
     SingleTouchInputMapper* mapper = new SingleTouchInputMapper(mDevice);
+    addConfigurationProperty("touch.deviceType", "touchScreen");
     prepareDisplay(DISPLAY_ORIENTATION_0);
     prepareAxes(POSITION);
     prepareVirtualKeys();
@@ -2475,6 +2500,7 @@
     // Note: Ideally we should send cancels but the implementation is more straightforward
     // with up and this will only happen if a device is forcibly removed.
     SingleTouchInputMapper* mapper = new SingleTouchInputMapper(mDevice);
+    addConfigurationProperty("touch.deviceType", "touchScreen");
     prepareDisplay(DISPLAY_ORIENTATION_0);
     prepareAxes(POSITION);
     prepareVirtualKeys();
@@ -2508,6 +2534,7 @@
 
 TEST_F(SingleTouchInputMapperTest, Reset_WhenNothingIsPressed_NothingMuchHappens) {
     SingleTouchInputMapper* mapper = new SingleTouchInputMapper(mDevice);
+    addConfigurationProperty("touch.deviceType", "touchScreen");
     prepareDisplay(DISPLAY_ORIENTATION_0);
     prepareAxes(POSITION);
     prepareVirtualKeys();
@@ -2534,6 +2561,7 @@
 
 TEST_F(SingleTouchInputMapperTest, Process_WhenVirtualKeyIsPressedAndReleasedNormally_SendsKeyDownAndKeyUp) {
     SingleTouchInputMapper* mapper = new SingleTouchInputMapper(mDevice);
+    addConfigurationProperty("touch.deviceType", "touchScreen");
     prepareDisplay(DISPLAY_ORIENTATION_0);
     prepareAxes(POSITION);
     prepareVirtualKeys();
@@ -2583,6 +2611,7 @@
 
 TEST_F(SingleTouchInputMapperTest, Process_WhenVirtualKeyIsPressedAndMovedOutOfBounds_SendsKeyDownAndKeyCancel) {
     SingleTouchInputMapper* mapper = new SingleTouchInputMapper(mDevice);
+    addConfigurationProperty("touch.deviceType", "touchScreen");
     prepareDisplay(DISPLAY_ORIENTATION_0);
     prepareAxes(POSITION);
     prepareVirtualKeys();
@@ -2697,6 +2726,7 @@
 
 TEST_F(SingleTouchInputMapperTest, Process_WhenTouchStartsOutsideDisplayAndMovesIn_SendsDownAsTouchEntersDisplay) {
     SingleTouchInputMapper* mapper = new SingleTouchInputMapper(mDevice);
+    addConfigurationProperty("touch.deviceType", "touchScreen");
     prepareDisplay(DISPLAY_ORIENTATION_0);
     prepareAxes(POSITION);
     prepareVirtualKeys();
@@ -2765,6 +2795,7 @@
 
 TEST_F(SingleTouchInputMapperTest, Process_NormalSingleTouchGesture) {
     SingleTouchInputMapper* mapper = new SingleTouchInputMapper(mDevice);
+    addConfigurationProperty("touch.deviceType", "touchScreen");
     prepareDisplay(DISPLAY_ORIENTATION_0);
     prepareAxes(POSITION);
     prepareVirtualKeys();
@@ -2848,6 +2879,7 @@
 
 TEST_F(SingleTouchInputMapperTest, Process_WhenNotOrientationAware_DoesNotRotateMotions) {
     SingleTouchInputMapper* mapper = new SingleTouchInputMapper(mDevice);
+    addConfigurationProperty("touch.deviceType", "touchScreen");
     prepareAxes(POSITION);
     addConfigurationProperty("touch.orientationAware", "0");
     addMapperAndConfigure(mapper);
@@ -2870,6 +2902,7 @@
 
 TEST_F(SingleTouchInputMapperTest, Process_WhenOrientationAware_RotatesMotions) {
     SingleTouchInputMapper* mapper = new SingleTouchInputMapper(mDevice);
+    addConfigurationProperty("touch.deviceType", "touchScreen");
     prepareAxes(POSITION);
     addMapperAndConfigure(mapper);
 
@@ -2930,6 +2963,7 @@
 
 TEST_F(SingleTouchInputMapperTest, Process_AllAxes_DefaultCalibration) {
     SingleTouchInputMapper* mapper = new SingleTouchInputMapper(mDevice);
+    addConfigurationProperty("touch.deviceType", "touchScreen");
     prepareDisplay(DISPLAY_ORIENTATION_0);
     prepareAxes(POSITION | PRESSURE | TOOL);
     addMapperAndConfigure(mapper);
@@ -3062,6 +3096,7 @@
 
 TEST_F(MultiTouchInputMapperTest, Process_NormalMultiTouchGesture_WithoutTrackingIds) {
     MultiTouchInputMapper* mapper = new MultiTouchInputMapper(mDevice);
+    addConfigurationProperty("touch.deviceType", "touchScreen");
     prepareDisplay(DISPLAY_ORIENTATION_0);
     prepareAxes(POSITION);
     prepareVirtualKeys();
@@ -3313,6 +3348,7 @@
 
 TEST_F(MultiTouchInputMapperTest, Process_NormalMultiTouchGesture_WithTrackingIds) {
     MultiTouchInputMapper* mapper = new MultiTouchInputMapper(mDevice);
+    addConfigurationProperty("touch.deviceType", "touchScreen");
     prepareDisplay(DISPLAY_ORIENTATION_0);
     prepareAxes(POSITION | ID);
     prepareVirtualKeys();
@@ -3473,6 +3509,7 @@
 
 TEST_F(MultiTouchInputMapperTest, Process_AllAxes_WithDefaultCalibration) {
     MultiTouchInputMapper* mapper = new MultiTouchInputMapper(mDevice);
+    addConfigurationProperty("touch.deviceType", "touchScreen");
     prepareDisplay(DISPLAY_ORIENTATION_0);
     prepareAxes(POSITION | TOUCH | TOOL | PRESSURE | ORIENTATION | ID | MINOR);
     addMapperAndConfigure(mapper);
@@ -3518,6 +3555,7 @@
 
 TEST_F(MultiTouchInputMapperTest, Process_TouchAndToolAxes_GeometricCalibration) {
     MultiTouchInputMapper* mapper = new MultiTouchInputMapper(mDevice);
+    addConfigurationProperty("touch.deviceType", "touchScreen");
     prepareDisplay(DISPLAY_ORIENTATION_0);
     prepareAxes(POSITION | TOUCH | TOOL | MINOR);
     addConfigurationProperty("touch.touchSize.calibration", "geometric");
@@ -3559,6 +3597,7 @@
 
 TEST_F(MultiTouchInputMapperTest, Process_TouchToolPressureSizeAxes_SummedLinearCalibration) {
     MultiTouchInputMapper* mapper = new MultiTouchInputMapper(mDevice);
+    addConfigurationProperty("touch.deviceType", "touchScreen");
     prepareDisplay(DISPLAY_ORIENTATION_0);
     prepareAxes(POSITION | TOUCH | TOOL);
     addConfigurationProperty("touch.touchSize.calibration", "pressure");
@@ -3615,6 +3654,7 @@
 
 TEST_F(MultiTouchInputMapperTest, Process_TouchToolPressureSizeAxes_AreaCalibration) {
     MultiTouchInputMapper* mapper = new MultiTouchInputMapper(mDevice);
+    addConfigurationProperty("touch.deviceType", "touchScreen");
     prepareDisplay(DISPLAY_ORIENTATION_0);
     prepareAxes(POSITION | TOUCH | TOOL);
     addConfigurationProperty("touch.touchSize.calibration", "pressure");
diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/LoadTestsAutoTest.java b/tests/DumpRenderTree/src/com/android/dumprendertree/LoadTestsAutoTest.java
index 5bcf727..622fb0e 100644
--- a/tests/DumpRenderTree/src/com/android/dumprendertree/LoadTestsAutoTest.java
+++ b/tests/DumpRenderTree/src/com/android/dumprendertree/LoadTestsAutoTest.java
@@ -16,8 +16,6 @@
 
 package com.android.dumprendertree;
 
-import dalvik.system.VMRuntime;
-
 import android.app.Instrumentation;
 import android.content.Context;
 import android.content.Intent;
@@ -34,12 +32,15 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.PrintStream;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
 
 public class LoadTestsAutoTest extends ActivityInstrumentationTestCase2<TestShellActivity> {
 
     private final static String LOGTAG = "LoadTest";
     private final static String LOAD_TEST_RESULT =
         Environment.getExternalStorageDirectory() + "/load_test_result.txt";
+    private final static int MAX_GC_WAIT_SEC = 10;
     private boolean mFinished;
     static final String LOAD_TEST_RUNNER_FILES[] = {
         "run_page_cycler.py"
@@ -90,14 +91,23 @@
 
     private void freeMem() {
         Log.v(LOGTAG, "freeMem: calling gc...");
-        final VMRuntime runtime = VMRuntime.getRuntime();
-
-        runtime.gcSoftReferences();
-        runtime.gcSoftReferences();
-        runtime.gcSoftReferences();
-        Runtime.getRuntime().gc();
-        Runtime.getRuntime().gc();
-
+        final CountDownLatch latch = new CountDownLatch(1);
+        Object dummy = new Object() {
+            @Override
+            protected void finalize() throws Throwable {
+                latch.countDown();
+                super.finalize();
+            }
+        };
+        dummy = null;
+        System.gc();
+        try {
+            if (!latch.await(MAX_GC_WAIT_SEC, TimeUnit.SECONDS)) {
+                Log.w(LOGTAG, "gc did not happen in 10s");
+            }
+        } catch (InterruptedException e) {
+            //ignore
+        }
     }
 
     private void printRow(PrintStream ps, String format, Object...objs) {
diff --git a/tests/StatusBar/res/drawable-mdpi/pineapple.png b/tests/StatusBar/res/drawable-mdpi/pineapple.png
index 7377b96..a903723 100644
--- a/tests/StatusBar/res/drawable-mdpi/pineapple.png
+++ b/tests/StatusBar/res/drawable-mdpi/pineapple.png
Binary files differ
diff --git a/tests/StatusBar/res/drawable-mdpi/pineapple2.png b/tests/StatusBar/res/drawable-mdpi/pineapple2.png
index ddc1038..8e5009b 100644
--- a/tests/StatusBar/res/drawable-mdpi/pineapple2.png
+++ b/tests/StatusBar/res/drawable-mdpi/pineapple2.png
Binary files differ
diff --git a/tools/layoutlib/bridge/src/android/graphics/Region_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Region_Delegate.java
index 9b6fb82..d2b6b27 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Region_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Region_Delegate.java
@@ -446,6 +446,15 @@
         return region1.mArea.equals(region2.mArea);
     }
 
+    /*package*/ static String nativeToString(int native_region) {
+        Region_Delegate region = sManager.getDelegate(native_region);
+        if (region == null) {
+            return "not found";
+        }
+
+        return region.mArea.toString();
+    }
+
     // ---- Private delegate/helper methods ----
 
 }
diff --git a/tools/layoutlib/bridge/src/android/os/Build_Delegate.java b/tools/layoutlib/bridge/src/android/os/Build_Delegate.java
new file mode 100644
index 0000000..f71860f
--- /dev/null
+++ b/tools/layoutlib/bridge/src/android/os/Build_Delegate.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2011 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.os;
+
+import com.android.layoutlib.bridge.Bridge;
+import com.android.layoutlib.bridge.impl.DelegateManager;
+
+import java.util.Map;
+
+/**
+ * Delegate implementing the native methods of android.os.Build
+ *
+ * Through the layoutlib_create tool, the original native methods of Build have been replaced
+ * by calls to methods of the same name in this delegate class.
+ *
+ * Because it's a stateless class to start with, there's no need to keep a {@link DelegateManager}
+ * around to map int to instance of the delegate.
+ *
+ */
+public class Build_Delegate {
+
+    /*package*/ static String getString(String property) {
+        Map<String, String> properties = Bridge.getPlatformProperties();
+        String value = properties.get(property);
+        if (value != null) {
+            return value;
+        }
+
+        return Build.UNKNOWN;
+    }
+
+}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java
index 37576b4..0c3aef4 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java
@@ -93,6 +93,7 @@
         new HashMap<String, SoftReference<NinePatchChunk>>();
 
     private static Map<String, Map<String, Integer>> sEnumValueMap;
+    private static Map<String, String> sPlatformProperties;
 
     /**
      * int[] wrapper to use as keys in maps.
@@ -157,10 +158,8 @@
      */
     private static LayoutLog sCurrentLog = sDefaultLog;
 
-
     private EnumSet<Capability> mCapabilities;
 
-
     @Override
     public int getApiLevel() {
         return com.android.ide.common.rendering.api.Bridge.API_CURRENT;
@@ -172,8 +171,11 @@
     }
 
     @Override
-    public boolean init(File fontLocation, Map<String, Map<String, Integer>> enumValueMap,
+    public boolean init(Map<String,String> platformProperties,
+            File fontLocation,
+            Map<String, Map<String, Integer>> enumValueMap,
             LayoutLog log) {
+        sPlatformProperties = platformProperties;
         sEnumValueMap = enumValueMap;
 
         // don't use EnumSet.allOf(), because the bridge doesn't come with its specific version
@@ -429,6 +431,13 @@
     }
 
     /**
+     * Returns the platform build properties.
+     */
+    public static Map<String, String> getPlatformProperties() {
+        return sPlatformProperties;
+    }
+
+    /**
      * Returns the bitmap for a specific path, from a specific project cache, or from the
      * framework cache.
      * @param value the path of the bitmap
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeRenderSession.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeRenderSession.java
index bc2301d..3bc0202 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeRenderSession.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeRenderSession.java
@@ -30,6 +30,7 @@
 import android.view.ViewParent;
 
 import java.awt.image.BufferedImage;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -55,8 +56,8 @@
     }
 
     @Override
-    public ViewInfo getRootView() {
-        return mSession.getViewInfo();
+    public List<ViewInfo> getRootViews() {
+        return mSession.getViewInfos();
     }
 
     @Override
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java
index 63d52e9..d7b7009 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java
@@ -116,7 +116,7 @@
 
     // information being returned through the API
     private BufferedImage mImage;
-    private ViewInfo mViewInfo;
+    private List<ViewInfo> mViewInfoList;
 
     private static final class PostInflateException extends Exception {
         private static final long serialVersionUID = 1L;
@@ -478,7 +478,7 @@
 
             mViewRoot.draw(mCanvas);
 
-            mViewInfo = visit(((ViewGroup)mViewRoot).getChildAt(0), mContext);
+            mViewInfoList = visitAllChildren((ViewGroup)mViewRoot, mContext);
 
             // success!
             return SUCCESS.createResult();
@@ -1101,16 +1101,25 @@
 
         if (view instanceof ViewGroup) {
             ViewGroup group = ((ViewGroup) view);
-            List<ViewInfo> children = new ArrayList<ViewInfo>();
-            for (int i = 0; i < group.getChildCount(); i++) {
-                children.add(visit(group.getChildAt(i), context));
-            }
-            result.setChildren(children);
+            result.setChildren(visitAllChildren(group, context));
         }
 
         return result;
     }
 
+    private List<ViewInfo> visitAllChildren(ViewGroup viewGroup, BridgeContext context) {
+        if (viewGroup == null) {
+            return null;
+        }
+
+        List<ViewInfo> children = new ArrayList<ViewInfo>();
+        for (int i = 0; i < viewGroup.getChildCount(); i++) {
+            children.add(visit(viewGroup.getChildAt(i), context));
+        }
+        return children;
+    }
+
+
     private void invalidateRenderingSize() {
         mMeasuredScreenWidth = mMeasuredScreenHeight = -1;
     }
@@ -1119,8 +1128,8 @@
         return mImage;
     }
 
-    public ViewInfo getViewInfo() {
-        return mViewInfo;
+    public List<ViewInfo> getViewInfos() {
+        return mViewInfoList;
     }
 
     public Map<String, String> getDefaultProperties(Object viewObject) {
diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java
index e3c5b4b..55e9e48 100644
--- a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java
+++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java
@@ -96,6 +96,7 @@
     private final static String[] DELEGATE_METHODS = new String[] {
         "android.app.Fragment#instantiate", //(Landroid/content/Context;Ljava/lang/String;Landroid/os/Bundle;)Landroid/app/Fragment;",
         "android.os.Handler#sendMessageAtTime",
+        "android.os.Build#getString",
         "android.view.LayoutInflater#rInflate",
         "android.view.View#isInEditMode",
         "com.android.internal.util.XmlUtils#convertValueToInt",