From 4d01acf44e7e357e3760622f0389c66fceb8a4be Mon Sep 17 00:00:00 2001 From: Ats Jenk Date: Tue, 7 Mar 2023 15:49:28 -0800 Subject: [PATCH] Remove empty desktop tile Do not show the desktop tile in overview when there are no apps on the desktop. Bug: 270399069 Test: have desktop mode proto 2 enabled, launch an app in fullscreen, open overview, observe no desktop tile Test: move an app to desktop, be on desktop, open overview, observe overview is opened with desktop tile focused Test: have an app on desktop, go home and launch an app in fullscreen, open overview, observe fullscreen app is focused, desktop is peeking in from right Test: have an app on desktop and a fullscreen app in overview, open desktop from overview, close the desktop app, open overview, observe desktop tile is not shown Change-Id: Ia8657d5b260043a630f32b35f2560ea93273d421 --- quickstep/res/drawable/ic_empty_desktop.xml | 25 ---------------- quickstep/res/layout/task_desktop.xml | 13 --------- quickstep/res/values/strings.xml | 3 -- .../android/quickstep/util/DesktopTask.java | 7 +++-- .../quickstep/views/DesktopTaskView.java | 4 --- .../android/quickstep/views/RecentsView.java | 29 +++++++++++-------- 6 files changed, 22 insertions(+), 59 deletions(-) delete mode 100644 quickstep/res/drawable/ic_empty_desktop.xml diff --git a/quickstep/res/drawable/ic_empty_desktop.xml b/quickstep/res/drawable/ic_empty_desktop.xml deleted file mode 100644 index cbf185658c..0000000000 --- a/quickstep/res/drawable/ic_empty_desktop.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - diff --git a/quickstep/res/layout/task_desktop.xml b/quickstep/res/layout/task_desktop.xml index f4548358ec..2ec9d4ceee 100644 --- a/quickstep/res/layout/task_desktop.xml +++ b/quickstep/res/layout/task_desktop.xml @@ -32,19 +32,6 @@ android:layout_width="match_parent" android:layout_height="match_parent" /> - - No recent items - - No desktop items - App usage settings diff --git a/quickstep/src/com/android/quickstep/util/DesktopTask.java b/quickstep/src/com/android/quickstep/util/DesktopTask.java index 433d23fa97..b3f5d82637 100644 --- a/quickstep/src/com/android/quickstep/util/DesktopTask.java +++ b/quickstep/src/com/android/quickstep/util/DesktopTask.java @@ -16,6 +16,8 @@ package com.android.quickstep.util; +import androidx.annotation.NonNull; + import com.android.quickstep.views.TaskView; import com.android.systemui.shared.recents.model.Task; @@ -27,9 +29,10 @@ import java.util.ArrayList; */ public class DesktopTask extends GroupTask { - public ArrayList tasks; + @NonNull + public final ArrayList tasks; - public DesktopTask(ArrayList tasks) { + public DesktopTask(@NonNull ArrayList tasks) { super(tasks.get(0), null, null, TaskView.Type.DESKTOP); this.tasks = tasks; } diff --git a/quickstep/src/com/android/quickstep/views/DesktopTaskView.java b/quickstep/src/com/android/quickstep/views/DesktopTaskView.java index 14898b1007..5414068d84 100644 --- a/quickstep/src/com/android/quickstep/views/DesktopTaskView.java +++ b/quickstep/src/com/android/quickstep/views/DesktopTaskView.java @@ -92,7 +92,6 @@ public class DesktopTaskView extends TaskView { private final ArrayList> mPendingThumbnailRequests = new ArrayList<>(); private View mBackgroundView; - private View mEmptyView; public DesktopTaskView(Context context) { this(context, null); @@ -111,7 +110,6 @@ public class DesktopTaskView extends TaskView { super.onFinishInflate(); mBackgroundView = findViewById(R.id.background); - mEmptyView = findViewById(R.id.empty_view); int topMarginPx = mActivity.getDeviceProfile().overviewTaskThumbnailTopMarginPx; @@ -187,8 +185,6 @@ public class DesktopTaskView extends TaskView { mSnapshotViewMap.put(task.key.id, snapshotView); } - mEmptyView.setVisibility(mTasks.isEmpty() ? View.VISIBLE : View.GONE); - updateTaskIdContainer(); updateTaskIdAttributeContainer(); diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index ac59403216..e7cff092d7 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -1518,9 +1518,10 @@ public abstract class RecentsView tasks = desktopTask != null ? desktopTask.tasks : new ArrayList<>(); - mDesktopTaskView.bind(tasks, mOrientationState); + if (DesktopTaskView.DESKTOP_IS_PROTO2_ENABLED) { + // Check if we have apps on the desktop + if (desktopTask != null && !desktopTask.tasks.isEmpty()) { + // If we are actively choosing apps for split, skip the desktop tile + if (!getSplitSelectController().isSplitSelectActive()) { + mDesktopTaskView = (DesktopTaskView) getTaskViewFromPool( + TaskView.Type.DESKTOP); + // Always add a desktop task to the first position + addView(mDesktopTaskView, 0); + mDesktopTaskView.bind(desktopTask.tasks, mOrientationState); + } + } } } @@ -5201,7 +5206,7 @@ public abstract class RecentsView