Attach work badge to Weather and Battery widgets

Moving the part where widget icon is generated from WidgetsListHeader (UI thread) to IconCache (backend)

Test: Open widget picker -> switch to work widget picker -> verify that Battery and Weather are badged
Fix: 226132413, 209995894
Change-Id: I3d649f2b26d7d8e7b756129b5bae4433ea344d43
This commit is contained in:
Sihua Ma committed 2022-04-19 15:41:56 -07:00
1 parent ce43fb91bb
commit 4c5bd537bb
3 files changed
+39 -20

No files matched your search

@@ -15,7 +15,6 @@
*/
package com.android.launcher3.widget.picker;
import static com.android.launcher3.widget.WidgetSections.NO_CATEGORY;
import android.content.Context;
import android.content.res.Resources;
@@ -43,8 +42,6 @@ import com.android.launcher3.model.data.ItemInfoWithIcon;
import com.android.launcher3.model.data.PackageItemInfo;
import com.android.launcher3.util.PluralMessageFormat;
import com.android.launcher3.views.ActivityContext;
import com.android.launcher3.widget.WidgetSections;
import com.android.launcher3.widget.WidgetSections.WidgetSection;
import com.android.launcher3.widget.model.WidgetsListHeaderEntry;
import com.android.launcher3.widget.model.WidgetsListSearchHeaderEntry;
@@ -177,13 +174,7 @@ public final class WidgetsListHeader extends LinearLayout implements ItemInfoUpd
private void setIcon(PackageItemInfo info) {
Drawable icon;
if (info.widgetCategory == NO_CATEGORY) {
icon = info.newIcon(getContext());
} else {
WidgetSection widgetSection = WidgetSections.getWidgetSections(getContext())
.get(info.widgetCategory);
icon = getContext().getDrawable(widgetSection.mSectionDrawable);
}
icon = info.newIcon(getContext());
applyDrawables(icon);
mIconDrawable = icon;
if (mIconDrawable != null) {