diff options
| author | 2023-10-26 12:59:15 -0400 | |
|---|---|---|
| committer | 2023-10-26 13:09:26 -0400 | |
| commit | 70b67510c9edd013a0a0b53a032090fa2cce0e8b (patch) | |
| tree | 0fa3bdb268a79ff910b303d984096d9d85348d55 | |
| parent | 72c6685cda6c64e89f3b8251e706364a119bb291 (diff) | |
Fix jank when rotating an expanded bubble
Previously we were removing all views and re-expanding the bubble after orientation changes.
That behavior also made the TaskView invisible and then visible again which triggered a SEND_TO_BACK followed by a
SEND_TO_FRONT shell transitions which caused flickering and noticeable latency before the task reappears.
This CL updates the positions and dimensions of the views without removing and readding them.
Demo: http://recall/-/bJtug1HhvXkkeA4MQvIaiP/dmFu9ca6zLPrWah7VZjmT0
Fixes: 280350168
Test: Manual
- Add bubbles
- Expand the stack
- Rotate
- Observe no jank
Change-Id: Ia3bcb4541928073dc5faae7de1088812b0c95974
| -rw-r--r-- | libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java | 4 | ||||
| -rw-r--r-- | libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java | 17 |
2 files changed, 12 insertions, 9 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 37bcf1ddeac5..0568edaa7ab6 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 @@ -949,7 +949,9 @@ public class BubbleExpandedView extends LinearLayout { if (mTaskView != null && mTaskView.getVisibility() == VISIBLE && mTaskView.isAttachedToWindow()) { - mTaskView.onLocationChanged(); + // post this to the looper, because if the device orientation just changed, we need to + // let the current shell transition complete before updating the task view bounds. + post(() -> mTaskView.onLocationChanged()); } if (mIsOverflow) { // post this to the looper so that the view has a chance to be laid out before it can diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java index ac5ba51ec139..f857ed724790 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java @@ -1010,15 +1010,15 @@ public class BubbleStackView extends FrameLayout } if (mIsExpanded) { - // Re-draw bubble row and pointer for new orientation. - beforeExpandedViewAnimation(); + // update the expanded view and pointer location for the new orientation. + hideFlyoutImmediate(); + mExpandedViewContainer.setAlpha(0f); + updateExpandedView(); updateOverflowVisibility(); - updatePointerPosition(false /* forIme */); - mExpandedAnimationController.expandFromStack(() -> { - afterExpandedViewAnimation(); - mExpandedViewContainer.setVisibility(VISIBLE); - showManageMenu(mShowingManage); - } /* after */); + updatePointerPosition(false); + requestUpdate(); + showManageMenu(mShowingManage); + PointF p = mPositioner.getExpandedBubbleXY(getBubbleIndex(mExpandedBubble), getState()); final float translationY = mPositioner.getExpandedViewY(mExpandedBubble, @@ -1027,6 +1027,7 @@ public class BubbleStackView extends FrameLayout mExpandedViewContainer.setTranslationY(translationY); mExpandedViewContainer.setAlpha(1f); } + removeOnLayoutChangeListener(mOrientationChangedListener); }; final float maxDismissSize = getResources().getDimensionPixelSize( |