From de28c115b22c3c8f4083c715ee1ca40ed9af95b1 Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Tue, 3 Oct 2023 13:57:37 -0700 Subject: [PATCH] Fix phone mode task bar inset values not correctly initialized We rely on contentHeightToReportToApps and tappableHeightToReportToApps (that ultimately call into DeviceProfile) of TaskbarStashController to initialize the insets. However, DeviceProfile only initializes those values when isTaskbarPresent is true. Rather than completely changing the initialization of DeviceProfile, we special case in TaskbarStashController that uses the bar height for inset Bug: 274517647 Test: turn on FLAG_HIDE_NAVBAR_WINDOW and TASKBAR_NO_RECREATION, make sure the insets are correct in both 3 button and gesture nav mode Change-Id: I164a6e2c9f9d24888155b45325ee8ce46ca2c39f --- .../launcher3/taskbar/StashedHandleViewController.java | 4 +--- .../launcher3/taskbar/TaskbarStashController.java | 10 ++++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java b/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java index afefe42fad..c4255bf70f 100644 --- a/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/StashedHandleViewController.java @@ -107,17 +107,14 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT mControllers = controllers; DeviceProfile deviceProfile = mActivity.getDeviceProfile(); Resources resources = mActivity.getResources(); - final int stashedTaskbarHeight; if (isPhoneGestureNavMode(mActivity.getDeviceProfile())) { mTaskbarSize = resources.getDimensionPixelSize(R.dimen.taskbar_size); mStashedHandleWidth = resources.getDimensionPixelSize(R.dimen.taskbar_stashed_small_screen); - stashedTaskbarHeight = resources.getDimensionPixelSize(R.dimen.taskbar_stashed_size); } else { mTaskbarSize = deviceProfile.taskbarHeight; mStashedHandleWidth = resources .getDimensionPixelSize(R.dimen.taskbar_stashed_handle_width); - stashedTaskbarHeight = mControllers.taskbarStashController.getStashedHeight(); } int taskbarBottomMargin = deviceProfile.taskbarBottomMargin; mStashedHandleView.getLayoutParams().height = mTaskbarSize + taskbarBottomMargin; @@ -126,6 +123,7 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT isPhoneGestureNavMode(deviceProfile) ? 1 : 0); mTaskbarStashedHandleHintScale.updateValue(1f); + final int stashedTaskbarHeight = mControllers.taskbarStashController.getStashedHeight(); mStashedHandleView.setOutlineProvider(new ViewOutlineProvider() { @Override public void getOutline(View view, Outline outline) { diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java index f2b60b952a..e67a6d5a67 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java @@ -278,8 +278,14 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba mSystemUiProxy = SystemUiProxy.INSTANCE.get(activity); mAccessibilityManager = mActivity.getSystemService(AccessibilityManager.class); - mUnstashedHeight = mActivity.getDeviceProfile().taskbarHeight; - mStashedHeight = mActivity.getDeviceProfile().stashedTaskbarHeight; + if (isPhoneMode()) { + mUnstashedHeight = mActivity.getResources().getDimensionPixelSize(R.dimen.taskbar_size); + mStashedHeight = mActivity.getResources().getDimensionPixelSize( + R.dimen.taskbar_stashed_size); + } else { + mUnstashedHeight = mActivity.getDeviceProfile().taskbarHeight; + mStashedHeight = mActivity.getDeviceProfile().stashedTaskbarHeight; + } } /**