Fix bug that heads up notification appear even when disable_expand is set
Fixes: 78880433
Test: execute app which setting a disable_expand flag to statusbar.
Test: after that, get a headsup notification.
Test: then, headsup appear and it would be presented as status bar height
Test: runtest systemui
Change-Id: I97cc77ad197ca5bc74ab03cc86f02083608549ba
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java
index d3cb5a6..37e0005 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java
@@ -443,6 +443,30 @@
}
@Test
+ public void testPeek_disabledStatusBar() {
+ Notification n = new Notification.Builder(getContext(), "a").build();
+ StatusBarNotification sbn = new StatusBarNotification("a", "a", 0, "a", 0, 0, n,
+ UserHandle.of(0), null, 0);
+ NotificationData.Entry entry = new NotificationData.Entry(sbn);
+ mStatusBar.disable(StatusBarManager.DISABLE_EXPAND, 0, false /* animate */);
+
+ assertFalse("The panel shouldn't allow peek while disabled",
+ mStatusBar.shouldPeek(entry, sbn));
+ }
+
+ @Test
+ public void testPeek_disabledNotificationShade() {
+ Notification n = new Notification.Builder(getContext(), "a").build();
+ StatusBarNotification sbn = new StatusBarNotification("a", "a", 0, "a", 0, 0, n,
+ UserHandle.of(0), null, 0);
+ NotificationData.Entry entry = new NotificationData.Entry(sbn);
+ mStatusBar.disable(0, StatusBarManager.DISABLE2_NOTIFICATION_SHADE, false /* animate */);
+
+ assertFalse("The panel shouldn't allow peek while notitifcation shade disabled",
+ mStatusBar.shouldPeek(entry, sbn));
+ }
+
+ @Test
public void testLogHidden() {
try {
mStatusBar.handleVisibleToUserChanged(false);