Merge "Fix stack height jump during lockscreen=>shade and aod<=>ls" into tm-dev am: c5b165e8a5 am: 0dce6876b1
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17872584 Change-Id: I3ec07c4906678703e665de37908915522672b0d3 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -1233,6 +1233,11 @@ public class NotificationPanelViewController extends PanelViewController {
|
|||||||
mKeyguardBottomArea.initQRCodeScanner(mQRCodeScannerController);
|
mKeyguardBottomArea.initQRCodeScanner(mQRCodeScannerController);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
void setMaxDisplayedNotifications(int maxAllowed) {
|
||||||
|
mMaxAllowedKeyguardNotifications = maxAllowed;
|
||||||
|
}
|
||||||
|
|
||||||
private void updateMaxDisplayedNotifications(boolean recompute) {
|
private void updateMaxDisplayedNotifications(boolean recompute) {
|
||||||
if (recompute) {
|
if (recompute) {
|
||||||
mMaxAllowedKeyguardNotifications = Math.max(computeMaxKeyguardNotifications(), 1);
|
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
|
* @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 topPadding = mNotificationStackScrollLayoutController.getTopPadding();
|
||||||
float shelfIntrinsicHeight =
|
float shelfIntrinsicHeight =
|
||||||
mNotificationShelfController.getVisibility() == View.GONE
|
mNotificationShelfController.getVisibility() == View.GONE
|
||||||
|
|||||||
@@ -557,6 +557,37 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
|
|||||||
mMainHandler.removeCallbacksAndMessages(null);
|
mMainHandler.removeCallbacksAndMessages(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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
|
@Test
|
||||||
public void testSetPanelScrimMinFraction() {
|
public void testSetPanelScrimMinFraction() {
|
||||||
mNotificationPanelViewController.setPanelScrimMinFraction(0.5f);
|
mNotificationPanelViewController.setPanelScrimMinFraction(0.5f);
|
||||||
|
|||||||
Reference in New Issue
Block a user