From cf4f4416c06ba254dd6be2aa3f7c82f66d8f616a Mon Sep 17 00:00:00 2001 From: Michal Brzezinski Date: Fri, 19 May 2023 15:13:22 +0100 Subject: [PATCH] Fixing shade not collapsing after rotating from split shade Issue was happening because when swiping to overscroll, mExpandImmediate in QS was set to true and was never reset. It should be true only when QS are in motion so the solution is to reset it after any motion is finished. Calling setExpandImmediate() twice is safe because if value doesn't change it doesn't do anything. Bug: 282095041 Test: Open split shade -> scroll down to do overscrolling -> rotate to portrait -> QS should be collapsed Test: NotificationPanelViewControllerTest#onShadeFlingEnd_mExpandImmediateShouldBeReset Test: e2e test: SplitNotificationShadeRotateToPortrait Change-Id: I0663bc28a48b2092546a2cb9a99993320fb7c8e4 --- .../systemui/shade/NotificationPanelViewController.java | 2 ++ .../shade/NotificationPanelViewControllerTest.java | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java index af12bc2ca9f8f..db1db6c646d28 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java @@ -2001,6 +2001,8 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump } updateExpansionAndVisibility(); mNotificationStackScrollLayoutController.setPanelFlinging(false); + // expandImmediate should be always reset at the end of animation + mQsController.setExpandImmediate(false); } private boolean isInContentBounds(float x, float y) { 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 48e0b53fc931e..50074b72c0f56 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java @@ -1089,6 +1089,13 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo inOrder.verify(mNotificationStackScrollLayoutController).onExpansionStopped(); } + @Test + public void onShadeFlingEnd_mExpandImmediateShouldBeReset() { + mNotificationPanelViewController.onFlingEnd(false); + + verify(mQsController).setExpandImmediate(false); + } + @Test public void inUnlockedSplitShade_transitioningMaxTransitionDistance_makesShadeFullyExpanded() { mStatusBarStateController.setState(SHADE);