From f2161dd8c3a805c4b002febe8e95ee4a6efe35a7 Mon Sep 17 00:00:00 2001 From: Liran Binyamin Date: Thu, 5 Dec 2024 14:35:09 -0500 Subject: [PATCH] Fix cropped bubble flyout when animating in app When animating the bubble bar in an app with a stashed handle, the flyout might not be displayed entirely. Fix the calculation of the amount of space needed to fully display the bubble bar and flyout views. Flag: com.android.wm.shell.enable_bubble_bar Fixes: 382513856 Test: manual - remove all bubbles - launch app - send a bubble with a 2-line message - observe flyout is fully visible Change-Id: I7953cb7f619f2c00b04bb4cb08c57a8195ff79fe --- .../bubbles/BubbleBarViewController.java | 20 +++++++++++++------ .../flyout/BubbleBarFlyoutController.kt | 2 -- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java index 67d7901cd3..590a553297 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java @@ -580,15 +580,23 @@ public class BubbleBarViewController { /** Returns maximum height of the bubble bar with the flyout view. */ public int getBubbleBarWithFlyoutMaximumHeight() { - if (!isBubbleBarVisible()) return 0; + if (!isBubbleBarVisible() && !isAnimatingNewBubble()) return 0; int bubbleBarTopOnHome = (int) (mBubbleStashController.getBubbleBarVerticalCenterForHome() - + mBarView.getBubbleBarCollapsedHeight() / 2); - int result = (int) (bubbleBarTopOnHome + mBarView.getArrowHeight()); + + mBarView.getBubbleBarCollapsedHeight() / 2 + mBarView.getArrowHeight()); if (isAnimatingNewBubble()) { - // when animating new bubble add the maximum height of the flyout view - result += mBubbleBarFlyoutController.getMaximumFlyoutHeight(); + if (mTaskbarStashController.isInApp() && mBubbleStashController.getHasHandleView()) { + // when animating a bubble in an app, the bubble bar will be higher than its + // position on home + float bubbleBarTopDistanceFromBottom = + -mBubbleStashController.getBubbleBarTranslationYForTaskbar() + + mBarView.getHeight(); + return (int) bubbleBarTopDistanceFromBottom + + mBubbleBarFlyoutController.getMaximumFlyoutHeight(); + } + return bubbleBarTopOnHome + mBubbleBarFlyoutController.getMaximumFlyoutHeight(); + } else { + return bubbleBarTopOnHome; } - return result; } /** diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutController.kt b/quickstep/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutController.kt index 63db01200f..7c718e5b56 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/flyout/BubbleBarFlyoutController.kt @@ -63,8 +63,6 @@ constructor( return rect } - fun getFlyoutMaxHeight(): Int = BubbleBarFlyoutView.getMaximumViewHeight(container.context) - fun setUpAndShowFlyout(message: BubbleBarFlyoutMessage, onInit: () -> Unit, onEnd: () -> Unit) { flyout?.let(container::removeView) val flyout = BubbleBarFlyoutView(container.context, positioner, flyoutScheduler)