From 0122cc904f59a2246e04f430e57cc444ab7cbb06 Mon Sep 17 00:00:00 2001 From: Mady Mellor Date: Thu, 27 Feb 2020 12:15:39 -0800 Subject: [PATCH] Fix crash when opening bubble overflow BubbleExpandedView needs a BubbleStackView reference, without that there could be an NPE in various locations. Also uses the correct parent view to setup the overflow. Test: manual - tap on the overflow, observe no crash Fixes: 150394526 Change-Id: Ib1ae9353a0dfd60ac8b6eb4f94b5b0cc5bc47811 --- .../src/com/android/systemui/bubbles/BubbleOverflow.java | 3 ++- .../src/com/android/systemui/bubbles/BubbleStackView.java | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleOverflow.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleOverflow.java index a0e7449791123..313bb42505706 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleOverflow.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleOverflow.java @@ -62,11 +62,12 @@ public class BubbleOverflow implements BubbleViewProvider { R.dimen.bubble_overflow_icon_bitmap_size); } - public void setUpOverflow(ViewGroup parentViewGroup) { + void setUpOverflow(ViewGroup parentViewGroup, BubbleStackView stackView) { mOverflowExpandedView = (BubbleExpandedView) mInflater.inflate( R.layout.bubble_expanded_view, parentViewGroup /* root */, false /* attachToRoot */); mOverflowExpandedView.setOverflow(true); + mOverflowExpandedView.setStackView(stackView); updateIcon(mContext, parentViewGroup); } diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java index df8e3941178ef..cff62c1ba87b4 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java @@ -522,8 +522,8 @@ public class BubbleStackView extends FrameLayout { private void setUpOverflow() { int overflowBtnIndex = 0; if (mBubbleOverflow == null) { - mBubbleOverflow = new BubbleOverflow(mContext); - mBubbleOverflow.setUpOverflow(this); + mBubbleOverflow = new BubbleOverflow(getContext()); + mBubbleOverflow.setUpOverflow(mBubbleContainer, this); } else { mBubbleContainer.removeView(mBubbleOverflow.getBtn()); mBubbleOverflow.updateIcon(mContext, this);