Update placement of the nav bar in persistent taskbar for 3 button nav

Implemented nav bar placement update to be located opposite to the
bubble bar.
When bubble bar is moved to the other side of the bar, 3 button nav will
swap sides (without animation).
If taskbar has to be repositioned it does that with the animation.

Test: TaskbarViewControllerTest
Bug: 346381754
Flag: com.android.wm.shell.enable_bubble_bar
Change-Id: Id031706183c60cbd9c67537b01530acb43bae614
This commit is contained in:
mpodolian
2024-08-30 17:34:23 -07:00
parent 9074e19dad
commit 04088ebef7
11 changed files with 288 additions and 34 deletions
@@ -118,6 +118,7 @@ public class BubbleBarController extends IBubblesListener.Stub {
private Optional<BubbleStashedHandleViewController> mBubbleStashedHandleViewController;
private BubblePinController mBubblePinController;
private BubbleCreator mBubbleCreator;
private BubbleBarLocationListener mBubbleBarLocationListener;
// Cache last sent top coordinate to avoid sending duplicate updates to shell
private int mLastSentBubbleBarTop;
@@ -176,6 +177,7 @@ public class BubbleBarController extends IBubblesListener.Stub {
/** Initializes controllers. */
public void init(BubbleControllers bubbleControllers,
BubbleBarLocationListener bubbleBarLocationListener,
ImeVisibilityChecker imeVisibilityChecker) {
mImeVisibilityChecker = imeVisibilityChecker;
mBubbleBarViewController = bubbleControllers.bubbleBarViewController;
@@ -183,6 +185,7 @@ public class BubbleBarController extends IBubblesListener.Stub {
mBubbleStashedHandleViewController = bubbleControllers.bubbleStashedHandleViewController;
mBubblePinController = bubbleControllers.bubblePinController;
mBubbleCreator = bubbleControllers.bubbleCreator;
mBubbleBarLocationListener = bubbleBarLocationListener;
bubbleControllers.runAfterInit(() -> {
mBubbleBarViewController.setHiddenForBubbles(
@@ -488,12 +491,16 @@ public class BubbleBarController extends IBubblesListener.Stub {
private void updateBubbleBarLocationInternal(BubbleBarLocation location) {
mBubbleBarViewController.setBubbleBarLocation(location);
mBubbleStashController.setBubbleBarLocation(location);
mBubbleBarLocationListener.onBubbleBarLocationUpdated(location);
}
@Override
public void animateBubbleBarLocation(BubbleBarLocation bubbleBarLocation) {
MAIN_EXECUTOR.execute(
() -> mBubbleBarViewController.animateBubbleBarLocation(bubbleBarLocation));
() -> {
mBubbleBarViewController.animateBubbleBarLocation(bubbleBarLocation);
mBubbleBarLocationListener.onBubbleBarLocationAnimated(bubbleBarLocation);
});
}
/** Notifies WMShell to show the expanded view. */
@@ -518,4 +525,14 @@ public class BubbleBarController extends IBubblesListener.Stub {
/** Whether the IME is visible. */
boolean isImeVisible();
}
/** Listener of {@link BubbleBarLocation} updates. */
public interface BubbleBarLocationListener {
/** Called when {@link BubbleBarLocation} is animated, but change is not yet final. */
void onBubbleBarLocationAnimated(BubbleBarLocation location);
/** Called when {@link BubbleBarLocation} is updated permanently. */
void onBubbleBarLocationUpdated(BubbleBarLocation location);
}
}