Merge "VpnDialogs: use IConnectivityManager instead or ConnectivityManager."
diff --git a/core/java/android/net/DhcpStateMachine.java b/core/java/android/net/DhcpStateMachine.java
index eaf087f..c49c019 100644
--- a/core/java/android/net/DhcpStateMachine.java
+++ b/core/java/android/net/DhcpStateMachine.java
@@ -66,6 +66,9 @@
     private static final int DHCP_RENEW = 0;
     private static final String ACTION_DHCP_RENEW = "android.net.wifi.DHCP_RENEW";
 
+    //Used for sanity check on setting up renewal
+    private static final int MIN_RENEWAL_TIME_SECS = 5 * 60;  // 5 minutes
+
     private enum DhcpAction {
         START,
         RENEW
@@ -331,13 +334,21 @@
 
         if (success) {
             Log.d(TAG, "DHCP succeeded on " + mInterfaceName);
-            //Do it a bit earlier than half the lease duration time
-            //to beat the native DHCP client and avoid extra packets
-            //48% for one hour lease time = 29 minutes
-            mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP,
-                    SystemClock.elapsedRealtime() +
-                    dhcpInfoInternal.leaseDuration * 480, //in milliseconds
-                    mDhcpRenewalIntent);
+           long leaseDuration = dhcpInfoInternal.leaseDuration; //int to long conversion
+
+           //Sanity check for renewal
+           //TODO: would be good to notify the user that his network configuration is
+           //bad and that the device cannot renew below MIN_RENEWAL_TIME_SECS
+           if (leaseDuration < MIN_RENEWAL_TIME_SECS) {
+               leaseDuration = MIN_RENEWAL_TIME_SECS;
+           }
+           //Do it a bit earlier than half the lease duration time
+           //to beat the native DHCP client and avoid extra packets
+           //48% for one hour lease time = 29 minutes
+           mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP,
+                   SystemClock.elapsedRealtime() +
+                   leaseDuration * 480, //in milliseconds
+                   mDhcpRenewalIntent);
 
             mController.obtainMessage(CMD_POST_DHCP_ACTION, DHCP_SUCCESS, 0, dhcpInfoInternal)
                 .sendToTarget();
diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java
index 00e2998..1816066 100644
--- a/core/java/android/provider/ContactsContract.java
+++ b/core/java/android/provider/ContactsContract.java
@@ -1298,6 +1298,15 @@
         public static final Uri CONTENT_VCARD_URI = Uri.withAppendedPath(CONTENT_URI,
                 "as_vcard");
 
+       /**
+        * Boolean parameter that may be used with {@link #CONTENT_VCARD_URI}
+        * and {@link #CONTENT_MULTI_VCARD_URI} to indicate that the returned
+        * vcard should not contain a photo.
+        *
+        * @hide
+        */
+        public static final String QUERY_PARAMETER_VCARD_NO_PHOTO = "nophoto";
+
         /**
          * Base {@link Uri} for referencing multiple {@link Contacts} entry,
          * created by appending {@link #LOOKUP_KEY} using
diff --git a/core/java/android/view/GLES20Canvas.java b/core/java/android/view/GLES20Canvas.java
index 383bfb3..5216c49 100644
--- a/core/java/android/view/GLES20Canvas.java
+++ b/core/java/android/view/GLES20Canvas.java
@@ -29,6 +29,7 @@
 import android.graphics.RectF;
 import android.graphics.Region;
 import android.graphics.Shader;
+import android.graphics.SurfaceTexture;
 import android.graphics.TemporaryBuffer;
 import android.text.GraphicsOperations;
 import android.text.SpannableString;
@@ -163,7 +164,7 @@
     static native int nCreateTextureLayer(int[] layerInfo);
     static native int nCreateLayer(int width, int height, boolean isOpaque, int[] layerInfo);
     static native void nResizeLayer(int layerId, int width, int height, int[] layerInfo);
-    static native void nUpdateTextureLayer(int layerId, int width, int height, int surface);
+    static native void nUpdateTextureLayer(int layerId, int width, int height, SurfaceTexture surface);
     static native void nDestroyLayer(int layerId);
     static native void nDestroyLayerDeferred(int layerId);
     static native boolean nCopyLayer(int layerId, int bitmap);
diff --git a/core/java/android/view/GLES20TextureLayer.java b/core/java/android/view/GLES20TextureLayer.java
index fcf421b..063eee7 100644
--- a/core/java/android/view/GLES20TextureLayer.java
+++ b/core/java/android/view/GLES20TextureLayer.java
@@ -70,7 +70,7 @@
         return mSurface;
     }
 
-    void update(int width, int height, int surface) {
-        GLES20Canvas.nUpdateTextureLayer(mLayer, width, height, surface);
+    void update(int width, int height) {
+        GLES20Canvas.nUpdateTextureLayer(mLayer, width, height, mSurface);
     }
 }
diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java
index 5944bd4..5ceb12a 100644
--- a/core/java/android/view/HardwareRenderer.java
+++ b/core/java/android/view/HardwareRenderer.java
@@ -194,7 +194,7 @@
      * 
      * @return A {@link SurfaceTexture}
      */
-    abstract SurfaceTexture createSuraceTexture(HardwareLayer layer);
+    abstract SurfaceTexture createSurfaceTexture(HardwareLayer layer);
 
     /**
      * Updates the specified layer.
@@ -202,10 +202,8 @@
      * @param layer The hardware layer to update
      * @param width The layer's width
      * @param height The layer's height
-     * @param surface The surface to update
      */
-    abstract void updateTextureLayer(HardwareLayer layer, int width, int height,
-            SurfaceTexture surface);
+    abstract void updateTextureLayer(HardwareLayer layer, int width, int height);
 
     /**
      * Copies the content of the specified layer into the specified bitmap.
@@ -815,14 +813,13 @@
         }
 
         @Override
-        SurfaceTexture createSuraceTexture(HardwareLayer layer) {
+        SurfaceTexture createSurfaceTexture(HardwareLayer layer) {
             return ((GLES20TextureLayer) layer).getSurfaceTexture();
         }
 
         @Override
-        void updateTextureLayer(HardwareLayer layer, int width, int height,
-                SurfaceTexture surface) {
-            ((GLES20TextureLayer) layer).update(width, height, surface.mSurfaceTexture);
+        void updateTextureLayer(HardwareLayer layer, int width, int height) {
+            ((GLES20TextureLayer) layer).update(width, height);
         }
 
         @Override
diff --git a/core/java/android/view/TextureView.java b/core/java/android/view/TextureView.java
index 4daa892..164c657 100644
--- a/core/java/android/view/TextureView.java
+++ b/core/java/android/view/TextureView.java
@@ -232,7 +232,7 @@
     protected void onSizeChanged(int w, int h, int oldw, int oldh) {
         super.onSizeChanged(w, h, oldw, oldh);
         if (mSurface != null) {
-            nSetDefaultBufferSize(mSurface.mSurfaceTexture, getWidth(), getHeight());
+            nSetDefaultBufferSize(mSurface, getWidth(), getHeight());
             if (mListener != null) {
                 mListener.onSurfaceTextureSizeChanged(mSurface, getWidth(), getHeight());
             }
@@ -247,8 +247,8 @@
 
         if (mLayer == null) {
             mLayer = mAttachInfo.mHardwareRenderer.createHardwareLayer();
-            mSurface = mAttachInfo.mHardwareRenderer.createSuraceTexture(mLayer);
-            nSetDefaultBufferSize(mSurface.mSurfaceTexture, getWidth(), getHeight());
+            mSurface = mAttachInfo.mHardwareRenderer.createSurfaceTexture(mLayer);
+            nSetDefaultBufferSize(mSurface, getWidth(), getHeight());
 
             mUpdateListener = new SurfaceTexture.OnFrameAvailableListener() {
                 @Override
@@ -290,7 +290,7 @@
             return;
         }
 
-        mAttachInfo.mHardwareRenderer.updateTextureLayer(mLayer, getWidth(), getHeight(), mSurface);
+        mAttachInfo.mHardwareRenderer.updateTextureLayer(mLayer, getWidth(), getHeight());
 
         invalidate();
     }
@@ -447,5 +447,5 @@
         public void onSurfaceTextureDestroyed(SurfaceTexture surface);
     }
 
-    private static native void nSetDefaultBufferSize(int surfaceTexture, int width, int height);
+    private static native void nSetDefaultBufferSize(SurfaceTexture surfaceTexture, int width, int height);
 }
diff --git a/core/java/android/widget/CompoundButton.java b/core/java/android/widget/CompoundButton.java
index a730018..2410eb2 100644
--- a/core/java/android/widget/CompoundButton.java
+++ b/core/java/android/widget/CompoundButton.java
@@ -28,6 +28,7 @@
 import android.view.Gravity;
 import android.view.ViewDebug;
 import android.view.accessibility.AccessibilityEvent;
+import android.view.accessibility.AccessibilityNodeInfo;
 
 /**
  * <p>
@@ -214,6 +215,12 @@
     }
 
     @Override
+    public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
+        super.onInitializeAccessibilityNodeInfo(info);
+        info.setChecked(mChecked);
+    }
+
+    @Override
     protected void onDraw(Canvas canvas) {
         super.onDraw(canvas);
 
diff --git a/core/java/com/android/internal/statusbar/IStatusBar.aidl b/core/java/com/android/internal/statusbar/IStatusBar.aidl
index 2ff0413..c11fc10 100644
--- a/core/java/com/android/internal/statusbar/IStatusBar.aidl
+++ b/core/java/com/android/internal/statusbar/IStatusBar.aidl
@@ -35,5 +35,6 @@
     void setImeWindowStatus(in IBinder token, int vis, int backDisposition);
     void setHardKeyboardStatus(boolean available, boolean enabled);
     void userActivity();
+    void toggleRecentApps();
 }
 
diff --git a/core/java/com/android/internal/statusbar/IStatusBarService.aidl b/core/java/com/android/internal/statusbar/IStatusBarService.aidl
index 3f2b1ef..a9e5057 100644
--- a/core/java/com/android/internal/statusbar/IStatusBarService.aidl
+++ b/core/java/com/android/internal/statusbar/IStatusBarService.aidl
@@ -47,4 +47,5 @@
     void setSystemUiVisibility(int vis);
     void setHardKeyboardEnabled(boolean enabled);
     void userActivity();
+    void toggleRecentApps();
 }
diff --git a/core/jni/android_view_GLES20Canvas.cpp b/core/jni/android_view_GLES20Canvas.cpp
index 7e82efb..84ad012 100644
--- a/core/jni/android_view_GLES20Canvas.cpp
+++ b/core/jni/android_view_GLES20Canvas.cpp
@@ -22,6 +22,7 @@
 #include "GraphicsJNI.h"
 #include <nativehelper/JNIHelp.h>
 #include <android_runtime/AndroidRuntime.h>
+#include <android_runtime/android_graphics_SurfaceTexture.h>
 #include <utils/ResourceTypes.h>
 
 #include <gui/SurfaceTexture.h>
@@ -644,11 +645,13 @@
 }
 
 static void android_view_GLES20Canvas_updateTextureLayer(JNIEnv* env, jobject clazz,
-        Layer* layer, jint width, jint height, SurfaceTexture* surface) {
+        Layer* layer, jint width, jint height, jobject surface) {
     float transform[16];
-    surface->updateTexImage();
-    surface->getTransformMatrix(transform);
-    GLenum renderTarget = surface->getCurrentTextureTarget();
+    sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, surface));
+
+    surfaceTexture->updateTexImage();
+    surfaceTexture->getTransformMatrix(transform);
+    GLenum renderTarget = surfaceTexture->getCurrentTextureTarget();
 
     LayerRenderer::updateTextureLayer(layer, width, height, renderTarget, transform);
 }
@@ -793,7 +796,8 @@
     { "nCreateLayer",            "(IIZ[I)I",   (void*) android_view_GLES20Canvas_createLayer },
     { "nResizeLayer",            "(III[I)V" ,  (void*) android_view_GLES20Canvas_resizeLayer },
     { "nCreateTextureLayer",     "([I)I",      (void*) android_view_GLES20Canvas_createTextureLayer },
-    { "nUpdateTextureLayer",     "(IIII)V",    (void*) android_view_GLES20Canvas_updateTextureLayer },
+    { "nUpdateTextureLayer",     "(IIILjava/lang/String;)V",
+                                               (void*) android_view_GLES20Canvas_updateTextureLayer },
     { "nDestroyLayer",           "(I)V",       (void*) android_view_GLES20Canvas_destroyLayer },
     { "nDestroyLayerDeferred",   "(I)V",       (void*) android_view_GLES20Canvas_destroyLayerDeferred },
     { "nDrawLayer",              "(IIFFI)V",   (void*) android_view_GLES20Canvas_drawLayer },
diff --git a/core/jni/com_google_android_gles_jni_EGLImpl.cpp b/core/jni/com_google_android_gles_jni_EGLImpl.cpp
index f777527..7a0668e 100644
--- a/core/jni/com_google_android_gles_jni_EGLImpl.cpp
+++ b/core/jni/com_google_android_gles_jni_EGLImpl.cpp
@@ -18,6 +18,7 @@
 #include "JNIHelp.h"
 #include <android_runtime/AndroidRuntime.h>
 #include <android_runtime/android_view_Surface.h>
+#include <android_runtime/android_graphics_SurfaceTexture.h>
 #include <utils/misc.h>
 
 #include <EGL/egl.h>
@@ -323,7 +324,7 @@
 }
 
 static jint jni_eglCreateWindowSurfaceTexture(JNIEnv *_env, jobject _this, jobject display,
-        jobject config, jint native_window, jintArray attrib_list) {
+        jobject config, jobject native_window, jintArray attrib_list) {
     if (display == NULL || config == NULL
         || !validAttribList(_env, attrib_list)) {
         jniThrowException(_env, "java/lang/IllegalArgumentException", NULL);
@@ -339,7 +340,7 @@
         return 0;
     }
     
-    sp<SurfaceTexture> surfaceTexture = reinterpret_cast<SurfaceTexture*>(native_window);
+    sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(_env, native_window));
 
     window = new SurfaceTextureClient(surfaceTexture);
     if (window == NULL)
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 3b4798e..e6dfc03 100755
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -389,9 +389,11 @@
     <!-- Control the behavior when the user long presses the power button.
             0 - Nothing
             1 - Recent apps dialog
-            2 - Recent apps activity in SystemUI
+            2 - Recent apps view in SystemUI
+         This needs to match the constants in
+         policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
     -->
-    <integer name="config_longPressOnHomeBehavior">1</integer>
+    <integer name="config_longPressOnHomeBehavior">2</integer>
 
     <!-- Array of light sensor LUX values to define our levels for auto backlight brightness support.
          The N entries of this array define N + 1 zones as follows:
@@ -633,4 +635,11 @@
 
     <!-- Set to true if the RSSI should always display CDMA signal strength even on EVDO -->
     <bool name="config_alwaysUseCdmaRssi">false</bool>
+
+    <!-- If this value is true, duplicate Source/Destination port fields
+         in WDP header of some carriers OMADM wap push are supported.
+         ex: MSGTYPE-TotalSegments-CurrentSegment
+             -SourcePortDestPort-SourcePortDestPort-OMADM PDU
+         If false, not supported. -->
+    <bool name="config_duplicate_port_omadm_wappush">false</bool>
 </resources>
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 34bc6bb..879892e 100755
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -901,16 +901,16 @@
         contact (address) data stored on your phone. Malicious
         applications can use this to erase or modify your contact data.</string>
 
-    <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+    <!-- Title of the read profile permission, listed so the user can decide whether to allow the application to read the user's personal profile data. [CHAR LIMIT=30] -->
     <string name="permlab_readProfile">read profile data</string>
-    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+    <!-- Description of the read profile permission, listed so the user can decide whether to allow the application to read the user's personal profile data. [CHAR LIMIT=NONE] -->
     <string name="permdesc_readProfile" product="default">Allows an application to read all
         of your personal profile information. Malicious applications can use this to identify
         you and send your personal information to other people.</string>
 
-    <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+    <!-- Title of the write profile permission, listed so the user can decide whether to allow the application to write to the user's personal profile data. [CHAR LIMIT=30] -->
     <string name="permlab_writeProfile">write profile data</string>
-    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+    <!-- Description of the write profile permission, listed so the user can decide whether to allow the application to write to the user's personal profile data. [CHAR LIMIT=NONE] -->
     <string name="permdesc_writeProfile" product="default">Allows an application to modify
         your personal profile information. Malicious applications can use this to erase or
         modify your profile data.</string>
diff --git a/graphics/java/android/graphics/SurfaceTexture.java b/graphics/java/android/graphics/SurfaceTexture.java
index 0ffd201..6c7341f 100644
--- a/graphics/java/android/graphics/SurfaceTexture.java
+++ b/graphics/java/android/graphics/SurfaceTexture.java
@@ -66,11 +66,8 @@
 
     /**
      * This field is used by native code, do not access or modify.
-     * 
-     * @hide
      */
-    @SuppressWarnings({"UnusedDeclaration"})
-    public int mSurfaceTexture;
+    private int mSurfaceTexture;
 
     /**
      * Callback interface for being notified that a new stream frame is available.
diff --git a/opengl/java/com/google/android/gles_jni/EGLImpl.java b/opengl/java/com/google/android/gles_jni/EGLImpl.java
index f162d40..51d6ca8 100644
--- a/opengl/java/com/google/android/gles_jni/EGLImpl.java
+++ b/opengl/java/com/google/android/gles_jni/EGLImpl.java
@@ -85,7 +85,7 @@
             eglSurfaceId = _eglCreateWindowSurface(display, config, sur, attrib_list);
         } else if (native_window instanceof SurfaceTexture) {
             eglSurfaceId = _eglCreateWindowSurfaceTexture(display, config,
-                    ((SurfaceTexture) native_window).mSurfaceTexture, attrib_list);
+                    (SurfaceTexture) native_window, attrib_list);
         } else {
             throw new java.lang.UnsupportedOperationException(
                 "eglCreateWindowSurface() can only be called with an instance of " +
@@ -143,7 +143,7 @@
     private native int _eglCreatePbufferSurface(EGLDisplay display, EGLConfig config, int[] attrib_list);
     private native void _eglCreatePixmapSurface(EGLSurface sur, EGLDisplay display, EGLConfig config, Object native_pixmap, int[] attrib_list);
     private native int _eglCreateWindowSurface(EGLDisplay display, EGLConfig config, Object native_window, int[] attrib_list);
-    private native int _eglCreateWindowSurfaceTexture(EGLDisplay display, EGLConfig config, int native_window, int[] attrib_list);
+    private native int _eglCreateWindowSurfaceTexture(EGLDisplay display, EGLConfig config, Object native_window, int[] attrib_list);
     private native int _eglGetDisplay(Object native_display);
     private native int _eglGetCurrentContext();
     private native int _eglGetCurrentDisplay();
diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml
index bbe146d6..55f5280 100644
--- a/packages/SystemUI/AndroidManifest.xml
+++ b/packages/SystemUI/AndroidManifest.xml
@@ -33,13 +33,6 @@
                 android:excludeFromRecents="true">
         </activity>
 
-        <activity android:name=".recent.RecentApplicationsActivity"
-            android:theme="@android:style/Theme.NoTitleBar"
-            android:excludeFromRecents="true"
-            android:launchMode="singleInstance"
-            android:exported="true">
-        </activity>
-
         <!-- started from UsbDeviceSettingsManager -->
         <activity android:name=".usb.UsbConfirmActivity"
             android:exported="true"
diff --git a/packages/SystemUI/res/drawable-hdpi/compat_mode_help_diagram.png b/packages/SystemUI/res/drawable-hdpi/compat_mode_help_diagram.png
new file mode 100644
index 0000000..944b1f0
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/compat_mode_help_diagram.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/compat_mode_help_divider_bottom.9.png b/packages/SystemUI/res/drawable-hdpi/compat_mode_help_divider_bottom.9.png
new file mode 100644
index 0000000..2e11928
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/compat_mode_help_divider_bottom.9.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/compat_mode_help_divider_top.9.png b/packages/SystemUI/res/drawable-hdpi/compat_mode_help_divider_top.9.png
new file mode 100644
index 0000000..58a78b7
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/compat_mode_help_divider_top.9.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/compat_mode_help_icon.png b/packages/SystemUI/res/drawable-hdpi/compat_mode_help_icon.png
new file mode 100644
index 0000000..46bb891
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/compat_mode_help_icon.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/compat_mode_help_top_divider.9.png b/packages/SystemUI/res/drawable-hdpi/compat_mode_help_top_divider.9.png
new file mode 100644
index 0000000..03a5639
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/compat_mode_help_top_divider.9.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/recents_thumbnail_bg.png b/packages/SystemUI/res/drawable-hdpi/recents_thumbnail_bg.png
index 87a67c9..23aabce 100644
--- a/packages/SystemUI/res/drawable-hdpi/recents_thumbnail_bg.png
+++ b/packages/SystemUI/res/drawable-hdpi/recents_thumbnail_bg.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/recents_thumbnail_bg_press.png b/packages/SystemUI/res/drawable-hdpi/recents_thumbnail_bg_press.png
new file mode 100644
index 0000000..0b0765b
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/recents_thumbnail_bg_press.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-large-hdpi/app_icon.png b/packages/SystemUI/res/drawable-large-hdpi/app_icon.png
deleted file mode 100644
index aedf7e7..0000000
--- a/packages/SystemUI/res/drawable-large-hdpi/app_icon.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-large-hdpi/recents_bg_protect_tile.png b/packages/SystemUI/res/drawable-large-hdpi/recents_bg_protect_tile.png
deleted file mode 100644
index a57c27a..0000000
--- a/packages/SystemUI/res/drawable-large-hdpi/recents_bg_protect_tile.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-large-mdpi/app_icon.png b/packages/SystemUI/res/drawable-large-mdpi/app_icon.png
deleted file mode 100644
index 50a8ac8..0000000
--- a/packages/SystemUI/res/drawable-large-mdpi/app_icon.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-large-mdpi/recents_bg_protect_tile.png b/packages/SystemUI/res/drawable-large-mdpi/recents_bg_protect_tile.png
deleted file mode 100644
index 87c7be6..0000000
--- a/packages/SystemUI/res/drawable-large-mdpi/recents_bg_protect_tile.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-large-mdpi/recents_blue_glow.9.png b/packages/SystemUI/res/drawable-large-mdpi/recents_blue_glow.9.png
deleted file mode 100644
index 4f4ae78..0000000
--- a/packages/SystemUI/res/drawable-large-mdpi/recents_blue_glow.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-large-mdpi/recents_callout_line.png b/packages/SystemUI/res/drawable-large-mdpi/recents_callout_line.png
deleted file mode 100644
index 5f4c035..0000000
--- a/packages/SystemUI/res/drawable-large-mdpi/recents_callout_line.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-large-mdpi/recents_thumbnail_bg.png b/packages/SystemUI/res/drawable-large-mdpi/recents_thumbnail_bg.png
deleted file mode 100644
index 87a67c9..0000000
--- a/packages/SystemUI/res/drawable-large-mdpi/recents_thumbnail_bg.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-large-mdpi/recents_thumbnail_bg_press.png b/packages/SystemUI/res/drawable-large-mdpi/recents_thumbnail_bg_press.png
deleted file mode 100644
index a1c39e6..0000000
--- a/packages/SystemUI/res/drawable-large-mdpi/recents_thumbnail_bg_press.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/compat_mode_help_diagram.png b/packages/SystemUI/res/drawable-mdpi/compat_mode_help_diagram.png
new file mode 100644
index 0000000..518a5c1
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/compat_mode_help_diagram.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/compat_mode_help_divider_bottom.9.png b/packages/SystemUI/res/drawable-mdpi/compat_mode_help_divider_bottom.9.png
new file mode 100644
index 0000000..3712abf
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/compat_mode_help_divider_bottom.9.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/compat_mode_help_divider_top.9.png b/packages/SystemUI/res/drawable-mdpi/compat_mode_help_divider_top.9.png
new file mode 100644
index 0000000..a4d08c8
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/compat_mode_help_divider_top.9.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/compat_mode_help_icon.png b/packages/SystemUI/res/drawable-mdpi/compat_mode_help_icon.png
new file mode 100644
index 0000000..233c4df
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/compat_mode_help_icon.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/recents_thumbnail_bg.png b/packages/SystemUI/res/drawable-mdpi/recents_thumbnail_bg.png
index 87a67c9..23aabce 100644
--- a/packages/SystemUI/res/drawable-mdpi/recents_thumbnail_bg.png
+++ b/packages/SystemUI/res/drawable-mdpi/recents_thumbnail_bg.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/recents_thumbnail_bg_press.png b/packages/SystemUI/res/drawable-mdpi/recents_thumbnail_bg_press.png
index a1c39e6..0b0765b 100644
--- a/packages/SystemUI/res/drawable-mdpi/recents_thumbnail_bg_press.png
+++ b/packages/SystemUI/res/drawable-mdpi/recents_thumbnail_bg_press.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-nodpi/compat_mode_help_bg.png b/packages/SystemUI/res/drawable-nodpi/compat_mode_help_bg.png
index d1d32a4..59a70ff 100644
--- a/packages/SystemUI/res/drawable-nodpi/compat_mode_help_bg.png
+++ b/packages/SystemUI/res/drawable-nodpi/compat_mode_help_bg.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-sw600dp-hdpi/app_icon.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/app_icon.png
deleted file mode 100644
index aedf7e7..0000000
--- a/packages/SystemUI/res/drawable-sw600dp-hdpi/app_icon.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-sw600dp-mdpi/app_icon.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/app_icon.png
deleted file mode 100644
index 50a8ac8..0000000
--- a/packages/SystemUI/res/drawable-sw600dp-mdpi/app_icon.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable/compat_mode_help_bg.png b/packages/SystemUI/res/drawable/compat_mode_help_bg.png
new file mode 100644
index 0000000..87d8c41
--- /dev/null
+++ b/packages/SystemUI/res/drawable/compat_mode_help_bg.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable/compat_mode_help_diagram.png b/packages/SystemUI/res/drawable/compat_mode_help_diagram.png
deleted file mode 100644
index e212231..0000000
--- a/packages/SystemUI/res/drawable/compat_mode_help_diagram.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable/compat_mode_help_icon.png b/packages/SystemUI/res/drawable/compat_mode_help_icon.png
deleted file mode 100644
index 03bbef9..0000000
--- a/packages/SystemUI/res/drawable/compat_mode_help_icon.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/layout-land/status_bar_recent_item.xml b/packages/SystemUI/res/layout-land/status_bar_recent_item.xml
index ce72f04..be4f1d7 100644
--- a/packages/SystemUI/res/layout-land/status_bar_recent_item.xml
+++ b/packages/SystemUI/res/layout-land/status_bar_recent_item.xml
@@ -39,8 +39,8 @@
         android:layout_height="wrap_content"
         android:layout_alignLeft="@id/app_thumbnail"
         android:layout_alignTop="@id/app_thumbnail"
-        android:layout_marginLeft="@dimen/status_bar_recents_thumbnail_border_width"
-        android:layout_marginTop="@dimen/status_bar_recents_thumbnail_border_height"
+        android:layout_marginTop="@dimen/status_bar_recents_app_icon_top_margin"
+        android:layout_marginLeft="@dimen/status_bar_recents_app_icon_left_margin"
         android:maxWidth="@dimen/status_bar_recents_thumbnail_max_width"
         android:maxHeight="@dimen/status_bar_recents_thumbnail_max_height"
         android:adjustViewBounds="true"
@@ -56,7 +56,7 @@
         android:layout_alignLeft="@id/app_thumbnail"
         android:layout_below="@id/app_thumbnail"
         android:layout_marginTop="@dimen/status_bar_recents_text_description_padding"
-        android:layout_marginLeft="@dimen/status_bar_recents_thumbnail_border_width"
+        android:layout_marginLeft="@dimen/recents_thumbnail_bg_padding_left"
         android:singleLine="true"
         android:ellipsize="marquee"
     />
@@ -71,7 +71,7 @@
         android:layout_alignLeft="@id/app_thumbnail"
         android:layout_below="@id/app_label"
         android:layout_marginTop="@dimen/status_bar_recents_text_description_padding"
-        android:layout_marginLeft="@dimen/status_bar_recents_thumbnail_border_width"
+        android:layout_marginLeft="@dimen/recents_thumbnail_bg_padding_left"
         android:singleLine="true"
         android:ellipsize="marquee"
     />
diff --git a/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml b/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml
index 75f5ee4..4a80489 100644
--- a/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml
+++ b/packages/SystemUI/res/layout-land/status_bar_recent_panel.xml
@@ -27,10 +27,9 @@
     <FrameLayout
         android:id="@+id/recents_bg_protect"
         android:background="@drawable/recents_bg_protect_tile"
-        android:layout_width="wrap_content"
+        android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:layout_alignParentBottom="true"
-        android:layout_alignParentRight="true"
         android:paddingBottom="@*android:dimen/status_bar_height"
         android:clipToPadding="false"
         android:clipChildren="false">
diff --git a/packages/SystemUI/res/layout/status_bar_recent_item.xml b/packages/SystemUI/res/layout-port/status_bar_recent_item.xml
similarity index 73%
rename from packages/SystemUI/res/layout/status_bar_recent_item.xml
rename to packages/SystemUI/res/layout-port/status_bar_recent_item.xml
index cd42d7e..76965c9 100644
--- a/packages/SystemUI/res/layout/status_bar_recent_item.xml
+++ b/packages/SystemUI/res/layout-port/status_bar_recent_item.xml
@@ -36,53 +36,52 @@
     <ImageView android:id="@+id/app_icon"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_alignParentLeft="true"
-        android:layout_alignParentTop="true"
-        android:layout_marginLeft="131dip"
-        android:layout_marginTop="13dip"
+        android:layout_alignLeft="@id/app_thumbnail"
+        android:layout_alignTop="@id/app_thumbnail"
+        android:layout_marginLeft="@dimen/status_bar_recents_app_icon_left_margin"
+        android:layout_marginTop="@dimen/status_bar_recents_app_icon_top_margin"
         android:maxWidth="@dimen/status_bar_recents_thumbnail_max_width"
         android:maxHeight="@dimen/status_bar_recents_thumbnail_max_height"
         android:adjustViewBounds="true"
     />
 
-    <View android:id="@+id/recents_callout_line"
-        android:layout_width="97dip"
-        android:layout_height="1dip"
-        android:layout_alignParentTop="true"
-        android:layout_marginTop="61dip"
-        android:layout_alignParentLeft="true"
-        android:layout_marginLeft="16dip"
-        android:layout_toLeftOf="@id/app_thumbnail"
-        android:layout_marginRight="3dip"
-        android:background="@drawable/recents_callout_line"
-    />
-
     <TextView android:id="@+id/app_label"
-        android:layout_width="97dip"
+        android:layout_width="@dimen/status_bar_recents_app_label_width"
         android:layout_height="wrap_content"
-        android:textSize="@dimen/status_bar_recents_app_description_text_size"
+        android:textSize="@dimen/status_bar_recents_app_label_text_size"
         android:fadingEdge="horizontal"
         android:fadingEdgeLength="@dimen/status_bar_recents_fading_edge_length"
         android:scrollHorizontally="true"
         android:layout_alignParentLeft="true"
-        android:layout_alignParentTop="true"
-        android:layout_marginLeft="16dip"
-        android:layout_marginTop="32dip"
+        android:layout_alignTop="@id/app_icon"
+        android:layout_marginLeft="@dimen/status_bar_recents_app_label_left_margin"
         android:singleLine="true"
         android:ellipsize="marquee"
     />
 
+    <View android:id="@+id/recents_callout_line"
+        android:layout_width="@dimen/status_bar_recents_app_label_width"
+        android:layout_height="1dip"
+        android:layout_alignParentLeft="true"
+        android:layout_marginLeft="@dimen/status_bar_recents_app_label_left_margin"
+        android:layout_toLeftOf="@id/app_thumbnail"
+        android:layout_below="@id/app_label"
+        android:layout_marginRight="3dip"
+        android:layout_marginTop="3dip"
+        android:background="@drawable/recents_callout_line"
+    />
+
     <TextView android:id="@+id/app_description"
-        android:layout_width="97dip"
+        android:layout_width="@dimen/status_bar_recents_app_label_width"
         android:layout_height="wrap_content"
         android:textSize="@dimen/status_bar_recents_app_description_text_size"
         android:fadingEdge="horizontal"
         android:fadingEdgeLength="@dimen/status_bar_recents_fading_edge_length"
         android:scrollHorizontally="true"
         android:layout_alignParentLeft="true"
-        android:layout_alignParentTop="true"
-        android:layout_marginLeft="16dip"
-        android:layout_marginTop="61dip"
+        android:layout_marginLeft="@dimen/status_bar_recents_app_label_left_margin"
+        android:layout_below="@id/recents_callout_line"
+        android:layout_marginTop="3dip"
         android:singleLine="true"
         android:ellipsize="marquee"
     />
diff --git a/packages/SystemUI/res/layout/status_bar_recent_panel.xml b/packages/SystemUI/res/layout-port/status_bar_recent_panel.xml
similarity index 91%
rename from packages/SystemUI/res/layout/status_bar_recent_panel.xml
rename to packages/SystemUI/res/layout-port/status_bar_recent_panel.xml
index 703cbc1..9391f9d 100644
--- a/packages/SystemUI/res/layout/status_bar_recent_panel.xml
+++ b/packages/SystemUI/res/layout-port/status_bar_recent_panel.xml
@@ -22,12 +22,12 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/recents_root"
     android:layout_height="match_parent"
-    android:layout_width="wrap_content">
+    android:layout_width="match_parent">
 
     <FrameLayout
         android:id="@+id/recents_bg_protect"
         android:background="@drawable/recents_bg_protect_tile"
-        android:layout_width="wrap_content"
+        android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:layout_alignParentBottom="true"
         android:paddingBottom="@*android:dimen/status_bar_height"
@@ -35,9 +35,9 @@
         android:clipChildren="false">
 
         <LinearLayout android:id="@+id/recents_glow"
-            android:layout_width="wrap_content"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_marginBottom="-49dip"
+            android:layout_marginBottom="0dp"
             android:layout_gravity="bottom"
             android:background="@drawable/recents_blue_glow"
             android:orientation="horizontal"
@@ -47,7 +47,7 @@
             <com.android.systemui.recent.RecentsVerticalScrollView android:id="@+id/recents_container"
                 android:layout_width="@dimen/status_bar_recents_width"
                 android:layout_height="wrap_content"
-                android:layout_marginRight="@dimen/status_bar_recents_right_glow_margin"
+                android:layout_marginRight="0dp"
                 android:divider="@null"
                 android:stackFromBottom="true"
                 android:fadingEdge="vertical"
diff --git a/packages/SystemUI/res/layout-sw600dp/compat_mode_help.xml b/packages/SystemUI/res/layout-sw600dp/compat_mode_help.xml
index df3c5a3..d29e495 100644
--- a/packages/SystemUI/res/layout-sw600dp/compat_mode_help.xml
+++ b/packages/SystemUI/res/layout-sw600dp/compat_mode_help.xml
@@ -27,51 +27,62 @@
         android:id="@+id/header"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_marginLeft="160dp"
+        android:layout_marginLeft="80dp"
         android:layout_marginTop="80dp"
+        android:layout_marginRight="80dp"
         android:textSize="60sp"
         android:maxLines="1"
         android:shadowRadius="8"
         android:shadowColor="#FF000000"
         android:text="@string/compat_mode_help_header"
+        android:background="@drawable/compat_mode_help_divider_top"
         />
     <ImageView
         android:id="@+id/diagram"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_marginLeft="160dp"
-        android:layout_marginTop="80dp"
         android:layout_centerInParent="true"
         android:src="@drawable/compat_mode_help_diagram"
         />
-    <TextView
-        android:id="@+id/explanation"
+    <RelativeLayout
+        android:orientation="horizontal"
         android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_marginBottom="80dp"
-        android:layout_marginRight="240dp"
+        android:layout_height="190dp"
+        android:background="@drawable/compat_mode_help_divider_bottom"
+        android:layout_marginBottom="55dp"
+        android:layout_marginRight="80dp"
         android:layout_alignLeft="@id/header"
         android:layout_alignParentBottom="true"
-        android:shadowRadius="4"
-        android:shadowColor="#FF000000"
-        android:textSize="28sp"
-        android:text="@string/compat_mode_help_body"
-        />
-    <ImageView
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginRight="80dp"
-        android:layout_alignBottom="@id/explanation"
-        android:layout_alignParentRight="true"
-        android:src="@drawable/compat_mode_help_icon"
-        />
+        >
+        <ImageView
+            android:id="@+id/icon"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignParentRight="true"
+            android:layout_centerVertical="true"
+            android:src="@drawable/compat_mode_help_icon"
+            />
+        <TextView
+            android:id="@+id/explanation"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_centerVertical="true"
+            android:layout_alignParentLeft="true"
+            android:layout_toLeftOf="@id/icon"
+            android:layout_marginRight="10dp"
+            android:shadowRadius="4"
+            android:shadowColor="#FF000000"
+            android:textSize="28sp"
+            android:text="@string/compat_mode_help_body"
+            />
+    </RelativeLayout>
     <Button
         android:id="@+id/button"
         android:layout_width="208dp"
         android:layout_height="48dp"
         android:layout_alignLeft="@id/header"
         android:layout_alignParentBottom="true"
-        android:layout_marginBottom="10dp"
+        android:layout_marginBottom="20dp"
         android:textSize="28sp"
         android:text="@android:string/ok"
         />
diff --git a/packages/SystemUI/res/layout-sw600dp/status_bar_compat_mode_panel.xml b/packages/SystemUI/res/layout-sw600dp/status_bar_compat_mode_panel.xml
index c151565..a33741e 100644
--- a/packages/SystemUI/res/layout-sw600dp/status_bar_compat_mode_panel.xml
+++ b/packages/SystemUI/res/layout-sw600dp/status_bar_compat_mode_panel.xml
@@ -31,13 +31,13 @@
         android:orientation="vertical"
         android:padding="10dp"
         >
-        <RadioButton android:id="@+id/compat_mode_on_radio"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:text="@string/compat_mode_on" />
         <RadioButton android:id="@+id/compat_mode_off_radio"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:text="@string/compat_mode_off" />
+        <RadioButton android:id="@+id/compat_mode_on_radio"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/compat_mode_on" />
     </RadioGroup>
 </com.android.systemui.statusbar.tablet.CompatModePanel>
diff --git a/packages/SystemUI/res/layout-sw600dp/status_bar_recent_item.xml b/packages/SystemUI/res/layout-sw600dp/status_bar_recent_item.xml
index cd42d7e..9687866 100644
--- a/packages/SystemUI/res/layout-sw600dp/status_bar_recent_item.xml
+++ b/packages/SystemUI/res/layout-sw600dp/status_bar_recent_item.xml
@@ -36,53 +36,53 @@
     <ImageView android:id="@+id/app_icon"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_alignParentLeft="true"
-        android:layout_alignParentTop="true"
-        android:layout_marginLeft="131dip"
-        android:layout_marginTop="13dip"
+        android:layout_alignLeft="@id/app_thumbnail"
+        android:layout_alignTop="@id/app_thumbnail"
+        android:layout_marginLeft="@dimen/status_bar_recents_app_icon_left_margin"
+        android:layout_marginTop="@dimen/status_bar_recents_app_icon_top_margin"
         android:maxWidth="@dimen/status_bar_recents_thumbnail_max_width"
         android:maxHeight="@dimen/status_bar_recents_thumbnail_max_height"
         android:adjustViewBounds="true"
     />
 
-    <View android:id="@+id/recents_callout_line"
-        android:layout_width="97dip"
-        android:layout_height="1dip"
-        android:layout_alignParentTop="true"
-        android:layout_marginTop="61dip"
-        android:layout_alignParentLeft="true"
-        android:layout_marginLeft="16dip"
-        android:layout_toLeftOf="@id/app_thumbnail"
-        android:layout_marginRight="3dip"
-        android:background="@drawable/recents_callout_line"
-    />
-
     <TextView android:id="@+id/app_label"
-        android:layout_width="97dip"
+        android:layout_width="@dimen/status_bar_recents_app_label_width"
         android:layout_height="wrap_content"
-        android:textSize="@dimen/status_bar_recents_app_description_text_size"
+        android:textSize="@dimen/status_bar_recents_app_label_text_size"
         android:fadingEdge="horizontal"
         android:fadingEdgeLength="@dimen/status_bar_recents_fading_edge_length"
         android:scrollHorizontally="true"
         android:layout_alignParentLeft="true"
         android:layout_alignParentTop="true"
-        android:layout_marginLeft="16dip"
+        android:layout_marginLeft="@dimen/status_bar_recents_app_label_left_margin"
         android:layout_marginTop="32dip"
         android:singleLine="true"
         android:ellipsize="marquee"
     />
 
+    <View android:id="@+id/recents_callout_line"
+        android:layout_width="@dimen/status_bar_recents_app_label_width"
+        android:layout_height="1dip"
+        android:layout_below="@id/app_label"
+        android:layout_marginTop="3dip"
+        android:layout_alignParentLeft="true"
+        android:layout_marginLeft="@dimen/status_bar_recents_app_label_left_margin"
+        android:layout_toLeftOf="@id/app_thumbnail"
+        android:layout_marginRight="3dip"
+        android:background="@drawable/recents_callout_line"
+    />
+
     <TextView android:id="@+id/app_description"
-        android:layout_width="97dip"
+        android:layout_width="@dimen/status_bar_recents_app_label_width"
         android:layout_height="wrap_content"
         android:textSize="@dimen/status_bar_recents_app_description_text_size"
         android:fadingEdge="horizontal"
         android:fadingEdgeLength="@dimen/status_bar_recents_fading_edge_length"
         android:scrollHorizontally="true"
         android:layout_alignParentLeft="true"
-        android:layout_alignParentTop="true"
-        android:layout_marginLeft="16dip"
-        android:layout_marginTop="61dip"
+        android:layout_below="@id/recents_callout_line"
+        android:layout_marginLeft="@dimen/status_bar_recents_app_label_left_margin"
+        android:layout_marginTop="3dip"
         android:singleLine="true"
         android:ellipsize="marquee"
     />
diff --git a/packages/SystemUI/res/layout/recent_apps_activity.xml b/packages/SystemUI/res/layout/recent_apps_activity.xml
deleted file mode 100644
index ec661e8..0000000
--- a/packages/SystemUI/res/layout/recent_apps_activity.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 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.
-*/
--->
-
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:orientation="vertical">
-
-    <!-- Title -->
-    <TextView
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:gravity="center"
-        android:textAppearance="?android:attr/textAppearanceSmall"
-        android:textColor="#80FFFFFF"
-        android:textStyle="bold"
-        android:singleLine="true"
-        android:text="@string/recent_tasks_title"
-        android:visibility="gone"/>
-
-    <!-- This is only intended to be visible when carousel is invisible -->
-    <TextView
-        android:id="@+id/no_applications_message"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_gravity="center"
-        android:textAppearance="?android:attr/textAppearanceSmall"
-        android:text="@string/recent_tasks_empty"
-        android:visibility="gone"/>
-
-    <com.android.systemui.recent.RecentApplicationsCarouselView
-        android:id="@+id/carousel"
-        android:layout_width="match_parent"
-        android:layout_height="0dip"
-        android:layout_weight="1">
-    </com.android.systemui.recent.RecentApplicationsCarouselView>
-
-</LinearLayout>
diff --git a/packages/SystemUI/res/layout/recents_detail_view.xml b/packages/SystemUI/res/layout/recents_detail_view.xml
deleted file mode 100644
index 879d0f2..0000000
--- a/packages/SystemUI/res/layout/recents_detail_view.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-** Copyright 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.
-*/
--->
-
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:orientation="vertical">
-
-    <!-- Application Title -->
-    <TextView android:id="@+id/app_title"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:textAppearance="?android:attr/textAppearanceMedium"
-        android:singleLine="true"/>
-
-    <!-- Application Details -->
-    <TextView
-        android:id="@+id/app_description"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:textAppearance="?android:attr/textAppearanceSmall"/>
-
-</LinearLayout>
diff --git a/packages/SystemUI/res/values-hdpi/dimens.xml b/packages/SystemUI/res/values-hdpi/dimens.xml
new file mode 100644
index 0000000..741b75a
--- /dev/null
+++ b/packages/SystemUI/res/values-hdpi/dimens.xml
@@ -0,0 +1,24 @@
+<?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.
+*/
+-->
+<resources>
+    <!-- Offsets for rendering thumbnails over drawable recents_thumbnail_bg -->
+    <dimen name="recents_thumbnail_bg_padding_left">6px</dimen>
+    <dimen name="recents_thumbnail_bg_padding_top">7px</dimen>
+    <dimen name="recents_thumbnail_bg_padding_right">6px</dimen>
+    <dimen name="recents_thumbnail_bg_padding_bottom">6px</dimen>
+</resources>
diff --git a/packages/SystemUI/res/values-land/dimens.xml b/packages/SystemUI/res/values-land/dimens.xml
index 6f1453e..0219a77 100644
--- a/packages/SystemUI/res/values-land/dimens.xml
+++ b/packages/SystemUI/res/values-land/dimens.xml
@@ -23,15 +23,17 @@
     <!-- Width of a recent app view, including all content -->
     <dimen name="status_bar_recents_thumbnail_view_width">156dp</dimen>
     <!-- How far the thumbnail for a recent app appears from left edge -->
-    <dimen name="status_bar_recents_thumbnail_left_margin">0dp</dimen>
+    <dimen name="status_bar_recents_thumbnail_left_margin">8dp</dimen>
+    <!-- How far the thumbnail for a recent app appears from top edge -->
+    <dimen name="status_bar_recents_thumbnail_top_margin">12dp</dimen>
     <!-- Width of scrollable area in recents -->
     <dimen name="status_bar_recents_width">128dp</dimen>
-    <!-- Thumbnail border width -->
-    <dimen name="status_bar_recents_thumbnail_border_width">8dp</dimen>
-    <!-- Thumbnail border height -->
-    <dimen name="status_bar_recents_thumbnail_border_height">12dp</dimen>
     <!-- Padding for text descriptions -->
     <dimen name="status_bar_recents_text_description_padding">8dp</dimen>
+    <!-- Width of application label text -->
+    <dimen name="status_bar_recents_app_label_width">97dip</dimen>
+    <!-- Left margin of application label text -->
+    <dimen name="status_bar_recents_app_label_left_margin">16dip</dimen>
     <!-- Margin between recents container and glow on the right -->
     <dimen name="status_bar_recents_right_glow_margin">0dip</dimen>
 </resources>
diff --git a/packages/SystemUI/res/values-large/dimens.xml b/packages/SystemUI/res/values-large/dimens.xml
index f8a4a1c..9d89e21 100644
--- a/packages/SystemUI/res/values-large/dimens.xml
+++ b/packages/SystemUI/res/values-large/dimens.xml
@@ -22,32 +22,6 @@
     <dimen name="status_bar_panel_bottom_offset">36dp</dimen>
     <!-- gap on either side of status bar notification icons -->
     <dimen name="status_bar_icon_padding">8dp</dimen>
-
-    <!-- Recent Applications parameters -->
-    <!-- Width of a recent app view, including all content -->
-    <dimen name="status_bar_recents_thumbnail_view_width">156dp</dimen>
-    <!-- How far the thumbnail for a recent app appears from left edge -->
-    <dimen name="status_bar_recents_thumbnail_left_margin">110dp</dimen>
-    <!-- Upper width limit for application icon -->
-    <dimen name="status_bar_recents_thumbnail_max_width">64dp</dimen>
-    <!-- Upper height limit for application icon -->
-    <dimen name="status_bar_recents_thumbnail_max_height">64dp</dimen>
-    <!-- Width of scrollable area in recents -->
-    <dimen name="status_bar_recents_width">356dp</dimen>
-    <!-- Thumbnail border width -->
-    <dimen name="status_bar_recents_thumbnail_border_width">12dp</dimen>
-    <!-- Thumbnail border height -->
-    <dimen name="status_bar_recents_thumbnail_border_height">12dp</dimen>
-    <!-- Padding for text descriptions -->
-    <dimen name="status_bar_recents_text_description_padding">8dp</dimen>
-    <!-- Size of application label text -->
-    <dimen name="status_bar_recents_app_label_text_size">18dip</dimen>
-    <!-- Size of application description text -->
-    <dimen name="status_bar_recents_app_description_text_size">18dip</dimen>
-    <!-- Size of fading edge for scroll effect -->
-    <dimen name="status_bar_recents_fading_edge_length">20dip</dimen>
-    <!-- Margin between recents container and glow on the right -->
-    <dimen name="status_bar_recents_right_glow_margin">100dip</dimen>
 </resources>
 
 
diff --git a/packages/SystemUI/res/values-mdpi/dimens.xml b/packages/SystemUI/res/values-mdpi/dimens.xml
new file mode 100644
index 0000000..741b75a
--- /dev/null
+++ b/packages/SystemUI/res/values-mdpi/dimens.xml
@@ -0,0 +1,24 @@
+<?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.
+*/
+-->
+<resources>
+    <!-- Offsets for rendering thumbnails over drawable recents_thumbnail_bg -->
+    <dimen name="recents_thumbnail_bg_padding_left">6px</dimen>
+    <dimen name="recents_thumbnail_bg_padding_top">7px</dimen>
+    <dimen name="recents_thumbnail_bg_padding_right">6px</dimen>
+    <dimen name="recents_thumbnail_bg_padding_bottom">6px</dimen>
+</resources>
diff --git a/packages/SystemUI/res/values-port/dimens.xml b/packages/SystemUI/res/values-port/dimens.xml
new file mode 100644
index 0000000..54c25fa
--- /dev/null
+++ b/packages/SystemUI/res/values-port/dimens.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (c) 2006, 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.
+*/
+-->
+<resources>
+    <!-- Recent Applications parameters -->
+    <!-- Width of a recent app view, including all content -->
+    <dimen name="status_bar_recents_thumbnail_view_width">156dp</dimen>
+    <!-- How far the thumbnail for a recent app appears from left edge -->
+    <dimen name="status_bar_recents_thumbnail_left_margin">110dp</dimen>
+    <!-- Width of scrollable area in recents -->
+    <dimen name="status_bar_recents_width">356dp</dimen>
+    <!-- Padding for text descriptions -->
+    <dimen name="status_bar_recents_text_description_padding">8dp</dimen>
+    <!-- Width of application label text -->
+    <dimen name="status_bar_recents_app_label_width">97dip</dimen>
+    <!-- Left margin of application label text -->
+    <dimen name="status_bar_recents_app_label_left_margin">16dip</dimen>
+    <!-- Margin between recents container and glow on the right -->
+    <dimen name="status_bar_recents_right_glow_margin">100dip</dimen>
+</resources>
diff --git a/packages/SystemUI/res/values-sw600dp/dimens.xml b/packages/SystemUI/res/values-sw600dp/dimens.xml
index 944e0ee..b4fd8ab 100644
--- a/packages/SystemUI/res/values-sw600dp/dimens.xml
+++ b/packages/SystemUI/res/values-sw600dp/dimens.xml
@@ -28,4 +28,40 @@
     <dimen name="notification_panel_min_height">770dp</dimen>
     <!-- Bottom margin (from display edge) for status bar panels -->
     <dimen name="panel_float">56dp</dimen>
+
+    <!-- Recent Applications parameters -->
+    <!-- Width of a recent app view, including all content -->
+    <dimen name="status_bar_recents_thumbnail_view_width">156dp</dimen>
+    <!-- How far the thumbnail for a recent app appears from left edge -->
+    <dimen name="status_bar_recents_thumbnail_left_margin">110dp</dimen>
+    <!-- Upper width limit for application icon -->
+    <dimen name="status_bar_recents_thumbnail_max_width">64dp</dimen>
+    <!-- Upper height limit for application icon -->
+    <dimen name="status_bar_recents_thumbnail_max_height">64dp</dimen>
+    <!-- Width of scrollable area in recents -->
+    <dimen name="status_bar_recents_width">356dp</dimen>
+    <!-- Padding for text descriptions -->
+    <dimen name="status_bar_recents_text_description_padding">8dp</dimen>
+    <!-- Size of application label text -->
+    <dimen name="status_bar_recents_app_label_text_size">18dip</dimen>
+    <!-- Size of application description text -->
+    <dimen name="status_bar_recents_app_description_text_size">18dip</dimen>
+    <!-- Width of application label text -->
+    <dimen name="status_bar_recents_app_label_width">97dip</dimen>
+    <!-- Left margin for application label -->
+    <dimen name="status_bar_recents_app_label_left_margin">16dip</dimen>
+    <!-- Size of fading edge for scroll effect -->
+    <dimen name="status_bar_recents_fading_edge_length">20dip</dimen>
+    <!-- Margin between recents container and glow on the right -->
+    <dimen name="status_bar_recents_right_glow_margin">100dip</dimen>
+
+    <!-- Offsets for rendering thumbnails over drawable recents_thumbnail_bg -->
+    <dimen name="recents_thumbnail_bg_padding_left">15px</dimen>
+    <dimen name="recents_thumbnail_bg_padding_top">8px</dimen>
+    <dimen name="recents_thumbnail_bg_padding_right">12px</dimen>
+    <dimen name="recents_thumbnail_bg_padding_bottom">8px</dimen>
+
+    <!-- Where to place the app icon over the thumbnail -->
+    <dimen name="status_bar_recents_app_icon_left_margin">13dp</dimen>
+    <dimen name="status_bar_recents_app_icon_top_margin">13dp</dimen>
 </resources>
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 83eaaa8..fc35a48 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -20,22 +20,14 @@
     <dimen name="status_bar_edge_ignore">5dp</dimen>
 
     <!-- Recent Applications parameters -->
-    <!-- Width of a recent app view, including all content -->
-    <dimen name="status_bar_recents_thumbnail_view_width">156dp</dimen>
-    <!-- How far the thumbnail for a recent app appears from left edge -->
-    <dimen name="status_bar_recents_thumbnail_left_margin">110dp</dimen>
     <!-- Upper width limit for application icon -->
     <dimen name="status_bar_recents_thumbnail_max_width">64dp</dimen>
     <!-- Upper height limit for application icon -->
     <dimen name="status_bar_recents_thumbnail_max_height">64dp</dimen>
-    <!-- Width of scrollable area in recents -->
-    <dimen name="status_bar_recents_width">356dp</dimen>
-    <!-- Thumbnail border width -->
-    <dimen name="status_bar_recents_thumbnail_border_width">12dp</dimen>
-    <!-- Thumbnail border height -->
-    <dimen name="status_bar_recents_thumbnail_border_height">12dp</dimen>
-    <!-- Padding for text descriptions -->
-    <dimen name="status_bar_recents_text_description_padding">8dp</dimen>
+    <!-- Where to place the app icon over the thumbnail -->
+    <dimen name="status_bar_recents_app_icon_left_margin">13dp</dimen>
+    <dimen name="status_bar_recents_app_icon_top_margin">13dp</dimen>
+
     <!-- Size of application label text -->
     <dimen name="status_bar_recents_app_label_text_size">18dip</dimen>
     <!-- Size of application description text -->
diff --git a/packages/SystemUI/src/com/android/systemui/recent/Choreographer.java b/packages/SystemUI/src/com/android/systemui/recent/Choreographer.java
index b876075..49a65d8 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/Choreographer.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/Choreographer.java
@@ -36,14 +36,16 @@
     View mScrimView;
     View mContentView;
     AnimatorSet mContentAnim;
+    Animator.AnimatorListener mListener;
 
     // the panel will start to appear this many px from the end
     final int HYPERSPACE_OFFRAMP = 200;
 
-    public Choreographer(View root, View scrim, View content) {
+    public Choreographer(View root, View scrim, View content, Animator.AnimatorListener listener) {
         mRootView = root;
         mScrimView = scrim;
         mContentView = content;
+        mListener = listener;
     }
 
     void createAnimation(boolean appearing) {
@@ -86,6 +88,9 @@
                 .with(posAnim);
         mContentAnim.setDuration(appearing ? OPEN_DURATION : CLOSE_DURATION);
         mContentAnim.addListener(this);
+        if (mListener != null) {
+            mContentAnim.addListener(mListener);
+        }
     }
 
     void startAnimation(boolean appearing) {
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
index 194c9d1..3dbcc59 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
@@ -16,7 +16,7 @@
 
 package com.android.systemui.recent;
 
-import com.android.systemui.recent.RecentsPanelView.ActvityDescriptionAdapter;
+import com.android.systemui.recent.RecentsPanelView.ActivityDescriptionAdapter;
 
 import android.animation.Animator;
 import android.animation.Animator.AnimatorListener;
@@ -49,7 +49,7 @@
     private static final float THRESHHOLD = 50;
     private static final boolean DEBUG_INVALIDATE = false;
     private LinearLayout mLinearLayout;
-    private ActvityDescriptionAdapter mAdapter;
+    private ActivityDescriptionAdapter mAdapter;
     private RecentsCallback mCallback;
     protected int mLastScrollPosition;
     private View mCurrentView;
@@ -273,7 +273,7 @@
         }
     }
 
-    public void setAdapter(ActvityDescriptionAdapter adapter) {
+    public void setAdapter(ActivityDescriptionAdapter adapter) {
         mAdapter = adapter;
         mAdapter.registerDataSetObserver(new DataSetObserver() {
             public void onChanged() {
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
index e2b3446..b8dc63d 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
@@ -19,6 +19,7 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import android.animation.Animator;
 import android.animation.LayoutTransition;
 import android.app.ActivityManager;
 import android.content.Context;
@@ -52,27 +53,33 @@
 import android.widget.TextView;
 
 import com.android.systemui.R;
+import com.android.systemui.statusbar.StatusBar;
+import com.android.systemui.statusbar.phone.PhoneStatusBar;
 import com.android.systemui.statusbar.tablet.StatusBarPanel;
 import com.android.systemui.statusbar.tablet.TabletStatusBar;
 
 public class RecentsPanelView extends RelativeLayout
-        implements OnItemClickListener, RecentsCallback, StatusBarPanel {
-    private static final int GLOW_PADDING = 15;
+        implements OnItemClickListener, RecentsCallback, StatusBarPanel, Animator.AnimatorListener {
     static final String TAG = "RecentsListView";
-    static final boolean DEBUG = TabletStatusBar.DEBUG;
+    static final boolean DEBUG = TabletStatusBar.DEBUG || PhoneStatusBar.DEBUG;
     private static final int DISPLAY_TASKS = 20;
     private static final int MAX_TASKS = DISPLAY_TASKS + 1; // allow extra for non-apps
-    private TabletStatusBar mBar;
+    private StatusBar mBar;
     private ArrayList<ActivityDescription> mActivityDescriptions;
     private int mIconDpi;
     private View mRecentsScrim;
     private View mRecentsGlowView;
     private View mRecentsContainer;
     private Bitmap mGlowBitmap;
+    // TODO: add these widgets attributes to the layout file
+    private int mGlowBitmapPaddingLeftPx;
+    private int mGlowBitmapPaddingTopPx;
+    private int mGlowBitmapPaddingRightPx;
+    private int mGlowBitmapPaddingBottomPx;
     private boolean mShowing;
     private Choreographer mChoreo;
     private View mRecentsDismissButton;
-    private ActvityDescriptionAdapter mListAdapter;
+    private ActivityDescriptionAdapter mListAdapter;
 
     /* package */ final static class ActivityDescription {
         int taskId; // application task id for curating apps
@@ -108,10 +115,10 @@
         ActivityDescription activityDescription;
     }
 
-    /* package */ final class ActvityDescriptionAdapter extends BaseAdapter {
+    /* package */ final class ActivityDescriptionAdapter extends BaseAdapter {
         private LayoutInflater mInflater;
 
-        public ActvityDescriptionAdapter(Context context) {
+        public ActivityDescriptionAdapter(Context context) {
             mInflater = LayoutInflater.from(context);
         }
 
@@ -183,6 +190,26 @@
         }
     }
 
+    public void onAnimationCancel(Animator animation) {
+    }
+
+    public void onAnimationEnd(Animator animation) {
+        if (mShowing) {
+            final LayoutTransition transitioner = new LayoutTransition();
+            ((ViewGroup)mRecentsContainer).setLayoutTransition(transitioner);
+            createCustomAnimations(transitioner);
+        } else {
+            ((ViewGroup)mRecentsContainer).setLayoutTransition(null);
+        }
+    }
+
+    public void onAnimationRepeat(Animator animation) {
+    }
+
+    public void onAnimationStart(Animator animation) {
+    }
+
+
     /**
      * We need to be aligned at the bottom.  LinearLayout can't do this, so instead,
      * let LinearLayout do all the hard work, and then shift everything down to the bottom.
@@ -201,7 +228,7 @@
         return mShowing;
     }
 
-    public void setBar(TabletStatusBar bar) {
+    public void setBar(StatusBar bar) {
         mBar = bar;
     }
 
@@ -217,7 +244,16 @@
                 & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE;
 
         mIconDpi = xlarge ? DisplayMetrics.DENSITY_HIGH : res.getDisplayMetrics().densityDpi;
+
         mGlowBitmap = BitmapFactory.decodeResource(res, R.drawable.recents_thumbnail_bg);
+        mGlowBitmapPaddingLeftPx =
+                res.getDimensionPixelSize(R.dimen.recents_thumbnail_bg_padding_left);
+        mGlowBitmapPaddingTopPx =
+                res.getDimensionPixelSize(R.dimen.recents_thumbnail_bg_padding_top);
+        mGlowBitmapPaddingRightPx =
+                res.getDimensionPixelSize(R.dimen.recents_thumbnail_bg_padding_right);
+        mGlowBitmapPaddingBottomPx =
+                res.getDimensionPixelSize(R.dimen.recents_thumbnail_bg_padding_bottom);
     }
 
     @Override
@@ -225,7 +261,7 @@
         super.onFinishInflate();
         mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
         mRecentsContainer = findViewById(R.id.recents_container);
-        mListAdapter = new ActvityDescriptionAdapter(mContext);
+        mListAdapter = new ActivityDescriptionAdapter(mContext);
         if (mRecentsContainer instanceof RecentsListView) {
             RecentsListView listView = (RecentsListView) mRecentsContainer;
             listView.setAdapter(mListAdapter);
@@ -246,13 +282,10 @@
             throw new IllegalArgumentException("missing RecentsListView/RecentsScrollView");
         }
 
-        final LayoutTransition transitioner = new LayoutTransition();
-        ((ViewGroup)mRecentsContainer).setLayoutTransition(transitioner);
-        createCustomAnimations(transitioner);
 
         mRecentsGlowView = findViewById(R.id.recents_glow);
         mRecentsScrim = (View) findViewById(R.id.recents_bg_protect);
-        mChoreo = new Choreographer(this, mRecentsScrim, mRecentsGlowView);
+        mChoreo = new Choreographer(this, mRecentsScrim, mRecentsGlowView, this);
         mRecentsDismissButton = findViewById(R.id.recents_dismiss_button);
         mRecentsDismissButton.setOnClickListener(new OnClickListener() {
             public void onClick(View v) {
@@ -402,10 +435,9 @@
             Log.v(TAG, "Source thumb: " + srcWidth + "x" + srcHeight);
             canvas.drawBitmap(thumbnail,
                     new Rect(0, 0, srcWidth-1, srcHeight-1),
-                    new RectF(GLOW_PADDING,
-                            GLOW_PADDING - 7.0f,
-                            outBitmap.getWidth() - GLOW_PADDING + 3.0f,
-                            outBitmap.getHeight() - GLOW_PADDING + 7.0f), paint);
+                    new RectF(mGlowBitmapPaddingLeftPx, mGlowBitmapPaddingTopPx,
+                            outBitmap.getWidth() - mGlowBitmapPaddingRightPx,
+                            outBitmap.getHeight() - mGlowBitmapPaddingBottomPx), paint);
         }
         return outBitmap;
     }
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
index 54ec6b5..6a962cb 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
@@ -16,7 +16,7 @@
 
 package com.android.systemui.recent;
 
-import com.android.systemui.recent.RecentsPanelView.ActvityDescriptionAdapter;
+import com.android.systemui.recent.RecentsPanelView.ActivityDescriptionAdapter;
 
 import android.animation.Animator;
 import android.animation.Animator.AnimatorListener;
@@ -49,7 +49,7 @@
     private static final float THRESHHOLD = 50;
     private static final boolean DEBUG_INVALIDATE = false;
     private LinearLayout mLinearLayout;
-    private ActvityDescriptionAdapter mAdapter;
+    private ActivityDescriptionAdapter mAdapter;
     private RecentsCallback mCallback;
     protected int mLastScrollPosition;
     private View mCurrentView;
@@ -275,7 +275,7 @@
         }
     }
 
-    public void setAdapter(ActvityDescriptionAdapter adapter) {
+    public void setAdapter(ActivityDescriptionAdapter adapter) {
         mAdapter = adapter;
         mAdapter.registerDataSetObserver(new DataSetObserver() {
             public void onChanged() {
diff --git a/packages/SystemUI/src/com/android/systemui/recent/carousel/RecentApplicationsActivity.java b/packages/SystemUI/src/com/android/systemui/recent/carousel/RecentApplicationsActivity.java
deleted file mode 100644
index 45e230f..0000000
--- a/packages/SystemUI/src/com/android/systemui/recent/carousel/RecentApplicationsActivity.java
+++ /dev/null
@@ -1,532 +0,0 @@
-/*
- * Copyright (C) 2010 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 com.android.systemui.recent.carousel;
-
-import com.android.systemui.R;
-
-import com.android.ex.carousel.CarouselView;
-import com.android.ex.carousel.CarouselViewHelper;
-import com.android.ex.carousel.CarouselRS.CarouselCallback;
-import com.android.ex.carousel.CarouselViewHelper.DetailTextureParameters;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import android.app.Activity;
-import android.app.ActivityManager;
-import android.app.ActivityManagerNative;
-import android.app.IActivityManager;
-import android.app.IThumbnailReceiver;
-import android.app.ActivityManager.RunningTaskInfo;
-import android.content.ActivityNotFoundException;
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.ActivityInfo;
-import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
-import android.content.res.Configuration;
-import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.graphics.Canvas;
-import android.graphics.Matrix;
-import android.graphics.Paint;
-import android.graphics.PaintFlagsDrawFilter;
-import android.graphics.PorterDuffXfermode;
-import android.graphics.PorterDuff;
-import android.graphics.Bitmap.Config;
-import android.graphics.drawable.Drawable;
-import android.graphics.PixelFormat;
-import android.os.Bundle;
-import android.os.RemoteException;
-import android.util.Log;
-import android.view.View;
-import android.view.View.MeasureSpec;
-import android.widget.TextView;
-
-public class RecentApplicationsActivity extends Activity {
-    private static final String TAG = "RecentApplicationsActivity";
-    private static boolean DBG = false;
-    private static final int CARD_SLOTS = 56;
-    private static final int VISIBLE_SLOTS = 7;
-    private static final int MAX_TASKS = VISIBLE_SLOTS * 2;
-
-    // TODO: these should be configurable
-    private static final int DETAIL_TEXTURE_MAX_WIDTH = 200;
-    private static final int DETAIL_TEXTURE_MAX_HEIGHT = 80;
-    private static final int TEXTURE_WIDTH = 256;
-    private static final int TEXTURE_HEIGHT = 256;
-
-    private ActivityManager mActivityManager;
-    private List<RunningTaskInfo> mRunningTaskList;
-    private boolean mPortraitMode = true;
-    private ArrayList<ActivityDescription> mActivityDescriptions
-            = new ArrayList<ActivityDescription>();
-    private CarouselView mCarouselView;
-    private LocalCarouselViewHelper mHelper;
-    private View mNoRecentsView;
-    private Bitmap mLoadingBitmap;
-    private Bitmap mRecentOverlay;
-    private boolean mHidden = false;
-    private boolean mHiding = false;
-    private DetailInfo mDetailInfo;
-
-    /**
-     * This class is a container for all items associated with the DetailView we'll
-     * be drawing to a bitmap and sending to Carousel.
-     *
-     */
-    static final class DetailInfo {
-        public DetailInfo(View _view, TextView _title, TextView _desc) {
-            view = _view;
-            title = _title;
-            description = _desc;
-        }
-
-        /**
-         * Draws view into the given bitmap, if provided
-         * @param bitmap
-         */
-        public Bitmap draw(Bitmap bitmap) {
-            resizeView(view, DETAIL_TEXTURE_MAX_WIDTH, DETAIL_TEXTURE_MAX_HEIGHT);
-            int desiredWidth = view.getWidth();
-            int desiredHeight = view.getHeight();
-            if (bitmap == null || desiredWidth != bitmap.getWidth()
-                    || desiredHeight != bitmap.getHeight()) {
-                bitmap = Bitmap.createBitmap(desiredWidth, desiredHeight, Config.ARGB_8888);
-            }
-            Canvas canvas = new Canvas(bitmap);
-            view.draw(canvas);
-            return bitmap;
-        }
-
-        /**
-         * Force a layout pass on the given view.
-         */
-        private void resizeView(View view, int maxWidth, int maxHeight) {
-            int widthSpec = MeasureSpec.getMode(MeasureSpec.AT_MOST)
-                    | MeasureSpec.getSize(maxWidth);
-            int heightSpec = MeasureSpec.getMode(MeasureSpec.AT_MOST)
-                    | MeasureSpec.getSize(maxHeight);
-            view.measure(widthSpec, heightSpec);
-            view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());
-            Log.v(TAG, "RESIZED VIEW: " + view.getWidth() + ", " + view.getHeight());
-        }
-
-        public View view;
-        public TextView title;
-        public TextView description;
-    }
-
-    static class ActivityDescription {
-        int id;
-        Bitmap thumbnail; // generated by Activity.onCreateThumbnail()
-        Drawable icon; // application package icon
-        String label; // application package label
-        CharSequence description; // generated by Activity.onCreateDescription()
-        Intent intent; // launch intent for application
-        Matrix matrix; // arbitrary rotation matrix to correct orientation
-        int position; // position in list
-
-        public ActivityDescription(Bitmap _thumbnail,
-                Drawable _icon, String _label, String _desc, int _id, int _pos)
-        {
-            thumbnail = _thumbnail;
-            icon = _icon;
-            label = _label;
-            description = _desc;
-            id = _id;
-            position = _pos;
-        }
-
-        public void clear() {
-            icon = null;
-            thumbnail = null;
-            label = null;
-            description = null;
-            intent = null;
-            matrix = null;
-            id = -1;
-            position = -1;
-        }
-    };
-
-    private ActivityDescription findActivityDescription(int id) {
-        for (int i = 0; i < mActivityDescriptions.size(); i++) {
-            ActivityDescription item = mActivityDescriptions.get(i);
-            if (item != null && item.id == id) {
-                return item;
-            }
-        }
-        return null;
-    }
-
-    private class LocalCarouselViewHelper extends CarouselViewHelper {
-        private DetailTextureParameters mDetailParams = new DetailTextureParameters(10.0f, 20.0f);
-
-        public LocalCarouselViewHelper(Context context) {
-            super(context);
-        }
-
-        @Override
-        public DetailTextureParameters getDetailTextureParameters(int id) {
-            return mDetailParams;
-        }
-
-        public void onCardSelected(int n) {
-            if (n < mActivityDescriptions.size()) {
-                ActivityDescription item = mActivityDescriptions.get(n);
-                if (item.id >= 0) {
-                    // This is an active task; it should just go to the foreground.
-                    final ActivityManager am = (ActivityManager)
-                            getSystemService(Context.ACTIVITY_SERVICE);
-                    am.moveTaskToFront(item.id, ActivityManager.MOVE_TASK_WITH_HOME);
-                } else if (item.intent != null) {
-                    // prepare a launch intent and send it
-                    item.intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY
-                            | Intent.FLAG_ACTIVITY_TASK_ON_HOME);
-                    try {
-                        if (DBG) Log.v(TAG, "Starting intent " + item.intent);
-                        startActivity(item.intent);
-                        overridePendingTransition(R.anim.recent_app_enter, R.anim.recent_app_leave);
-                    } catch (ActivityNotFoundException e) {
-                        if (DBG) Log.w("Recent", "Unable to launch recent task", e);
-                    }
-                    finish();
-                }
-            }
-        }
-
-        @Override
-        public Bitmap getTexture(final int id) {
-            if (DBG) Log.v(TAG, "onRequestTexture(" + id + ")");
-            ActivityDescription info;
-            synchronized(mActivityDescriptions) {
-                info = mActivityDescriptions.get(id);
-            }
-            Bitmap bitmap = null;
-            if (info != null) {
-                bitmap = compositeBitmap(info);
-            }
-            return bitmap;
-        }
-
-        @Override
-        public Bitmap getDetailTexture(int n) {
-            Bitmap bitmap = null;
-            if (n < mActivityDescriptions.size()) {
-                ActivityDescription item = mActivityDescriptions.get(n);
-                mDetailInfo.title.setText(item.label);
-                mDetailInfo.description.setText(item.description);
-                bitmap = mDetailInfo.draw(null);
-            }
-            return bitmap;
-        }
-    };
-
-    private Bitmap compositeBitmap(ActivityDescription info) {
-        final int targetWidth = TEXTURE_WIDTH;
-        final int targetHeight = TEXTURE_HEIGHT;
-        final int border = 3; // inset along the edge for thumnnail content
-        final int overlap = 1; // how many pixels of overlap between border and thumbnail
-        final Resources res = getResources();
-        if (mRecentOverlay == null) {
-            mRecentOverlay = BitmapFactory.decodeResource(res, R.drawable.recent_overlay);
-        }
-
-        // Create a bitmap of the proper size/format and set the canvas to draw to it
-        final Bitmap result = Bitmap.createBitmap(targetWidth, targetHeight, Bitmap.Config.ARGB_8888);
-        final Canvas canvas = new Canvas(result);
-        canvas.setDrawFilter(new PaintFlagsDrawFilter(Paint.DITHER_FLAG, Paint.FILTER_BITMAP_FLAG));
-        Paint paint = new Paint();
-        paint.setFilterBitmap(false);
-
-        paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC));
-        canvas.save();
-        if (info.thumbnail != null) {
-            // Draw the thumbnail
-            int sourceWidth = targetWidth - 2 * (border - overlap);
-            int sourceHeight = targetHeight - 2 * (border - overlap);
-            final float scaleX = (float) sourceWidth / info.thumbnail.getWidth();
-            final float scaleY = (float) sourceHeight / info.thumbnail.getHeight();
-            canvas.translate(border * 0.5f, border * 0.5f);
-            canvas.scale(scaleX, scaleY);
-            canvas.drawBitmap(info.thumbnail, 0, 0, paint);
-        } else {
-            // Draw the Loading bitmap placeholder, TODO: Remove when RS handles blending
-            final float scaleX = (float) targetWidth / mLoadingBitmap.getWidth();
-            final float scaleY = (float) targetHeight / mLoadingBitmap.getHeight();
-            canvas.scale(scaleX, scaleY);
-            canvas.drawBitmap(mLoadingBitmap, 0, 0, paint);
-        }
-        canvas.restore();
-
-        // Draw overlay
-        canvas.save();
-        final float scaleOverlayX = (float) targetWidth / mRecentOverlay.getWidth();
-        final float scaleOverlayY = (float) targetHeight / mRecentOverlay.getHeight();
-        canvas.scale(scaleOverlayX, scaleOverlayY);
-        paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.ADD));
-        canvas.drawBitmap(mRecentOverlay, 0, 0, paint);
-        canvas.restore();
-
-        // Draw icon
-        if (info.icon != null) {
-            canvas.save();
-            info.icon.draw(canvas);
-            canvas.restore();
-        }
-
-        return result;
-    }
-
-    private final IThumbnailReceiver mThumbnailReceiver = new IThumbnailReceiver.Stub() {
-
-        public void finished() throws RemoteException {
-
-        }
-
-        public void newThumbnail(final int id, final Bitmap bitmap, CharSequence description)
-                throws RemoteException {
-            int w = bitmap.getWidth();
-            int h = bitmap.getHeight();
-            if (DBG) Log.v(TAG, "New thumbnail for id=" + id + ", dimensions=" + w + "x" + h
-                    + " description '" + description + "'");
-            ActivityDescription info = findActivityDescription(id);
-            if (info != null) {
-                info.thumbnail = bitmap;
-                info.description = description;
-                final int thumbWidth = bitmap.getWidth();
-                final int thumbHeight = bitmap.getHeight();
-                if ((mPortraitMode && thumbWidth > thumbHeight)
-                        || (!mPortraitMode && thumbWidth < thumbHeight)) {
-                    Matrix matrix = new Matrix();
-                    matrix.setRotate(90.0f, (float) thumbWidth / 2, (float) thumbHeight / 2);
-                    info.matrix = matrix;
-                } else {
-                    info.matrix = null;
-                }
-                // Force Carousel to request new textures for this item.
-                mCarouselView.setTextureForItem(info.position, null);
-                mCarouselView.setDetailTextureForItem(info.position, 0, 0, 0, 0, null);
-            } else {
-                if (DBG) Log.v(TAG, "Can't find view for id " + id);
-            }
-        }
-    };
-
-    /**
-     * We never really finish() RecentApplicationsActivity, since we don't want to
-     * get destroyed and pay the start-up cost to restart it.
-     */
-    @Override
-    public void finish() {
-        moveTaskToBack(true);
-    }
-
-    @Override
-    protected void onNewIntent(Intent intent) {
-        mHidden = !mHidden;
-        if (mHidden) {
-            mHiding = true;
-            moveTaskToBack(true);
-        } else {
-            mHiding = false;
-        }
-        super.onNewIntent(intent);
-    }
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        final Resources res = getResources();
-        final View decorView = getWindow().getDecorView();
-
-        getWindow().getDecorView().setBackgroundColor(0x80000000);
-
-        if (mCarouselView == null) {
-            long t = System.currentTimeMillis();
-            setContentView(R.layout.recent_apps_activity);
-            long elapsed = System.currentTimeMillis() - t;
-            Log.v(TAG, "Recents layout took " + elapsed + "ms to load");
-            mLoadingBitmap = BitmapFactory.decodeResource(res, R.drawable.recent_rez_border);
-            mCarouselView = (CarouselView)findViewById(R.id.carousel);
-            mHelper = new LocalCarouselViewHelper(this);
-            mHelper.setCarouselView(mCarouselView);
-
-            mCarouselView.setSlotCount(CARD_SLOTS);
-            mCarouselView.setVisibleSlots(VISIBLE_SLOTS);
-            mCarouselView.createCards(0);
-            mCarouselView.setStartAngle((float) -(2.0f*Math.PI * 5 / CARD_SLOTS));
-            mCarouselView.setDefaultBitmap(mLoadingBitmap);
-            mCarouselView.setLoadingBitmap(mLoadingBitmap);
-            mCarouselView.setRezInCardCount(3.0f);
-            mCarouselView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
-
-            mNoRecentsView = (View) findViewById(R.id.no_applications_message);
-
-            mActivityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
-            mPortraitMode = decorView.getHeight() > decorView.getWidth();
-
-            // Load detail view which will be used to render text
-            View detail = getLayoutInflater().inflate(R.layout.recents_detail_view, null);
-            TextView title = (TextView) detail.findViewById(R.id.app_title);
-            TextView description = (TextView) detail.findViewById(R.id.app_description);
-            mDetailInfo = new DetailInfo(detail, title, description);
-
-            refresh();
-        }
-    }
-
-    @Override
-    protected void onResume() {
-        super.onResume();
-        refresh();
-    }
-
-    @Override
-    public void onConfigurationChanged(Configuration newConfig) {
-        super.onConfigurationChanged(newConfig);
-        mPortraitMode = newConfig.orientation == Configuration.ORIENTATION_PORTRAIT;
-        if (DBG) Log.v(TAG, "CONFIG CHANGE, mPortraitMode = " + mPortraitMode);
-        refresh();
-    }
-
-    void updateRunningTasks() {
-        mRunningTaskList = mActivityManager.getRunningTasks(MAX_TASKS,
-                0, mThumbnailReceiver);
-        if (DBG) Log.v(TAG, "Portrait: " + mPortraitMode);
-        for (RunningTaskInfo r : mRunningTaskList) {
-            if (r.thumbnail != null) {
-                int thumbWidth = r.thumbnail.getWidth();
-                int thumbHeight = r.thumbnail.getHeight();
-                if (DBG) Log.v(TAG, "Got thumbnail " + thumbWidth + "x" + thumbHeight);
-                ActivityDescription desc = findActivityDescription(r.id);
-                if (desc != null) {
-                    desc.thumbnail = r.thumbnail;
-                    desc.description = r.description;
-                    if ((mPortraitMode && thumbWidth > thumbHeight)
-                            || (!mPortraitMode && thumbWidth < thumbHeight)) {
-                        Matrix matrix = new Matrix();
-                        matrix.setRotate(90.0f, (float) thumbWidth / 2, (float) thumbHeight / 2);
-                        desc.matrix = matrix;
-                    }
-                } else {
-                    if (DBG) Log.v(TAG, "Couldn't find ActivityDesc for id=" + r.id);
-                }
-            } else {
-                if (DBG) Log.v(TAG, "*** RUNNING THUMBNAIL WAS NULL ***");
-            }
-        }
-    }
-
-    private void updateRecentTasks() {
-        final PackageManager pm = getPackageManager();
-        final ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
-
-        final List<ActivityManager.RecentTaskInfo> recentTasks =
-                am.getRecentTasks(MAX_TASKS, ActivityManager.RECENT_IGNORE_UNAVAILABLE);
-
-        ActivityInfo homeInfo = new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME)
-                    .resolveActivityInfo(pm, 0);
-
-        // IconUtilities iconUtilities = new IconUtilities(this); // FIXME
-
-        int numTasks = recentTasks.size();
-        mActivityDescriptions.clear();
-        for (int i = 0, index = 0; i < numTasks && (index < MAX_TASKS); ++i) {
-            final ActivityManager.RecentTaskInfo recentInfo = recentTasks.get(i);
-
-            Intent intent = new Intent(recentInfo.baseIntent);
-            if (recentInfo.origActivity != null) {
-                intent.setComponent(recentInfo.origActivity);
-            }
-
-            // Skip the current home activity.
-            if (homeInfo != null
-                    && homeInfo.packageName.equals(intent.getComponent().getPackageName())
-                    && homeInfo.name.equals(intent.getComponent().getClassName())) {
-                continue;
-            }
-
-            intent.setFlags((intent.getFlags()&~Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED)
-                    | Intent.FLAG_ACTIVITY_NEW_TASK);
-            final ResolveInfo resolveInfo = pm.resolveActivity(intent, 0);
-            if (resolveInfo != null) {
-                final ActivityInfo info = resolveInfo.activityInfo;
-                final String title = info.loadLabel(pm).toString();
-                Drawable icon = info.loadIcon(pm);
-
-                int id = recentTasks.get(i).id;
-                if (id != -1 && title != null && title.length() > 0 && icon != null) {
-                    // icon = null; FIXME: iconUtilities.createIconDrawable(icon);
-                    ActivityDescription item = new ActivityDescription(
-                            null, icon, title, null, id, index);
-                    item.intent = intent;
-                    mActivityDescriptions.add(item);
-                    if (DBG) Log.v(TAG, "Added item[" + index
-                            + "], id=" + item.id
-                            + ", title=" + item.label);
-                    ++index;
-                } else {
-                    if (DBG) Log.v(TAG, "SKIPPING item " + id);
-                }
-            }
-        }
-    }
-
-    private final Runnable mRefreshRunnable = new Runnable() {
-        public void run() {
-            updateRecentTasks();
-            updateRunningTasks();
-            showCarousel(mActivityDescriptions.size() > 0);
-        }
-    };
-
-    private void showCarousel(boolean show) {
-        if (show) {
-            mCarouselView.createCards(mActivityDescriptions.size());
-            for (int i = 1; i < mActivityDescriptions.size(); i++) {
-                // Force Carousel to update textures. Note we don't do this for the first item,
-                // since it will be updated when mThumbnailReceiver returns a thumbnail.
-                // TODO: only do this for apps that have changed.
-                mCarouselView.setTextureForItem(i, null);
-                mCarouselView.setDetailTextureForItem(i, 0, 0, 0, 0, null);
-            }
-            // Make carousel visible
-            mNoRecentsView.setVisibility(View.GONE);
-            mCarouselView.setVisibility(View.VISIBLE);
-            mCarouselView.createCards(mActivityDescriptions.size());
-        } else {
-            // show "No Recent Tasks"
-            mNoRecentsView.setVisibility(View.VISIBLE);
-            mCarouselView.setVisibility(View.GONE);
-        }
-    }
-
-    private void refresh() {
-        if (!mHiding && mCarouselView != null) {
-            // Don't update the view now. Instead, post a request so it happens next time
-            // we reach the looper after a delay. This way we can fold multiple refreshes
-            // into just the latest.
-            mCarouselView.removeCallbacks(mRefreshRunnable);
-            mCarouselView.postDelayed(mRefreshRunnable, 50);
-        }
-    }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/recent/carousel/RecentApplicationsCarouselView.java b/packages/SystemUI/src/com/android/systemui/recent/carousel/RecentApplicationsCarouselView.java
deleted file mode 100644
index 1afb086..0000000
--- a/packages/SystemUI/src/com/android/systemui/recent/carousel/RecentApplicationsCarouselView.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2010 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 com.android.systemui.recent.carousel;
-
-import android.content.Context;
-import android.util.AttributeSet;
-
-import com.android.ex.carousel.CarouselView;
-import com.android.systemui.R;
-
-public class RecentApplicationsCarouselView extends CarouselView {
-
-    public RecentApplicationsCarouselView(Context context) {
-        this(context, null);
-    }
-
-    public RecentApplicationsCarouselView(Context context, AttributeSet attrs) {
-        super(context, attrs);
-    }
-
-    public Info getRenderScriptInfo() {
-        return new Info(R.raw.carousel);
-    }
-
-}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
index f81820e..62d7500 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
@@ -61,6 +61,7 @@
     private static final int MSG_SET_HARD_KEYBOARD_STATUS = 10 << MSG_SHIFT;
     
     private static final int MSG_USER_ACTIVITY          = 11 << MSG_SHIFT;
+    private static final int MSG_TOGGLE_RECENT_APPS       = 12 << MSG_SHIFT;
 
     private StatusBarIconList mList;
     private Callbacks mCallbacks;
@@ -90,6 +91,7 @@
         public void setImeWindowStatus(IBinder token, int vis, int backDisposition);
         public void setHardKeyboardStatus(boolean available, boolean enabled);
         public void userActivity();
+        public void toggleRecentApps();
     }
 
     public CommandQueue(Callbacks callbacks, StatusBarIconList list) {
@@ -196,6 +198,13 @@
         }
     }
 
+    public void toggleRecentApps() {
+        synchronized (mList) {
+            mHandler.removeMessages(MSG_TOGGLE_RECENT_APPS);
+            mHandler.obtainMessage(MSG_TOGGLE_RECENT_APPS, 0, 0, null).sendToTarget();
+        }
+    }
+
     private final class H extends Handler {
         public void handleMessage(Message msg) {
             final int what = msg.what & MSG_MASK;
@@ -265,6 +274,9 @@
                 case MSG_USER_ACTIVITY:
                     mCallbacks.userActivity();
                     break;
+                case MSG_TOGGLE_RECENT_APPS:
+                    mCallbacks.toggleRecentApps();
+                    break;
             }
         }
     }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBar.java
index e567dc7..ca75138 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBar.java
@@ -53,6 +53,7 @@
     protected abstract View makeStatusBarView();
     protected abstract int getStatusBarGravity();
     public abstract int getStatusBarHeight();
+    public abstract void animateCollapse();
 
     private DoNotDisturb mDoNotDisturb;
 
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index cc8358e..0b82123 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -28,10 +28,12 @@
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.content.res.Resources;
+import android.content.res.Configuration;
 import android.graphics.PixelFormat;
 import android.graphics.Rect;
 import android.graphics.drawable.Drawable;
 import android.net.Uri;
+import android.os.Bundle;
 import android.os.IBinder;
 import android.os.RemoteException;
 import android.os.Handler;
@@ -74,6 +76,7 @@
 import com.android.internal.statusbar.StatusBarNotification;
 
 import com.android.systemui.R;
+import com.android.systemui.recent.RecentsPanelView;
 import com.android.systemui.statusbar.NotificationData;
 import com.android.systemui.statusbar.StatusBar;
 import com.android.systemui.statusbar.StatusBarIconView;
@@ -83,6 +86,7 @@
 public class PhoneStatusBar extends StatusBar {
     static final String TAG = "PhoneStatusBar";
     static final boolean SPEW = false;
+    public static final boolean DEBUG = false;
 
     public static final String ACTION_STATUSBAR_START
             = "com.android.internal.policy.statusbar.START";
@@ -94,6 +98,8 @@
     private static final int MSG_ANIMATE_REVEAL = 1001;
     private static final int MSG_SHOW_INTRUDER = 1002;
     private static final int MSG_HIDE_INTRUDER = 1003;
+    private static final int MSG_OPEN_RECENTS_PANEL = 1020;
+    private static final int MSG_CLOSE_RECENTS_PANEL = 1021;
 
     // will likely move to a resource or other tunable param at some point
     private static final int INTRUDER_ALERT_DECAY_MS = 10000;
@@ -160,6 +166,9 @@
     private View mTickerView;
     private boolean mTicking;
 
+    // Recent applications
+    private RecentsPanelView mRecentsPanel;
+
     // Tracking finger for opening/closing.
     int mEdgeBorder; // corresponds to R.dimen.status_bar_edge_ignore
     boolean mTracking;
@@ -296,6 +305,9 @@
         setAreThereNotifications();
         mDateView.setVisibility(View.INVISIBLE);
 
+        // Recents Panel
+        initializeRecentsPanel();
+
         // receive broadcasts
         IntentFilter filter = new IntentFilter();
         filter.addAction(Intent.ACTION_CONFIGURATION_CHANGED);
@@ -306,6 +318,51 @@
         return sb;
     }
 
+    protected WindowManager.LayoutParams getRecentsLayoutParams() {
+        boolean translucent = false;
+        WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
+                ViewGroup.LayoutParams.WRAP_CONTENT,
+                ViewGroup.LayoutParams.WRAP_CONTENT,
+                WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL,
+                WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
+                | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM
+                | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH
+                | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
+                (translucent ? PixelFormat.OPAQUE : PixelFormat.TRANSLUCENT));
+        lp.gravity = Gravity.BOTTOM | Gravity.LEFT;
+        lp.setTitle("RecentsPanel");
+        lp.windowAnimations = R.style.Animation_RecentPanel;
+        lp.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_STATE_UNCHANGED
+        | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING;
+        return lp;
+    }
+
+    protected void initializeRecentsPanel() {
+        // Recents Panel
+        boolean visible = false;
+        if (mRecentsPanel != null) {
+            visible = mRecentsPanel.getVisibility() == View.VISIBLE;
+            WindowManagerImpl.getDefault().removeView(mRecentsPanel);
+        }
+        mRecentsPanel = (RecentsPanelView) View.inflate(mContext,
+                R.layout.status_bar_recent_panel, null);
+
+        mRecentsPanel.setOnTouchListener(new TouchOutsideListener(MSG_CLOSE_RECENTS_PANEL,
+                mRecentsPanel));
+        mRecentsPanel.setVisibility(View.GONE);
+        WindowManager.LayoutParams lp = getRecentsLayoutParams();
+
+        WindowManagerImpl.getDefault().addView(mRecentsPanel, lp);
+        mRecentsPanel.setBar(this);
+        if (visible) {
+            // need to set visibility to View.GONE earlier since that
+            // triggers refreshing application list
+            mRecentsPanel.setVisibility(View.VISIBLE);
+            mRecentsPanel.show(true, false);
+        }
+
+    }
+
     protected int getStatusBarGravity() {
         return Gravity.TOP | Gravity.FILL_HORIZONTAL;
     }
@@ -581,6 +638,12 @@
         }
     }
 
+    @Override
+    protected void onConfigurationChanged(Configuration newConfig) {
+        initializeRecentsPanel();
+    }
+
+
     View[] makeNotificationView(StatusBarNotification notification, ViewGroup parent) {
         Notification n = notification.notification;
         RemoteViews remoteViews = n.contentView;
@@ -789,6 +852,21 @@
                 case MSG_HIDE_INTRUDER:
                     setIntruderAlertVisibility(false);
                     break;
+                case MSG_OPEN_RECENTS_PANEL:
+                    if (DEBUG) Slog.d(TAG, "opening recents panel");
+                    if (mRecentsPanel != null) {
+                        disable(StatusBarManager.DISABLE_BACK);
+                        mRecentsPanel.setVisibility(View.VISIBLE);
+                        mRecentsPanel.show(true, true);
+                    }
+                    break;
+                case MSG_CLOSE_RECENTS_PANEL:
+                    if (DEBUG) Slog.d(TAG, "closing recents panel");
+                    if (mRecentsPanel != null && mRecentsPanel.isShowing()) {
+                        disable(StatusBarManager.DISABLE_NONE);
+                        mRecentsPanel.show(false, true);
+                    }
+                    break;
             }
         }
     }
@@ -835,6 +913,10 @@
     }
 
     public void animateCollapse() {
+        animateCollapse(false);
+    }
+
+    public void animateCollapse(boolean excludeRecents) {
         if (SPEW) {
             Slog.d(TAG, "animateCollapse(): mExpanded=" + mExpanded
                     + " mExpandedVisible=" + mExpandedVisible
@@ -844,6 +926,11 @@
                     + " mAnimVel=" + mAnimVel);
         }
 
+        if (!excludeRecents) {
+            mHandler.removeMessages(MSG_CLOSE_RECENTS_PANEL);
+            mHandler.sendEmptyMessage(MSG_CLOSE_RECENTS_PANEL);
+        }
+
         if (!mExpandedVisible) {
             return;
         }
@@ -1557,6 +1644,13 @@
         } catch (RemoteException ex) { }
     }
 
+    public void toggleRecentApps() {
+        int msg = (mRecentsPanel.getVisibility() == View.GONE)
+                ? MSG_OPEN_RECENTS_PANEL : MSG_CLOSE_RECENTS_PANEL;
+        mHandler.removeMessages(msg);
+        mHandler.sendEmptyMessage(msg);
+    }
+
     /**
      * The LEDs are turned o)ff when the notification panel is shown, even just a little bit.
      * This was added last-minute and is inconsistent with the way the rest of the notifications
@@ -1625,7 +1719,14 @@
             String action = intent.getAction();
             if (Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals(action)
                     || Intent.ACTION_SCREEN_OFF.equals(action)) {
-                animateCollapse();
+                boolean excludeRecents = false;
+                if (Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals(action)) {
+                    String reason = intent.getExtras().getString("reason");
+                    if (reason != null) {
+                        excludeRecents = reason.equals("recentapps");
+                    }
+                }
+                animateCollapse(excludeRecents);
             }
             else if (Intent.ACTION_CONFIGURATION_CHANGED.equals(action)) {
                 repositionNavigationBar();
@@ -1690,5 +1791,27 @@
             vibrate();
         }
     };
+
+    public class TouchOutsideListener implements View.OnTouchListener {
+        private int mMsg;
+        private RecentsPanelView mPanel;
+
+        public TouchOutsideListener(int msg, RecentsPanelView panel) {
+            mMsg = msg;
+            mPanel = panel;
+        }
+
+        public boolean onTouch(View v, MotionEvent ev) {
+            final int action = ev.getAction();
+            if (action == MotionEvent.ACTION_OUTSIDE
+                || (action == MotionEvent.ACTION_DOWN
+                    && !mPanel.isInContentArea((int)ev.getX(), (int)ev.getY()))) {
+                mHandler.removeMessages(mMsg);
+                mHandler.sendEmptyMessage(mMsg);
+                return true;
+            }
+            return false;
+        }
+    }
 }
 
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/CompatModePanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/CompatModePanel.java
index 5a82d1b..c62c4ad 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/CompatModePanel.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/CompatModePanel.java
@@ -107,9 +107,14 @@
 
     private void refresh() {
         int mode = mAM.getFrontActivityScreenCompatMode();
+        if (mode == ActivityManager.COMPAT_MODE_ALWAYS
+                || mode == ActivityManager.COMPAT_MODE_NEVER) {
+            // No longer have something to switch.
+            closePanel();
+            return;
+        }
         final boolean on = (mode == ActivityManager.COMPAT_MODE_ENABLED);
         mOnButton.setChecked(on);
         mOffButton.setChecked(!on);
     }
-
 }
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 a7af30d..93f7af3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
@@ -76,12 +76,12 @@
 import com.android.systemui.statusbar.policy.NetworkController;
 import com.android.systemui.statusbar.policy.Prefs;
 import com.android.systemui.recent.RecentsPanelView;
-import com.android.systemui.recent.carousel.RecentApplicationsActivity;
 
 public class TabletStatusBar extends StatusBar implements
         HeightReceiver.OnBarHeightChangedListener,
         InputMethodsPanel.OnHardKeyboardEnabledChangeListener {
     public static final boolean DEBUG = false;
+    public static final boolean DEBUG_COMPAT_HELP = false;
     public static final String TAG = "TabletStatusBar";
 
 
@@ -166,6 +166,8 @@
     View mFakeSpaceBar;
     KeyEvent mSpaceBarKeyEvent = null;
 
+    View mCompatibilityHelpDialog = null;
+    
     // for disabling the status bar
     int mDisabled = 0;
 
@@ -1010,20 +1012,31 @@
 
         mCompatModeButton.refresh();
         if (mCompatModeButton.getVisibility() == View.VISIBLE) {
-            if (! Prefs.read(mContext).getBoolean(Prefs.SHOWN_COMPAT_MODE_HELP, false)) {
+            if (DEBUG_COMPAT_HELP
+                    || ! Prefs.read(mContext).getBoolean(Prefs.SHOWN_COMPAT_MODE_HELP, false)) {
                 showCompatibilityHelp();
             }
+        } else {
+            hideCompatibilityHelp();
+            mCompatModePanel.closePanel();
         }
     }
 
     private void showCompatibilityHelp() {
-        final View dlg = View.inflate(mContext, R.layout.compat_mode_help, null);
-        View button = dlg.findViewById(R.id.button);
+        if (mCompatibilityHelpDialog != null) {
+            return;
+        }
+        
+        mCompatibilityHelpDialog = View.inflate(mContext, R.layout.compat_mode_help, null);
+        View button = mCompatibilityHelpDialog.findViewById(R.id.button);
 
         button.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
-                WindowManagerImpl.getDefault().removeView(dlg);
+                hideCompatibilityHelp();
+                SharedPreferences.Editor editor = Prefs.edit(mContext);
+                editor.putBoolean(Prefs.SHOWN_COMPAT_MODE_HELP, true);
+                editor.apply();
             }
         });
 
@@ -1040,13 +1053,16 @@
                 | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING;
         lp.windowAnimations = com.android.internal.R.style.Animation_ZoomButtons; // simple fade
 
-        WindowManagerImpl.getDefault().addView(dlg, lp);
-
-        SharedPreferences.Editor editor = Prefs.edit(mContext);
-        editor.putBoolean(Prefs.SHOWN_COMPAT_MODE_HELP, true);
-        editor.apply();
+        WindowManagerImpl.getDefault().addView(mCompatibilityHelpDialog, lp);
     }
 
+    private void hideCompatibilityHelp() {
+        if (mCompatibilityHelpDialog != null) {
+            WindowManagerImpl.getDefault().removeView(mCompatibilityHelpDialog);
+            mCompatibilityHelpDialog = null;
+        }
+    }
+    
     public void setImeWindowStatus(IBinder token, int vis, int backDisposition) {
         mInputMethodSwitchButton.setImeWindowStatus(token,
                 (vis & InputMethodService.IME_ACTIVE) != 0);
@@ -1156,20 +1172,12 @@
 
     public void onClickRecentButton() {
         if (DEBUG) Slog.d(TAG, "clicked recent apps; disabled=" + mDisabled);
-        if (mRecentsPanel == null) {
-            Intent intent = new Intent();
-            intent.setClass(mContext, RecentApplicationsActivity.class);
-            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
-                    | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
-            mContext.startActivity(intent);
-        } else {
-            if ((mDisabled & StatusBarManager.DISABLE_EXPAND) == 0) {
-                int msg = (mRecentsPanel.getVisibility() == View.GONE)
-                    ? MSG_OPEN_RECENTS_PANEL
-                    : MSG_CLOSE_RECENTS_PANEL;
-                mHandler.removeMessages(msg);
-                mHandler.sendEmptyMessage(msg);
-            }
+        if ((mDisabled & StatusBarManager.DISABLE_EXPAND) == 0) {
+            int msg = (mRecentsPanel.getVisibility() == View.GONE)
+                ? MSG_OPEN_RECENTS_PANEL
+                : MSG_CLOSE_RECENTS_PANEL;
+            mHandler.removeMessages(msg);
+            mHandler.sendEmptyMessage(msg);
         }
     }
 
@@ -1681,6 +1689,13 @@
     public void userActivity() {
     }
 
+    public void toggleRecentApps() {
+        int msg = (mRecentsPanel.getVisibility() == View.GONE)
+                ? MSG_OPEN_RECENTS_PANEL : MSG_CLOSE_RECENTS_PANEL;
+        mHandler.removeMessages(msg);
+        mHandler.sendEmptyMessage(msg);
+    }
+
     public class TouchOutsideListener implements View.OnTouchListener {
         private int mMsg;
         private StatusBarPanel mPanel;
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index 5728989..b52e7e1 100755
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -149,10 +149,12 @@
     static final int LONG_PRESS_POWER_NOTHING = 0;
     static final int LONG_PRESS_POWER_GLOBAL_ACTIONS = 1;
     static final int LONG_PRESS_POWER_SHUT_OFF = 2;
-    
+
+    // These need to match the documentation/constant in
+    // core/res/res/values/config.xml
     static final int LONG_PRESS_HOME_NOTHING = 0;
     static final int LONG_PRESS_HOME_RECENT_DIALOG = 1;
-    static final int LONG_PRESS_HOME_RECENT_ACTIVITY = 2;
+    static final int LONG_PRESS_HOME_RECENT_SYSTEM_UI = 2;
 
     // wallpaper is at the bottom, though the window manager may move it.
     static final int WALLPAPER_LAYER = 2;
@@ -623,7 +625,7 @@
             mLongPressOnHomeBehavior
                     = mContext.getResources().getInteger(R.integer.config_longPressOnHomeBehavior);
             if (mLongPressOnHomeBehavior < LONG_PRESS_HOME_NOTHING ||
-                    mLongPressOnHomeBehavior > LONG_PRESS_HOME_RECENT_ACTIVITY) {
+                    mLongPressOnHomeBehavior > LONG_PRESS_HOME_RECENT_SYSTEM_UI) {
                 mLongPressOnHomeBehavior = LONG_PRESS_HOME_NOTHING;
             }
         }
@@ -639,17 +641,11 @@
 
         if (mLongPressOnHomeBehavior == LONG_PRESS_HOME_RECENT_DIALOG) {
             showOrHideRecentAppsDialog(0, true /*dismissIfShown*/);
-        } else if (mLongPressOnHomeBehavior == LONG_PRESS_HOME_RECENT_ACTIVITY) {
+        } else if (mLongPressOnHomeBehavior == LONG_PRESS_HOME_RECENT_SYSTEM_UI) {
             try {
-                Intent intent = new Intent();
-                intent.setClassName("com.android.systemui", 
-                        "com.android.systemui.recent.RecentApplicationsActivity");
-                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK 
-                        | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
-                mContext.startActivity(intent);
-                return;
-            } catch (ActivityNotFoundException e) {
-                Log.e(TAG, "Failed to launch RecentAppsIntent", e);
+                mStatusBarService.toggleRecentApps();
+            } catch (RemoteException e) {
+                Slog.e(TAG, "RemoteException when showing recent apps", e);
             }
         }
     }
diff --git a/services/java/com/android/server/StatusBarManagerService.java b/services/java/com/android/server/StatusBarManagerService.java
index b1bce50..286a937 100644
--- a/services/java/com/android/server/StatusBarManagerService.java
+++ b/services/java/com/android/server/StatusBarManagerService.java
@@ -345,6 +345,15 @@
         });
     }
 
+    @Override
+    public void toggleRecentApps() {
+        if (mBar != null) {
+            try {
+                mBar.toggleRecentApps();
+            } catch (RemoteException ex) {}
+        }
+    }
+
     private void enforceStatusBar() {
         mContext.enforceCallingOrSelfPermission(android.Manifest.permission.STATUS_BAR,
                 "StatusBarManagerService");
diff --git a/services/tests/servicestests/src/com/android/server/NetworkPolicyManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/NetworkPolicyManagerServiceTest.java
index 476aded..edccf6c 100644
--- a/services/tests/servicestests/src/com/android/server/NetworkPolicyManagerServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/NetworkPolicyManagerServiceTest.java
@@ -25,13 +25,16 @@
 import static android.net.NetworkPolicyManager.computeLastCycleBoundary;
 import static android.net.NetworkStats.UID_ALL;
 import static android.net.TrafficStats.TEMPLATE_WIFI;
+import static org.easymock.EasyMock.anyInt;
 import static org.easymock.EasyMock.capture;
 import static org.easymock.EasyMock.createMock;
 import static org.easymock.EasyMock.eq;
 import static org.easymock.EasyMock.expect;
 import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.isA;
 
 import android.app.IActivityManager;
+import android.app.INotificationManager;
 import android.app.IProcessObserver;
 import android.content.Intent;
 import android.content.pm.PackageManager;
@@ -81,14 +84,15 @@
     private INetworkPolicyListener mPolicyListener;
     private TrustedTime mTime;
     private IConnectivityManager mConnManager;
+    private INotificationManager mNotifManager;
 
     private NetworkPolicyManagerService mService;
     private IProcessObserver mProcessObserver;
 
     private Binder mStubBinder = new Binder();
 
-    private static final int UID_A = 800;
-    private static final int UID_B = 801;
+    private static final int UID_A = android.os.Process.FIRST_APPLICATION_UID + 800;
+    private static final int UID_B = android.os.Process.FIRST_APPLICATION_UID + 801;
 
     private static final int PID_1 = 400;
     private static final int PID_2 = 401;
@@ -119,10 +123,12 @@
         mPolicyListener = createMock(INetworkPolicyListener.class);
         mTime = createMock(TrustedTime.class);
         mConnManager = createMock(IConnectivityManager.class);
+        mNotifManager = createMock(INotificationManager.class);
 
         mService = new NetworkPolicyManagerService(
                 mServiceContext, mActivityManager, mPowerManager, mStatsService, mTime, mPolicyDir);
         mService.bindConnectivityManager(mConnManager);
+        mService.bindNotificationManager(mNotifManager);
 
         // RemoteCallbackList needs a binder to use as key
         expect(mPolicyListener.asBinder()).andReturn(mStubBinder).atLeastOnce();
@@ -137,6 +143,7 @@
 
         // expect to answer screen status during systemReady()
         expect(mPowerManager.isScreenOn()).andReturn(true).atLeastOnce();
+        expectTime(System.currentTimeMillis());
 
         replay();
         mService.systemReady();
@@ -365,6 +372,8 @@
         // expect that quota remaining should be 1536 bytes
         // TODO: write up NetworkManagementService mock
 
+        expectClearNotifications();
+
         replay();
         setNetworkPolicies(new NetworkPolicy(TEMPLATE_WIFI, null, CYCLE_DAY, 1024L, 2048L));
         verifyAndReset();
@@ -388,7 +397,7 @@
         return new NetworkState(info, prop, null);
     }
 
-    public void expectTime(long currentTime) throws Exception {
+    private void expectTime(long currentTime) throws Exception {
         expect(mTime.forceRefresh()).andReturn(false).anyTimes();
         expect(mTime.hasCache()).andReturn(true).anyTimes();
         expect(mTime.currentTimeMillis()).andReturn(currentTime).anyTimes();
@@ -396,6 +405,11 @@
         expect(mTime.getCacheCertainty()).andReturn(0L).anyTimes();
     }
 
+    private void expectClearNotifications() throws Exception {
+        mNotifManager.cancelNotificationWithTag(isA(String.class), isA(String.class), anyInt());
+        expectLastCall().anyTimes();
+    }
+
     private void expectRulesChanged(int uid, int policy) throws Exception {
         mPolicyListener.onRulesChanged(eq(uid), eq(policy));
         expectLastCall().atLeastOnce();
@@ -403,13 +417,13 @@
 
     private void replay() {
         EasyMock.replay(mActivityManager, mPowerManager, mStatsService, mPolicyListener, mTime,
-                mConnManager);
+                mConnManager, mNotifManager);
     }
 
     private void verifyAndReset() {
         EasyMock.verify(mActivityManager, mPowerManager, mStatsService, mPolicyListener, mTime,
-                mConnManager);
+                mConnManager, mNotifManager);
         EasyMock.reset(mActivityManager, mPowerManager, mStatsService, mPolicyListener, mTime,
-                mConnManager);
+                mConnManager, mNotifManager);
     }
 }
diff --git a/telephony/java/com/android/internal/telephony/DataCallState.java b/telephony/java/com/android/internal/telephony/DataCallState.java
index 1d67d45..f5651e0 100644
--- a/telephony/java/com/android/internal/telephony/DataCallState.java
+++ b/telephony/java/com/android/internal/telephony/DataCallState.java
@@ -202,7 +202,7 @@
 
                 result = SetupResult.SUCCESS;
             } catch (UnknownHostException e) {
-                Log.d(LOG_TAG, "onSetupCompleted: UnknownHostException " + e);
+                Log.d(LOG_TAG, "setLinkProperties: UnknownHostException " + e);
                 e.printStackTrace();
                 result = SetupResult.ERR_UnacceptableParameter;
             }
@@ -216,8 +216,10 @@
 
         // An error occurred so clear properties
         if (result != SetupResult.SUCCESS) {
-            if(DBG) Log.d(LOG_TAG,
-                    "onSetupConnectionCompleted with an error, clearing LinkProperties");
+            if(DBG) {
+                Log.d(LOG_TAG, "setLinkProperties: error clearing LinkProperties " +
+                        "status=" + status + " result=" + result);
+            }
             linkProperties.clear();
         }
 
diff --git a/telephony/java/com/android/internal/telephony/DataConnection.java b/telephony/java/com/android/internal/telephony/DataConnection.java
index c21a96a..5c030fd 100644
--- a/telephony/java/com/android/internal/telephony/DataConnection.java
+++ b/telephony/java/com/android/internal/telephony/DataConnection.java
@@ -228,7 +228,6 @@
         mId = id;
         mRetryMgr = rm;
         this.cid = -1;
-        clearSettings();
 
         setDbg(false);
         addState(mDefaultState);
@@ -313,7 +312,6 @@
             AsyncResult.forMessage(msg);
             msg.sendToTarget();
         }
-        clearSettings();
         if (DBG) log("NotifyDisconnectCompleted DisconnectParams=" + dp);
     }
 
@@ -632,7 +630,6 @@
                 }
                 case DataConnectionAc.REQ_RESET:
                     if (VDBG) log("DcDefaultState: msg.what=REQ_RESET");
-                    clearSettings();
                     mAc.replyToMessage(msg, DataConnectionAc.RSP_RESET);
                     transitionTo(mInactiveState);
                     break;
@@ -718,6 +715,7 @@
                 if (VDBG) log("DcInactiveState: enter notifyDisconnectCompleted");
                 notifyDisconnectCompleted(mDisconnectParams);
             }
+            clearSettings();
         }
 
         @Override
diff --git a/telephony/java/com/android/internal/telephony/WapPushOverSms.java b/telephony/java/com/android/internal/telephony/WapPushOverSms.java
old mode 100644
new mode 100755
diff --git a/telephony/java/com/android/internal/telephony/WspTypeDecoder.java b/telephony/java/com/android/internal/telephony/WspTypeDecoder.java
old mode 100644
new mode 100755
index c8dd718..73260fb
--- a/telephony/java/com/android/internal/telephony/WspTypeDecoder.java
+++ b/telephony/java/com/android/internal/telephony/WspTypeDecoder.java
@@ -194,6 +194,7 @@
 
     public static final String CONTENT_TYPE_B_PUSH_CO = "application/vnd.wap.coc";
     public static final String CONTENT_TYPE_B_MMS = "application/vnd.wap.mms-message";
+    public static final String CONTENT_TYPE_B_PUSH_SYNCML_NOTI = "application/vnd.syncml.notification";
 
     byte[] wspData;
     int    dataLength;
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java b/telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java
old mode 100644
new mode 100755
index 29349db..07b0f4f
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java
@@ -41,6 +41,7 @@
 import com.android.internal.telephony.SmsMessageBase;
 import com.android.internal.telephony.SmsMessageBase.TextEncodingDetails;
 import com.android.internal.telephony.TelephonyProperties;
+import com.android.internal.telephony.WspTypeDecoder;
 import com.android.internal.telephony.cdma.sms.SmsEnvelope;
 import com.android.internal.telephony.cdma.sms.UserData;
 import com.android.internal.util.HexDump;
@@ -50,6 +51,8 @@
 import java.util.Arrays;
 import java.util.HashMap;
 
+import android.content.res.Resources;
+
 
 final class CdmaSMSDispatcher extends SMSDispatcher {
     private static final String TAG = "CDMA";
@@ -57,6 +60,9 @@
     private byte[] mLastDispatchedSmsFingerprint;
     private byte[] mLastAcknowledgedSmsFingerprint;
 
+    private boolean mCheckForDuplicatePortsInOmadmWapPush = Resources.getSystem().getBoolean(
+            com.android.internal.R.bool.config_duplicate_port_omadm_wappush);
+
     CdmaSMSDispatcher(CDMAPhone phone) {
         super(phone);
     }
@@ -253,6 +259,13 @@
             sourcePort |= 0xFF & pdu[index++];
             destinationPort = (0xFF & pdu[index++]) << 8;
             destinationPort |= 0xFF & pdu[index++];
+            // Some carriers incorrectly send duplicate port fields in omadm wap pushes.
+            // If configured, check for that here
+            if (mCheckForDuplicatePortsInOmadmWapPush) {
+                if (checkDuplicatePortOmadmWappush(pdu,index)) {
+                    index = index + 4; // skip duplicate port fields
+                }
+            }
         }
 
         // Lookup all other related parts
@@ -502,4 +515,42 @@
             return CommandsInterface.CDMA_SMS_FAIL_CAUSE_ENCODING_PROBLEM;
         }
     }
+
+    /**
+     * Optional check to see if the received WapPush is an OMADM notification with erroneous
+     * extra port fields.
+     * - Some carriers make this mistake.
+     * ex: MSGTYPE-TotalSegments-CurrentSegment
+     *       -SourcePortDestPort-SourcePortDestPort-OMADM PDU
+     * @param origPdu The WAP-WDP PDU segment
+     * @param index Current Index while parsing the PDU.
+     * @return True if OrigPdu is OmaDM Push Message which has duplicate ports.
+     *         False if OrigPdu is NOT OmaDM Push Message which has duplicate ports.
+     */
+    private boolean checkDuplicatePortOmadmWappush(byte[] origPdu, int index) {
+        index += 4;
+        byte[] omaPdu = new byte[origPdu.length - index];
+        System.arraycopy(origPdu, index, omaPdu, 0, omaPdu.length);
+
+        WspTypeDecoder pduDecoder = new WspTypeDecoder(omaPdu);
+        int wspIndex = 2;
+
+        // Process header length field
+        if (pduDecoder.decodeUintvarInteger(wspIndex) == false) {
+            return false;
+        }
+
+        wspIndex += pduDecoder.getDecodedDataLength(); // advance to next field
+
+        // Process content type field
+        if (pduDecoder.decodeContentType(wspIndex) == false) {
+            return false;
+        }
+
+        String mimeType = pduDecoder.getValueString();
+        if (mimeType != null && mimeType.equals(WspTypeDecoder.CONTENT_TYPE_B_PUSH_SYNCML_NOTI)) {
+            return true;
+        }
+        return false;
+    }
 }
diff --git a/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java b/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java
index ee63ede..9af2d26 100755
--- a/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java
+++ b/telephony/java/com/android/internal/telephony/cdma/RuimRecords.java
@@ -119,8 +119,11 @@
 
         adnCache.reset();
 
-        phone.setSystemProperty(PROPERTY_ICC_OPERATOR_NUMERIC, null);
-        phone.setSystemProperty(PROPERTY_ICC_OPERATOR_ISO_COUNTRY, null);
+        // Don't clean up PROPERTY_ICC_OPERATOR_ISO_COUNTRY and
+        // PROPERTY_ICC_OPERATOR_NUMERIC here. Since not all CDMA
+        // devices have RUIM, these properties should keep the original
+        // values, e.g. build time settings, when there is no RUIM but
+        // set new values when RUIM is available and loaded.
 
         // recordsRequested is set to false indicating that the SIM
         // read requests made so far are not valid. This is set to
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
index dcde71a..19c06f6 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
@@ -1850,7 +1850,7 @@
             if (!dc.configureRetry(SystemProperties.get("ro.gsm.data_retry_config"))) {
                 if (!dc.configureRetry(DEFAULT_DATA_RETRY_CONFIG)) {
                     // Should never happen, log an error and default to a simple linear sequence.
-                    loge("createDataConnection: Could not configure using " +
+                    loge("configureRetry: Could not configure using " +
                             "DEFAULT_DATA_RETRY_CONFIG=" + DEFAULT_DATA_RETRY_CONFIG);
                     dc.configureRetry(20, 2000, 1000);
                 }
@@ -1859,7 +1859,7 @@
             if (!dc.configureRetry(SystemProperties.get("ro.gsm.2nd_data_retry_config"))) {
                 if (!dc.configureRetry(SECONDARY_DATA_RETRY_CONFIG)) {
                     // Should never happen, log an error and default to a simple sequence.
-                    loge("createDataConnection: Could note configure using " +
+                    loge("configureRetry: Could note configure using " +
                             "SECONDARY_DATA_RETRY_CONFIG=" + SECONDARY_DATA_RETRY_CONFIG);
                     dc.configureRetry("max_retries=3, 333, 333, 333");
                 }
@@ -1872,7 +1872,7 @@
             if (DBG) log("destroyDataConnections: clear mDataConnectionList");
             mDataConnections.clear();
         } else {
-            if (DBG) log("destroyDataConnectionList mDataConnecitonList is empty, ignore");
+            if (DBG) log("destroyDataConnections: mDataConnecitonList is empty, ignore");
         }
     }
 
diff --git a/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
index 8e3ed93..b4448a9 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
@@ -1093,6 +1093,33 @@
     }
 
     @LayoutlibDelegate
+    /*package*/ static void native_drawTextWithGlyphs(int nativeCanvas, char[] text,
+            int index, int count, float x,
+            float y, int flags, int paint) {
+        native_drawText(nativeCanvas, text, index, count, x, y, flags, paint);
+    }
+
+    @LayoutlibDelegate
+    /*package*/ static void native_drawTextWithGlyphs(int nativeCanvas, String text,
+            int start, int end, float x,
+            float y, int flags, int paint) {
+        int count = end - start;
+        char[] buffer = TemporaryBuffer.obtain(count);
+        TextUtils.getChars(text, start, end, buffer, 0);
+
+        native_drawText(nativeCanvas, text, 0, count, x, y, flags, paint);
+    }
+
+    @LayoutlibDelegate
+    /*package*/ static void native_drawGlyphs(int nativeCanvas, char[] glyphs,
+            int index, int count, float x,
+            float y, int flags, int paint) {
+        // FIXME
+        Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
+                "Canvas.drawGlyphs is not supported.", null, null /*data*/);
+    }
+
+    @LayoutlibDelegate
     /*package*/ static void native_drawPosText(int nativeCanvas,
                                                   char[] text, int index,
                                                   int count, float[] pos,
diff --git a/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java
index 373f482..7777e19 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java
@@ -940,9 +940,16 @@
     }
 
     @LayoutlibDelegate
+    /* package */static int native_getTextGlyphs(int native_object, String text, int start,
+            int end, int contextStart, int contextEnd, int flags, char[] glyphs) {
+        // FIXME
+        return 0;
+    }
+
+    @LayoutlibDelegate
     /*package*/ static float native_getTextRunAdvances(int native_object,
             char[] text, int index, int count, int contextIndex, int contextCount,
-            int flags, float[] advances, int advancesIndex) {
+            int flags, float[] advances, int advancesIndex, int reserved) {
         // get the delegate from the native int.
         Paint_Delegate delegate = sManager.getDelegate(native_object);
         if (delegate == null) {
@@ -986,14 +993,14 @@
     @LayoutlibDelegate
     /*package*/ static float native_getTextRunAdvances(int native_object,
             String text, int start, int end, int contextStart, int contextEnd,
-            int flags, float[] advances, int advancesIndex) {
+            int flags, float[] advances, int advancesIndex, int reserved) {
         // FIXME: support contextStart, contextEnd and direction flag
         int count = end - start;
         char[] buffer = TemporaryBuffer.obtain(count);
         TextUtils.getChars(text, start, end, buffer, 0);
 
         return native_getTextRunAdvances(native_object, buffer, 0, count, contextStart,
-                contextEnd - contextStart, flags, advances, advancesIndex);
+                contextEnd - contextStart, flags, advances, advancesIndex, reserved);
     }
 
     @LayoutlibDelegate
diff --git a/tools/layoutlib/bridge/src/libcore/icu/ICU_Delegate.java b/tools/layoutlib/bridge/src/libcore/icu/ICU_Delegate.java
index e6dc646..98f8529 100644
--- a/tools/layoutlib/bridge/src/libcore/icu/ICU_Delegate.java
+++ b/tools/layoutlib/bridge/src/libcore/icu/ICU_Delegate.java
@@ -44,6 +44,16 @@
     // --- Native methods accessing ICU's database.
 
     @LayoutlibDelegate
+    /*package*/ static String getIcuVersion() {
+        return "unknown_layoutlib";
+    }
+
+    @LayoutlibDelegate
+    /*package*/ static String getUnicodeVersion() {
+        return "5.2";
+    }
+
+    @LayoutlibDelegate
     /*package*/ static String[] getAvailableBreakIteratorLocalesNative() {
         return new String[0];
     }
@@ -74,17 +84,27 @@
     }
 
     @LayoutlibDelegate
-    /*package*/ static String getCurrencyCodeNative(String locale) {
+    /*package*/ static String[] getAvailableCurrencyCodes() {
+        return new String[0];
+    }
+
+    @LayoutlibDelegate
+    /*package*/ static String getCurrencyCode(String locale) {
         return "";
     }
 
     @LayoutlibDelegate
-    /*package*/ static int getCurrencyFractionDigitsNative(String currencyCode) {
+    /*package*/ static String getCurrencyDisplayName(String locale, String currencyCode) {
+        return "";
+    }
+
+    @LayoutlibDelegate
+    /*package*/ static int getCurrencyFractionDigits(String currencyCode) {
         return 0;
     }
 
     @LayoutlibDelegate
-    /*package*/ static String getCurrencySymbolNative(String locale, String currencyCode) {
+    /*package*/ static String getCurrencySymbol(String locale, String currencyCode) {
         return "";
     }
 
@@ -114,6 +134,12 @@
     }
 
     @LayoutlibDelegate
+    /*package*/ static String addLikelySubtags(String locale) {
+        return "";
+    }
+
+
+    @LayoutlibDelegate
     /*package*/ static String[] getISOLanguagesNative() {
         return Locale.getISOLanguages();
     }