Merge "Use onTaskThumbnailChanged as sourced of truth for thumnbail override" into main
diff --git a/aconfig/launcher.aconfig b/aconfig/launcher.aconfig
index a779641..0df6c36 100644
--- a/aconfig/launcher.aconfig
+++ b/aconfig/launcher.aconfig
@@ -311,13 +311,6 @@
}
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"
description: "Menu in Taskbar with options to launch and manage multiple instances of the same app"
@@ -329,3 +322,13 @@
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/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt
index 67cb7cb..9dee473 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt
@@ -64,6 +64,10 @@
companion object {
private const val INDEX_LEFT = 0
private const val INDEX_RIGHT = 1
+
+ private fun Region.addBoundsToRegion(bounds: Rect?) {
+ bounds?.let { op(it, Region.Op.UNION) }
+ }
}
/** The bottom insets taskbar provides to the IME when IME is visible. */
@@ -128,32 +132,26 @@
}
}
+ val bubbleControllers = controllers.bubbleControllers.getOrNull()
val taskbarTouchableHeight = controllers.taskbarStashController.touchableHeight
val bubblesTouchableHeight =
- if (controllers.bubbleControllers.isPresent) {
- controllers.bubbleControllers.get().bubbleStashController.getTouchableHeight()
- } else {
- 0
- }
+ bubbleControllers?.bubbleStashController?.getTouchableHeight() ?: 0
+ // add bounds for task bar and bubble bar stash controllers
val touchableHeight = max(taskbarTouchableHeight, bubblesTouchableHeight)
-
defaultTouchableRegion.set(
0,
windowLayoutParams.height - touchableHeight,
context.deviceProfile.widthPx,
windowLayoutParams.height
)
- val isBubbleBarVisible =
- controllers.bubbleControllers.isPresent &&
- controllers.bubbleControllers.get().bubbleStashController.isBubbleBarVisible()
- // if there's an animating bubble add it to the touch region so that it's clickable
- val isAnimatingNewBubble =
- controllers.bubbleControllers.getOrNull()?.bubbleBarViewController?.isAnimatingNewBubble
- ?: false
- if (isBubbleBarVisible || isAnimatingNewBubble) {
- val iconBounds =
- controllers.bubbleControllers.get().bubbleBarViewController.bubbleBarBounds
- defaultTouchableRegion.op(iconBounds, Region.Op.UNION)
+ if (bubbleControllers != null) {
+ val bubbleBarViewController = bubbleControllers.bubbleBarViewController
+ val isBubbleBarVisible = bubbleControllers.bubbleStashController.isBubbleBarVisible()
+ val isAnimatingNewBubble = bubbleBarViewController.isAnimatingNewBubble
+ // if bubble bar is visible or animating new bubble, add bar bounds to the touch region
+ if (isBubbleBarVisible || isAnimatingNewBubble) {
+ defaultTouchableRegion.addBoundsToRegion(bubbleBarViewController.bubbleBarBounds)
+ }
}
// Pre-calculate insets for different providers across different rotations for this gravity
@@ -404,7 +402,7 @@
// Include the bounds of the bubble bar in the touchable region if they exist.
if (bubbleBarBounds != null) {
- region.op(bubbleBarBounds, Region.Op.UNION)
+ region.addBoundsToRegion(bubbleBarBounds)
}
insetsInfo.touchableRegion.set(region)
debugTouchableRegion.lastSetTouchableReason = "Transient Taskbar is in Overview"
diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationCallbacks.java b/quickstep/src/com/android/quickstep/RecentsAnimationCallbacks.java
index da7a98f..32e2389 100644
--- a/quickstep/src/com/android/quickstep/RecentsAnimationCallbacks.java
+++ b/quickstep/src/com/android/quickstep/RecentsAnimationCallbacks.java
@@ -128,15 +128,11 @@
mController::finishAnimationToApp);
} else {
RemoteAnimationTarget[] nonAppTargets;
- if (!TaskAnimationManager.ENABLE_SHELL_TRANSITIONS) {
- nonAppTargets = mSystemUiProxy.onGoingToRecentsLegacy(appTargets);
- } else {
- final ArrayList<RemoteAnimationTarget> apps = new ArrayList<>();
- final ArrayList<RemoteAnimationTarget> nonApps = new ArrayList<>();
- classifyTargets(appTargets, apps, nonApps);
- appTargets = apps.toArray(new RemoteAnimationTarget[apps.size()]);
- nonAppTargets = nonApps.toArray(new RemoteAnimationTarget[nonApps.size()]);
- }
+ final ArrayList<RemoteAnimationTarget> apps = new ArrayList<>();
+ final ArrayList<RemoteAnimationTarget> nonApps = new ArrayList<>();
+ classifyTargets(appTargets, apps, nonApps);
+ appTargets = apps.toArray(new RemoteAnimationTarget[apps.size()]);
+ nonAppTargets = nonApps.toArray(new RemoteAnimationTarget[nonApps.size()]);
if (nonAppTargets == null) {
nonAppTargets = new RemoteAnimationTarget[0];
}
diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.java b/quickstep/src/com/android/quickstep/SystemUiProxy.java
index 673de14..0c2f29b 100644
--- a/quickstep/src/com/android/quickstep/SystemUiProxy.java
+++ b/quickstep/src/com/android/quickstep/SystemUiProxy.java
@@ -1000,77 +1000,6 @@
}
}
- /**
- * Start multiple tasks in split-screen simultaneously.
- */
- public void startTasksWithLegacyTransition(int taskId1, Bundle options1, int taskId2,
- Bundle options2, @StagePosition int splitPosition,
- @PersistentSnapPosition int snapPosition, RemoteAnimationAdapter adapter,
- InstanceId instanceId) {
- if (mSystemUiProxy != null) {
- try {
- mSplitScreen.startTasksWithLegacyTransition(taskId1, options1, taskId2, options2,
- splitPosition, snapPosition, adapter, instanceId);
- } catch (RemoteException e) {
- Log.w(TAG, splitFailureMessage(
- "startTasksWithLegacyTransition", "RemoteException"), e);
- }
- }
- }
-
- public void startIntentAndTaskWithLegacyTransition(PendingIntent pendingIntent, int userId1,
- Bundle options1, int taskId, Bundle options2, @StagePosition int splitPosition,
- @PersistentSnapPosition int snapPosition, RemoteAnimationAdapter adapter,
- InstanceId instanceId) {
- if (mSystemUiProxy != null) {
- try {
- mSplitScreen.startIntentAndTaskWithLegacyTransition(pendingIntent, userId1,
- options1, taskId, options2, splitPosition, snapPosition, adapter,
- instanceId);
- } catch (RemoteException e) {
- Log.w(TAG, splitFailureMessage(
- "startIntentAndTaskWithLegacyTransition", "RemoteException"), e);
- }
- }
- }
-
- public void startShortcutAndTaskWithLegacyTransition(ShortcutInfo shortcutInfo, Bundle options1,
- int taskId, Bundle options2, @StagePosition int splitPosition,
- @PersistentSnapPosition int snapPosition, RemoteAnimationAdapter adapter,
- InstanceId instanceId) {
- if (mSystemUiProxy != null) {
- try {
- mSplitScreen.startShortcutAndTaskWithLegacyTransition(shortcutInfo, options1,
- taskId, options2, splitPosition, snapPosition, adapter, instanceId);
- } catch (RemoteException e) {
- Log.w(TAG, splitFailureMessage(
- "startShortcutAndTaskWithLegacyTransition", "RemoteException"), e);
- }
- }
- }
-
- /**
- * Starts a pair of intents or shortcuts in split-screen using legacy transition. Passing a
- * non-null shortcut info means to start the app as a shortcut.
- */
- public void startIntentsWithLegacyTransition(PendingIntent pendingIntent1, int userId1,
- @Nullable ShortcutInfo shortcutInfo1, @Nullable Bundle options1,
- PendingIntent pendingIntent2, int userId2, @Nullable ShortcutInfo shortcutInfo2,
- @Nullable Bundle options2, @StagePosition int sidePosition,
- @PersistentSnapPosition int snapPosition, RemoteAnimationAdapter adapter,
- InstanceId instanceId) {
- if (mSystemUiProxy != null) {
- try {
- mSplitScreen.startIntentsWithLegacyTransition(pendingIntent1, userId1,
- shortcutInfo1, options1, pendingIntent2, userId2, shortcutInfo2, options2,
- sidePosition, snapPosition, adapter, instanceId);
- } catch (RemoteException e) {
- Log.w(TAG, splitFailureMessage(
- "startIntentsWithLegacyTransition", "RemoteException"), e);
- }
- }
- }
-
public void startShortcut(String packageName, String shortcutId, int position,
Bundle options, UserHandle user, InstanceId instanceId) {
if (mSplitScreen != null) {
@@ -1105,36 +1034,6 @@
}
}
- /**
- * Call this when going to recents so that shell can set-up and provide appropriate leashes
- * for animation (eg. DividerBar).
- *
- * @return RemoteAnimationTargets of windows that need to animate but only exist in shell.
- */
- @Nullable
- public RemoteAnimationTarget[] onGoingToRecentsLegacy(RemoteAnimationTarget[] apps) {
- if (!TaskAnimationManager.ENABLE_SHELL_TRANSITIONS && mSplitScreen != null) {
- try {
- return mSplitScreen.onGoingToRecentsLegacy(apps);
- } catch (RemoteException e) {
- Log.w(TAG, "Failed call onGoingToRecentsLegacy");
- }
- }
- return null;
- }
-
- @Nullable
- public RemoteAnimationTarget[] onStartingSplitLegacy(RemoteAnimationTarget[] apps) {
- if (mSplitScreen != null) {
- try {
- return mSplitScreen.onStartingSplitLegacy(apps);
- } catch (RemoteException e) {
- Log.w(TAG, "Failed call onStartingSplitLegacy");
- }
- }
- return null;
- }
-
//
// One handed
//
diff --git a/quickstep/src/com/android/quickstep/TaskAnimationManager.java b/quickstep/src/com/android/quickstep/TaskAnimationManager.java
index 723aa03..f414399 100644
--- a/quickstep/src/com/android/quickstep/TaskAnimationManager.java
+++ b/quickstep/src/com/android/quickstep/TaskAnimationManager.java
@@ -264,12 +264,7 @@
}
}
- RemoteAnimationTarget[] nonAppTargets = ENABLE_SHELL_TRANSITIONS
- ? null : getSystemUiProxy().onStartingSplitLegacy(
- appearedTaskTargets);
- if (nonAppTargets == null) {
- nonAppTargets = new RemoteAnimationTarget[0];
- }
+ RemoteAnimationTarget[] nonAppTargets = new RemoteAnimationTarget[0];
if ((containerInterface.isInLiveTileMode()
|| mLastGestureState.getEndTarget() == RECENTS
|| isNonRecentsStartedTasksAppeared(appearedTaskTargets))
diff --git a/res/color-night-v31/material_color_surface_container_lowest.xml b/res/color-night-v31/material_color_surface_container_lowest.xml
new file mode 100644
index 0000000..4396f6d
--- /dev/null
+++ b/res/color-night-v31/material_color_surface_container_lowest.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+ ~ Copyright (C) 2024 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:color="@android:color/system_neutral1_500" android:lStar="4" />
+</selector>
\ No newline at end of file
diff --git a/res/color-v31/material_color_surface_container_lowest.xml b/res/color-v31/material_color_surface_container_lowest.xml
new file mode 100644
index 0000000..f726aea
--- /dev/null
+++ b/res/color-v31/material_color_surface_container_lowest.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+ ~ Copyright (C) 2024 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:color="@android:color/system_neutral1_500" android:lStar="100" />
+</selector>
\ No newline at end of file
diff --git a/res/drawable/cloud_download_semibold_24px.xml b/res/drawable/cloud_download_semibold_24px.xml
new file mode 100644
index 0000000..ef15f9f
--- /dev/null
+++ b/res/drawable/cloud_download_semibold_24px.xml
@@ -0,0 +1,11 @@
+<!-- From GM3 icon cloud_download:wght600_vd_theme_24 -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="960"
+ android:viewportHeight="960"
+ android:tint="?attr/colorControlNormal">
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M260,819.22Q162.22,819.22 92.35,751.7Q22.48,684.17 22.48,586.63Q22.48,503.03 70.61,437.64Q118.74,372.26 198.13,354.13Q217.39,283.26 284.26,217.98Q351.13,152.7 428.7,152.7Q467.91,152.7 496.22,179.3Q524.52,205.91 524.52,244L524.52,484.3L584,425.7L646.22,487.91L480,654.13L313.78,487.91L376,425.7L435.48,484.3L435.48,252.48Q365.13,269.87 326.8,327.11Q288.48,384.35 288.48,446.78L261.7,446.78Q206.51,446.78 167.49,485.8Q128.48,524.81 128.48,580Q128.48,635.74 167,674.48Q205.51,713.22 260,713.22L740,713.22Q778.04,713.22 804.78,686.48Q831.52,659.74 831.52,620Q831.52,581.39 804.78,554.09Q778.04,526.78 738.3,526.78L675.48,526.78L675.48,441.7Q675.48,396.52 656.3,358.98Q637.13,321.44 604.52,292.44L604.52,171.74Q680.78,206.74 726.33,275.8Q771.87,344.87 776.39,428.13L776.39,428.13L776.39,428.13Q847.09,442.35 892.31,496.96Q937.52,551.57 937.52,623.39Q937.52,704.99 879.91,762.1Q822.3,819.22 740,819.22L260,819.22ZM480,431.83Q480,431.83 480,431.83Q480,431.83 480,431.83L480,431.83Q480,431.83 480,431.83Q480,431.83 480,431.83L480,431.83Q480,431.83 480,431.83Q480,431.83 480,431.83L480,431.83Q480,431.83 480,431.83Q480,431.83 480,431.83Q480,431.83 480,431.83Q480,431.83 480,431.83L480,431.83Q480,431.83 480,431.83Q480,431.83 480,431.83Q480,431.83 480,431.83Q480,431.83 480,431.83L480,431.83L480,431.83Q480,431.83 480,431.83Q480,431.83 480,431.83Z"/>
+</vector>
diff --git a/res/drawable/private_space_install_app_icon.xml b/res/drawable/private_space_install_app_icon.xml
index 12c4a82..cfec2b1 100644
--- a/res/drawable/private_space_install_app_icon.xml
+++ b/res/drawable/private_space_install_app_icon.xml
@@ -23,9 +23,9 @@
android:pathData="M30 0H30A30 30 0 0 1 60 30V30A30 30 0 0 1 30 60H30A30 30 0 0 1 0 30V30A30 30 0 0 1 30 0Z" />
<path
android:pathData="M30 0H30A30 30 0 0 1 60 30V30A30 30 0 0 1 30 60H30A30 30 0 0 1 0 30V30A30 30 0 0 1 30 0Z"
- android:fillColor="?attr/materialColorSurfaceContainerLowest" />
+ android:fillColor="@color/material_color_surface_container_lowest" />
<path
android:pathData="M29 31h-6v-2h6v-6h2v6h6v2h-6v6h-2v-6Z"
- android:fillColor="?attr/materialColorOnSurface" />
+ android:fillColor="@color/material_color_on_surface" />
</group>
</vector>
diff --git a/res/values-night-v31/colors.xml b/res/values-night-v31/colors.xml
index 07c450e..0f630e5 100644
--- a/res/values-night-v31/colors.xml
+++ b/res/values-night-v31/colors.xml
@@ -57,4 +57,6 @@
@android:color/system_accent1_200</color>
<color name="work_fab_icon_color">
@android:color/system_accent1_900</color>
+
+ <color name="material_color_on_surface">@android:color/system_neutral1_100</color>
</resources>
\ No newline at end of file
diff --git a/res/values-night/colors.xml b/res/values-night/colors.xml
new file mode 100644
index 0000000..887a2a5
--- /dev/null
+++ b/res/values-night/colors.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+ ~ Copyright (C) 2024 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<resources>
+ <color name="material_color_surface_container_lowest">#0D0E11</color>
+ <color name="material_color_on_surface">#E3E2E6</color>
+</resources>
\ No newline at end of file
diff --git a/res/values-v31/colors.xml b/res/values-v31/colors.xml
index 5c81d49..a5cdfc7 100644
--- a/res/values-v31/colors.xml
+++ b/res/values-v31/colors.xml
@@ -110,4 +110,6 @@
@android:color/system_accent1_900</color>
<color name="overview_foreground_scrim_color">@android:color/system_neutral1_1000</color>
+
+ <color name="material_color_on_surface">@android:color/system_neutral1_900</color>
</resources>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index c82358b..3f8bede 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -142,6 +142,9 @@
<color name="widget_cell_title_color_dark">@color/system_on_surface_dark</color>
<color name="widget_cell_subtitle_color_dark">@color/system_on_surface_variant_dark</color>
+ <color name="material_color_surface_container_lowest">#FFFFFF</color>
+ <color name="material_color_on_surface">#1B1B1F</color>
+
<color name="system_primary_container_light">#D9E2FF</color>
<color name="system_on_primary_container_light">#001945</color>
<color name="system_primary_light">#475D92</color>
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index 0cb2137..2eb5034 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -16,6 +16,8 @@
package com.android.launcher3;
+import static android.graphics.fonts.FontStyle.FONT_WEIGHT_BOLD;
+import static android.graphics.fonts.FontStyle.FONT_WEIGHT_NORMAL;
import static android.text.Layout.Alignment.ALIGN_NORMAL;
import static com.android.launcher3.Flags.enableCursorHoverStates;
@@ -118,6 +120,7 @@
private static final String EMPTY = "";
private static final StringMatcherUtility.StringMatcher MATCHER =
StringMatcherUtility.StringMatcher.getInstance();
+ private static final int BOLD_TEXT_ADJUSTMENT = FONT_WEIGHT_BOLD - FONT_WEIGHT_NORMAL;
private static final int[] STATE_PRESSED = new int[]{android.R.attr.state_pressed};
@@ -501,10 +504,10 @@
mLastOriginalText = label;
mLastModifiedText = mLastOriginalText;
mBreakPointsIntArray = StringMatcherUtility.getListOfBreakpoints(label, MATCHER);
- if (Flags.enableNewArchivingIcon()
+ if (Flags.useNewIconForArchivedApps()
&& info instanceof ItemInfoWithIcon infoWithIcon
&& infoWithIcon.isInactiveArchive()) {
- setTextWithStartIcon(label, R.drawable.cloud_download_24px);
+ setTextWithArchivingIcon(label);
} else {
setText(label);
}
@@ -817,10 +820,10 @@
getLineSpacingExtra());
if (!TextUtils.equals(modifiedString, mLastModifiedText)) {
mLastModifiedText = modifiedString;
- if (Flags.enableNewArchivingIcon()
+ if (Flags.useNewIconForArchivedApps()
&& getTag() instanceof ItemInfoWithIcon infoWithIcon
&& infoWithIcon.isInactiveArchive()) {
- setTextWithStartIcon(modifiedString, R.drawable.cloud_download_24px);
+ setTextWithArchivingIcon(modifiedString);
} else {
setText(modifiedString);
}
@@ -845,12 +848,28 @@
}
/**
+ * Sets text with a start icon for App Archiving.
+ * Uses a bolded drawable if text is bolded.
+ * @param text
+ */
+ private void setTextWithArchivingIcon(CharSequence text) {
+ var drawableId = R.drawable.cloud_download_24px;
+ if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S
+ && getResources().getConfiguration().fontWeightAdjustment >= BOLD_TEXT_ADJUSTMENT) {
+ // If System bold text setting is on, then use a bolded icon
+ drawableId = R.drawable.cloud_download_semibold_24px;
+ }
+ setTextWithStartIcon(text, drawableId);
+ }
+
+ /**
* Uses a SpannableString to set text with a Drawable at the start of the TextView
* @param text text to use for TextView
- * @param drawableRes Drawable Resource to use for drawing image at start of text
+ * @param drawableId Drawable Resource to use for drawing image at start of text
*/
- private void setTextWithStartIcon(CharSequence text, @DrawableRes int drawableRes) {
- Drawable drawable = getContext().getDrawable(drawableRes);
+ @VisibleForTesting
+ public void setTextWithStartIcon(CharSequence text, @DrawableRes int drawableId) {
+ Drawable drawable = getContext().getDrawable(drawableId);
if (drawable == null) {
setText(text);
Log.w(TAG, "setTextWithStartIcon: start icon Drawable not found from resources"
diff --git a/src/com/android/launcher3/LauncherAppState.java b/src/com/android/launcher3/LauncherAppState.java
index 08ccfb2..15641ab 100644
--- a/src/com/android/launcher3/LauncherAppState.java
+++ b/src/com/android/launcher3/LauncherAppState.java
@@ -115,7 +115,7 @@
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/src/com/android/launcher3/allapps/AlphabeticalAppsList.java b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java
index 9271596..a3cabc2 100644
--- a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java
+++ b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java
@@ -412,9 +412,8 @@
// Apply decorator to private apps.
if (hasPrivateApps) {
mAdapterItems.add(AdapterItem.asAppWithDecorationInfo(info,
- new SectionDecorationInfo(mActivityContext.getApplicationContext(),
- getRoundRegions(i, appList.size()),
- true /* decorateTogether */)));
+ new SectionDecorationInfo(mActivityContext,
+ getRoundRegions(i, appList.size()), true /* decorateTogether */)));
} else {
mAdapterItems.add(AdapterItem.asApp(info));
}
diff --git a/tests/multivalentTests/src/com/android/launcher3/ui/BubbleTextViewTest.java b/tests/multivalentTests/src/com/android/launcher3/ui/BubbleTextViewTest.java
index b83349e..aa7f388 100644
--- a/tests/multivalentTests/src/com/android/launcher3/ui/BubbleTextViewTest.java
+++ b/tests/multivalentTests/src/com/android/launcher3/ui/BubbleTextViewTest.java
@@ -16,28 +16,41 @@
package com.android.launcher3.ui;
+import static android.graphics.fonts.FontStyle.FONT_WEIGHT_BOLD;
+import static android.graphics.fonts.FontStyle.FONT_WEIGHT_NORMAL;
+import static android.text.style.DynamicDrawableSpan.ALIGN_CENTER;
+
import static androidx.test.core.app.ApplicationProvider.getApplicationContext;
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_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;
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.graphics.Typeface;
+import android.os.Build;
import android.os.UserHandle;
+import android.platform.test.annotations.EnableFlags;
import android.platform.test.flag.junit.SetFlagsRule;
+import android.text.SpannedString;
+import android.text.style.ImageSpan;
import android.view.ViewGroup;
import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.test.filters.SdkSuppress;
import androidx.test.filters.SmallTest;
import com.android.launcher3.BubbleTextView;
@@ -403,6 +416,62 @@
assertThat(mBubbleTextView.getIcon().hasBadge()).isEqualTo(false);
}
+ @EnableFlags(FLAG_USE_NEW_ICON_FOR_ARCHIVED_APPS)
+ @Test
+ public void applyIconAndLabel_setsImageSpan_whenInactiveArchivedApp() {
+ // Given
+ BubbleTextView spyTextView = spy(mBubbleTextView);
+ mGmailAppInfo.runtimeStatusFlags |= FLAG_ARCHIVED;
+ BubbleTextView expectedTextView = new BubbleTextView(mContext);
+ mContext.getResources().getConfiguration().fontWeightAdjustment = 0;
+ int expectedDrawableId = mContext.getResources().getIdentifier(
+ "cloud_download_24px", /* name */
+ "drawable", /* defType */
+ mContext.getPackageName()
+ );
+ expectedTextView.setTextWithStartIcon(mGmailAppInfo.title, expectedDrawableId);
+ // When
+ spyTextView.applyIconAndLabel(mGmailAppInfo);
+ // Then
+ SpannedString expectedText = (SpannedString) expectedTextView.getText();
+ SpannedString actualText = (SpannedString) spyTextView.getText();
+ ImageSpan actualSpan = actualText.getSpans(
+ 0, /* queryStart */
+ 1, /* queryEnd */
+ ImageSpan.class
+ )[0];
+ ImageSpan expectedSpan = expectedText.getSpans(
+ 0, /* queryStart */
+ 1, /* queryEnd */
+ ImageSpan.class
+ )[0];
+ verify(spyTextView).setTextWithStartIcon(mGmailAppInfo.title, expectedDrawableId);
+ assertThat(actualText.toString()).isEqualTo(expectedText.toString());
+ assertThat(actualSpan.getDrawable().getBounds())
+ .isEqualTo(expectedSpan.getDrawable().getBounds());
+ assertThat(actualSpan.getVerticalAlignment()).isEqualTo(ALIGN_CENTER);
+ }
+
+ @EnableFlags(FLAG_USE_NEW_ICON_FOR_ARCHIVED_APPS)
+ @SdkSuppress(minSdkVersion = Build.VERSION_CODES.S)
+ @Test
+ public void applyIconAndLabel_setsBoldDrawable_whenBoldedTextForArchivedApp() {
+ // Given
+ int expectedDrawableId = mContext.getResources().getIdentifier(
+ "cloud_download_semibold_24px", /* name */
+ "drawable", /* defType */
+ mContext.getPackageName()
+ );
+ mContext.getResources().getConfiguration().fontWeightAdjustment =
+ FONT_WEIGHT_BOLD - FONT_WEIGHT_NORMAL;
+ BubbleTextView spyTextView = spy(mBubbleTextView);
+ mGmailAppInfo.runtimeStatusFlags |= FLAG_ARCHIVED;
+ // When
+ spyTextView.applyIconAndLabel(mGmailAppInfo);
+ // Then
+ verify(spyTextView).setTextWithStartIcon(mGmailAppInfo.title, expectedDrawableId);
+ }
+
@Test
public void applyIconAndLabel_whenDisplay_DISPLAY_SEARCH_RESULT_hasBadge() {
FlagOp op = FlagOp.NO_OP;