From 4c98374d99a78bf6f0524cbf51d2e332065391f6 Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Fri, 10 Dec 2021 13:09:53 +0000 Subject: [PATCH] DeviceProfile.overviewRowSpacing should exclude extra top margin on grid tasks Bug: 207350366 Bug: 210158657 Test: manual Change-Id: I28116407c4267259a75fd39637104cea9db73fe3 --- .../src/com/android/quickstep/TaplTestsQuickstep.java | 4 +++- src/com/android/launcher3/DeviceProfile.java | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java index 7c503be4a1..237e426fb6 100644 --- a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java +++ b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java @@ -37,6 +37,7 @@ import com.android.launcher3.tapl.LauncherInstrumentation.NavigationModel; import com.android.launcher3.tapl.Overview; import com.android.launcher3.tapl.OverviewActions; import com.android.launcher3.tapl.OverviewTask; +import com.android.launcher3.tapl.TestHelpers; import com.android.launcher3.ui.TaplTestsLauncher3; import com.android.launcher3.util.rule.ScreenRecordRule.ScreenRecord; import com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch; @@ -321,7 +322,8 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest { @Test @PortraitLandscape public void testOverviewForTablet() throws Exception { - if (!mLauncher.isTablet()) { + // TODO(b/210158657): Re-enable for OOP + if (!mLauncher.isTablet() || !TestHelpers.isInLauncherProcess()) { return; } for (int i = 2; i <= 14; i++) { diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index 6a399ac50f..d2b9dfe0e5 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -394,7 +394,13 @@ public class DeviceProfile { } overviewActionsMarginThreeButtonPx = res.getDimensionPixelSize( R.dimen.overview_actions_margin_three_button); - overviewRowSpacing = res.getDimensionPixelSize(R.dimen.overview_grid_row_spacing); + // Grid task's top margin is only overviewTaskIconSizePx + overviewTaskMarginGridPx, but + // overviewTaskThumbnailTopMarginPx is applied to all TaskThumbnailView, so exclude the + // extra margin when calculating row spacing. + int extraTopMargin = overviewTaskThumbnailTopMarginPx - overviewTaskIconSizePx + - overviewTaskMarginGridPx; + overviewRowSpacing = res.getDimensionPixelSize(R.dimen.overview_grid_row_spacing) + - extraTopMargin; overviewGridSideMargin = isLandscape ? res.getDimensionPixelSize(R.dimen.overview_grid_side_margin_landscape) : res.getDimensionPixelSize(R.dimen.overview_grid_side_margin_portrait);