Merge "Remove empty desktop tile" into tm-qpr-dev am: bac6d4946a am: cff883d96f am: 1889431ba9 am: 4a768f8d5f

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/21893975

Change-Id: I346f2703ebeeaa311816458983919ea0ac4b928a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Ats Jenk
2023-03-09 02:49:55 +00:00
committed by Automerger Merge Worker
6 changed files with 22 additions and 59 deletions
@@ -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;
}
@@ -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();
@@ -1516,9 +1516,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);
@@ -1651,14 +1652,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);
}
}
}
}
@@ -5202,7 +5207,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;
}