Revert "Inflate TaskThumbnailViewDeprecated as TaskContentView"

This reverts commit bba7e8af3735ae4f9113f471c96d476118bd8a24.

Reason for revert: DroidMonitor: Potential culprit for http://b/404515699 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.

Change-Id: Iadb65f37b9712c3d6e5943847520ca3bd76624c7
diff --git a/quickstep/src/com/android/quickstep/views/DesktopTaskView.kt b/quickstep/src/com/android/quickstep/views/DesktopTaskView.kt
index 5c60798..27657b4 100644
--- a/quickstep/src/com/android/quickstep/views/DesktopTaskView.kt
+++ b/quickstep/src/com/android/quickstep/views/DesktopTaskView.kt
@@ -73,27 +73,14 @@
 
     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 =
-        if (enableRefactorTaskThumbnail()) {
-            ViewPool<TaskContentView>(
-                context,
-                this,
-                R.layout.task_content_view,
-                VIEW_POOL_MAX_SIZE,
-                VIEW_POOL_INITIAL_SIZE,
-            )
-        } else null
+        ViewPool<TaskContentView>(
+            context,
+            this,
+            R.layout.task_content_view,
+            VIEW_POOL_MAX_SIZE,
+            VIEW_POOL_INITIAL_SIZE,
+        )
 
     private val tempPointF = PointF()
     private val lastComputedTaskSize = Rect()
@@ -262,7 +249,7 @@
                 if (
                     enableDesktopRecentsTransitionsCornersBugfix() && enableRefactorTaskThumbnail()
                 ) {
-                    (it.taskContentView as TaskContentView).outlineBounds =
+                    it.taskContentView?.outlineBounds =
                         if (intersects(overviewTaskPosition, screenRect))
                             Rect(overviewTaskPosition).apply {
                                 intersectUnchecked(screenRect)
@@ -313,15 +300,13 @@
         val backgroundViewIndex = contentView.indexOfChild(backgroundView)
         taskContainers =
             tasks.map { task ->
-                val taskContentView =
-                    if (enableRefactorTaskThumbnail()) taskContentViewPool!!.view
-                    else taskThumbnailViewDeprecatedPool!!.view
+                val taskContentView = taskContentViewPool.view
                 contentView.addView(taskContentView, backgroundViewIndex + 1)
                 val snapshotView =
                     if (enableRefactorTaskThumbnail()) {
                         taskContentView.findViewById<TaskThumbnailView>(R.id.snapshot)
                     } else {
-                        taskContentView
+                        taskContentView.findViewById<TaskThumbnailViewDeprecated>(R.id.snapshot)
                     }
 
                 TaskContainer(
@@ -481,11 +466,7 @@
 
     private fun removeAndRecycleThumbnailView(taskContainer: TaskContainer) {
         contentView.removeView(taskContainer.taskContentView)
-        if (enableRefactorTaskThumbnail()) {
-            taskContentViewPool!!.recycle(taskContainer.taskContentView as TaskContentView)
-        } else {
-            taskThumbnailViewDeprecatedPool!!.recycle(taskContainer.thumbnailViewDeprecated)
-        }
+        taskContentViewPool.recycle(taskContainer.taskContentView)
     }
 
     private fun updateTaskPositions() {
diff --git a/quickstep/src/com/android/quickstep/views/GroupedTaskView.kt b/quickstep/src/com/android/quickstep/views/GroupedTaskView.kt
index b8dadce..71a4dde 100644
--- a/quickstep/src/com/android/quickstep/views/GroupedTaskView.kt
+++ b/quickstep/src/com/android/quickstep/views/GroupedTaskView.kt
@@ -24,7 +24,6 @@
 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
@@ -95,11 +94,8 @@
 
     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 = taskContentViewLayoutId }
+            ?.apply { layoutResource = R.layout.task_content_view }
             ?.inflate()
         findViewById<ViewStub>(R.id.bottomRight_icon)
             ?.apply {
diff --git a/quickstep/src/com/android/quickstep/views/TaskContainer.kt b/quickstep/src/com/android/quickstep/views/TaskContainer.kt
index a98b17d..afe7e92 100644
--- a/quickstep/src/com/android/quickstep/views/TaskContainer.kt
+++ b/quickstep/src/com/android/quickstep/views/TaskContainer.kt
@@ -40,8 +40,7 @@
 class TaskContainer(
     val taskView: TaskView,
     val task: Task,
-    // TODO(b/361500574): Upon flag cleanup, use the TaskContentView type and remove the getter
-    val taskContentView: View,
+    val taskContentView: TaskContentView,
     val snapshotView: View,
     val iconView: TaskViewIcon,
     /**
@@ -63,10 +62,8 @@
 
     init {
         if (enableRefactorTaskThumbnail()) {
-            require(taskContentView is TaskContentView)
             require(snapshotView is TaskThumbnailView)
         } else {
-            require(taskContentView is TaskThumbnailViewDeprecated)
             require(snapshotView is TaskThumbnailViewDeprecated)
         }
     }
@@ -177,7 +174,7 @@
         clickCloseListener: OnClickListener?,
     ) =
         traceSection("TaskContainer.setState") {
-            (taskContentView as TaskContentView).setState(
+            taskContentView.setState(
                 TaskUiStateMapper.toTaskHeaderState(state, hasHeader, clickCloseListener),
                 TaskUiStateMapper.toTaskThumbnailUiState(state, liveTile),
                 state?.taskId,
diff --git a/quickstep/src/com/android/quickstep/views/TaskView.kt b/quickstep/src/com/android/quickstep/views/TaskView.kt
index 24e6fc9..8d95b13 100644
--- a/quickstep/src/com/android/quickstep/views/TaskView.kt
+++ b/quickstep/src/com/android/quickstep/views/TaskView.kt
@@ -722,12 +722,8 @@
     }
 
     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 = taskContentViewLayoutId }
+            ?.apply { layoutResource = R.layout.task_content_view }
             ?.inflate()
 
         findViewById<ViewStub>(R.id.icon)
@@ -897,7 +893,7 @@
             taskContainers.forEach { container ->
                 container.bind()
                 if (enableRefactorTaskThumbnail()) {
-                    (container.taskContentView as TaskContentView).cornerRadius =
+                    container.taskContentView.cornerRadius =
                         thumbnailFullscreenParams.currentCornerRadius
                     container.taskContentView.doOnSizeChange { width, height ->
                         updateThumbnailValidity(container)
@@ -936,15 +932,12 @@
     ): TaskContainer =
         traceSection("TaskView.createTaskContainer") {
             val iconView = findViewById<View>(iconViewId) as TaskViewIcon
-            val taskContentView = findViewById<View>(taskContentViewId)
-            val snapshotView =
-                if (enableRefactorTaskThumbnail()) taskContentView.findViewById(thumbnailViewId)
-                else taskContentView
+            val taskContentView = findViewById<TaskContentView>(taskContentViewId)
             return TaskContainer(
                 this,
                 task,
                 taskContentView,
-                snapshotView,
+                taskContentView.findViewById(thumbnailViewId),
                 iconView,
                 TransformingTouchDelegate(iconView.asView()),
                 stagePosition,
@@ -1759,8 +1752,7 @@
         updateFullscreenParams(thumbnailFullscreenParams)
         taskContainers.forEach {
             if (enableRefactorTaskThumbnail()) {
-                (it.taskContentView as TaskContentView).cornerRadius =
-                    thumbnailFullscreenParams.currentCornerRadius
+                it.taskContentView.cornerRadius = thumbnailFullscreenParams.currentCornerRadius
             } else {
                 it.thumbnailViewDeprecated.setFullscreenParams(thumbnailFullscreenParams)
             }