From 020aa38488ccb6bbc6491bc9f1c2765a73837d21 Mon Sep 17 00:00:00 2001 From: Mady Mellor Date: Wed, 16 Mar 2022 01:40:09 +0000 Subject: [PATCH] Fix bubbles IME alignment on tablet There was a mistake in the math here, instead of using the y location of the top of the IME, it was just using the height of the IME in the calculation. This caused the bubbles to move out of the way of the IME in tablet portrait when they didn't actually have to move. This also impacted tablet landscape causing the bubbles to NOT move out of the way of the IME when they should. Test: manual - have bubbles on tablet in portrait and have the IME show, bubbles should only move if the IME would overlap with them. - have 5 bubbles on tablet in landscape and have the IME show, bubbles should move above the IME as much as they can without going past the top of the expanded view. Bug: 223912157 Bug: 215063840 Change-Id: Ifd763caef6c521b1083757cade2898b1361198cd --- .../com/android/wm/shell/bubbles/BubbleExpandedView.java | 1 + .../src/com/android/wm/shell/bubbles/BubblePositioner.java | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java index da8308ee7bab3..10ff2fb31b0d2 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java @@ -692,6 +692,7 @@ public class BubbleExpandedView extends LinearLayout { * @param bubblePosition the x position of the bubble if showing on top, the y position of * the bubble if showing vertically. * @param onLeft whether the stack was on the left side of the screen when expanded. + * @param animate whether the pointer should animate to this position. */ public void setPointerPosition(float bubblePosition, boolean onLeft, boolean animate) { // Pointer gets drawn in the padding diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubblePositioner.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubblePositioner.java index 8a120b94f96d2..97e5ee3a35d36 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubblePositioner.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubblePositioner.java @@ -579,11 +579,10 @@ public class BubblePositioner { // Showing vertically: might need to translate the bubbles above the IME. // Subtract spacing here to provide a margin between top of IME and bottom of bubble row. - final float bottomInset = getImeHeight() + mInsets.bottom - (mSpacingBetweenBubbles * 2); + final float bottomHeight = getImeHeight() + mInsets.bottom - (mSpacingBetweenBubbles * 2); + final float bottomInset = mScreenRect.bottom - bottomHeight; final float expandedStackSize = getExpandedStackSize(numberOfBubbles); - final float centerPosition = showBubblesVertically() - ? mPositionRect.centerY() - : mPositionRect.centerX(); + final float centerPosition = mPositionRect.centerY(); final float rowBottom = centerPosition + (expandedStackSize / 2f); final float rowTop = centerPosition - (expandedStackSize / 2f); float rowTopForIme = rowTop;