From e07bab8c7fc2a879122dfaa1657e279aceaf3bba Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Mon, 23 Aug 2021 13:54:28 -0700 Subject: [PATCH 01/15] Null out RemoteTargetHandles as soon as finishing recents is requested * Instead of waiting for recents animation to be complete before we stop manipulating remote leashes, stop it as soon as RecentsView gets the request. Bug: 197232424 Change-Id: I7f3cb6d2fc389d502e57054f60f28e7967212194 --- quickstep/src/com/android/quickstep/views/RecentsView.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index abeadfd29b..5e0412340a 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -4084,6 +4084,8 @@ public abstract class RecentsView Date: Tue, 24 Aug 2021 22:50:27 +0100 Subject: [PATCH 02/15] Change dark overview scrim color to Neutral 2 palette with 35 luminosity. Bug: 197361088 Test: manual Change-Id: I2e9a4d41c2660aa10f3f9cfe51bbee55dee917f2 Signed-off-by: Mariia Sandrikova --- res/color-v31/overview_scrim_dark.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/color-v31/overview_scrim_dark.xml b/res/color-v31/overview_scrim_dark.xml index b8ed7747e0..85ede9a9ec 100644 --- a/res/color-v31/overview_scrim_dark.xml +++ b/res/color-v31/overview_scrim_dark.xml @@ -14,5 +14,5 @@ limitations under the License. --> - + From 8b78c138d4dba2d66ecfba630503cd5273ed7b51 Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Tue, 24 Aug 2021 17:24:49 -0700 Subject: [PATCH 03/15] Implement swipe gesture for staged split in landscape * Maintain task split percentages when swiping up. * Split percentages not maintained in GroupedTaskView, however. That is a TODO. Bug: 181704764, 181705607 Test: Swiped up in landscape with home rotation on/off. Portrait still works. Change-Id: Iec62abae34f6ccadf98e2afdc9409cf3160f8223 --- .../quickstep/BaseActivityInterface.java | 28 ------------- .../quickstep/util/TaskViewSimulator.java | 15 +++---- .../touch/LandscapePagedViewHandler.java | 24 +++++++++++ .../touch/PagedOrientationHandler.java | 27 +++++++++++++ .../touch/PortraitPagedViewHandler.java | 40 +++++++++++++++++++ .../util/SplitConfigurationOptions.java | 12 ++++++ 6 files changed, 109 insertions(+), 37 deletions(-) diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java index e2ef3bc66d..6298bb806e 100644 --- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java +++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java @@ -53,7 +53,6 @@ import com.android.launcher3.statehandlers.DepthController; import com.android.launcher3.statemanager.BaseState; import com.android.launcher3.statemanager.StatefulActivity; import com.android.launcher3.touch.PagedOrientationHandler; -import com.android.launcher3.util.SplitConfigurationOptions; import com.android.launcher3.util.WindowBounds; import com.android.launcher3.views.ScrimView; import com.android.quickstep.SysUINavigationMode.Mode; @@ -202,33 +201,6 @@ public abstract class BaseActivityInterface Date: Tue, 24 Aug 2021 19:59:30 -0700 Subject: [PATCH 04/15] Set thumbnails for GroupedTaskView based on split layout bounds Bug: 181704764 Test: Go to stage split in landscape w/ home rotation on/off, swipe up. Thumbnails aren't perfectly overlaid, polish needed Change-Id: I54e39cc5a18f527e80a664d60aca72dfd706ebdc --- .../quickstep/views/GroupedTaskView.java | 39 ++++++------------- .../android/quickstep/views/RecentsView.java | 18 ++++++--- .../touch/LandscapePagedViewHandler.java | 20 ++++++++++ .../touch/PagedOrientationHandler.java | 3 ++ .../touch/PortraitPagedViewHandler.java | 34 ++++++++++++++++ 5 files changed, 80 insertions(+), 34 deletions(-) diff --git a/quickstep/src/com/android/quickstep/views/GroupedTaskView.java b/quickstep/src/com/android/quickstep/views/GroupedTaskView.java index cd20f4bcbf..1bc7c755df 100644 --- a/quickstep/src/com/android/quickstep/views/GroupedTaskView.java +++ b/quickstep/src/com/android/quickstep/views/GroupedTaskView.java @@ -1,13 +1,10 @@ package com.android.quickstep.views; -import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; - import android.content.Context; import android.util.AttributeSet; -import android.view.ViewGroup; -import com.android.launcher3.DeviceProfile; import com.android.launcher3.R; +import com.android.launcher3.util.SplitConfigurationOptions; import com.android.quickstep.RecentsModel; import com.android.quickstep.TaskThumbnailCache; import com.android.quickstep.util.CancellableTask; @@ -48,13 +45,14 @@ public class GroupedTaskView extends TaskView { mSnapshotView2 = findViewById(R.id.bottomright_snapshot); } - public void bind(Task primary, Task secondary, RecentsOrientedState orientedState) { + public void bind(Task primary, Task secondary, RecentsOrientedState orientedState, + SplitConfigurationOptions.StagedSplitBounds splitBoundsConfig) { super.bind(primary, orientedState); mSecondaryTask = secondary; mTaskIdContainer[1] = secondary.key.id; mTaskIdAttributeContainer[1] = new TaskIdAttributeContainer(secondary, mSnapshotView2); mSnapshotView2.bind(secondary); - adjustThumbnailBoundsForSplit(); + adjustThumbnailBoundsForSplit(splitBoundsConfig, orientedState); } @Override @@ -108,30 +106,15 @@ public class GroupedTaskView extends TaskView { mSnapshotView2.setOverlayEnabled(overlayEnabled); } - private void adjustThumbnailBoundsForSplit() { - DeviceProfile deviceProfile = mActivity.getDeviceProfile(); - ViewGroup.LayoutParams primaryLp = mSnapshotView.getLayoutParams(); - primaryLp.width = mSecondaryTask == null ? - MATCH_PARENT : - getWidth(); - int spaceAboveSnapshot = deviceProfile.overviewTaskThumbnailTopMarginPx; - // TODO get divider height - int dividerBar = 20; - primaryLp.height = mSecondaryTask == null ? - MATCH_PARENT : - (getHeight() - spaceAboveSnapshot - dividerBar) / 2; - mSnapshotView.setLayoutParams(primaryLp); - - if (mSecondaryTask == null) { - mSnapshotView2.setVisibility(GONE); + private void adjustThumbnailBoundsForSplit( + SplitConfigurationOptions.StagedSplitBounds splitBoundsConfig, + RecentsOrientedState orientedState) { + if (splitBoundsConfig == null) { return; } - mSnapshotView2.setVisibility(VISIBLE); - ViewGroup.LayoutParams secondaryLp = mSnapshotView2.getLayoutParams(); - secondaryLp.width = getWidth(); - secondaryLp.height = primaryLp.height; - mSnapshotView2.setLayoutParams(secondaryLp); - mSnapshotView2.setTranslationY(primaryLp.height + spaceAboveSnapshot + dividerBar); + orientedState.getOrientationHandler().setGroupedTaskViewThumbnailBounds( + mSnapshotView, mSnapshotView2, this, splitBoundsConfig, + mActivity.getDeviceProfile()); } } diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index abeadfd29b..763dbfb3ab 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -575,6 +575,7 @@ public abstract class RecentsView Date: Wed, 25 Aug 2021 11:59:43 -0700 Subject: [PATCH 05/15] Fix public variables to not have 'm' prefix Bug: 181704764 Change-Id: I89e43ce6cc74119514c8124e7cc61b11dc475f58 --- .../states/SplitScreenSelectState.java | 2 +- .../quickstep/TaskShortcutFactory.java | 2 +- .../util/SplitSelectStateController.java | 4 +- .../quickstep/util/TaskViewSimulator.java | 2 +- .../touch/LandscapePagedViewHandler.java | 14 +++--- .../touch/PortraitPagedViewHandler.java | 34 +++++++------- .../util/SplitConfigurationOptions.java | 44 +++++++++---------- 7 files changed, 51 insertions(+), 51 deletions(-) diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/SplitScreenSelectState.java b/quickstep/src/com/android/launcher3/uioverrides/states/SplitScreenSelectState.java index 1882a0c929..cbb4081e91 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/SplitScreenSelectState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/SplitScreenSelectState.java @@ -44,7 +44,7 @@ public class SplitScreenSelectState extends OverviewState { public float getSplitSelectTranslation(Launcher launcher) { RecentsView recentsView = launcher.getOverviewPanel(); int splitPosition = recentsView.getSplitPlaceholder() - .getActiveSplitPositionOption().mStagePosition; + .getActiveSplitPositionOption().stagePosition; if (!recentsView.shouldShiftThumbnailsForSplitSelect(splitPosition)) { return 0f; } diff --git a/quickstep/src/com/android/quickstep/TaskShortcutFactory.java b/quickstep/src/com/android/quickstep/TaskShortcutFactory.java index a078bf331e..559125ea97 100644 --- a/quickstep/src/com/android/quickstep/TaskShortcutFactory.java +++ b/quickstep/src/com/android/quickstep/TaskShortcutFactory.java @@ -100,7 +100,7 @@ public interface TaskShortcutFactory { private SplitPositionOption mSplitPositionOption; public SplitSelectSystemShortcut(BaseDraggingActivity target, TaskView taskView, SplitPositionOption option) { - super(option.mIconResId, option.mTextResId, target, taskView.getItemInfo()); + super(option.iconResId, option.textResId, target, taskView.getItemInfo()); mTaskView = taskView; mSplitPositionOption = option; setEnabled(taskView.getRecentsView().getTaskViewCount() > 1); diff --git a/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java b/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java index 16c925a6e9..6dff857452 100644 --- a/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java +++ b/quickstep/src/com/android/quickstep/util/SplitSelectStateController.java @@ -83,7 +83,7 @@ public class SplitSelectStateController { mSecondTaskView = taskView; // Assume initial task is for top/left part of screen - final int[] taskIds = mInitialPosition.mStagePosition == STAGE_POSITION_TOP_OR_LEFT + final int[] taskIds = mInitialPosition.stagePosition == STAGE_POSITION_TOP_OR_LEFT ? new int[]{mInitialTaskView.getTask().key.id, taskView.getTask().key.id} : new int[]{taskView.getTask().key.id, mInitialTaskView.getTask().key.id}; if (TaskAnimationManager.ENABLE_SHELL_TRANSITIONS) { @@ -113,7 +113,7 @@ public class SplitSelectStateController { DeviceProfile deviceProfile) { InsettableFrameLayout.LayoutParams params = new InsettableFrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT); - boolean topLeftPosition = mInitialPosition.mStagePosition == STAGE_POSITION_TOP_OR_LEFT; + boolean topLeftPosition = mInitialPosition.stagePosition == STAGE_POSITION_TOP_OR_LEFT; if (deviceProfile.isLandscape) { params.width = (int) resources.getDimension(R.dimen.split_placeholder_size); params.gravity = topLeftPosition ? Gravity.START : Gravity.END; diff --git a/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java b/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java index 760f665c64..9960fd341c 100644 --- a/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java +++ b/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java @@ -176,7 +176,7 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { mStagePosition = STAGE_POSITION_UNDEFINED; return; } - mStagePosition = mThumbnailPosition.equals(splitInfo.mLeftTopBounds) ? + mStagePosition = mThumbnailPosition.equals(splitInfo.leftTopBounds) ? STAGE_POSITION_TOP_OR_LEFT : STAGE_POSITION_BOTTOM_OR_RIGHT; } diff --git a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java index 0304a4ef85..29e5446076 100644 --- a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java +++ b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java @@ -169,12 +169,12 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler { DeviceProfile dp) { // Don't use device profile here because we know we're in fake landscape, only split option // available is top/left - if (splitPosition.mStagePosition == STAGE_POSITION_TOP_OR_LEFT) { + if (splitPosition.stagePosition == STAGE_POSITION_TOP_OR_LEFT) { // Top (visually left) side return SPLIT_TRANSLATE_PRIMARY_NEGATIVE; } throw new IllegalStateException("Invalid split stage position: " + - splitPosition.mStagePosition); + splitPosition.stagePosition); } @Override @@ -389,10 +389,10 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler { SplitConfigurationOptions.StagedSplitBounds splitInfo, int desiredStagePosition) { float diff; if (desiredStagePosition == SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT) { - diff = outRect.height() * (1f - splitInfo.mLeftTaskPercent); + diff = outRect.height() * (1f - splitInfo.leftTaskPercent); outRect.bottom -= diff; } else { - diff = outRect.height() * splitInfo.mLeftTaskPercent; + diff = outRect.height() * splitInfo.leftTaskPercent; outRect.top += diff; } } @@ -402,7 +402,7 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler { SplitConfigurationOptions.StagedSplitBounds splitInfo, int desiredStagePosition) { if (desiredStagePosition == STAGE_POSITION_BOTTOM_OR_RIGHT) { // The preview set is for the bottom/right, inset by top/left task - splitOffset.x = splitInfo.mLeftTopBounds.width() + splitInfo.mDividerBounds.width() / 2; + splitOffset.x = splitInfo.leftTopBounds.width() + splitInfo.dividerBounds.width() / 2; } } @@ -413,12 +413,12 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler { int spaceAboveSnapshot = dp.overviewTaskThumbnailTopMarginPx; int totalThumbnailHeight = taskParent.getHeight() - spaceAboveSnapshot; int totalThumbnailWidth = taskParent.getWidth(); - int dividerBar = splitBoundsConfig.mDividerBounds.width() / 2; + int dividerBar = splitBoundsConfig.dividerBounds.width() / 2; ViewGroup.LayoutParams primaryLp = mSnapshotView.getLayoutParams(); ViewGroup.LayoutParams secondaryLp = mSnapshotView2.getLayoutParams(); primaryLp.width = totalThumbnailWidth; - primaryLp.height = (int)(totalThumbnailHeight * splitBoundsConfig.mLeftTaskPercent); + primaryLp.height = (int)(totalThumbnailHeight * splitBoundsConfig.leftTaskPercent); secondaryLp.width = totalThumbnailWidth; secondaryLp.height = totalThumbnailHeight - primaryLp.height - dividerBar; diff --git a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java index bc3c0bf576..737162f5aa 100644 --- a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java +++ b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java @@ -167,7 +167,7 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler { @Override public int getSplitTaskViewDismissDirection(SplitPositionOption splitPosition, DeviceProfile dp) { - if (splitPosition.mStagePosition == STAGE_POSITION_TOP_OR_LEFT) { + if (splitPosition.stagePosition == STAGE_POSITION_TOP_OR_LEFT) { if (dp.isLandscape) { // Left side return SPLIT_TRANSLATE_PRIMARY_NEGATIVE; @@ -175,12 +175,12 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler { // Top side return SPLIT_TRANSLATE_SECONDARY_NEGATIVE; } - } else if (splitPosition.mStagePosition == STAGE_POSITION_BOTTOM_OR_RIGHT) { + } else if (splitPosition.stagePosition == STAGE_POSITION_BOTTOM_OR_RIGHT) { // We don't have a bottom option, so should be right return SPLIT_TRANSLATE_PRIMARY_POSITIVE; } throw new IllegalStateException("Invalid split stage position: " + - splitPosition.mStagePosition); + splitPosition.stagePosition); } @Override @@ -425,7 +425,7 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler { } // Now we rotate the portrait rect depending on what side we want pinned - boolean pinToRight = splitPositionOption.mStagePosition == STAGE_POSITION_BOTTOM_OR_RIGHT; + boolean pinToRight = splitPositionOption.stagePosition == STAGE_POSITION_BOTTOM_OR_RIGHT; int screenHeight = dp.heightPx; float postRotateScale = (float) screenHeight / width; @@ -453,7 +453,7 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler { } // Now we rotate the portrait rect depending on what side we want pinned - boolean pinToRight = initialSplitOption.mStagePosition == STAGE_POSITION_BOTTOM_OR_RIGHT; + boolean pinToRight = initialSplitOption.stagePosition == STAGE_POSITION_BOTTOM_OR_RIGHT; float postRotateScale = (float) screenHeight / screenWidth; mTmpMatrix.reset(); @@ -477,18 +477,18 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler { float diff; if (desiredStagePosition == SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT) { if (isLandscape) { - diff = outRect.width() * (1f - splitInfo.mLeftTaskPercent); + diff = outRect.width() * (1f - splitInfo.leftTaskPercent); outRect.right -= diff; } else { - diff = outRect.height() * (1f - splitInfo.mTopTaskPercent); + diff = outRect.height() * (1f - splitInfo.topTaskPercent); outRect.bottom -= diff; } } else { if (isLandscape) { - diff = outRect.width() * splitInfo.mLeftTaskPercent; + diff = outRect.width() * splitInfo.leftTaskPercent; outRect.left += diff; } else { - diff = outRect.height() * splitInfo.mTopTaskPercent; + diff = outRect.height() * splitInfo.topTaskPercent; outRect.top += diff; } } @@ -499,11 +499,11 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler { SplitConfigurationOptions.StagedSplitBounds splitInfo, int desiredStagePosition) { if (desiredStagePosition == STAGE_POSITION_BOTTOM_OR_RIGHT) { if (dp.isLandscape) { - splitOffset.x = splitInfo.mLeftTopBounds.width() + - splitInfo.mDividerBounds.width() / 2; + splitOffset.x = splitInfo.leftTopBounds.width() + + splitInfo.dividerBounds.width() / 2; } else { - splitOffset.y = splitInfo.mLeftTopBounds.height() + - splitInfo.mDividerBounds.height() / 2; + splitOffset.y = splitInfo.leftTopBounds.height() + + splitInfo.dividerBounds.height() / 2; } } } @@ -516,15 +516,15 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler { int totalThumbnailHeight = taskParent.getHeight() - spaceAboveSnapshot; int totalThumbnailWidth = taskParent.getWidth(); int dividerBar = (dp.isLandscape ? - splitBoundsConfig.mDividerBounds.width() : - splitBoundsConfig.mDividerBounds.height()) + splitBoundsConfig.dividerBounds.width() : + splitBoundsConfig.dividerBounds.height()) / 2; ViewGroup.LayoutParams primaryLp = mSnapshotView.getLayoutParams(); ViewGroup.LayoutParams secondaryLp = mSnapshotView2.getLayoutParams(); if (dp.isLandscape) { primaryLp.height = totalThumbnailHeight; - primaryLp.width = (int)(totalThumbnailWidth * splitBoundsConfig.mLeftTaskPercent); + primaryLp.width = (int)(totalThumbnailWidth * splitBoundsConfig.leftTaskPercent); secondaryLp.height = totalThumbnailHeight; secondaryLp.width = totalThumbnailWidth - primaryLp.width - dividerBar; @@ -532,7 +532,7 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler { mSnapshotView2.setTranslationY(spaceAboveSnapshot); } else { primaryLp.width = totalThumbnailWidth; - primaryLp.height = (int)(totalThumbnailHeight * splitBoundsConfig.mTopTaskPercent); + primaryLp.height = (int)(totalThumbnailHeight * splitBoundsConfig.topTaskPercent); secondaryLp.width = totalThumbnailWidth; secondaryLp.height = totalThumbnailHeight - primaryLp.height - dividerBar; diff --git a/src/com/android/launcher3/util/SplitConfigurationOptions.java b/src/com/android/launcher3/util/SplitConfigurationOptions.java index b07c21f399..41693def5f 100644 --- a/src/com/android/launcher3/util/SplitConfigurationOptions.java +++ b/src/com/android/launcher3/util/SplitConfigurationOptions.java @@ -69,44 +69,44 @@ public final class SplitConfigurationOptions { /////////////////////////////////// public static class SplitPositionOption { - public final int mIconResId; - public final int mTextResId; + public final int iconResId; + public final int textResId; @StagePosition - public final int mStagePosition; + public final int stagePosition; @StageType public final int mStageType; public SplitPositionOption(int iconResId, int textResId, int stagePosition, int stageType) { - mIconResId = iconResId; - mTextResId = textResId; - mStagePosition = stagePosition; + this.iconResId = iconResId; + this.textResId = textResId; + this.stagePosition = stagePosition; mStageType = stageType; } } public static class StagedSplitBounds { - public final Rect mLeftTopBounds; - public final Rect mRightBottomBounds; - public final Rect mDividerBounds; + public final Rect leftTopBounds; + public final Rect rightBottomBounds; + public final Rect dividerBounds; // This class is orientation-agnostic, so we compute both for later use - public final float mTopTaskPercent; - public final float mLeftTaskPercent; + public final float topTaskPercent; + public final float leftTaskPercent; public StagedSplitBounds(Rect leftTopBounds, Rect rightBottomBounds, Rect dividerBounds) { - mLeftTopBounds = leftTopBounds; - mRightBottomBounds = rightBottomBounds; - mDividerBounds = dividerBounds; - float totalHeight = mLeftTopBounds.height() - + mRightBottomBounds.height() - + mDividerBounds.height(); - float totalWidth = mLeftTopBounds.width() - + mRightBottomBounds.width() - + mDividerBounds.width(); + this.leftTopBounds = leftTopBounds; + this.rightBottomBounds = rightBottomBounds; + this.dividerBounds = dividerBounds; + float totalHeight = this.leftTopBounds.height() + + this.rightBottomBounds.height() + + this.dividerBounds.height(); + float totalWidth = this.leftTopBounds.width() + + this.rightBottomBounds.width() + + this.dividerBounds.width(); - mLeftTaskPercent = mLeftTopBounds.width() / totalWidth; - mTopTaskPercent = mLeftTopBounds.height() / totalHeight; + leftTaskPercent = this.leftTopBounds.width() / totalWidth; + topTaskPercent = this.leftTopBounds.height() / totalHeight; } } From a88802ee922bec27ef7ce3a45471fc163afbb7a7 Mon Sep 17 00:00:00 2001 From: Alan Viverette Date: Wed, 25 Aug 2021 22:06:47 +0000 Subject: [PATCH 06/15] Disable eager initialization of Jetpack libraries Bug: 197780098 Test: Launcher3 tests Change-Id: I8f921ae26e873822ac2340ad78449cf1040af4cf --- AndroidManifest-common.xml | 7 +++++++ tests/AndroidManifest-common.xml | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/AndroidManifest-common.xml b/AndroidManifest-common.xml index 4eecf29d67..ea75ea9549 100644 --- a/AndroidManifest-common.xml +++ b/AndroidManifest-common.xml @@ -19,6 +19,7 @@ --> + diff --git a/tests/AndroidManifest-common.xml b/tests/AndroidManifest-common.xml index 8222f75268..5124f809c2 100644 --- a/tests/AndroidManifest-common.xml +++ b/tests/AndroidManifest-common.xml @@ -16,6 +16,7 @@ @@ -235,5 +236,11 @@ + + + From 1a79f87004ebbc9eadc13ef1d58cf33b57d4c98f Mon Sep 17 00:00:00 2001 From: vadimt Date: Wed, 25 Aug 2021 20:12:56 -0700 Subject: [PATCH 07/15] More more logging for for Nexus home activity appearing after to-home gesture in L3 Bug: 192018189 Test: presubmit Change-Id: Id99dbf9469c61f81643e5182d17012b508cfce1e --- .../src/com/android/quickstep/AbsSwipeUpHandler.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 46d58577cd..6e90a3a5a7 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -1194,9 +1194,6 @@ public abstract class AbsSwipeUpHandler, @UiThread private void animateToProgressInternal(float start, float end, long duration, Interpolator interpolator, GestureEndTarget target, PointF velocityPxPerMs) { - if (Utilities.IS_RUNNING_IN_TEST_HARNESS) { - Log.d(TestProtocol.L3_SWIPE_TO_HOME, "7"); - } maybeUpdateRecentsAttachedState(); // If we are transitioning to launcher, then listen for the activity to be restarted while @@ -1219,6 +1216,9 @@ public abstract class AbsSwipeUpHandler, } } + if (Utilities.IS_RUNNING_IN_TEST_HARNESS) { + Log.d(TestProtocol.L3_SWIPE_TO_HOME, "7, end target=" + mGestureState.getEndTarget()); + } if (mGestureState.getEndTarget() == HOME) { getOrientationHandler().adjustFloatingIconStartVelocity(velocityPxPerMs); final RemoteAnimationTargetCompat runningTaskTarget = mRecentsAnimationTargets != null @@ -1233,6 +1233,9 @@ public abstract class AbsSwipeUpHandler, && runningTaskTarget.allowEnterPip && runningTaskTarget.taskInfo.pictureInPictureParams != null && runningTaskTarget.taskInfo.pictureInPictureParams.isAutoEnterEnabled(); + if (Utilities.IS_RUNNING_IN_TEST_HARNESS) { + Log.d(TestProtocol.L3_SWIPE_TO_HOME, "8, class=" + getClass().getSimpleName()); + } HomeAnimationFactory homeAnimFactory = createHomeAnimationFactory(cookies, duration, isTranslucent, appCanEnterPip, runningTaskTarget); From 8c574de97f967ca79d5d25ef8bd65a8bd58256f0 Mon Sep 17 00:00:00 2001 From: Andras Kloczl Date: Tue, 17 Aug 2021 23:12:17 +0200 Subject: [PATCH 08/15] Two panel home empty page removing logic change - Don't remove a single page if it's empty, only if both pages are empty. - Add back empty pages after they were removed while the phone was on single panel home. - On two panel home don't add new workspace items onto the second screen Test: manual Bug: 196376162 Change-Id: I4c54ffa3b359a236deb3ab67adb54111e77ec896 --- src/com/android/launcher3/Launcher.java | 19 ++++++++++- src/com/android/launcher3/Workspace.java | 32 +++++++++++++++++++ .../launcher3/WorkspaceLayoutManager.java | 2 ++ .../graphics/LauncherPreviewRenderer.java | 3 +- .../graphics/PreviewSurfaceRenderer.java | 5 +-- .../model/AddWorkspaceItemsTask.java | 6 ++++ src/com/android/launcher3/util/IntArray.java | 2 +- 7 files changed, 62 insertions(+), 7 deletions(-) diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 4d5cc5ee4a..6ea7b17871 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -2186,6 +2186,24 @@ public class Launcher extends StatefulActivity implements Launche } private void bindAddScreens(IntArray orderedScreenIds) { + if (mDeviceProfile.isTwoPanels) { + // Some empty pages might have been removed while the phone was in a single panel + // mode, so we want to add those empty pages back. + IntSet screenIds = IntSet.wrap(orderedScreenIds); + for (int i = 0; i < orderedScreenIds.size(); i++) { + int screenId = orderedScreenIds.get(i); + // Don't add the page pair if the page is the last one and if the pair is on the + // right, because that would cause a bug when adding new pages. + // TODO: (b/196376162) remove this when the new screen id logic is fixed for two + // panel in Workspace::commitExtraEmptyScreen + if (i == orderedScreenIds.size() - 1 && screenId % 2 == 0) { + continue; + } + screenIds.add(mWorkspace.getPagePair(screenId)); + } + orderedScreenIds = screenIds.getArray(); + } + int count = orderedScreenIds.size(); for (int i = 0; i < count; i++) { int screenId = orderedScreenIds.get(i); @@ -2193,7 +2211,6 @@ public class Launcher extends StatefulActivity implements Launche // No need to bind the first screen, as its always bound. continue; } - mWorkspace.insertNewWorkspaceScreenBeforeEmptyScreen(screenId); } } diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 38beeea97d..5049ae5bd5 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -123,6 +123,7 @@ import com.android.systemui.plugins.shared.LauncherOverlayManager.LauncherOverla import java.util.ArrayList; import java.util.Collections; +import java.util.Iterator; import java.util.List; import java.util.function.Predicate; import java.util.stream.Collectors; @@ -797,6 +798,21 @@ public class Workspace extends PagedView return mScreenOrder; } + /** + * Returns the page that is shown together with the given page when two panel is enabled. + * @throws IllegalStateException if called while two panel home isn't enabled. + */ + public int getPagePair(int page) { + if (!isTwoPanelEnabled()) { + throw new IllegalStateException("Two panel home isn't enabled."); + } + if (page % 2 == 0) { + return page + 1; + } else { + return page - 1; + } + } + public void stripEmptyScreens() { if (mLauncher.isWorkspaceLoading()) { // Don't strip empty screens if the workspace is still loading. @@ -822,6 +838,22 @@ public class Workspace extends PagedView } } + // When two panel home is enabled we only remove an empty page if both visible pages are + // empty. + if (isTwoPanelEnabled()) { + // We go through all the pages that were marked as removable and check their page pair + Iterator removeScreensIterator = removeScreens.iterator(); + while (removeScreensIterator.hasNext()) { + int pageToRemove = removeScreensIterator.next(); + int pagePair = getPagePair(pageToRemove); + if (!removeScreens.contains(pagePair)) { + // The page pair isn't empty so we want to remove the current page from the + // removable pages' collection + removeScreensIterator.remove(); + } + } + } + // We enforce at least one page to add new items to. In the case that we remove the last // such screen, we convert the last screen to the empty screen int minScreens = 1; diff --git a/src/com/android/launcher3/WorkspaceLayoutManager.java b/src/com/android/launcher3/WorkspaceLayoutManager.java index d6302ce580..44a5536c92 100644 --- a/src/com/android/launcher3/WorkspaceLayoutManager.java +++ b/src/com/android/launcher3/WorkspaceLayoutManager.java @@ -32,6 +32,8 @@ public interface WorkspaceLayoutManager { int EXTRA_EMPTY_SCREEN_ID = -201; // The is the first screen. It is always present, even if its empty. int FIRST_SCREEN_ID = 0; + // This is the second page. On two panel home it is always present, even if its empty. + int SECOND_SCREEN_ID = 1; /** * At bind time, we use the rank (screenId) to compute x and y for hotseat items. diff --git a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java index a96de31241..94c578e0ae 100644 --- a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java +++ b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java @@ -65,6 +65,7 @@ import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherSettings.Favorites; import com.android.launcher3.R; import com.android.launcher3.Utilities; +import com.android.launcher3.Workspace; import com.android.launcher3.WorkspaceLayoutManager; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.folder.FolderIcon; @@ -279,7 +280,7 @@ public class LauncherPreviewRenderer extends ContextWrapper mDp.workspacePadding.top, mDp.workspacePadding.right + mDp.cellLayoutPaddingLeftRightPx, mDp.workspacePadding.bottom); - mWorkspaceScreens.put(PreviewSurfaceRenderer.SECOND_SCREEN_ID, rightPanel); + mWorkspaceScreens.put(Workspace.SECOND_SCREEN_ID, rightPanel); } if (Utilities.ATLEAST_S) { diff --git a/src/com/android/launcher3/graphics/PreviewSurfaceRenderer.java b/src/com/android/launcher3/graphics/PreviewSurfaceRenderer.java index af006d6a56..f4d1e615d7 100644 --- a/src/com/android/launcher3/graphics/PreviewSurfaceRenderer.java +++ b/src/com/android/launcher3/graphics/PreviewSurfaceRenderer.java @@ -66,9 +66,6 @@ public class PreviewSurfaceRenderer { private static final int FADE_IN_ANIMATION_DURATION = 200; - // The is the second screen. It is always present in two panel, even if its empty. - static final int SECOND_SCREEN_ID = 1; - private static final String KEY_HOST_TOKEN = "host_token"; private static final String KEY_VIEW_WIDTH = "width"; private static final String KEY_VIEW_HEIGHT = "height"; @@ -172,7 +169,7 @@ public class PreviewSurfaceRenderer { + LauncherSettings.Favorites.CONTAINER_HOTSEAT; if (deviceProfile.isTwoPanels) { query += " or " + LauncherSettings.Favorites.SCREEN + " = " - + SECOND_SCREEN_ID; + + Workspace.SECOND_SCREEN_ID; } loadWorkspace(new ArrayList<>(), LauncherSettings.Favorites.PREVIEW_CONTENT_URI, query); diff --git a/src/com/android/launcher3/model/AddWorkspaceItemsTask.java b/src/com/android/launcher3/model/AddWorkspaceItemsTask.java index a13fa55dff..fea15c41f8 100644 --- a/src/com/android/launcher3/model/AddWorkspaceItemsTask.java +++ b/src/com/android/launcher3/model/AddWorkspaceItemsTask.java @@ -16,6 +16,7 @@ package com.android.launcher3.model; import static com.android.launcher3.WorkspaceLayoutManager.FIRST_SCREEN_ID; +import static com.android.launcher3.WorkspaceLayoutManager.SECOND_SCREEN_ID; import android.content.Intent; import android.content.pm.LauncherActivityInfo; @@ -299,6 +300,11 @@ public class AddWorkspaceItemsTask extends BaseModelUpdateTask { IntSet screensToExclude = new IntSet(); if (FeatureFlags.QSB_ON_FIRST_SCREEN) { screensToExclude.add(FIRST_SCREEN_ID); + + // On split display we don't want to add the new items onto the second screen. + if (app.getInvariantDeviceProfile().isSplitDisplay) { + screensToExclude.add(SECOND_SCREEN_ID); + } } for (int screen = 0; screen < screenCount; screen++) { diff --git a/src/com/android/launcher3/util/IntArray.java b/src/com/android/launcher3/util/IntArray.java index e7235e76ce..1c787959e4 100644 --- a/src/com/android/launcher3/util/IntArray.java +++ b/src/com/android/launcher3/util/IntArray.java @@ -296,7 +296,7 @@ public class IntArray implements Cloneable, Iterable { @Override public void remove() { - throw new UnsupportedOperationException(); + removeIndex(--mNextIndex); } } } \ No newline at end of file From bc4dc49c6c48bc716df63def3b25c476a414a757 Mon Sep 17 00:00:00 2001 From: Alan Viverette Date: Thu, 26 Aug 2021 03:27:13 +0000 Subject: [PATCH 09/15] Temporarily disable Launcher3 tests affected by fling changes Bug: 197802324 Test: TaplTestsLauncher3 Change-Id: I3958bd9fb5521d09fa7cae642128b9f5e11b8e2e --- .../tests/src/com/android/quickstep/TaplTestsQuickstep.java | 2 ++ tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java | 1 + 2 files changed, 3 insertions(+) diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java index e5e560a91c..e27bc2c4d4 100644 --- a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java +++ b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java @@ -42,6 +42,7 @@ import com.android.quickstep.views.RecentsView; import org.junit.After; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; @@ -212,6 +213,7 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { } @Test + @Ignore("b/197802324") @PortraitLandscape public void testAllAppsFromHome() throws Exception { // Test opening all apps diff --git a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java index 881f50cafb..ea185492c5 100644 --- a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java +++ b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java @@ -250,6 +250,7 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { } @Test + @Ignore("b/197802324") @PortraitLandscape public void testWidgets() throws Exception { // Test opening widgets. From bc30e25cecef745bdb1d19be8d7c04852a4f404c Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Thu, 26 Aug 2021 10:18:04 -0700 Subject: [PATCH 10/15] Hide taskbar icons when recents button is disabled The idea is that both taskbar icons and recents navigate you to new apps, which we'd want to disable in similar contexts. Hence reusing FLAG_DISABLE_RECENTS. Test: locally set FLAG_DISABLE_RECENTS=true, ensure taskbar icons don't show up (both in 3 button mode and gesture nav) Bug: 193183428 Bug: 194990283 Change-Id: I9537f57dc25663151b1414c5260dadb58506fdb0 --- .../taskbar/NavbarButtonsViewController.java | 7 +++++++ .../launcher3/taskbar/TaskbarActivityContext.java | 2 ++ .../launcher3/taskbar/TaskbarViewController.java | 12 +++++++++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java index e871c2556d..be9368fcac 100644 --- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java @@ -260,6 +260,13 @@ public class NavbarButtonsViewController { return (mState & FLAG_IME_VISIBLE) != 0; } + /** + * Returns true if the recents (overview) button is disabled + */ + public boolean isRecentsDisabled() { + return (mState & FLAG_DISABLE_RECENTS) != 0; + } + /** * Adds the bounds corresponding to all visible buttons to provided region */ diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index 8d7a6dc602..8c12567ccf 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -236,6 +236,8 @@ public class TaskbarActivityContext extends ContextThemeWrapper implements Activ systemUiStateFlags, forceUpdate); mControllers.taskbarViewController.setImeIsVisible( mControllers.navbarButtonsViewController.isImeVisible()); + mControllers.taskbarViewController.setRecentsButtonDisabled( + mControllers.navbarButtonsViewController.isRecentsDisabled()); mControllers.taskbarKeyguardController.updateStateForSysuiFlags(systemUiStateFlags); } diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java index 1882762a67..a4b2e50fa8 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java @@ -44,6 +44,8 @@ public class TaskbarViewController { public static final int ALPHA_INDEX_IME = 1; public static final int ALPHA_INDEX_KEYGUARD = 2; public static final int ALPHA_INDEX_STASH = 3; + public static final int ALPHA_INDEX_RECENTS_DISABLED = 4; + private static final int NUM_ALPHA_CHANNELS = 5; private final TaskbarActivityContext mActivity; private final TaskbarView mTaskbarView; @@ -67,7 +69,7 @@ public class TaskbarViewController { public TaskbarViewController(TaskbarActivityContext activity, TaskbarView taskbarView) { mActivity = activity; mTaskbarView = taskbarView; - mTaskbarIconAlpha = new MultiValueAlpha(mTaskbarView, 4); + mTaskbarIconAlpha = new MultiValueAlpha(mTaskbarView, NUM_ALPHA_CHANNELS); mTaskbarIconAlpha.setUpdateVisibility(true); mModelCallbacks = new TaskbarModelCallbacks(activity, mTaskbarView); } @@ -100,6 +102,14 @@ public class TaskbarViewController { mTaskbarView.setTouchesEnabled(!isImeVisible); } + /** + * Should be called when the recents button is disabled, so we can hide taskbar icons as well. + */ + public void setRecentsButtonDisabled(boolean isDisabled) { + // TODO: check TaskbarStashController#supportsStashing(), to stash instead of setting alpha. + mTaskbarIconAlpha.getProperty(ALPHA_INDEX_RECENTS_DISABLED).setValue(isDisabled ? 0 : 1); + } + /** * Sets OnClickListener and OnLongClickListener for the given view. */ From 3feebeb19669c65d99ad0f12b2986e2444da51cc Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Tue, 24 Aug 2021 17:06:41 -0700 Subject: [PATCH 11/15] Fix taskbar folder leave-behind not being drawn I guess FrameLayout has willNotDraw=true by default, so we need to set it to false in order to get onDraw(). Test: open a folder on taskbar Bug: 197866264 Change-Id: Ia521bc3da28527b9c3f1fa7bcdaf5d9ffb7feccf --- quickstep/src/com/android/launcher3/taskbar/TaskbarView.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java index a4a92f7567..2280c491b5 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java @@ -90,6 +90,9 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar // We layout the icons to be of mIconTouchSize in width and height mItemMarginLeftRight = actualMargin - (mIconTouchSize - actualIconSize) / 2; mItemPadding = (mIconTouchSize - actualIconSize) / 2; + + // Needed to draw folder leave-behind when opening one. + setWillNotDraw(false); } protected void init(TaskbarViewController.TaskbarViewCallbacks callbacks) { From 6174106f68ef0e54d9166ee464c80f011cc217f4 Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Mon, 16 Aug 2021 14:53:59 -0700 Subject: [PATCH 12/15] Add Split button in OverviewActions Shows up only for large screen devices, not phones. Tested for NexusLauncher, general 3P launcher support needed for staged split (TODO b/195607777) Bug: 195423591 Change-Id: I4d455769b17637174b590c640516b9fbb6352c3d --- .../res/layout/overview_actions_container.xml | 17 ++++++ quickstep/res/values/strings.xml | 2 + .../states/SplitScreenSelectState.java | 8 ++- .../android/quickstep/TaskOverlayFactory.java | 12 ++++ .../util/SplitSelectStateController.java | 30 ++++++---- .../quickstep/views/LauncherRecentsView.java | 4 +- .../quickstep/views/OverviewActionsView.java | 15 +++++ .../android/quickstep/views/RecentsView.java | 30 ++++++---- .../com/android/quickstep/views/TaskView.java | 2 +- .../touch/LandscapePagedViewHandler.java | 31 +++++++--- .../touch/PagedOrientationHandler.java | 12 ++-- .../touch/PortraitPagedViewHandler.java | 58 +++++++++++++++---- 12 files changed, 169 insertions(+), 52 deletions(-) diff --git a/quickstep/res/layout/overview_actions_container.xml b/quickstep/res/layout/overview_actions_container.xml index 0c2a28cc75..acbb5b9234 100644 --- a/quickstep/res/layout/overview_actions_container.xml +++ b/quickstep/res/layout/overview_actions_container.xml @@ -46,6 +46,23 @@ android:layout_height="1dp" android:layout_weight="1" /> +