From 0b8e16e2cb4978b00d4d84f7cdcad65303fd2e2c Mon Sep 17 00:00:00 2001 From: vadimt Date: Tue, 26 Jan 2021 19:39:26 -0800 Subject: [PATCH 1/2] Showing DWB remaining time for work profile apps Test: manual Bug: 170441505 Change-Id: Idb305adb028c897ddafd2255c1f7c34417c16968 --- .../com/android/quickstep/views/DigitalWellBeingToast.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java b/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java index 6630aede3d..6e3a8b50d1 100644 --- a/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java +++ b/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java @@ -113,11 +113,6 @@ public final class DigitalWellBeingToast { public void initialize(Task task) { mTask = task; - if (task.key.userId != UserHandle.myUserId()) { - setNoLimit(); - return; - } - THREAD_POOL_EXECUTOR.execute(() -> { final AppUsageLimit usageLimit = mLauncherApps.getAppUsageLimit( task.getTopComponent().getPackageName(), From 5921dd65108ee386708b1e88cc1fedbbe6fb7ecd Mon Sep 17 00:00:00 2001 From: Pat Manning Date: Thu, 25 Mar 2021 18:33:09 +0000 Subject: [PATCH 2/2] Shift only tasks within current grid row upon task dismissal. Test: manual Bug: 182579190 Change-Id: I656a743f41f5139ab5673862e27b48076cfc4313 --- .../android/quickstep/views/RecentsView.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 769344080a..a35580f2bb 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -355,6 +355,8 @@ public abstract class RecentsView extends PagedView // The GestureEndTarget that is still in progress. private GestureState.GestureEndTarget mCurrentGestureEndTarget; + IntSet mTopIdSet = new IntSet(); + /** * TODO: Call reloadIdNeeded in onTaskStackChanged. */ @@ -1201,7 +1203,7 @@ public abstract class RecentsView extends PagedView fullscreenTranslations[i] - fullscreenTranslations[firstNonHomeTaskIndex]); } - updateGridProperties(); + updateGridProperties(false); } public void getTaskSize(Rect outRect) { @@ -1674,7 +1676,7 @@ public abstract class RecentsView extends PagedView * This method only calculates the potential position and depends on {@link #setGridProgress} to * apply the actual scaling and translation. */ - private void updateGridProperties() { + private void updateGridProperties(boolean isTaskDismissal) { int taskCount = getTaskViewCount(); if (taskCount == 0) { return; @@ -1690,6 +1692,10 @@ public abstract class RecentsView extends PagedView IntSet bottomSet = new IntSet(); float[] gridTranslations = new float[taskCount]; int firstNonHomeTaskIndex = 0; + + if (!isTaskDismissal) { + mTopIdSet.clear(); + } for (int i = 0; i < taskCount; i++) { TaskView taskView = getTaskViewAt(i); if (isHomeTask(taskView)) { @@ -1699,10 +1705,14 @@ public abstract class RecentsView extends PagedView continue; } - if (topRowWidth <= bottomRowWidth) { + // Evenly distribute tasks between rows unless rearranging due to task dismissal, in + // which case keep tasks in their respective rows. + if ((!isTaskDismissal && topRowWidth <= bottomRowWidth) || (isTaskDismissal && mTopIdSet + .contains(taskView.getTask().key.id))) { gridTranslations[i] += topAccumulatedTranslationX; topRowWidth += taskView.getLayoutParams().width + mPageSpacing; topSet.add(i); + mTopIdSet.add(taskView.getTask().key.id); taskView.setGridTranslationY(0); @@ -2066,7 +2076,7 @@ public abstract class RecentsView extends PagedView } else { snapToPageImmediately(pageToSnapTo); // Grid got messed up, reapply. - updateGridProperties(); + updateGridProperties(true); } // Update the layout synchronously so that the position of next view is // immediately available.