Speeding up Recent Apps

- removing unused calls on startup
- no longer compositing bitmaps against a background bitmap

Change-Id: If26812ef475d5d972d98dd1cb9f7f741eeb99dae
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 167d362..c6966f9 100644
--- a/packages/SystemUI/res/layout-land/status_bar_recent_item.xml
+++ b/packages/SystemUI/res/layout-land/status_bar_recent_item.xml
@@ -40,8 +40,8 @@
             android:background="@drawable/recents_thumbnail_bg"
             android:foreground="@drawable/recents_thumbnail_fg">
             <ImageView android:id="@+id/app_thumbnail_image"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
+                android:layout_width="@dimen/status_bar_recents_thumbnail_width"
+                android:layout_height="@dimen/status_bar_recents_thumbnail_height"
                 android:visibility="invisible"
             />
         </FrameLayout>
diff --git a/packages/SystemUI/res/layout-port/status_bar_recent_item.xml b/packages/SystemUI/res/layout-port/status_bar_recent_item.xml
index de80a51..586712f 100644
--- a/packages/SystemUI/res/layout-port/status_bar_recent_item.xml
+++ b/packages/SystemUI/res/layout-port/status_bar_recent_item.xml
@@ -38,8 +38,8 @@
             android:background="@drawable/recents_thumbnail_bg"
             android:foreground="@drawable/recents_thumbnail_fg">
             <ImageView android:id="@+id/app_thumbnail_image"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
+                android:layout_width="@dimen/status_bar_recents_thumbnail_width"
+                android:layout_height="@dimen/status_bar_recents_thumbnail_height"
                 android:visibility="invisible"
             />
         </FrameLayout>
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 07088d5..cd8ccd5 100644
--- a/packages/SystemUI/res/layout-sw600dp/status_bar_recent_item.xml
+++ b/packages/SystemUI/res/layout-sw600dp/status_bar_recent_item.xml
@@ -33,8 +33,8 @@
         android:background="@drawable/recents_thumbnail_bg"
         android:foreground="@drawable/recents_thumbnail_fg">
         <ImageView android:id="@+id/app_thumbnail_image"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
+            android:layout_width="@dimen/status_bar_recents_thumbnail_width"
+            android:layout_height="@dimen/status_bar_recents_thumbnail_height"
             android:visibility="invisible"
         />
     </FrameLayout>
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
index 0621b22..9bda158 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java
@@ -128,7 +128,7 @@
         }
 
         public void setThumbnail(Bitmap thumbnail) {
-            mThumbnail = compositeBitmap(mDefaultThumbnailBackground, thumbnail);
+            mThumbnail = thumbnail;
         }
 
         public Bitmap getThumbnail() {
@@ -478,13 +478,10 @@
             if (resolveInfo != null) {
                 final ActivityInfo info = resolveInfo.activityInfo;
                 final String title = info.loadLabel(pm).toString();
-                // Drawable icon = info.loadIcon(pm);
                 Drawable icon = getFullResIcon(resolveInfo, pm);
                 if (title != null && title.length() > 0 && icon != null) {
                     if (DEBUG) Log.v(TAG, "creating activity desc for id="
                             + recentInfo.id + ", label=" + title);
-                    ActivityManager.TaskThumbnails thumbs = am.getTaskThumbnails(
-                            recentInfo.persistentId);
                     ActivityDescription item = new ActivityDescription(recentInfo,
                             resolveInfo, intent, index, info.packageName);
                     activityDescriptions.add(item);
@@ -523,7 +520,9 @@
         synchronized (ad) {
             ad.mLabel = label;
             ad.mIcon = icon;
-            ad.setThumbnail(thumbs != null ? thumbs.mainThumbnail : mDefaultThumbnailBackground);
+            if (thumbs != null && thumbs.mainThumbnail != null) {
+                ad.setThumbnail(thumbs.mainThumbnail);
+            }
         }
     }
 
@@ -651,21 +650,6 @@
         }
     }
 
-    private Bitmap compositeBitmap(Bitmap background, Bitmap thumbnail) {
-        Bitmap outBitmap = background.copy(background.getConfig(), true);
-        if (thumbnail != null) {
-            Canvas canvas = new Canvas(outBitmap);
-            Paint paint = new Paint();
-            paint.setAntiAlias(true);
-            paint.setFilterBitmap(true);
-            paint.setAlpha(255);
-            canvas.drawBitmap(thumbnail, null,
-                    new RectF(0, 0, outBitmap.getWidth(), outBitmap.getHeight()), paint);
-            canvas.setBitmap(null);
-        }
-        return outBitmap;
-    }
-
     private void updateUiElements(Configuration config) {
         final int items = mActivityDescriptions.size();