Hit back button in overflow to collapse stack
getExpandedDisplayId(mContext) was returning -1 (INVALID_DISPLAY) for overflow
Add getDisplayId to BubbleViewProvider, override that in overflow and
return actual display id for overflow's expanded view.
Fixes: 150398525
Fixes: 149882551
Test: manual -> press back button in overflow -> stack collapses
Test: manual -> swipe right from left edge in gesture nav -> stack collapses
Test: adb shell am instrument -w com.android.systemui.tests
Change-Id: I9d43de3803a7c771eaabe38b8e8dc9aacd8bad94
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
index f873f42..67299a6 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
@@ -1175,23 +1175,17 @@
* status bar, otherwise returns {@link Display#INVALID_DISPLAY}.
*/
public int getExpandedDisplayId(Context context) {
- final Bubble bubble = getExpandedBubble(context);
- return bubble != null ? bubble.getDisplayId() : INVALID_DISPLAY;
- }
-
- @Nullable
- private Bubble getExpandedBubble(Context context) {
if (mStackView == null) {
- return null;
+ return INVALID_DISPLAY;
}
final boolean defaultDisplay = context.getDisplay() != null
&& context.getDisplay().getDisplayId() == DEFAULT_DISPLAY;
- final Bubble expandedBubble = mStackView.getExpandedBubble();
- if (defaultDisplay && expandedBubble != null && isStackExpanded()
+ final BubbleViewProvider expandedViewProvider = mStackView.getExpandedBubble();
+ if (defaultDisplay && expandedViewProvider != null && isStackExpanded()
&& !mNotificationShadeWindowController.getPanelExpanded()) {
- return expandedBubble;
+ return expandedViewProvider.getDisplayId();
}
- return null;
+ return INVALID_DISPLAY;
}
@VisibleForTesting
@@ -1256,7 +1250,7 @@
@Override
public void onSingleTaskDisplayEmpty(int displayId) {
- final Bubble expandedBubble = mStackView != null
+ final BubbleViewProvider expandedBubble = mStackView != null
? mStackView.getExpandedBubble()
: null;
int expandedId = expandedBubble != null ? expandedBubble.getDisplayId() : -1;