Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 30d3651f authored by e.min's avatar e.min Committed by Selim Cinek
Browse files

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
parent c8303adb
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1896,6 +1896,13 @@ public class StatusBar extends SystemUI implements DemoMode,
            }
        }

        if (!panelsEnabled()) {
            if (DEBUG) {
                Log.d(TAG, "No peeking: disabled panel : " + sbn.getKey());
            }
            return false;
        }

        if (sbn.getNotification().fullScreenIntent != null) {
            if (mAccessibilityManager.isTouchExplorationEnabled()) {
                if (DEBUG) Log.d(TAG, "No peeking: accessible fullscreen: " + sbn.getKey());
+24 −0
Original line number Diff line number Diff line
@@ -442,6 +442,30 @@ public class StatusBarTest extends SysuiTestCase {
        assertTrue(mEntryManager.shouldPeek(entry, sbn));
    }

    @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 {