From 6b8e36224796405449c3006d8a95ae5bba9895f6 Mon Sep 17 00:00:00 2001 From: Charlie Anderson Date: Thu, 1 Aug 2024 15:19:27 -0400 Subject: [PATCH] Adds new bugfix flag for using new app archiving icon Flag: com.android.launcher3.use_new_icon_for_archived_apps Bug: 350758155 Test: locally Change-Id: I7bacbacd85a8216e7975665e6d3c1ab98ed23235 --- aconfig/launcher.aconfig | 17 ++++++++++------- src/com/android/launcher3/BubbleTextView.java | 4 ++-- src/com/android/launcher3/LauncherAppState.java | 2 +- .../launcher3/ui/BubbleTextViewTest.java | 6 +++--- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/aconfig/launcher.aconfig b/aconfig/launcher.aconfig index a7796415e2..0df6c368ba 100644 --- a/aconfig/launcher.aconfig +++ b/aconfig/launcher.aconfig @@ -310,13 +310,6 @@ flag { bug: "341795751" } -flag { - name: "enable_new_archiving_icon" - namespace: "launcher" - description: "Archived apps will use new icon in app title" - bug: "350758155" -} - flag { name: "enable_multi_instance_menu_taskbar" namespace: "launcher" @@ -329,3 +322,13 @@ flag { description: "Settings screen supports navigating to child preference if the key is not on the screen" bug: "293390881" } + +flag { + name: "use_new_icon_for_archived_apps" + namespace: "launcher" + description: "Archived apps will use new cloud icon in app title instead of overlay" + bug: "350758155" + metadata { + purpose: PURPOSE_BUGFIX + } +} diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java index 5134dbe232..2eb50340e3 100644 --- a/src/com/android/launcher3/BubbleTextView.java +++ b/src/com/android/launcher3/BubbleTextView.java @@ -504,7 +504,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, mLastOriginalText = label; mLastModifiedText = mLastOriginalText; mBreakPointsIntArray = StringMatcherUtility.getListOfBreakpoints(label, MATCHER); - if (Flags.enableNewArchivingIcon() + if (Flags.useNewIconForArchivedApps() && info instanceof ItemInfoWithIcon infoWithIcon && infoWithIcon.isInactiveArchive()) { setTextWithArchivingIcon(label); @@ -820,7 +820,7 @@ public class BubbleTextView extends TextView implements ItemInfoUpdateReceiver, getLineSpacingExtra()); if (!TextUtils.equals(modifiedString, mLastModifiedText)) { mLastModifiedText = modifiedString; - if (Flags.enableNewArchivingIcon() + if (Flags.useNewIconForArchivedApps() && getTag() instanceof ItemInfoWithIcon infoWithIcon && infoWithIcon.isInactiveArchive()) { setTextWithArchivingIcon(modifiedString); diff --git a/src/com/android/launcher3/LauncherAppState.java b/src/com/android/launcher3/LauncherAppState.java index 08ccfb2148..15641ab516 100644 --- a/src/com/android/launcher3/LauncherAppState.java +++ b/src/com/android/launcher3/LauncherAppState.java @@ -115,7 +115,7 @@ public class LauncherAppState implements SafeCloseable { if (BuildCompat.isAtLeastV() && Flags.enableSupportForArchiving()) { ArchiveCompatibilityParams params = new ArchiveCompatibilityParams(); params.setEnableUnarchivalConfirmation(false); - params.setEnableIconOverlay(!Flags.enableNewArchivingIcon()); + params.setEnableIconOverlay(!Flags.useNewIconForArchivedApps()); launcherApps.setArchiveCompatibility(params); } diff --git a/tests/multivalentTests/src/com/android/launcher3/ui/BubbleTextViewTest.java b/tests/multivalentTests/src/com/android/launcher3/ui/BubbleTextViewTest.java index 5db041161a..aa7f3887e1 100644 --- a/tests/multivalentTests/src/com/android/launcher3/ui/BubbleTextViewTest.java +++ b/tests/multivalentTests/src/com/android/launcher3/ui/BubbleTextViewTest.java @@ -26,7 +26,7 @@ import static com.android.launcher3.BubbleTextView.DISPLAY_ALL_APPS; import static com.android.launcher3.BubbleTextView.DISPLAY_PREDICTION_ROW; import static com.android.launcher3.BubbleTextView.DISPLAY_SEARCH_RESULT; import static com.android.launcher3.BubbleTextView.DISPLAY_SEARCH_RESULT_SMALL; -import static com.android.launcher3.Flags.FLAG_ENABLE_NEW_ARCHIVING_ICON; +import static com.android.launcher3.Flags.FLAG_USE_NEW_ICON_FOR_ARCHIVED_APPS; import static com.android.launcher3.LauncherPrefs.ENABLE_TWOLINE_ALLAPPS_TOGGLE; import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_ARCHIVED; @@ -416,7 +416,7 @@ public class BubbleTextViewTest { assertThat(mBubbleTextView.getIcon().hasBadge()).isEqualTo(false); } - @EnableFlags(FLAG_ENABLE_NEW_ARCHIVING_ICON) + @EnableFlags(FLAG_USE_NEW_ICON_FOR_ARCHIVED_APPS) @Test public void applyIconAndLabel_setsImageSpan_whenInactiveArchivedApp() { // Given @@ -452,7 +452,7 @@ public class BubbleTextViewTest { assertThat(actualSpan.getVerticalAlignment()).isEqualTo(ALIGN_CENTER); } - @EnableFlags(FLAG_ENABLE_NEW_ARCHIVING_ICON) + @EnableFlags(FLAG_USE_NEW_ICON_FOR_ARCHIVED_APPS) @SdkSuppress(minSdkVersion = Build.VERSION_CODES.S) @Test public void applyIconAndLabel_setsBoldDrawable_whenBoldedTextForArchivedApp() {