Fix back presses dismissing bubbles when IME is up
If bubbles is expanded & shade is not use the virtual display id of the
expanded activity view (if it's valid, otherwise do whats normal).
Test: manual 1) have expanded bubble with IME up
2) hit back button
=> note that the IME goes away but the bubble remains
1) have expanded bubble up
2) pull down shade
3) hit back button
=> shade goes away
Do above with gesture nav turned on & do back gesture
Test: atest KeyButtonViewTest
Fixes: 122535136
Change-Id: Iabaace66cfb4d3d80b1a3a3c7b0773deb48fbcaa
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
index 93effed..13bdb99 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
@@ -16,6 +16,8 @@
package com.android.systemui.bubbles;
+import static android.view.Display.DEFAULT_DISPLAY;
+import static android.view.Display.INVALID_DISPLAY;
import static android.view.View.INVISIBLE;
import static android.view.View.VISIBLE;
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
@@ -530,6 +532,21 @@
return mTempRect;
}
+ /**
+ * The display id of the expanded view, if the stack is expanded and not occluded by the
+ * status bar, otherwise returns {@link Display#INVALID_DISPLAY}.
+ */
+ public int getExpandedDisplayId(Context context) {
+ boolean defaultDisplay = context.getDisplay() != null
+ && context.getDisplay().getDisplayId() == DEFAULT_DISPLAY;
+ Bubble b = mStackView.getExpandedBubble();
+ if (defaultDisplay && b != null && isStackExpanded()
+ && !mStatusBarWindowController.getPanelExpanded()) {
+ return b.expandedView.getVirtualDisplayId();
+ }
+ return INVALID_DISPLAY;
+ }
+
@VisibleForTesting
BubbleStackView getStackView() {
return mStackView;