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
This commit is contained in:
Tracy Zhou
2024-08-06 13:23:27 -07:00
parent 7a247fb2ac
commit 26a3dc8d5c
@@ -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();