From a51ee6a4dc692da660035f25a4e96229d714153f Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Tue, 13 Aug 2024 20:35:13 -0700 Subject: [PATCH] Use isGestureNav signal from TaskbarActivityContext for getTaskbarPhoneDimensions Somehow deviceProfile.isGestureMode doesn't have the right signal for tests. We need to look into why dp doesn't have the right signal for isGestureMode in tests. Temporary fix here to unblock pushing the flag to staging Bug: 359196354 Test: https://android-build.corp.google.com/builds/abtd/run/L05600030005823769 Flag: com.android.wm.shell.enable_taskbar_on_phones Change-Id: Ie6451812cf4b0c3f034cabdfd4cec726322af0bc --- .../launcher3/taskbar/NavbarButtonsViewController.java | 2 +- .../launcher3/taskbar/TaskbarDragLayerController.java | 2 +- src/com/android/launcher3/util/DimensionUtils.kt | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java index 7338485d5c..f61840a55d 100644 --- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java @@ -267,7 +267,7 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT int setupSize = mControllers.taskbarActivityContext.getSetupWindowSize(); Point p = DimensionUtils.getTaskbarPhoneDimensions(deviceProfile, resources, - mContext.isPhoneMode()); + mContext.isPhoneMode(), mContext.isGestureNav()); ViewGroup.LayoutParams navButtonsViewLayoutParams = mNavButtonsView.getLayoutParams(); navButtonsViewLayoutParams.width = p.x; if (!mContext.isUserSetupComplete()) { diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java index ff890fb18e..acf976fe9a 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java @@ -291,7 +291,7 @@ public class TaskbarDragLayerController implements TaskbarControllers.LoggableTa if (mActivity.isPhoneMode()) { Resources resources = mActivity.getResources(); Point taskbarDimensions = DimensionUtils.getTaskbarPhoneDimensions(deviceProfile, - resources, true /* isPhoneMode */); + resources, true /* isPhoneMode */, mActivity.isGestureNav()); return taskbarDimensions.y == -1 ? deviceProfile.getDisplayInfo().currentSize.y : taskbarDimensions.y; diff --git a/src/com/android/launcher3/util/DimensionUtils.kt b/src/com/android/launcher3/util/DimensionUtils.kt index 63e919ad3e..821dda789f 100644 --- a/src/com/android/launcher3/util/DimensionUtils.kt +++ b/src/com/android/launcher3/util/DimensionUtils.kt @@ -31,7 +31,8 @@ object DimensionUtils { fun getTaskbarPhoneDimensions( deviceProfile: DeviceProfile, res: Resources, - isPhoneMode: Boolean + isPhoneMode: Boolean, + isGestureNav: Boolean, ): Point { val p = Point() // Taskbar for large screen @@ -42,7 +43,7 @@ object DimensionUtils { } // Taskbar on phone using gesture nav, it will always be stashed - if (deviceProfile.isGestureMode) { + if (isGestureNav) { p.x = ViewGroup.LayoutParams.MATCH_PARENT p.y = res.getDimensionPixelSize(R.dimen.taskbar_stashed_size) return p