From bccc4c2cac7a5d195f277e4687ac359c445a50b8 Mon Sep 17 00:00:00 2001 From: Sergey Serokurov Date: Fri, 10 Jun 2022 17:30:51 -0700 Subject: [PATCH] Do not update pointer postion when stack is going to collapse Bug: 232293580 Test: atest SystemUITests Test: video at https://drive.google.com/file/d/1Yjs7AzTeI_Zp764CPF9d6e7zI-XRvYX4/view?usp=sharing Change-Id: I3131a8f32e088573e8e4e8401b6cc279e73bef87 --- .../com/android/wm/shell/bubbles/BubbleController.java | 8 ++++++-- .../src/com/android/wm/shell/bubbles/BubbleStackView.java | 7 +++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java index ea3712ba34b47..a2c40550b5834 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java @@ -1350,14 +1350,18 @@ public class BubbleController { mStackView.setBubbleSuppressed(update.unsuppressedBubble, false); } + boolean collapseStack = update.expandedChanged && !update.expanded; + // At this point, the correct bubbles are inflated in the stack. // Make sure the order in bubble data is reflected in bubble row. if (update.orderChanged && mStackView != null) { mDataRepository.addBubbles(mCurrentUserId, update.bubbles); - mStackView.updateBubbleOrder(update.bubbles); + // if the stack is going to be collapsed, do not update pointer position + // after reordering + mStackView.updateBubbleOrder(update.bubbles, !collapseStack); } - if (update.expandedChanged && !update.expanded) { + if (collapseStack) { mStackView.setExpanded(false); mSysuiProxy.requestNotificationShadeTopUi(false, TAG); } 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 492bff99dd2f0..be94059cc2eee 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 @@ -1796,7 +1796,7 @@ public class BubbleStackView extends FrameLayout /** * Update bubble order and pointer position. */ - public void updateBubbleOrder(List bubbles) { + public void updateBubbleOrder(List bubbles, boolean updatePointerPositoion) { final Runnable reorder = () -> { for (int i = 0; i < bubbles.size(); i++) { Bubble bubble = bubbles.get(i); @@ -1812,7 +1812,10 @@ public class BubbleStackView extends FrameLayout .map(b -> b.getIconView()).collect(Collectors.toList()); mStackAnimationController.animateReorder(bubbleViews, reorder); } - updatePointerPosition(false /* forIme */); + + if (updatePointerPositoion) { + updatePointerPosition(false /* forIme */); + } } /**