From 7be4c6166b3cd34d1d64cd474f3f5ed52e841968 Mon Sep 17 00:00:00 2001 From: Joshua Tsuji Date: Wed, 4 Mar 2020 14:58:14 -0500 Subject: [PATCH 1/2] Fix inability to return to selected bubble after opening overflow. Test: Expand the stack, tap overflow, tap the previously selected bubble, observe that it expands the previous bubble instead of doing nothing. Fixes: 150791968 Change-Id: Ibe43fd744b818744182f6f70d7126daab02bd185 --- .../android/systemui/bubbles/BubbleStackView.java | 12 ++++++++++++ .../android/systemui/bubbles/BubbleTouchHandler.java | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java index aedd2db738ee0..10b90f28d893a 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java @@ -1421,6 +1421,18 @@ public class BubbleStackView extends FrameLayout { hideDismissTarget(); } + /** Expands the clicked bubble. */ + public void expandBubble(Bubble bubble) { + if (bubble.equals(mBubbleData.getSelectedBubble())) { + // If the bubble we're supposed to expand is the selected bubble, that means the + // overflow bubble is currently expanded. Don't tell BubbleData to set this bubble as + // selected, since it already is. Just call the stack's setSelectedBubble to expand it. + setSelectedBubble(bubble); + } else { + mBubbleData.setSelectedBubble(bubble); + } + } + void onDragStart() { if (DEBUG_BUBBLE_STACK_VIEW) { Log.d(TAG, "onDragStart()"); diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleTouchHandler.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleTouchHandler.java index 0c5bef4d2bded..132c45fab3d2f 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleTouchHandler.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleTouchHandler.java @@ -189,7 +189,7 @@ class BubbleTouchHandler implements View.OnTouchListener { if (key == BubbleOverflow.KEY) { mStack.showOverflow(); } else { - mBubbleData.setSelectedBubble(mBubbleData.getBubbleWithKey(key)); + mStack.expandBubble(mBubbleData.getBubbleWithKey(key)); } } resetForNextGesture(); From bc7744b9951fe1b35031dbabe5cff349545b56b8 Mon Sep 17 00:00:00 2001 From: Joshua Tsuji Date: Wed, 4 Mar 2020 15:04:59 -0500 Subject: [PATCH 2/2] Don't allow the overflow bubble to be dragged out. Test: Try and fail to drag out the overflow bubble. Also quick-fling it towards where the dismiss target would be and observe that sysui doesn't crash. Fixes: 149870727 Change-Id: I23fdfa3a9b0e1b3722704bfc28d5ef42c3bf66c4 --- .../com/android/systemui/bubbles/BubbleStackView.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java index 10b90f28d893a..0b7dbd2bfa2e4 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java @@ -1386,6 +1386,11 @@ public class BubbleStackView extends FrameLayout { if (DEBUG_BUBBLE_STACK_VIEW) { Log.d(TAG, "onBubbleDragStart: bubble=" + bubble); } + + if (bubble.equals(mBubbleOverflow.getIconView())) { + return; + } + mExpandedAnimationController.prepareForBubbleDrag(bubble, mMagneticTarget); // We're dragging an individual bubble, so set the magnetized object to the magnetized @@ -1398,7 +1403,7 @@ public class BubbleStackView extends FrameLayout { /** Called with the coordinates to which an individual bubble has been dragged. */ public void onBubbleDragged(View bubble, float x, float y) { - if (!mIsExpanded || mIsExpansionAnimating) { + if (!mIsExpanded || mIsExpansionAnimating || bubble.equals(mBubbleOverflow.getIconView())) { return; } @@ -1413,7 +1418,7 @@ public class BubbleStackView extends FrameLayout { Log.d(TAG, "onBubbleDragFinish: bubble=" + bubble); } - if (!mIsExpanded || mIsExpansionAnimating) { + if (!mIsExpanded || mIsExpansionAnimating || bubble.equals(mBubbleOverflow.getIconView())) { return; }