Merge "Update Split-Screen icons with new icons." into main
diff --git a/quickstep/res/layout/task.xml b/quickstep/res/layout/task.xml
index 4abfbbe..def5a1e 100644
--- a/quickstep/res/layout/task.xml
+++ b/quickstep/res/layout/task.xml
@@ -30,7 +30,6 @@
 
     <ViewStub
         android:id="@+id/task_content_view"
-        android:inflatedId="@id/task_content_view"
         android:layout_width="match_parent"
         android:layout_height="match_parent" />
 
diff --git a/quickstep/res/layout/task_grouped.xml b/quickstep/res/layout/task_grouped.xml
index a7c4856..a9a6dc1 100644
--- a/quickstep/res/layout/task_grouped.xml
+++ b/quickstep/res/layout/task_grouped.xml
@@ -35,13 +35,11 @@
 
     <ViewStub
         android:id="@+id/task_content_view"
-        android:inflatedId="@id/task_content_view"
         android:layout_width="match_parent"
         android:layout_height="match_parent" />
 
     <ViewStub
         android:id="@+id/bottomright_task_content_view"
-        android:inflatedId="@id/bottomright_task_content_view"
         android:layout_width="match_parent"
         android:layout_height="match_parent" />
 
diff --git a/quickstep/res/values/ids.xml b/quickstep/res/values/ids.xml
index c71bb76..14928fd 100644
--- a/quickstep/res/values/ids.xml
+++ b/quickstep/res/values/ids.xml
@@ -21,4 +21,6 @@
     <item type="id" name="action_dismiss_all" />
 
     <item type="id" name="bubble_bar_flyout_view" />
+    <!-- TODO(b/361500574): Delete with enableRefactorTaskThumbnail -->
+    <item type="id" name="bottomright_snapshot" />
 </resources>
\ No newline at end of file
diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
index 21af26e..548fbef 100644
--- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
+++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java
@@ -68,6 +68,7 @@
 import static com.android.systemui.shared.Flags.returnAnimationFrameworkLibrary;
 import static com.android.systemui.shared.system.QuickStepContract.getWindowCornerRadius;
 import static com.android.systemui.shared.system.QuickStepContract.supportsRoundedCornersOnWindows;
+import static com.android.wm.shell.Flags.enableDynamicInsetsForAppLaunch;
 
 import android.animation.Animator;
 import android.animation.AnimatorListenerAdapter;
@@ -283,6 +284,8 @@
     private final Interpolator mOpeningXInterpolator;
     private final Interpolator mOpeningInterpolator;
 
+    private final SystemUiProxy mSystemUiProxy;
+
     public QuickstepTransitionManager(Context context) {
         mLauncher = Launcher.cast(Launcher.getLauncher(context));
         mDragLayer = mLauncher.getDragLayer();
@@ -297,6 +300,7 @@
         mMaxShadowRadius = res.getDimensionPixelSize(R.dimen.max_shadow_radius);
 
         mLauncher.addOnDeviceProfileChangeListener(this);
+        mSystemUiProxy = SystemUiProxy.INSTANCE.get(mLauncher);
 
         if (ENABLE_SHELL_STARTING_SURFACE) {
             mTaskStartParams = new LinkedHashMap<>(MAX_NUM_TASKS) {
@@ -306,8 +310,7 @@
                 }
             };
 
-            SystemUiProxy.INSTANCE.get(mLauncher).setStartingWindowListener(
-                    mStartingWindowListener);
+            mSystemUiProxy.setStartingWindowListener(mStartingWindowListener);
         }
 
         mOpeningXInterpolator = AnimationUtils.loadInterpolator(context, R.interpolator.app_open_x);
@@ -522,12 +525,6 @@
                         4 - rotationChange);
             }
         }
-        if (mDeviceProfile.isTaskbarPresentInApps
-                && !target.willShowImeOnTarget
-                && !isTransientTaskbar(mLauncher)) {
-            // Animate to above the taskbar.
-            bounds.bottom -= target.contentInsets.bottom;
-        }
         return bounds;
     }
 
@@ -694,6 +691,13 @@
         };
     }
 
+    private boolean shouldCropToInset(RemoteAnimationTarget target) {
+        return enableDynamicInsetsForAppLaunch()
+                && mDeviceProfile.isTaskbarPresentInApps
+                && target != null && !target.willShowImeOnTarget
+                && !isTransientTaskbar(mLauncher);
+    }
+
     /**
      * @return Animator that controls the window of the opening targets from app icons.
      */
@@ -702,8 +706,19 @@
             RemoteAnimationTarget[] wallpaperTargets,
             RemoteAnimationTarget[] nonAppTargets,
             boolean launcherClosing) {
+        RemoteAnimationTargets openingTargets = new RemoteAnimationTargets(appTargets,
+                wallpaperTargets, nonAppTargets, MODE_OPENING);
         int rotationChange = getRotationChange(appTargets);
         Rect windowTargetBounds = getWindowTargetBounds(appTargets, rotationChange);
+        final int[] bottomInsetPos = new int[]{
+                mSystemUiProxy.getHomeVisibilityState().getNavbarInsetPosition()};
+        final RemoteAnimationTarget target = openingTargets.getFirstAppTarget();
+        final boolean cropToInset = shouldCropToInset(target);
+        if (cropToInset) {
+            // Animate to above the taskbar.
+            windowTargetBounds.bottom = Math.min(bottomInsetPos[0],
+                    windowTargetBounds.bottom);
+        }
         boolean appTargetsAreTranslucent = areAllTargetsTranslucent(appTargets);
 
         RectF launcherIconBounds = new RectF();
@@ -716,8 +731,6 @@
         Rect crop = new Rect();
         Matrix matrix = new Matrix();
 
-        RemoteAnimationTargets openingTargets = new RemoteAnimationTargets(appTargets,
-                wallpaperTargets, nonAppTargets, MODE_OPENING);
         SurfaceTransactionApplier surfaceApplier =
                 new SurfaceTransactionApplier(floatingView);
         openingTargets.addReleaseCheck(surfaceApplier);
@@ -823,6 +836,39 @@
 
             @Override
             public void onUpdate(float percent, boolean initOnly) {
+                if (cropToInset && bottomInsetPos[0] != mSystemUiProxy.getHomeVisibilityState()
+                        .getNavbarInsetPosition()) {
+                    final RemoteAnimationTarget target = openingTargets.getFirstAppTarget();
+                    bottomInsetPos[0] = mSystemUiProxy.getHomeVisibilityState()
+                            .getNavbarInsetPosition();
+                    final Rect bounds = target != null
+                            ? target.screenSpaceBounds : windowTargetBounds;
+                    // Animate to above the taskbar.
+                    int bottomLevel = Math.min(bottomInsetPos[0], bounds.bottom);
+                    windowTargetBounds.bottom = bottomLevel;
+                    final int endHeight = bottomLevel - bounds.top;
+
+                    AnimOpenProperties prop = new AnimOpenProperties(mLauncher.getResources(),
+                            mDeviceProfile, windowTargetBounds, launcherIconBounds, v,
+                            dragLayerBounds[0], dragLayerBounds[1], hasSplashScreen,
+                            floatingView.isDifferentFromAppIcon());
+                    mCropRectCenterY = new FloatProp(prop.cropCenterYStart, prop.cropCenterYEnd,
+                            mOpeningInterpolator);
+                    mCropRectHeight = new FloatProp(prop.cropHeightStart, prop.cropHeightEnd,
+                            mOpeningInterpolator);
+                    mDy = new FloatProp(0, prop.dY, mOpeningInterpolator);
+                    mIconScaleToFitScreen = new FloatProp(prop.initialAppIconScale,
+                            prop.finalAppIconScale, mOpeningInterpolator);
+                    float interpolatedPercent = mOpeningInterpolator.getInterpolation(percent);
+                    mCropRectHeight.value = Utilities.mapRange(interpolatedPercent,
+                            prop.cropHeightStart, prop.cropHeightEnd);
+                    mCropRectCenterY.value = Utilities.mapRange(interpolatedPercent,
+                            prop.cropCenterYStart, prop.cropCenterYEnd);
+                    mDy.value = Utilities.mapRange(interpolatedPercent, 0, prop.dY);
+                    mIconScaleToFitScreen.value = Utilities.mapRange(interpolatedPercent,
+                            prop.initialAppIconScale, prop.finalAppIconScale);
+                }
+
                 // Calculate the size of the scaled icon.
                 float iconWidth = launcherIconBounds.width() * mIconScaleToFitScreen.value;
                 float iconHeight = launcherIconBounds.height() * mIconScaleToFitScreen.value;
diff --git a/quickstep/src/com/android/quickstep/HomeVisibilityState.kt b/quickstep/src/com/android/quickstep/HomeVisibilityState.kt
index 1345e0b..020b9e2 100644
--- a/quickstep/src/com/android/quickstep/HomeVisibilityState.kt
+++ b/quickstep/src/com/android/quickstep/HomeVisibilityState.kt
@@ -18,6 +18,9 @@
 
 import android.os.RemoteException
 import android.util.Log
+import android.view.InsetsState
+import android.view.WindowInsets
+
 import com.android.launcher3.Utilities
 import com.android.launcher3.config.FeatureFlags
 import com.android.launcher3.util.Executors
@@ -30,6 +33,8 @@
     var isHomeVisible = true
         private set
 
+    @Volatile var navbarInsetPosition = 0
+
     private var listeners = mutableSetOf<VisibilityChangeListener>()
 
     fun addListener(l: VisibilityChangeListener) = listeners.add(l)
@@ -50,6 +55,11 @@
                             },
                         )
                     }
+                    override fun onDisplayInsetsChanged(insetsState: InsetsState) {
+                        val bottomInset = insetsState.calculateInsets(insetsState.displayFrame,
+                                WindowInsets.Type.navigationBars(), false).bottom
+                        navbarInsetPosition = insetsState.displayFrame.bottom - bottomInset
+                    }
                 }
             )
         } catch (e: RemoteException) {
diff --git a/quickstep/src/com/android/quickstep/TaskAnimationManager.java b/quickstep/src/com/android/quickstep/TaskAnimationManager.java
index 4f00381..cf0a3d5 100644
--- a/quickstep/src/com/android/quickstep/TaskAnimationManager.java
+++ b/quickstep/src/com/android/quickstep/TaskAnimationManager.java
@@ -59,6 +59,7 @@
 
 import java.io.PrintWriter;
 import java.util.HashMap;
+import java.util.Locale;
 
 public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAnimationListener {
     public static final boolean SHELL_TRANSITIONS_ROTATION =
@@ -132,6 +133,17 @@
     public RecentsAnimationCallbacks startRecentsAnimation(@NonNull GestureState gestureState,
             Intent intent, RecentsAnimationCallbacks.RecentsAnimationListener listener) {
         ActiveGestureProtoLogProxy.logStartRecentsAnimation();
+        // Check displayId
+        if (mDisplayId != gestureState.getDisplayId()) {
+            String msg = String.format(Locale.ENGLISH,
+                    "Constructor displayId %d does not equal gestureState display id %d",
+                    mDisplayId, gestureState.getDisplayId());
+            if (FeatureFlags.IS_STUDIO_BUILD) {
+                throw new IllegalArgumentException(msg);
+            } else {
+                Log.e("TaskAnimationManager", msg, new Exception());
+            }
+        }
         // Notify if recents animation is still running
         if (mController != null) {
             String msg = "New recents animation started before old animation completed";
@@ -239,11 +251,11 @@
                 RemoteAnimationTarget appearedTaskTarget = appearedTaskTargets[0];
                 BaseContainerInterface containerInterface =
                         mLastGestureState.getContainerInterface();
-
                 for (RemoteAnimationTarget compat : appearedTaskTargets) {
                     if (compat.windowConfiguration.getActivityType() == ACTIVITY_TYPE_HOME
                             && containerInterface.getCreatedContainer() instanceof RecentsActivity
-                            && DisplayController.getNavigationMode(mCtx) != NO_BUTTON) {
+                            && DisplayController.INSTANCE.get(mCtx).getInfoForDisplay(
+                            mDisplayId).getNavigationMode() != NO_BUTTON) {
                         // The only time we get onTasksAppeared() in button navigation with a
                         // 3p launcher is if the user goes to overview first, and in this case we
                         // can immediately finish the transition
diff --git a/quickstep/src/com/android/quickstep/orientation/LandscapePagedViewHandler.kt b/quickstep/src/com/android/quickstep/orientation/LandscapePagedViewHandler.kt
index b8f43a4..7dff504 100644
--- a/quickstep/src/com/android/quickstep/orientation/LandscapePagedViewHandler.kt
+++ b/quickstep/src/com/android/quickstep/orientation/LandscapePagedViewHandler.kt
@@ -275,7 +275,7 @@
         desiredTaskId: Int,
         banner: View,
     ): Pair<Float, Float> {
-        val snapshotParams = thumbnailViews[0].layoutParams as LinearLayout.LayoutParams
+        val snapshotParams = thumbnailViews[0].layoutParams as ViewGroup.MarginLayoutParams
         val translationX = banner.height.toFloat()
         val translationY: Float
         if (splitBounds == null) {
diff --git a/quickstep/src/com/android/quickstep/orientation/PortraitPagedViewHandler.kt b/quickstep/src/com/android/quickstep/orientation/PortraitPagedViewHandler.kt
index 15eb69e..c6b2f3c 100644
--- a/quickstep/src/com/android/quickstep/orientation/PortraitPagedViewHandler.kt
+++ b/quickstep/src/com/android/quickstep/orientation/PortraitPagedViewHandler.kt
@@ -255,7 +255,8 @@
                 }
             } else {
                 if (desiredTaskId == splitBounds.leftTopTaskId) {
-                    val snapshotParams = thumbnailViews[0].layoutParams as LinearLayout.LayoutParams
+                    val snapshotParams =
+                        thumbnailViews[0].layoutParams as ViewGroup.MarginLayoutParams
                     val bottomRightTaskPlusDividerPercent =
                         (splitBounds.rightBottomTaskPercent + splitBounds.dividerPercent)
                     translationY =
diff --git a/quickstep/src/com/android/quickstep/orientation/SeascapePagedViewHandler.kt b/quickstep/src/com/android/quickstep/orientation/SeascapePagedViewHandler.kt
index 80b50cb..f0b67ef 100644
--- a/quickstep/src/com/android/quickstep/orientation/SeascapePagedViewHandler.kt
+++ b/quickstep/src/com/android/quickstep/orientation/SeascapePagedViewHandler.kt
@@ -25,8 +25,8 @@
 import android.view.Surface
 import android.view.View
 import android.view.View.MeasureSpec
+import android.view.ViewGroup
 import android.widget.FrameLayout
-import android.widget.LinearLayout
 import androidx.core.util.component1
 import androidx.core.util.component2
 import androidx.core.view.updateLayoutParams
@@ -152,7 +152,7 @@
         desiredTaskId: Int,
         banner: View,
     ): Pair<Float, Float> {
-        val snapshotParams = thumbnailViews[0].layoutParams as LinearLayout.LayoutParams
+        val snapshotParams = thumbnailViews[0].layoutParams as ViewGroup.MarginLayoutParams
         val translationX: Float = (taskViewWidth - banner.height).toFloat()
         val translationY: Float
         if (splitBounds == null) {
diff --git a/quickstep/src/com/android/quickstep/views/DesktopTaskView.kt b/quickstep/src/com/android/quickstep/views/DesktopTaskView.kt
index 8876633..9d07b30 100644
--- a/quickstep/src/com/android/quickstep/views/DesktopTaskView.kt
+++ b/quickstep/src/com/android/quickstep/views/DesktopTaskView.kt
@@ -78,14 +78,27 @@
 
     private val contentViewFullscreenParams = FullscreenDrawParams(context)
 
+    private val taskThumbnailViewDeprecatedPool =
+        if (!enableRefactorTaskThumbnail()) {
+            ViewPool<TaskThumbnailViewDeprecated>(
+                context,
+                this,
+                R.layout.task_thumbnail_deprecated,
+                VIEW_POOL_MAX_SIZE,
+                VIEW_POOL_INITIAL_SIZE,
+            )
+        } else null
+
     private val taskContentViewPool =
-        ViewPool<TaskContentView>(
-            context,
-            this,
-            R.layout.task_content_view,
-            VIEW_POOL_MAX_SIZE,
-            VIEW_POOL_INITIAL_SIZE,
-        )
+        if (enableRefactorTaskThumbnail()) {
+            ViewPool<TaskContentView>(
+                context,
+                this,
+                R.layout.task_content_view,
+                VIEW_POOL_MAX_SIZE,
+                VIEW_POOL_INITIAL_SIZE,
+            )
+        } else null
 
     private val tempPointF = PointF()
     private val lastComputedTaskSize = Rect()
@@ -262,7 +275,7 @@
                 if (
                     enableDesktopRecentsTransitionsCornersBugfix() && enableRefactorTaskThumbnail()
                 ) {
-                    it.taskContentView?.outlineBounds =
+                    (it.taskContentView as TaskContentView).outlineBounds =
                         if (intersects(overviewTaskPosition, screenRect))
                             Rect(overviewTaskPosition).apply {
                                 intersectUnchecked(screenRect)
@@ -313,13 +326,15 @@
         val backgroundViewIndex = contentView.indexOfChild(backgroundView)
         taskContainers =
             tasks.map { task ->
-                val taskContentView = taskContentViewPool.view
+                val taskContentView =
+                    if (enableRefactorTaskThumbnail()) taskContentViewPool!!.view
+                    else taskThumbnailViewDeprecatedPool!!.view
                 contentView.addView(taskContentView, backgroundViewIndex + 1)
                 val snapshotView =
                     if (enableRefactorTaskThumbnail()) {
                         taskContentView.findViewById<TaskThumbnailView>(R.id.snapshot)
                     } else {
-                        taskContentView.findViewById<TaskThumbnailViewDeprecated>(R.id.snapshot)
+                        taskContentView
                     }
 
                 TaskContainer(
@@ -479,7 +494,11 @@
 
     private fun removeAndRecycleThumbnailView(taskContainer: TaskContainer) {
         contentView.removeView(taskContainer.taskContentView)
-        taskContentViewPool.recycle(taskContainer.taskContentView)
+        if (enableRefactorTaskThumbnail()) {
+            taskContentViewPool!!.recycle(taskContainer.taskContentView as TaskContentView)
+        } else {
+            taskThumbnailViewDeprecatedPool!!.recycle(taskContainer.thumbnailViewDeprecated)
+        }
     }
 
     private fun updateTaskPositions() {
diff --git a/quickstep/src/com/android/quickstep/views/GroupedTaskView.kt b/quickstep/src/com/android/quickstep/views/GroupedTaskView.kt
index 10a2e90..3b8607b 100644
--- a/quickstep/src/com/android/quickstep/views/GroupedTaskView.kt
+++ b/quickstep/src/com/android/quickstep/views/GroupedTaskView.kt
@@ -24,6 +24,7 @@
 import android.view.ViewStub
 import com.android.internal.jank.Cuj
 import com.android.launcher3.Flags.enableOverviewIconMenu
+import com.android.launcher3.Flags.enableRefactorTaskThumbnail
 import com.android.launcher3.R
 import com.android.launcher3.Utilities
 import com.android.launcher3.util.RunnableList
@@ -94,8 +95,16 @@
 
     override fun inflateViewStubs() {
         super.inflateViewStubs()
+        val taskContentViewLayoutId =
+            if (enableRefactorTaskThumbnail()) R.layout.task_content_view
+            else R.layout.task_thumbnail_deprecated
         findViewById<ViewStub>(R.id.bottomright_task_content_view)
-            ?.apply { layoutResource = R.layout.task_content_view }
+            ?.apply {
+                inflatedId =
+                    if (enableRefactorTaskThumbnail()) R.id.bottomright_task_content_view
+                    else R.id.bottomright_snapshot
+                layoutResource = taskContentViewLayoutId
+            }
             ?.inflate()
         findViewById<ViewStub>(R.id.bottomRight_icon)
             ?.apply {
@@ -134,7 +143,7 @@
                 createTaskContainer(
                     secondaryTask,
                     R.id.bottomright_task_content_view,
-                    R.id.snapshot,
+                    if (enableRefactorTaskThumbnail()) R.id.snapshot else R.id.bottomright_snapshot,
                     R.id.bottomRight_icon,
                     R.id.show_windows_right,
                     R.id.bottomRight_digital_wellbeing_toast,
diff --git a/quickstep/src/com/android/quickstep/views/IconAppChipView.kt b/quickstep/src/com/android/quickstep/views/IconAppChipView.kt
index 7683a15..46ed29b 100644
--- a/quickstep/src/com/android/quickstep/views/IconAppChipView.kt
+++ b/quickstep/src/com/android/quickstep/views/IconAppChipView.kt
@@ -122,7 +122,7 @@
             field = max(value, minMaxWidth)
         }
 
-    var isExpanded: Boolean = false
+    var status: AppChipStatus = AppChipStatus.Collapsed
         private set
 
     override fun onFinishInflate() {
@@ -358,8 +358,8 @@
                 ObjectAnimator.ofFloat(iconArrowView, TRANSLATION_X, arrowTranslationWithRtl),
                 ObjectAnimator.ofFloat(iconArrowView, SCALE_Y, -1f),
             )
-            animator!!.setDuration(MENU_BACKGROUND_REVEAL_DURATION.toLong())
-            isExpanded = true
+            animator!!.duration = MENU_BACKGROUND_REVEAL_DURATION.toLong()
+            status = AppChipStatus.Expanded
         } else {
             // Clip expanded text with reveal animation so it doesn't go beyond the edge of the menu
             val expandedTextClipAnim =
@@ -393,8 +393,8 @@
                 ObjectAnimator.ofFloat(iconArrowView, TRANSLATION_X, 0f),
                 ObjectAnimator.ofFloat(iconArrowView, SCALE_Y, 1f),
             )
-            animator!!.setDuration(MENU_BACKGROUND_HIDE_DURATION.toLong())
-            isExpanded = false
+            animator!!.duration = MENU_BACKGROUND_HIDE_DURATION.toLong()
+            status = AppChipStatus.Collapsed
         }
 
         if (!animated) animator!!.duration = 0
@@ -434,6 +434,11 @@
 
     override fun asView(): View = this
 
+    enum class AppChipStatus {
+        Expanded,
+        Collapsed,
+    }
+
     private companion object {
         private val SUM_AGGREGATOR = FloatBiFunction { a: Float, b: Float -> a + b }
 
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index aa25738..4feeb95 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -3367,8 +3367,8 @@
         int snappedPage = isKeyboardTaskFocusPending() ? mKeyboardTaskFocusIndex : getNextPage();
         TaskView snappedTaskView = getTaskViewAt(snappedPage);
         TaskView homeTaskView = getHomeTaskView();
-        TaskView expectedCurrentTaskView = mUtils.getExpectedCurrentTask(getFocusedTaskView(),
-                getRunningTaskView());
+        TaskView expectedCurrentTaskView = mUtils.getExpectedCurrentTask(getRunningTaskView(),
+                getFocusedTaskView());
         TaskView nextFocusedTaskView = null;
 
         // Don't clear the top row, if the user has dismissed a task, to maintain the task order.
diff --git a/quickstep/src/com/android/quickstep/views/TaskContainer.kt b/quickstep/src/com/android/quickstep/views/TaskContainer.kt
index afe7e92..a98b17d 100644
--- a/quickstep/src/com/android/quickstep/views/TaskContainer.kt
+++ b/quickstep/src/com/android/quickstep/views/TaskContainer.kt
@@ -40,7 +40,8 @@
 class TaskContainer(
     val taskView: TaskView,
     val task: Task,
-    val taskContentView: TaskContentView,
+    // TODO(b/361500574): Upon flag cleanup, use the TaskContentView type and remove the getter
+    val taskContentView: View,
     val snapshotView: View,
     val iconView: TaskViewIcon,
     /**
@@ -62,8 +63,10 @@
 
     init {
         if (enableRefactorTaskThumbnail()) {
+            require(taskContentView is TaskContentView)
             require(snapshotView is TaskThumbnailView)
         } else {
+            require(taskContentView is TaskThumbnailViewDeprecated)
             require(snapshotView is TaskThumbnailViewDeprecated)
         }
     }
@@ -174,7 +177,7 @@
         clickCloseListener: OnClickListener?,
     ) =
         traceSection("TaskContainer.setState") {
-            taskContentView.setState(
+            (taskContentView as TaskContentView).setState(
                 TaskUiStateMapper.toTaskHeaderState(state, hasHeader, clickCloseListener),
                 TaskUiStateMapper.toTaskThumbnailUiState(state, liveTile),
                 state?.taskId,
diff --git a/quickstep/src/com/android/quickstep/views/TaskMenuView.kt b/quickstep/src/com/android/quickstep/views/TaskMenuView.kt
index 696f934..4d4ce4e 100644
--- a/quickstep/src/com/android/quickstep/views/TaskMenuView.kt
+++ b/quickstep/src/com/android/quickstep/views/TaskMenuView.kt
@@ -428,9 +428,7 @@
 
         var additionalTranslationX = 0f
         if (
-            recentsViewContainer.deviceProfile.isLandscape &&
-                taskContainer.stagePosition ==
-                    SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT
+            taskContainer.stagePosition == SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT
         ) {
             // Animate menu and icon when split task would display off the side of the screen.
             additionalTranslationX =
diff --git a/quickstep/src/com/android/quickstep/views/TaskView.kt b/quickstep/src/com/android/quickstep/views/TaskView.kt
index 3835e48..daecbfd 100644
--- a/quickstep/src/com/android/quickstep/views/TaskView.kt
+++ b/quickstep/src/com/android/quickstep/views/TaskView.kt
@@ -99,6 +99,7 @@
 import com.android.quickstep.util.TaskRemovedDuringLaunchListener
 import com.android.quickstep.util.displayId
 import com.android.quickstep.util.isExternalDisplay
+import com.android.quickstep.views.IconAppChipView.AppChipStatus
 import com.android.quickstep.views.RecentsView.UNBOUND_TASK_VIEW_ID
 import com.android.systemui.shared.recents.model.Task
 import com.android.systemui.shared.recents.model.ThumbnailData
@@ -764,8 +765,16 @@
     }
 
     protected open fun inflateViewStubs() {
+        val taskContentViewLayoutId =
+            if (enableRefactorTaskThumbnail()) R.layout.task_content_view
+            else R.layout.task_thumbnail_deprecated
+
         findViewById<ViewStub>(R.id.task_content_view)
-            ?.apply { layoutResource = R.layout.task_content_view }
+            ?.apply {
+                inflatedId =
+                    if (enableRefactorTaskThumbnail()) R.id.task_content_view else R.id.snapshot
+                layoutResource = taskContentViewLayoutId
+            }
             ?.inflate()
 
         findViewById<ViewStub>(R.id.icon)
@@ -935,7 +944,7 @@
             taskContainers.forEach { container ->
                 container.bind()
                 if (enableRefactorTaskThumbnail()) {
-                    container.taskContentView.cornerRadius =
+                    (container.taskContentView as TaskContentView).cornerRadius =
                         thumbnailFullscreenParams.currentCornerRadius
                     container.taskContentView.doOnSizeChange { width, height ->
                         updateThumbnailValidity(container)
@@ -974,12 +983,17 @@
     ): TaskContainer =
         traceSection("TaskView.createTaskContainer") {
             val iconView = findViewById<View>(iconViewId) as TaskViewIcon
-            val taskContentView = findViewById<TaskContentView>(taskContentViewId)
+            val taskContentView =
+                if (enableRefactorTaskThumbnail()) findViewById<View>(taskContentViewId)
+                else findViewById(thumbnailViewId)
+            val snapshotView =
+                if (enableRefactorTaskThumbnail()) taskContentView.findViewById(thumbnailViewId)
+                else taskContentView
             return TaskContainer(
                 this,
                 task,
                 taskContentView,
-                taskContentView.findViewById(thumbnailViewId),
+                snapshotView,
                 iconView,
                 TransformingTouchDelegate(iconView.asView()),
                 stagePosition,
@@ -1551,7 +1565,7 @@
             recentsView.setTaskBorderEnabled(false)
         }
         return if (enableOverviewIconMenu() && menuContainer.iconView is IconAppChipView) {
-            if (menuContainer.iconView.isExpanded) {
+            if (menuContainer.iconView.status == AppChipStatus.Expanded) {
                 closeTaskMenu()
             } else {
                 menuContainer.iconView.revealAnim(/* isRevealing= */ true)
@@ -1800,7 +1814,8 @@
         updateFullscreenParams(thumbnailFullscreenParams)
         taskContainers.forEach {
             if (enableRefactorTaskThumbnail()) {
-                it.taskContentView.cornerRadius = thumbnailFullscreenParams.currentCornerRadius
+                (it.taskContentView as TaskContentView).cornerRadius =
+                    thumbnailFullscreenParams.currentCornerRadius
             } else {
                 it.thumbnailViewDeprecated.setFullscreenParams(thumbnailFullscreenParams)
             }
diff --git a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimatorTest.kt b/quickstep/tests/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimatorTest.kt
similarity index 100%
rename from quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimatorTest.kt
rename to quickstep/tests/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimatorTest.kt