Merge "Reset shade over scroll state when split shade enabled changes" into tm-qpr-dev am: ca9896a79d

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21912029

Change-Id: I3fe9d746ad1a8ff92948a50ade5eacc3c2a95f9b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Christian Göllner
2023-03-13 13:32:34 +00:00
committed by Automerger Merge Worker
2 changed files with 39 additions and 0 deletions

View File

@@ -1201,6 +1201,12 @@ public final class NotificationPanelViewController implements Dumpable {
private void onSplitShadeEnabledChanged() { private void onSplitShadeEnabledChanged() {
mShadeLog.logSplitShadeChanged(mSplitShadeEnabled); mShadeLog.logSplitShadeChanged(mSplitShadeEnabled);
// Reset any left over overscroll state. It is a rare corner case but can happen.
mQsController.setOverScrollAmount(0);
mScrimController.setNotificationsOverScrollAmount(0);
mNotificationStackScrollLayoutController.setOverExpansion(0);
mNotificationStackScrollLayoutController.setOverScrollAmount(0);
// when we switch between split shade and regular shade we want to enforce setting qs to // when we switch between split shade and regular shade we want to enforce setting qs to
// the default state: expanded for split shade and collapsed otherwise // the default state: expanded for split shade and collapsed otherwise
if (!isOnKeyguard() && mPanelExpanded) { if (!isOnKeyguard() && mPanelExpanded) {

View File

@@ -37,6 +37,7 @@ import static org.mockito.Mockito.clearInvocations;
import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never; import static org.mockito.Mockito.never;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.times; import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
@@ -921,6 +922,38 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo
} }
@Test
public void onSplitShadeChanged_duringShadeExpansion_resetsOverScrollState() {
// There was a bug where there was left-over overscroll state after going from split shade
// to single shade.
// Since on single shade we don't set overscroll values on QS nor Scrim, those values that
// were there from split shade were never reset.
// To prevent this, we will reset all overscroll state.
enableSplitShade(true);
reset(mQsController, mScrimController, mNotificationStackScrollLayoutController);
mNotificationPanelViewController.setOverExpansion(123);
verify(mQsController).setOverScrollAmount(123);
verify(mScrimController).setNotificationsOverScrollAmount(123);
verify(mNotificationStackScrollLayoutController).setOverExpansion(123);
enableSplitShade(false);
verify(mQsController).setOverScrollAmount(0);
verify(mScrimController).setNotificationsOverScrollAmount(0);
verify(mNotificationStackScrollLayoutController).setOverExpansion(0);
}
@Test
public void onSplitShadeChanged_alwaysResetsOverScrollState() {
enableSplitShade(true);
enableSplitShade(false);
verify(mQsController, times(2)).setOverScrollAmount(0);
verify(mScrimController, times(2)).setNotificationsOverScrollAmount(0);
verify(mNotificationStackScrollLayoutController, times(2)).setOverExpansion(0);
verify(mNotificationStackScrollLayoutController, times(2)).setOverScrollAmount(0);
}
/** /**
* When shade is flinging to close and this fling is not intercepted, * When shade is flinging to close and this fling is not intercepted,
* {@link AmbientState#setIsClosing(boolean)} should be called before * {@link AmbientState#setIsClosing(boolean)} should be called before