diff --git a/quickstep/res/layout/task_content_view.xml b/quickstep/res/layout/task_content_view.xml
index 478ee55c06..62277919f6 100644
--- a/quickstep/res/layout/task_content_view.xml
+++ b/quickstep/res/layout/task_content_view.xml
@@ -14,21 +14,30 @@
~ limitations under the License.
-->
+ android:layout_height="wrap_content"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ />
-
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ />
\ No newline at end of file
diff --git a/quickstep/src/com/android/quickstep/task/thumbnail/TaskContentView.kt b/quickstep/src/com/android/quickstep/task/thumbnail/TaskContentView.kt
index a010f81c1f..184d863c45 100644
--- a/quickstep/src/com/android/quickstep/task/thumbnail/TaskContentView.kt
+++ b/quickstep/src/com/android/quickstep/task/thumbnail/TaskContentView.kt
@@ -24,7 +24,8 @@ import android.util.AttributeSet
import android.view.View
import android.view.ViewOutlineProvider
import android.view.ViewStub
-import android.widget.LinearLayout
+import androidx.constraintlayout.widget.ConstraintLayout
+import androidx.constraintlayout.widget.ConstraintSet
import androidx.core.view.isInvisible
import com.android.launcher3.R
import com.android.launcher3.util.ViewPool
@@ -35,7 +36,7 @@ import com.android.quickstep.views.TaskHeaderView
* DWB, AiAi (TaskOverlay).
*/
class TaskContentView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
- LinearLayout(context, attrs), ViewPool.Reusable {
+ ConstraintLayout(context, attrs), ViewPool.Reusable {
private var taskHeaderView: TaskHeaderView? = null
private var taskThumbnailView: TaskThumbnailView? = null
@@ -123,6 +124,16 @@ class TaskContentView @JvmOverloads constructor(context: Context, attrs: Attribu
findViewById(R.id.task_header_view)
.apply { layoutResource = R.layout.task_header_view }
.inflate() as TaskHeaderView
+
+ // TODO: Move to layout xml when moving away from view stubs.
+ val constraintSet = ConstraintSet().apply { clone(this@TaskContentView) }
+ constraintSet.connect(
+ R.id.snapshot,
+ ConstraintSet.TOP,
+ R.id.task_header_view,
+ ConstraintSet.BOTTOM,
+ )
+ constraintSet.applyTo(this@TaskContentView)
}
}
diff --git a/quickstep/tests/multivalentScreenshotTests/src/com/android/quickstep/task/thumbnail/TaskContentViewScreenshotTest.kt b/quickstep/tests/multivalentScreenshotTests/src/com/android/quickstep/task/thumbnail/TaskContentViewScreenshotTest.kt
index 5e546f7f1a..e3b27f0359 100644
--- a/quickstep/tests/multivalentScreenshotTests/src/com/android/quickstep/task/thumbnail/TaskContentViewScreenshotTest.kt
+++ b/quickstep/tests/multivalentScreenshotTests/src/com/android/quickstep/task/thumbnail/TaskContentViewScreenshotTest.kt
@@ -61,7 +61,10 @@ class TaskContentViewScreenshotTest(emulationSpec: DeviceEmulationSpec) {
@Test
fun taskContentView_recyclesToUninitialized() {
- screenshotRule.screenshotTest("taskContentView_uninitialized") { activity ->
+ screenshotRule.screenshotTest(
+ "taskContentView_uninitialized",
+ ViewScreenshotTestRule.Mode.MatchSize,
+ ) { activity ->
activity.actionBar?.hide()
val taskContentView = createTaskContentView(activity)
taskContentView.setState(
@@ -76,7 +79,10 @@ class TaskContentViewScreenshotTest(emulationSpec: DeviceEmulationSpec) {
@Test
fun taskContentView_shows_thumbnail_and_header() {
- screenshotRule.screenshotTest("taskContentView_shows_thumbnail_and_header") { activity ->
+ screenshotRule.screenshotTest(
+ "taskContentView_shows_thumbnail_and_header",
+ ViewScreenshotTestRule.Mode.MatchSize,
+ ) { activity ->
activity.actionBar?.hide()
createTaskContentView(activity).apply {
setState(
@@ -95,7 +101,10 @@ class TaskContentViewScreenshotTest(emulationSpec: DeviceEmulationSpec) {
@Test
fun taskContentView_scaled_roundRoundedCorners() {
- screenshotRule.screenshotTest("taskContentView_scaledRoundedCorners") { activity ->
+ screenshotRule.screenshotTest(
+ "taskContentView_scaledRoundedCorners",
+ ViewScreenshotTestRule.Mode.MatchSize,
+ ) { activity ->
activity.actionBar?.hide()
createTaskContentView(activity).apply {
scaleX = 0.75f