diff --git a/quickstep/src/com/android/quickstep/TaskIconCache.java b/quickstep/src/com/android/quickstep/TaskIconCache.java index 08503cfaac..ba1c413909 100644 --- a/quickstep/src/com/android/quickstep/TaskIconCache.java +++ b/quickstep/src/com/android/quickstep/TaskIconCache.java @@ -146,7 +146,7 @@ public class TaskIconCache { key.getComponent(), key.userId); if (activityInfo != null) { BitmapInfo bitmapInfo = getBitmapInfo( - mIconProvider.getIcon(activityInfo, UserHandle.of(key.userId)), + mIconProvider.getIcon(activityInfo), key.userId, desc.getPrimaryColor(), activityInfo.applicationInfo.isInstantApp()); diff --git a/src/com/android/launcher3/WidgetPreviewLoader.java b/src/com/android/launcher3/WidgetPreviewLoader.java index 2f9c96e567..f43452cd65 100644 --- a/src/com/android/launcher3/WidgetPreviewLoader.java +++ b/src/com/android/launcher3/WidgetPreviewLoader.java @@ -541,20 +541,17 @@ public class WidgetPreviewLoader { c.setBitmap(preview); c.drawColor(0, PorterDuff.Mode.CLEAR); } - RectF boxRect = drawBoxWithShadow(c, size, size); + + drawBoxWithShadow(c, size, size); LauncherIcons li = LauncherIcons.obtain(mContext); - Bitmap icon = li.createBadgedIconBitmap( + Drawable icon = li.createBadgedIconBitmap( mutateOnMainThread(info.getFullResIcon(mIconCache)), - Process.myUserHandle(), 0).icon; + Process.myUserHandle(), 0).newIcon(launcher); li.recycle(); - Rect src = new Rect(0, 0, icon.getWidth(), icon.getHeight()); - - boxRect.set(0, 0, iconSize, iconSize); - boxRect.offset(padding, padding); - c.drawBitmap(icon, src, boxRect, - new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG)); + icon.setBounds(padding, padding, padding + iconSize, padding + iconSize); + icon.draw(c); c.setBitmap(null); return preview; } diff --git a/src/com/android/launcher3/notification/NotificationInfo.java b/src/com/android/launcher3/notification/NotificationInfo.java index 80eeb22747..d27d8c7778 100644 --- a/src/com/android/launcher3/notification/NotificationInfo.java +++ b/src/com/android/launcher3/notification/NotificationInfo.java @@ -22,7 +22,6 @@ import android.app.ActivityOptions; import android.app.Notification; import android.app.PendingIntent; import android.content.Context; -import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.Icon; import android.os.Bundle; @@ -86,9 +85,8 @@ public class NotificationInfo implements View.OnClickListener { mIsIconLarge = true; } if (mIconDrawable == null) { - mIconDrawable = new BitmapDrawable(context.getResources(), LauncherAppState - .getInstance(context).getIconCache() - .getDefaultIcon(statusBarNotification.getUser()).icon); + mIconDrawable = LauncherAppState.getInstance(context).getIconCache() + .getDefaultIcon(statusBarNotification.getUser()).newIcon(context); } intent = notification.contentIntent; autoCancel = (notification.flags & Notification.FLAG_AUTO_CANCEL) != 0; diff --git a/src/com/android/launcher3/widget/PendingItemDragHelper.java b/src/com/android/launcher3/widget/PendingItemDragHelper.java index ad0a4017c6..3e61e56ee4 100644 --- a/src/com/android/launcher3/widget/PendingItemDragHelper.java +++ b/src/com/android/launcher3/widget/PendingItemDragHelper.java @@ -39,6 +39,7 @@ import com.android.launcher3.dragndrop.DraggableView; import com.android.launcher3.graphics.DragPreviewProvider; import com.android.launcher3.icons.FastBitmapDrawable; import com.android.launcher3.icons.LauncherIcons; +import com.android.launcher3.icons.RoundDrawableWrapper; import com.android.launcher3.widget.dragndrop.AppWidgetHostViewDragListener; /** @@ -118,12 +119,12 @@ public class PendingItemDragHelper extends DragPreviewProvider { .addDragListener(new AppWidgetHostViewDragListener(launcher)); } if (preview == null) { - FastBitmapDrawable p = new FastBitmapDrawable( + Drawable p = new FastBitmapDrawable( app.getWidgetCache().generateWidgetPreview(launcher, createWidgetInfo.info, maxWidth, null, previewSizeBeforeScale).first); if (RoundedCornerEnforcement.isRoundedCornerEnabled()) { - p.setRoundedCornersRadius(mEnforcedRoundedCornersForWidget); + p = new RoundDrawableWrapper(p, mEnforcedRoundedCornersForWidget); } preview = p; } diff --git a/src/com/android/launcher3/widget/WidgetCell.java b/src/com/android/launcher3/widget/WidgetCell.java index c11b68e5f6..40b256b9cd 100644 --- a/src/com/android/launcher3/widget/WidgetCell.java +++ b/src/com/android/launcher3/widget/WidgetCell.java @@ -46,6 +46,7 @@ import com.android.launcher3.dragndrop.AppWidgetHostViewDrawable; import com.android.launcher3.icons.BaseIconFactory; import com.android.launcher3.icons.BitmapRenderer; import com.android.launcher3.icons.FastBitmapDrawable; +import com.android.launcher3.icons.RoundDrawableWrapper; import com.android.launcher3.model.WidgetItem; /** @@ -248,8 +249,7 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener { public void applyPreview(Bitmap bitmap) { FastBitmapDrawable drawable = new FastBitmapDrawable(bitmap); - drawable.setRoundedCornersRadius(mEnforcedCornerRadius); - applyPreview(drawable); + applyPreview(new RoundDrawableWrapper(drawable, mEnforcedCornerRadius)); } private void applyPreview(Drawable drawable) { diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java index 72b1d2242e..d4e8f1f5d0 100644 --- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java +++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java @@ -512,7 +512,7 @@ public abstract class AbstractLauncherUiTest { } protected boolean isInBackground(Launcher launcher) { - return !launcher.hasBeenResumed(); + return launcher == null || !launcher.hasBeenResumed(); } protected boolean isInState(Supplier state) {