Collapse the notification shade when closing the QS using the back button in split shade mode.
CentralSurfacesImpl.onBackPressed() was collapsing the QS to QQS on the first back button tap, but when in split shade mode closing the Qs does nothing. Now NotificationPanelViewController.animateCloseQs() will run collapsePanel() to close the entire panel if mSplitShadeEnabled.
Fixes: 234306461
Test: manually checking the notification panel closes with one back button tap
Test: NotificationPanelViewControllerTest
Change-Id: I99d8b06846214344011d5ee6f590193594d6e247
diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
index 25e7904..99d0fe9 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
@@ -1714,10 +1714,17 @@
/**
* Animate QS closing by flinging it.
* If QS is expanded, it will collapse into QQS and stop.
+ * If in split shade, it will collapse the whole shade.
*
* @param animateAway Do not stop when QS becomes QQS. Fling until QS isn't visible anymore.
*/
public void animateCloseQs(boolean animateAway) {
+ if (mSplitShadeEnabled) {
+ collapsePanel(
+ /* animate= */true, /* delayed= */false, /* speedUpFactor= */1.0f);
+ return;
+ }
+
if (mQsExpansionAnimator != null) {
if (!mQsAnimatorExpand) {
return;
@@ -3390,19 +3397,11 @@
return mQsExpanded;
}
- public boolean isQsDetailShowing() {
- return mQs.isShowingDetail();
- }
-
/** Returns whether the QS customizer is currently active. */
public boolean isQsCustomizing() {
return mQs.isCustomizing();
}
- public void closeQsDetail() {
- mQs.closeDetail();
- }
-
/** Close the QS customizer if it is open. */
public void closeQsCustomizer() {
mQs.closeCustomizer();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
index 2d6d846..98404eb 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
@@ -3325,11 +3325,7 @@
return true;
}
if (mNotificationPanelViewController.isQsExpanded()) {
- if (mNotificationPanelViewController.isQsDetailShowing()) {
- mNotificationPanelViewController.closeQsDetail();
- } else {
mNotificationPanelViewController.animateCloseQs(false /* animateAway */);
- }
return true;
}
if (mNotificationPanelViewController.closeUserSwitcherIfOpen()) {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java
index f13aa67..e2673bb 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java
@@ -1284,6 +1284,29 @@
}
@Test
+ public void testPanelClosedWhenClosingQsInSplitShade() {
+ mPanelExpansionStateManager.onPanelExpansionChanged(/* fraction= */ 1,
+ /* expanded= */ true, /* tracking= */ false, /* dragDownPxAmount= */ 0);
+ enableSplitShade(/* enabled= */ true);
+ mNotificationPanelViewController.setExpandedFraction(1f);
+
+ assertThat(mNotificationPanelViewController.isClosing()).isFalse();
+ mNotificationPanelViewController.animateCloseQs(false);
+ assertThat(mNotificationPanelViewController.isClosing()).isTrue();
+ }
+
+ @Test
+ public void testPanelStaysOpenWhenClosingQs() {
+ mPanelExpansionStateManager.onPanelExpansionChanged(/* fraction= */ 1,
+ /* expanded= */ true, /* tracking= */ false, /* dragDownPxAmount= */ 0);
+ mNotificationPanelViewController.setExpandedFraction(1f);
+
+ assertThat(mNotificationPanelViewController.isClosing()).isFalse();
+ mNotificationPanelViewController.animateCloseQs(false);
+ assertThat(mNotificationPanelViewController.isClosing()).isFalse();
+ }
+
+ @Test
public void interceptTouchEvent_withinQs_shadeExpanded_startsQsTracking() {
mNotificationPanelViewController.mQs = mQs;
when(mQsFrame.getX()).thenReturn(0f);