From eb7a55cc470d9e6c8053adc1a17606eb9f9892ab Mon Sep 17 00:00:00 2001 From: Jamie Garside Date: Tue, 26 Oct 2021 16:43:44 +0100 Subject: [PATCH] Fix bugs with QS customizer when split shade is active. * When the QS customizer is active, closing the split shade does not close the customizer. * When three-button nav is enabled, pressing back when the QS customizer is active on the split shade will close the shade, not close the customizer. This CL instead adds functions to QS.java so we can check whether the customizer is active (and close it), so we can handle these cases appropriately. Test: Manually verified. Bug: 201388768 Change-Id: I94208d1cd966975f39328529b9d866fbf27927ac --- .../src/com/android/systemui/plugins/qs/QS.java | 4 +++- .../src/com/android/systemui/qs/QSFragment.java | 7 ++++++- .../phone/NotificationPanelViewController.java | 14 ++++++++++++++ .../systemui/statusbar/phone/StatusBar.java | 4 ++++ 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QS.java b/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QS.java index b83ea4acd26f8..d5f858c4df941 100644 --- a/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QS.java +++ b/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QS.java @@ -34,7 +34,7 @@ public interface QS extends FragmentBase { String ACTION = "com.android.systemui.action.PLUGIN_QS"; - int VERSION = 11; + int VERSION = 12; String TAG = "QS"; @@ -46,6 +46,8 @@ public interface QS extends FragmentBase { void setHeightOverride(int desiredHeight); void setHeaderClickable(boolean qsExpansionEnabled); boolean isCustomizing(); + /** Close the QS customizer, if it is open. */ + void closeCustomizer(); void setOverscrolling(boolean overscrolling); void setExpanded(boolean qsExpanded); void setListening(boolean listening); diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java b/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java index dd876b7c7d246..e42c47b1d3bed 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java @@ -15,10 +15,10 @@ package com.android.systemui.qs; import static android.app.StatusBarManager.DISABLE2_QUICK_SETTINGS; -import static com.android.systemui.statusbar.DisableFlagsLogger.DisableState; import static com.android.systemui.media.dagger.MediaModule.QS_PANEL; import static com.android.systemui.media.dagger.MediaModule.QUICK_QS_PANEL; +import static com.android.systemui.statusbar.DisableFlagsLogger.DisableState; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; @@ -696,6 +696,11 @@ public class QSFragment extends LifecycleFragment implements QS, CommandQueue.Ca mQSPanelController.closeDetail(); } + @Override + public void closeCustomizer() { + mQSCustomizerController.hide(); + } + public void notifyCustomizeChanged() { // The customize state changed, so our height changed. mContainer.updateExpansion(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java index 988034f9c5fd9..4c72db5ec9b16 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java @@ -2869,6 +2869,10 @@ public class NotificationPanelViewController extends PanelViewController { mStatusBarTouchableRegionManager.setPanelExpanded(isExpanded); mStatusBar.setPanelExpanded(isExpanded); mPanelExpanded = isExpanded; + + if (!isExpanded && mQs != null && mQs.isCustomizing()) { + mQs.closeCustomizer(); + } } } @@ -3167,10 +3171,20 @@ public class NotificationPanelViewController extends PanelViewController { 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(); + } + public boolean isLaunchTransitionFinished() { return mIsLaunchTransitionFinished; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index cbaa4683c3641..14a01ab3de6cc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -3283,6 +3283,10 @@ public class StatusBar extends SystemUI implements } return true; } + if (mNotificationPanelViewController.isQsCustomizing()) { + mNotificationPanelViewController.closeQsCustomizer(); + return true; + } if (mNotificationPanelViewController.isQsExpanded()) { if (mNotificationPanelViewController.isQsDetailShowing()) { mNotificationPanelViewController.closeQsDetail();