Migrate layout transition flag to DesktopModeFlag version.

Flag: com.android.window.flags.enable_taskbar_recents_layout_transition
Bug: 343521765
Test: go/testedequals
Change-Id: I175e428240bc52689efe0f6e4457620ac2efdbb5
This commit is contained in:
Brian Isganitis
2025-02-27 23:41:53 +00:00
parent 12d5e6aed8
commit 42c58e39fd
6 changed files with 19 additions and 22 deletions
@@ -16,11 +16,11 @@
package com.android.launcher3.taskbar;
import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED;
import static android.window.DesktopModeFlags.ENABLE_TASKBAR_RECENTS_LAYOUT_TRANSITION;
import static com.android.launcher3.BubbleTextView.DISPLAY_TASKBAR;
import static com.android.launcher3.Flags.enableCursorHoverStates;
import static com.android.launcher3.Flags.enableRecentsInTaskbar;
import static com.android.launcher3.Flags.taskbarRecentsLayoutTransition;
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APP_PAIR;
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_FOLDER;
import static com.android.launcher3.config.FeatureFlags.enableTaskbarPinning;
@@ -201,8 +201,10 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
// TODO: Disable touch events on QSB otherwise it can crash.
mQsb = LayoutInflater.from(context).inflate(R.layout.search_container_hotseat, this, false);
mNumStaticViews = taskbarRecentsLayoutTransition() && !mActivityContext.isPhoneMode()
? addStaticViews() : 0;
mNumStaticViews =
ENABLE_TASKBAR_RECENTS_LAYOUT_TRANSITION.isTrue() && !mActivityContext.isPhoneMode()
? addStaticViews()
: 0;
}
/**
@@ -399,7 +401,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
// TODO(b/343289567 and b/316004172): support app pairs and desktop mode.
recentTasks = recentTasks.stream().filter(it -> it instanceof SingleTask).toList();
if (taskbarRecentsLayoutTransition()) {
if (ENABLE_TASKBAR_RECENTS_LAYOUT_TRANSITION.isTrue()) {
updateItemsWithLayoutTransition(hotseatItemInfos, recentTasks);
} else {
updateItemsWithoutLayoutTransition(hotseatItemInfos, recentTasks);
@@ -663,7 +665,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
View recentIcon = null;
// If a task is new, we should not reuse a view so that it animates in when it is added.
final boolean canReuseView = !taskbarRecentsLayoutTransition()
final boolean canReuseView = !ENABLE_TASKBAR_RECENTS_LAYOUT_TRANSITION.isTrue()
|| mPrevRecentTasks.contains(task);
while (canReuseView && isNextViewInSection(GroupTask.class)) {
recentIcon = getChildAt(mNextViewIndex);
@@ -672,7 +674,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
if ((recentIcon.getSourceLayoutResId() != expectedLayoutResId)
|| (isCollection && (recentIcon.getTag() != task))
// Remove view corresponding to removed task so that it animates out.
|| (taskbarRecentsLayoutTransition()
|| (ENABLE_TASKBAR_RECENTS_LAYOUT_TRANSITION.isTrue()
&& !recentTasksSet.contains(recentIcon.getTag()))) {
removeAndRecycle(recentIcon);
recentIcon = null;