From 7313bc7800f4c6c713e2923ef9d97933ac2c3117 Mon Sep 17 00:00:00 2001 From: Ats Jenk Date: Tue, 1 Aug 2023 14:18:52 -0700 Subject: [PATCH] Use window corner radius for desktop task snapshots Desktop task snapshots are shown inside the desktop tile in overview. They use the window corner radius, when shown on the desktop. Keep the same radius for the snapshots in overview. Only the desktop tile background should use the task corner radius. Bug: 280827930 Flag: persist.wm.debug.desktop_mode_2 Test: open some apps on desktop, swipe up for overview, observe the desktop task corner radius remains the same as when on desktop Change-Id: I55ced9f704b83a6c7619508aa3e7a8080ccc5c35 --- .../quickstep/views/DesktopTaskView.java | 19 ++++++++++++++++--- .../com/android/quickstep/views/TaskView.java | 14 +++++++++++--- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/quickstep/src/com/android/quickstep/views/DesktopTaskView.java b/quickstep/src/com/android/quickstep/views/DesktopTaskView.java index 1cfaf14224..83e99459ac 100644 --- a/quickstep/src/com/android/quickstep/views/DesktopTaskView.java +++ b/quickstep/src/com/android/quickstep/views/DesktopTaskView.java @@ -51,6 +51,7 @@ import com.android.quickstep.util.CancellableTask; import com.android.quickstep.util.RecentsOrientedState; import com.android.systemui.shared.recents.model.Task; import com.android.systemui.shared.recents.model.ThumbnailData; +import com.android.systemui.shared.system.QuickStepContract; import java.util.ArrayList; import java.util.Arrays; @@ -79,7 +80,7 @@ public class DesktopTaskView extends TaskView { private static final String TAG = DesktopTaskView.class.getSimpleName(); - private static final boolean DEBUG = true; + private static final boolean DEBUG = false; @NonNull private List mTasks = new ArrayList<>(); @@ -91,6 +92,8 @@ public class DesktopTaskView extends TaskView { private final ArrayList> mPendingThumbnailRequests = new ArrayList<>(); + private final TaskView.FullscreenDrawParams mSnapshotDrawParams; + private View mBackgroundView; public DesktopTaskView(Context context) { @@ -103,6 +106,10 @@ public class DesktopTaskView extends TaskView { public DesktopTaskView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); + + mSnapshotDrawParams = new FullscreenDrawParams( + QuickStepContract.getWindowCornerRadius(context), + QuickStepContract.getWindowCornerRadius(context)); } @Override @@ -465,14 +472,20 @@ public class DesktopTaskView extends TaskView { for (int i = 0; i < mSnapshotViewMap.size(); i++) { TaskThumbnailView thumbnailView = mSnapshotViewMap.valueAt(i); thumbnailView.getTaskOverlay().setFullscreenProgress(progress); - updateSnapshotRadius(); } + updateSnapshotRadius(); } @Override protected void updateSnapshotRadius() { + super.updateSnapshotRadius(); for (int i = 0; i < mSnapshotViewMap.size(); i++) { - mSnapshotViewMap.valueAt(i).setFullscreenParams(mCurrentFullscreenParams); + if (i == 0) { + // All snapshots share the same params. Only update it with the first snapshot. + updateFullscreenParams(mSnapshotDrawParams, + mSnapshotView.getPreviewPositionHelper()); + } + mSnapshotViewMap.valueAt(i).setFullscreenParams(mSnapshotDrawParams); } } diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java index 6b0843ccf5..854c3c7218 100644 --- a/quickstep/src/com/android/quickstep/views/TaskView.java +++ b/quickstep/src/com/android/quickstep/views/TaskView.java @@ -1707,10 +1707,15 @@ public class TaskView extends FrameLayout implements Reusable { } void updateCurrentFullscreenParams(PreviewPositionHelper previewPositionHelper) { + updateFullscreenParams(mCurrentFullscreenParams, previewPositionHelper); + } + + protected void updateFullscreenParams(TaskView.FullscreenDrawParams fullscreenParams, + PreviewPositionHelper previewPositionHelper) { if (getRecentsView() == null) { return; } - mCurrentFullscreenParams.setProgress(mFullscreenProgress, getRecentsView().getScaleX(), + fullscreenParams.setProgress(mFullscreenProgress, getRecentsView().getScaleX(), getScaleX(), getWidth(), mActivity.getDeviceProfile(), previewPositionHelper); } @@ -1860,9 +1865,12 @@ public class TaskView extends FrameLayout implements Reusable { public float mCurrentDrawnCornerRadius; public FullscreenDrawParams(Context context) { - mCornerRadius = TaskCornerRadius.get(context); - mWindowCornerRadius = QuickStepContract.getWindowCornerRadius(context); + this(TaskCornerRadius.get(context), QuickStepContract.getWindowCornerRadius(context)); + } + FullscreenDrawParams(float cornerRadius, float windowCornerRadius) { + mCornerRadius = cornerRadius; + mWindowCornerRadius = windowCornerRadius; mCurrentDrawnCornerRadius = mCornerRadius; }