summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
author Sebastian Franco <fransebas@google.com> 2025-03-05 14:50:21 -0800
committer Sebastian Franco <fransebas@google.com> 2025-03-11 14:27:52 -0700
commitad047c74b324966bd44cd7007deecf306b2061bd (patch)
treedc8b0c1fc3d7a47516ac0392d4cca62e3d632d07 /src
parentcccec098e87a252567eeaed268f6e50acf91556c (diff)
Add padding in Fixed Landscape on the side oposite of the camera hole
Fix: 380031237 Test: HomeScreenImageTest Flag: com.android.launcher3.one_grid_specs Change-Id: Ie7557767f629f0c7a5b7b62a3039c8a5c3cc7f43
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/DeviceProfile.java42
1 files changed, 31 insertions, 11 deletions
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index c85ca49c43..be8d30b069 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -30,8 +30,8 @@ import static com.android.launcher3.testing.shared.ResourceUtils.INVALID_RESOURC
import static com.android.launcher3.testing.shared.ResourceUtils.pxFromDp;
import static com.android.launcher3.testing.shared.ResourceUtils.roundPxValueFromFloat;
import static com.android.wm.shell.Flags.enableBubbleBar;
-import static com.android.wm.shell.Flags.enableTinyTaskbar;
import static com.android.wm.shell.Flags.enableBubbleBarOnPhones;
+import static com.android.wm.shell.Flags.enableTinyTaskbar;
import android.annotation.SuppressLint;
import android.content.Context;
@@ -1830,10 +1830,17 @@ public class DeviceProfile {
workspacePageIndicatorHeight - mWorkspacePageIndicatorOverlapWorkspace;
}
int paddingTop = workspaceTopPadding + (mIsScalableGrid ? 0 : edgeMarginPx);
- // On isFixedLandscapeMode on phones we already have padding because of the camera hole
- int paddingSide = inv.isFixedLandscape ? 0 : desiredWorkspaceHorizontalMarginPx;
+ int paddingLeft = desiredWorkspaceHorizontalMarginPx;
+ int paddingRight = desiredWorkspaceHorizontalMarginPx;
- padding.set(paddingSide, paddingTop, paddingSide, paddingBottom);
+ // In fixed Landscape we don't need padding on the side next to the cutout because
+ // the cutout is already adding padding to all of Launcher, we only need on the other
+ // side
+ if (inv.isFixedLandscape) {
+ paddingLeft = isSeascape() ? desiredWorkspaceHorizontalMarginPx : 0;
+ paddingRight = isSeascape() ? 0 : desiredWorkspaceHorizontalMarginPx;
+ }
+ padding.set(paddingLeft, paddingTop, paddingRight, paddingBottom);
}
insetPadding(workspacePadding, cellLayoutPaddingPx);
}
@@ -1931,7 +1938,24 @@ public class DeviceProfile {
hotseatBarPadding.set(mHotseatBarWorkspaceSpacePx, paddingTop,
mInsets.right + mHotseatBarEdgePaddingPx, paddingBottom);
}
- } else if (isTaskbarPresent || inv.isFixedLandscape) {
+ } else if (inv.isFixedLandscape) {
+ // Center the QSB vertically with hotseat
+ int hotseatBarBottomPadding = getHotseatBarBottomPadding();
+ int hotseatPlusQSBWidth = getHotseatRequiredWidth();
+ int qsbWidth = getAdditionalQsbSpace();
+ int availableWidthPxForHotseat = availableWidthPx - Math.abs(workspacePadding.width())
+ - Math.abs(cellLayoutPaddingPx.width());
+ int remainingSpaceOnSide = (availableWidthPxForHotseat - hotseatPlusQSBWidth) / 2;
+
+ hotseatBarPadding.set(
+ (remainingSpaceOnSide + qsbWidth) + mInsets.left + workspacePadding.left
+ + cellLayoutPaddingPx.left,
+ hotseatBarSizePx - hotseatBarBottomPadding - hotseatCellHeightPx,
+ remainingSpaceOnSide + mInsets.right + workspacePadding.right
+ + cellLayoutPaddingPx.right,
+ hotseatBarBottomPadding
+ );
+ } else if (isTaskbarPresent) {
// Center the QSB vertically with hotseat
int hotseatBarBottomPadding = getHotseatBarBottomPadding();
int hotseatBarTopPadding =
@@ -1950,11 +1974,6 @@ public class DeviceProfile {
}
startSpacing += getAdditionalQsbSpace();
- if (inv.isFixedLandscape) {
- endSpacing += mInsets.right;
- startSpacing += mInsets.left;
- }
-
hotseatBarPadding.top = hotseatBarTopPadding;
hotseatBarPadding.bottom = hotseatBarBottomPadding;
boolean isRtl = Utilities.isRtl(context.getResources());
@@ -2164,7 +2183,8 @@ public class DeviceProfile {
}
public boolean isSeascape() {
- return rotationHint == Surface.ROTATION_270 && isVerticalBarLayout();
+ return rotationHint == Surface.ROTATION_270
+ && (isVerticalBarLayout() || inv.isFixedLandscape);
}
public boolean shouldFadeAdjacentWorkspaceScreens() {