From acf37d29dbe009758fb1443eb1b583b462489833 Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Tue, 20 Feb 2024 16:38:34 +0000 Subject: [PATCH] In 3-button landscape/seascape, override nav insets to always present - In 3-button landscape/seascape, Launcher should always have nav insets regardless if it's initiated from fullscreen apps - This avoid inset to change mid-way during app->overview transition via recents button - This bug doesn't happen in portrait because bottomNav is always overriden in WindowManagerProxy, we're now applying the same fix in landscape/seascape Test: Recents button from fullscreen app in 3-button landscape/seascape, and launch adjacent fullscreen app in Overview Test: Homescreen and widget picker in 3-button landscape/seascape Fix: 316085856 Flag: None Change-Id: Ia4ae7948fe794b71c49f89c43dd2d1d14031abb9 --- .../launcher3/util/window/WindowManagerProxy.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/com/android/launcher3/util/window/WindowManagerProxy.java b/src/com/android/launcher3/util/window/WindowManagerProxy.java index 6a0090c60b..4a906d33e1 100644 --- a/src/com/android/launcher3/util/window/WindowManagerProxy.java +++ b/src/com/android/launcher3/util/window/WindowManagerProxy.java @@ -145,7 +145,18 @@ public class WindowManagerProxy implements ResourceBasedOverride { : (isGesture ? getDimenByName(systemRes, NAVBAR_HEIGHT_LANDSCAPE) : 0)); - Insets newNavInsets = Insets.of(navInsets.left, navInsets.top, navInsets.right, bottomNav); + int leftNav = navInsets.left; + int rightNav = navInsets.right; + if (!isLargeScreen && !isGesture && !isPortrait) { + // In 3-button landscape/seascape, Launcher should always have nav insets regardless if + // it's initiated from fullscreen apps. + int navBarWidth = getDimenByName(systemRes, NAVBAR_LANDSCAPE_LEFT_RIGHT_SIZE); + switch (getRotation(context)) { + case Surface.ROTATION_90 -> rightNav = navBarWidth; + case Surface.ROTATION_270 -> leftNav = navBarWidth; + } + } + Insets newNavInsets = Insets.of(leftNav, navInsets.top, rightNav, bottomNav); insetsBuilder.setInsets(WindowInsets.Type.navigationBars(), newNavInsets); insetsBuilder.setInsetsIgnoringVisibility(WindowInsets.Type.navigationBars(), newNavInsets);