Skip to content

Commit 57e4d44

Browse files
committed
Speeding up Recent Apps
- removing unused calls on startup - no longer compositing bitmaps against a background bitmap Change-Id: If26812ef475d5d972d98dd1cb9f7f741eeb99dae
1 parent 4f92c9b commit 57e4d44

File tree

4 files changed

+10
-26
lines changed

4 files changed

+10
-26
lines changed

packages/SystemUI/res/layout-land/status_bar_recent_item.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
android:background="@drawable/recents_thumbnail_bg"
4141
android:foreground="@drawable/recents_thumbnail_fg">
4242
<ImageView android:id="@+id/app_thumbnail_image"
43-
android:layout_width="wrap_content"
44-
android:layout_height="wrap_content"
43+
android:layout_width="@dimen/status_bar_recents_thumbnail_width"
44+
android:layout_height="@dimen/status_bar_recents_thumbnail_height"
4545
android:visibility="invisible"
4646
/>
4747
</FrameLayout>

packages/SystemUI/res/layout-port/status_bar_recent_item.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
android:background="@drawable/recents_thumbnail_bg"
3939
android:foreground="@drawable/recents_thumbnail_fg">
4040
<ImageView android:id="@+id/app_thumbnail_image"
41-
android:layout_width="wrap_content"
42-
android:layout_height="wrap_content"
41+
android:layout_width="@dimen/status_bar_recents_thumbnail_width"
42+
android:layout_height="@dimen/status_bar_recents_thumbnail_height"
4343
android:visibility="invisible"
4444
/>
4545
</FrameLayout>

packages/SystemUI/res/layout-sw600dp/status_bar_recent_item.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
android:background="@drawable/recents_thumbnail_bg"
3434
android:foreground="@drawable/recents_thumbnail_fg">
3535
<ImageView android:id="@+id/app_thumbnail_image"
36-
android:layout_width="wrap_content"
37-
android:layout_height="wrap_content"
36+
android:layout_width="@dimen/status_bar_recents_thumbnail_width"
37+
android:layout_height="@dimen/status_bar_recents_thumbnail_height"
3838
android:visibility="invisible"
3939
/>
4040
</FrameLayout>

packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public Drawable getIcon() {
128128
}
129129

130130
public void setThumbnail(Bitmap thumbnail) {
131-
mThumbnail = compositeBitmap(mDefaultThumbnailBackground, thumbnail);
131+
mThumbnail = thumbnail;
132132
}
133133

134134
public Bitmap getThumbnail() {
@@ -478,13 +478,10 @@ private ArrayList<ActivityDescription> getRecentTasks() {
478478
if (resolveInfo != null) {
479479
final ActivityInfo info = resolveInfo.activityInfo;
480480
final String title = info.loadLabel(pm).toString();
481-
// Drawable icon = info.loadIcon(pm);
482481
Drawable icon = getFullResIcon(resolveInfo, pm);
483482
if (title != null && title.length() > 0 && icon != null) {
484483
if (DEBUG) Log.v(TAG, "creating activity desc for id="
485484
+ recentInfo.id + ", label=" + title);
486-
ActivityManager.TaskThumbnails thumbs = am.getTaskThumbnails(
487-
recentInfo.persistentId);
488485
ActivityDescription item = new ActivityDescription(recentInfo,
489486
resolveInfo, intent, index, info.packageName);
490487
activityDescriptions.add(item);
@@ -523,7 +520,9 @@ void loadActivityDescription(ActivityDescription ad, int index) {
523520
synchronized (ad) {
524521
ad.mLabel = label;
525522
ad.mIcon = icon;
526-
ad.setThumbnail(thumbs != null ? thumbs.mainThumbnail : mDefaultThumbnailBackground);
523+
if (thumbs != null && thumbs.mainThumbnail != null) {
524+
ad.setThumbnail(thumbs.mainThumbnail);
525+
}
527526
}
528527
}
529528

@@ -651,21 +650,6 @@ protected Void doInBackground(Void... params) {
651650
}
652651
}
653652

654-
private Bitmap compositeBitmap(Bitmap background, Bitmap thumbnail) {
655-
Bitmap outBitmap = background.copy(background.getConfig(), true);
656-
if (thumbnail != null) {
657-
Canvas canvas = new Canvas(outBitmap);
658-
Paint paint = new Paint();
659-
paint.setAntiAlias(true);
660-
paint.setFilterBitmap(true);
661-
paint.setAlpha(255);
662-
canvas.drawBitmap(thumbnail, null,
663-
new RectF(0, 0, outBitmap.getWidth(), outBitmap.getHeight()), paint);
664-
canvas.setBitmap(null);
665-
}
666-
return outBitmap;
667-
}
668-
669653
private void updateUiElements(Configuration config) {
670654
final int items = mActivityDescriptions.size();
671655

0 commit comments

Comments
 (0)