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
This commit is contained in:
Ats Jenk
2023-03-07 15:49:28 -08:00
parent 83683829f7
commit 4d01acf44e
6 changed files with 22 additions and 59 deletions

View File

@@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright (C) 2023 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="92dp"
android:height="80dp"
android:tint="?android:attr/textColorPrimary"
android:viewportHeight="80.0"
android:viewportWidth="92.0">
<path
android:fillColor="#AAFFFFFF"
android:pathData="M 14.365954,80 Q 10.981668,80 8.4908345,77.509166 6,75.018332 6,71.634046 V 36.193807 q 0,-3.384286 2.4908345,-5.87512 2.4908335,-2.493091 5.8751195,-2.493091 H 22.35738 V 8.365954 q 0,-3.3842855 2.538217,-5.8751198 Q 27.433811,0 30.723337,0 h 46.910711 q 3.479041,0 5.969878,2.4908342 2.490834,2.4908343 2.490834,5.8751198 v 35.442495 q 0,3.384286 -2.490834,5.87512 -2.490837,2.490835 -5.969878,2.490835 h -7.896671 v 19.459642 q 0,3.384286 -2.49083,5.87512 Q 64.755713,80 61.371423,80 Z m 0,-8.365954 h 47.005469 q 0,0 0,0 0,0 0,0 V 43.526426 H 14.365954 v 28.10762 q 0,0 0,0 0,0 0,0 z M 69.737377,43.808449 h 7.896671 q 0,0 0,0 0,0 0,0 V 15.698573 H 30.723337 v 12.127023 h 30.740592 q 3.479048,0 5.877376,2.445711 2.396072,2.443454 2.396072,5.82774 z" />
</vector>

View File

@@ -32,19 +32,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent" />
<TextView
android:id="@+id/empty_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="@dimen/overview_task_margin"
android:drawablePadding="@dimen/recents_empty_message_text_padding"
android:text="@string/recents_empty_desktop_message"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/recents_empty_message_text_size"
android:drawableTop="@drawable/ic_empty_desktop"
android:drawableTint="?android:attr/textColorPrimary" />
<!--
TODO(b249371338): DesktopTaskView extends from TaskView. TaskView expects TaskThumbnailView
and IconView with these ids to be present. Need to refactor RecentsView to accept child

View File

@@ -30,9 +30,6 @@
<!-- Recents: The empty recents string. [CHAR LIMIT=NONE] -->
<string name="recents_empty_message">No recent items</string>
<!-- Recents: The empty recents desktop tile string. [CHAR LIMIT=NONE] -->
<string name="recents_empty_desktop_message">No desktop items</string>
<!-- Content description for the recent apps's accessibility option that opens its usage settings. [CHAR LIMIT=NONE] -->
<string name="accessibility_app_usage_settings">App usage settings</string>

View File

@@ -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<Task> tasks;
@NonNull
public final ArrayList<Task> tasks;
public DesktopTask(ArrayList<Task> tasks) {
public DesktopTask(@NonNull ArrayList<Task> tasks) {
super(tasks.get(0), null, null, TaskView.Type.DESKTOP);
this.tasks = tasks;
}

View File

@@ -92,7 +92,6 @@ public class DesktopTaskView extends TaskView {
private final ArrayList<CancellableTask<?>> 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();

View File

@@ -1518,9 +1518,10 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
mMovingTaskView = null;
runningTaskView.resetPersistentViewTransforms();
int frontTaskIndex = 0;
if (DesktopTaskView.DESKTOP_IS_PROTO2_ENABLED && !runningTaskView.isDesktopTask()) {
// If desktop mode is enabled, desktop task view is pinned at first position.
// Move running task to position 1
if (DesktopTaskView.DESKTOP_IS_PROTO2_ENABLED && mDesktopTaskView != null
&& !runningTaskView.isDesktopTask()) {
// If desktop mode is enabled, desktop task view is pinned at first position if present.
// Move running task to position 1.
frontTaskIndex = 1;
}
addView(runningTaskView, frontTaskIndex);
@@ -1653,14 +1654,18 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
if (!taskGroups.isEmpty()) {
addView(mClearAllButton);
if (DesktopTaskView.DESKTOP_IS_PROTO2_ENABLED
&& !getSplitSelectController().isSplitSelectActive()) {
mDesktopTaskView = (DesktopTaskView) getTaskViewFromPool(TaskView.Type.DESKTOP);
// Always add a desktop task to the first position. Even if it is empty
addView(mDesktopTaskView, 0);
ArrayList<Task> 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<ACTIVITY_TYPE extends StatefulActivity<STATE_T
}
private int getFirstViewIndex() {
if (DesktopTaskView.DESKTOP_IS_PROTO2_ENABLED) {
if (DesktopTaskView.DESKTOP_IS_PROTO2_ENABLED && mDesktopTaskView != null) {
// Desktop task is at position 0, that is the first view
return 0;
}