From b79e1742bdada4aa63f4df832955a0b369168b9a Mon Sep 17 00:00:00 2001 From: mpodolian Date: Tue, 17 Sep 2024 18:05:37 -0700 Subject: [PATCH] Fixed the navigation bar placement on device restart. Moved logic that adjusts the hotseat position from the constructor of the NavbarButtonsViewController to onTaskbarLayoutChange() method that is called from the TaskbarViewController TaskbarView layout change listener. Test: Manual: Moved the bubble bar to the default right position. Rebooted the device. Navigation bar was placed on the left side of the screen. Flag: com.android.wm.shell.enable_bubble_bar_in_persistent_task_bar Bug: 367829539 Change-Id: Ife0c48a72b318d6051b7b09bde13818546e65d98 --- .../taskbar/NavbarButtonsViewController.java | 16 ++++++++++------ .../launcher3/taskbar/TaskbarViewController.java | 10 ++++++---- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java index e9bd30ace9..2ac579361e 100644 --- a/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/NavbarButtonsViewController.java @@ -400,12 +400,6 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT } }; mSeparateWindowParent.recreateControllers(); - if (com.android.wm.shell.Flags.enableBubbleBarInPersistentTaskBar() - && mControllers.bubbleControllers.isPresent()) { - BubbleBarLocation bubblesLocation = mControllers.bubbleControllers.get() - .bubbleBarViewController.getBubbleBarLocation(); - onBubbleBarLocationUpdated(bubblesLocation); - } } private void initButtons(ViewGroup navContainer, ViewGroup endContainer, @@ -1223,6 +1217,16 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT return (int) navBarTargetStartX - mNavButtonContainer.getLeft(); } + /** Adjusts the navigation buttons layout position according to the bubble bar location. */ + public void onTaskbarLayoutChange() { + if (com.android.wm.shell.Flags.enableBubbleBarInPersistentTaskBar() + && mControllers.bubbleControllers.isPresent()) { + BubbleBarLocation bubblesLocation = mControllers.bubbleControllers.get() + .bubbleBarViewController.getBubbleBarLocation(); + onBubbleBarLocationUpdated(bubblesLocation); + } + } + private class RotationButtonListener implements RotationButton.RotationButtonUpdatesCallback { @Override public void onVisibilityChanged(boolean isVisible) { diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java index b663ccb44e..0a67ac2f1d 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java @@ -140,10 +140,6 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar private final AnimatedFloat mTaskbarIconTranslationYForPinning = new AnimatedFloat( this::updateTranslationY); - private final View.OnLayoutChangeListener mTaskbarViewLayoutChangeListener = - (v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) - -> updateTaskbarIconTranslationXForPinning(); - private AnimatedFloat mTaskbarNavButtonTranslationY; private AnimatedFloat mTaskbarNavButtonTranslationYForInAppDisplay; @@ -158,6 +154,12 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar // Initialized in init. private TaskbarControllers mControllers; + private final View.OnLayoutChangeListener mTaskbarViewLayoutChangeListener = + (v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> { + updateTaskbarIconTranslationXForPinning(); + mControllers.navbarButtonsViewController.onTaskbarLayoutChange(); + }; + // Animation to align icons with Launcher, created lazily. This allows the controller to be // active only during the animation and does not need to worry about layout changes. private AnimatorPlaybackController mIconAlignControllerLazy = null;