From 8fe6bd257227942782f30002111ac09bf987b17d Mon Sep 17 00:00:00 2001 From: Brandon Dayauon Date: Fri, 3 Nov 2023 14:41:45 +0000 Subject: [PATCH] Revert "Revert "Fix the badge in badge (triple badging), by simp..." Revert submission 25263180-revert-24721954-cherrypick-removeBadgeInBadge-dia2ji7r7td-RZRSBRGYSA Reason for revert: Fix the test that uses the work USERHANDLE that may cause this security exception https://paste.googleplex.com/5530091189698560 Reverted changes: /q/submissionid:25263180-revert-24721954-cherrypick-removeBadgeInBadge-dia2ji7r7td-RZRSBRGYSA Change-Id: I82dbf155b7bc41a496d50884193f5f168cb46f31 --- src/com/android/launcher3/BubbleTextView.java | 10 ++++++++++ src/com/android/launcher3/pm/UserCache.java | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java index 91da7e6404..bd271b9b0e 100644 --- a/src/com/android/launcher3/BubbleTextView.java +++ b/src/com/android/launcher3/BubbleTextView.java @@ -22,6 +22,7 @@ import static com.android.launcher3.Flags.enableCursorHoverStates; import static com.android.launcher3.config.FeatureFlags.ENABLE_ICON_LABEL_AUTO_SCALING; import static com.android.launcher3.graphics.PreloadIconDrawable.newPendingIcon; import static com.android.launcher3.icons.BitmapInfo.FLAG_NO_BADGE; +import static com.android.launcher3.icons.BitmapInfo.FLAG_SKIP_USER_BADGE; import static com.android.launcher3.icons.BitmapInfo.FLAG_THEMED; import static com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound; import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_INCREMENTAL_DOWNLOAD_ACTIVE; @@ -164,6 +165,8 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, @ViewDebug.ExportedProperty(category = "launcher") private boolean mHideBadge = false; @ViewDebug.ExportedProperty(category = "launcher") + private boolean mSkipUserBadge = false; + @ViewDebug.ExportedProperty(category = "launcher") private boolean mIsIconVisible = true; @ViewDebug.ExportedProperty(category = "launcher") private int mTextColor; @@ -268,6 +271,10 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, mHideBadge = hideBadge; } + public void setSkipUserBadge(boolean skipUserBadge) { + mSkipUserBadge = skipUserBadge; + } + /** * Resets the view so it can be recycled. */ @@ -397,6 +404,9 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, if (mHideBadge || mDisplay == DISPLAY_SEARCH_RESULT_SMALL) { flags |= FLAG_NO_BADGE; } + if (mSkipUserBadge) { + flags |= FLAG_SKIP_USER_BADGE; + } FastBitmapDrawable iconDrawable = info.newIcon(getContext(), flags); mDotParams.appColor = iconDrawable.getIconColor(); mDotParams.dotColor = Themes.getAttrColor(getContext(), R.attr.notificationDotColor); diff --git a/src/com/android/launcher3/pm/UserCache.java b/src/com/android/launcher3/pm/UserCache.java index 4661fd4498..8708d5ac2e 100644 --- a/src/com/android/launcher3/pm/UserCache.java +++ b/src/com/android/launcher3/pm/UserCache.java @@ -28,6 +28,7 @@ import android.os.UserManager; import androidx.annotation.AnyThread; import androidx.annotation.NonNull; +import androidx.annotation.VisibleForTesting; import androidx.annotation.WorkerThread; import com.android.launcher3.util.MainThreadInitializedObject; @@ -154,6 +155,11 @@ public class UserCache implements SafeCloseable { .orElse(Process.myUserHandle()); } + @VisibleForTesting + public void putToCache(UserHandle userHandle, UserIconInfo info) { + mUserToSerialMap.put(userHandle, info); + } + /** * @see UserManager#getUserProfiles() */