summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Lyn Han <lynhan@google.com> 2022-04-27 18:28:58 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2022-04-27 18:28:58 +0000
commit7097029e7481a26d2ffffcee3402e7517cff765a (patch)
tree66d207fb6d5dbe5be17160ad4426d79626e7c663
parentafcb91483133fd2edbcd05a17101862b18e1deb6 (diff)
parent726f5f323a90573fd615401e34427cd77744de24 (diff)
Merge "Fix stack height jump during lockscreen=>shade and aod<=>ls" into tm-dev am: c5b165e8a5 am: 726f5f323a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17872584 Change-Id: Idcc0539bd7df894f3715f36dc6a2c8cb3a6d08da Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java11
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewControllerTest.java31
2 files changed, 41 insertions, 1 deletions
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 adf70a255b4f..0b46f07f8e8b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
@@ -1233,6 +1233,11 @@ public class NotificationPanelViewController extends PanelViewController {
mKeyguardBottomArea.initQRCodeScanner(mQRCodeScannerController);
}
+ @VisibleForTesting
+ void setMaxDisplayedNotifications(int maxAllowed) {
+ mMaxAllowedKeyguardNotifications = maxAllowed;
+ }
+
private void updateMaxDisplayedNotifications(boolean recompute) {
if (recompute) {
mMaxAllowedKeyguardNotifications = Math.max(computeMaxKeyguardNotifications(), 1);
@@ -1463,7 +1468,11 @@ public class NotificationPanelViewController extends PanelViewController {
/**
* @return the maximum keyguard notifications that can fit on the screen
*/
- private int computeMaxKeyguardNotifications() {
+ @VisibleForTesting
+ int computeMaxKeyguardNotifications() {
+ if (mAmbientState.getFractionToShade() > 0 || mAmbientState.getDozeAmount() > 0) {
+ return mMaxAllowedKeyguardNotifications;
+ }
float topPadding = mNotificationStackScrollLayoutController.getTopPadding();
float shelfIntrinsicHeight =
mNotificationShelfController.getVisibility() == View.GONE
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewControllerTest.java
index 71f1f0b0f7cf..cad603c85bbc 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewControllerTest.java
@@ -558,6 +558,37 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
}
@Test
+ public void computeMaxKeyguardNotifications_lockscreenToShade_returnsExistingMax() {
+ when(mAmbientState.getFractionToShade()).thenReturn(0.5f);
+ mNotificationPanelViewController.setMaxDisplayedNotifications(-1);
+
+ // computeMaxKeyguardNotifications sets maxAllowed to 0 at minimum if it updates the value
+ assertThat(mNotificationPanelViewController.computeMaxKeyguardNotifications())
+ .isEqualTo(-1);
+ }
+
+ @Test
+ public void computeMaxKeyguardNotifications_dozeAmountNotZero_returnsExistingMax() {
+ when(mAmbientState.getDozeAmount()).thenReturn(0.5f);
+ mNotificationPanelViewController.setMaxDisplayedNotifications(-1);
+
+ // computeMaxKeyguardNotifications sets maxAllowed to 0 at minimum if it updates the value
+ assertThat(mNotificationPanelViewController.computeMaxKeyguardNotifications())
+ .isEqualTo(-1);
+ }
+
+ @Test
+ public void computeMaxKeyguardNotifications_noTransition_updatesMax() {
+ when(mAmbientState.getFractionToShade()).thenReturn(0f);
+ when(mAmbientState.getDozeAmount()).thenReturn(0f);
+ mNotificationPanelViewController.setMaxDisplayedNotifications(-1);
+
+ // computeMaxKeyguardNotifications sets maxAllowed to 0 at minimum if it updates the value
+ assertThat(mNotificationPanelViewController.computeMaxKeyguardNotifications())
+ .isNotEqualTo(-1);
+ }
+
+ @Test
public void testSetPanelScrimMinFraction() {
mNotificationPanelViewController.setPanelScrimMinFraction(0.5f);
verify(mNotificationShadeDepthController).setPanelPullDownMinFraction(eq(0.5f));