Updated bubble bar position to be center aligned with the hotseat

Added a method to the device profile to calculate the vertical center of
the hotseat icons. Simplified the logic for positioning the bubble bar.

Test: TransientBubbleStashControllerTest
Test: PersistentBubbleStashControllerTest
Test: Visual. Go to home page, check that bubble bar is vertically
center aligned with the hotseat
Bug: 345491493
Flag: com.android.wm.shell.enable_bubble_bar

Change-Id: I52f1b94de79f6c912f43a88fcc5c884e20e56310
This commit is contained in:
mpodolian
2024-10-15 17:14:06 -07:00
parent bea43b0c03
commit f230eee2ff
9 changed files with 46 additions and 35 deletions
@@ -297,6 +297,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
BubbleStashController bubbleStashController = isTransientTaskbar
? new TransientBubbleStashController(dimensionsProvider, this)
: new PersistentBubbleStashController(dimensionsProvider);
bubbleStashController.setHotseatVerticalCenter(launcherDp.getHotseatVerticalCenter());
bubbleControllersOptional = Optional.of(new BubbleControllers(
new BubbleBarController(this, bubbleBarView),
new BubbleBarViewController(this, bubbleBarView, bubbleBarContainer),
@@ -362,8 +363,11 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
/** Updates {@link DeviceProfile} instances for any Taskbar windows. */
public void updateDeviceProfile(DeviceProfile launcherDp) {
applyDeviceProfile(launcherDp);
mControllers.taskbarOverlayController.updateLauncherDeviceProfile(launcherDp);
mControllers.bubbleControllers.ifPresent(bubbleControllers -> {
int hotseatVertCenter = launcherDp.getHotseatVerticalCenter();
bubbleControllers.bubbleStashController.setHotseatVerticalCenter(hotseatVertCenter);
});
AbstractFloatingView.closeAllOpenViewsExcept(this, false, TYPE_REBIND_SAFE);
// Reapply fullscreen to take potential new screen size into account.
setTaskbarWindowFullscreen(mIsFullscreen);