Adding FLAG_ICON_BADGED and check flag in DragView.getBadge.
Bug: 77634973
Change-Id: I0e398bea7aa86246616e37bbd76f0936facb83ba
diff --git a/src/com/android/launcher3/ItemInfoWithIcon.java b/src/com/android/launcher3/ItemInfoWithIcon.java
index bf985c3..4677d31 100644
--- a/src/com/android/launcher3/ItemInfoWithIcon.java
+++ b/src/com/android/launcher3/ItemInfoWithIcon.java
@@ -91,6 +91,11 @@
public static final int FLAG_ADAPTIVE_ICON = 1 << 8;
/**
+ * Flag indicating that the icon is badged.
+ */
+ public static final int FLAG_ICON_BADGED = 1 << 9;
+
+ /**
* Status associated with the system state of the underlying item. This is calculated every
* time a new info is created and not persisted on the disk.
*/
diff --git a/src/com/android/launcher3/dragndrop/DragView.java b/src/com/android/launcher3/dragndrop/DragView.java
index 8d4f2ef..e1e1f83 100644
--- a/src/com/android/launcher3/dragndrop/DragView.java
+++ b/src/com/android/launcher3/dragndrop/DragView.java
@@ -46,6 +46,7 @@
import com.android.launcher3.FastBitmapDrawable;
import com.android.launcher3.ItemInfo;
+import com.android.launcher3.ItemInfoWithIcon;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAnimUtils;
import com.android.launcher3.LauncherAppState;
@@ -69,6 +70,8 @@
import java.util.Arrays;
import java.util.List;
+import static com.android.launcher3.ItemInfoWithIcon.FLAG_ICON_BADGED;
+
public class DragView extends View {
private static final ColorMatrix sTempMatrix1 = new ColorMatrix();
private static final ColorMatrix sTempMatrix2 = new ColorMatrix();
@@ -364,7 +367,10 @@
private Drawable getBadge(ItemInfo info, LauncherAppState appState, Object obj) {
int iconSize = appState.getInvariantDeviceProfile().iconBitmapSize;
if (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT) {
- if (info.id == ItemInfo.NO_ID || !(obj instanceof ShortcutInfoCompat)) {
+ boolean iconBadged = (info instanceof ItemInfoWithIcon)
+ && (((ItemInfoWithIcon) info).runtimeStatusFlags & FLAG_ICON_BADGED) > 0;
+ if ((info.id == ItemInfo.NO_ID && !iconBadged)
+ || !(obj instanceof ShortcutInfoCompat)) {
// The item is not yet added on home screen.
return new FixedSizeEmptyDrawable(iconSize);
}