From 80484e6da0517b2fd220f23162a04ee2f34f6f7c Mon Sep 17 00:00:00 2001 From: Orhan Uysal Date: Thu, 21 Dec 2023 16:24:53 +0000 Subject: [PATCH] Fix z order of tasks in overview. The recent tasks list provided to launcher is ordered from most recent to least recent. As a result, we need to add snapshot views always to the start of the view list. Test: Manual Bug: 269664273 Bug: 317486696 Flag: None Change-Id: I4efb3b3dbb21171cbbb52783e88e86d1b1778ec3 --- .../com/android/quickstep/views/DesktopTaskView.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/quickstep/src/com/android/quickstep/views/DesktopTaskView.java b/quickstep/src/com/android/quickstep/views/DesktopTaskView.java index a10d2ed47d..6b00473b73 100644 --- a/quickstep/src/com/android/quickstep/views/DesktopTaskView.java +++ b/quickstep/src/com/android/quickstep/views/DesktopTaskView.java @@ -17,6 +17,7 @@ package com.android.quickstep.views; import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; + import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_UNDEFINED; import android.content.Context; @@ -53,6 +54,8 @@ import com.android.systemui.shared.recents.model.ThumbnailData; import com.android.systemui.shared.system.QuickStepContract; import com.android.wm.shell.Flags; +import kotlin.Unit; + import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -60,7 +63,6 @@ import java.util.HashMap; import java.util.List; import java.util.function.Consumer; -import kotlin.Unit; /** * TaskView that contains all tasks that are part of the desktop. @@ -91,6 +93,8 @@ public class DesktopTaskView extends TaskView { private View mBackgroundView; + private int mChildCountAtInflation; + /** Check whether desktop windowing is enabled */ public static boolean isDesktopModeSupported() { // Check for aconfig flag first @@ -151,6 +155,8 @@ public class DesktopTaskView extends TaskView { Drawable iconBackground = getResources().getDrawable(R.drawable.bg_circle, getContext().getTheme()); mIconView.setDrawable(new LayerDrawable(new Drawable[]{iconBackground, icon})); + + mChildCountAtInflation = getChildCount(); } @Override @@ -196,7 +202,9 @@ public class DesktopTaskView extends TaskView { for (int i = 0; i < diff; i++) { TaskThumbnailView snapshotView = new TaskThumbnailView(getContext()); mSnapshotViews.add(snapshotView); - addView(snapshotView, new LayoutParams(WRAP_CONTENT, WRAP_CONTENT)); + // Add snapshots from to position after the initial child views. + addView(snapshotView, mChildCountAtInflation, + new LayoutParams(WRAP_CONTENT, WRAP_CONTENT)); } }