From 26a3dc8d5c2197e471bbb3087fc9a8ff2751530a Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Tue, 6 Aug 2024 13:23:27 -0700 Subject: [PATCH] Set navbuttons_view width instead of height in landscape mode Launcher tests fail in the first run in landscape mode. Somehow this is not reproducible locally or can be seen in production. After digging into hierarchy traces, found that the height of the nav buttons view (in landscape mode) is set to the task bar size (48). Then found where we had this logic historically and adjusted to width in phone landscape mode. Fixes: 356156690 Test: https://android-build.corp.google.com/builds/abtd/run/L40800030005694733 Flag: com.android.wm.shell.enable_taskbar_on_phones Change-Id: I170fe45375a63a2e1d2e63b1d680efb45ae0752e --- .../taskbar/NavbarButtonsViewController.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java index ea2adcf08b..7338485d5c 100644 --- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java @@ -264,11 +264,19 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT boolean isThreeButtonNav = mContext.isThreeButtonNav(); DeviceProfile deviceProfile = mContext.getDeviceProfile(); Resources resources = mContext.getResources(); - Point p = !mContext.isUserSetupComplete() - ? new Point(0, mControllers.taskbarActivityContext.getSetupWindowSize()) - : DimensionUtils.getTaskbarPhoneDimensions(deviceProfile, resources, - mContext.isPhoneMode()); - mNavButtonsView.getLayoutParams().height = p.y; + + int setupSize = mControllers.taskbarActivityContext.getSetupWindowSize(); + Point p = DimensionUtils.getTaskbarPhoneDimensions(deviceProfile, resources, + mContext.isPhoneMode()); + ViewGroup.LayoutParams navButtonsViewLayoutParams = mNavButtonsView.getLayoutParams(); + navButtonsViewLayoutParams.width = p.x; + if (!mContext.isUserSetupComplete()) { + // Setup mode in phone mode uses gesture nav. + navButtonsViewLayoutParams.height = setupSize; + } else { + navButtonsViewLayoutParams.height = p.y; + } + mNavButtonsView.setLayoutParams(navButtonsViewLayoutParams); mIsImeRenderingNavButtons = InputMethodService.canImeRenderGesturalNavButtons() && mContext.imeDrawsImeNavBar();