Skip to content

Commit df9d4e8

Browse files
mikejurkaAndroid (Google) Code Review
authored andcommitted
Merge "Speeding up Recent Apps"
2 parents a71483c + 57e4d44 commit df9d4e8

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
@@ -129,7 +129,7 @@ public Drawable getIcon() {
129129
}
130130

131131
public void setThumbnail(Bitmap thumbnail) {
132-
mThumbnail = compositeBitmap(mDefaultThumbnailBackground, thumbnail);
132+
mThumbnail = thumbnail;
133133
}
134134

135135
public Bitmap getThumbnail() {
@@ -480,13 +480,10 @@ private ArrayList<ActivityDescription> getRecentTasks() {
480480
if (resolveInfo != null) {
481481
final ActivityInfo info = resolveInfo.activityInfo;
482482
final String title = info.loadLabel(pm).toString();
483-
// Drawable icon = info.loadIcon(pm);
484483
Drawable icon = getFullResIcon(resolveInfo, pm);
485484
if (title != null && title.length() > 0 && icon != null) {
486485
if (DEBUG) Log.v(TAG, "creating activity desc for id="
487486
+ recentInfo.id + ", label=" + title);
488-
ActivityManager.TaskThumbnails thumbs = am.getTaskThumbnails(
489-
recentInfo.persistentId);
490487
ActivityDescription item = new ActivityDescription(recentInfo,
491488
resolveInfo, intent, index, info.packageName);
492489
activityDescriptions.add(item);
@@ -525,7 +522,9 @@ void loadActivityDescription(ActivityDescription ad, int index) {
525522
synchronized (ad) {
526523
ad.mLabel = label;
527524
ad.mIcon = icon;
528-
ad.setThumbnail(thumbs != null ? thumbs.mainThumbnail : mDefaultThumbnailBackground);
525+
if (thumbs != null && thumbs.mainThumbnail != null) {
526+
ad.setThumbnail(thumbs.mainThumbnail);
527+
}
529528
}
530529
}
531530

@@ -660,21 +659,6 @@ protected Void doInBackground(Void... params) {
660659
}
661660
}
662661

663-
private Bitmap compositeBitmap(Bitmap background, Bitmap thumbnail) {
664-
Bitmap outBitmap = background.copy(background.getConfig(), true);
665-
if (thumbnail != null) {
666-
Canvas canvas = new Canvas(outBitmap);
667-
Paint paint = new Paint();
668-
paint.setAntiAlias(true);
669-
paint.setFilterBitmap(true);
670-
paint.setAlpha(255);
671-
canvas.drawBitmap(thumbnail, null,
672-
new RectF(0, 0, outBitmap.getWidth(), outBitmap.getHeight()), paint);
673-
canvas.setBitmap(null);
674-
}
675-
return outBitmap;
676-
}
677-
678662
private void updateUiElements(Configuration config) {
679663
final int items = mActivityDescriptions.size();
680664

0 commit comments

Comments
 (0)