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

Commit 3ec7017a authored by Ibrahim Yilmaz's avatar Ibrahim Yilmaz
Browse files

[Inline Reply] Use system expanded for not pinned hun

Not Pinned HUN should use systemExpanded. If they dont, they will not be shown as expanded on shade when they are the first one.

Fixes: 349989253
Test: ExpandableNotificationRowTest and Send a HUN with delay and open the shade. Observe incoming hun to the shade is expanded
Flag: com.android.systemui.expand_heads_up_on_inline_reply
Change-Id: Ib5f276201e0d385461df9c119382596b2103964d
parent e39d93fc
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -2869,14 +2869,16 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
    }

    public boolean isExpanded(boolean allowOnKeyguard) {
        // System expanded should be ignored in heads up state
        final boolean isHeadsUpState = ExpandHeadsUpOnInlineReply.isEnabled()
                && canShowHeadsUp() && isHeadsUpState();
        // System expanded should be ignored in pinned heads up state
        final boolean isPinned = isHeadsUpState && isPinned();
        // Heads Up Notification can be expanded when it is pinned.
        final boolean isPinnedAndExpanded =
                isHeadsUpState && isPinnedAndExpanded();

        return (!shouldShowPublic()) && (!mOnKeyguard || allowOnKeyguard)
                && (!hasUserChangedExpansion() && !isHeadsUpState
                && (!hasUserChangedExpansion() && !isPinned
                && (isSystemExpanded() || isSystemChildExpanded())
                || isUserExpanded() || isPinnedAndExpanded);
    }
+33 −2
Original line number Diff line number Diff line
@@ -862,11 +862,12 @@ public class ExpandableNotificationRowTest extends SysuiTestCase {

    @Test
    @EnableFlags(ExpandHeadsUpOnInlineReply.FLAG_NAME)
    public void isExpanded_systemExpandedTrueForHeadsUp_notExpanded() throws Exception {
    public void isExpanded_HUNsystemExpandedTrueForPinned_notExpanded() throws Exception {
        // GIVEN
        final ExpandableNotificationRow row = mNotificationTestHelper.createRow();
        row.setOnKeyguard(false);
        row.setSystemExpanded(true);
        row.setPinned(true);
        row.setHeadsUp(true);

        // THEN
@@ -875,18 +876,48 @@ public class ExpandableNotificationRowTest extends SysuiTestCase {

    @Test
    @EnableFlags(ExpandHeadsUpOnInlineReply.FLAG_NAME)
    public void isExpanded_systemExpandedTrueForHeadsUpDisappearRunning_notExpanded()
    public void isExpanded_HUNsystemExpandedTrueForNotPinned_expanded() throws Exception {
        // GIVEN
        final ExpandableNotificationRow row = mNotificationTestHelper.createRow();
        row.setOnKeyguard(false);
        row.setSystemExpanded(true);
        row.setPinned(false);
        row.setHeadsUp(true);

        // THEN
        assertThat(row.isExpanded()).isTrue();
    }

    @Test
    @EnableFlags(ExpandHeadsUpOnInlineReply.FLAG_NAME)
    public void isExpanded_HUNDisappearingsystemExpandedTrueForPinned_notExpanded()
            throws Exception {
        // GIVEN
        final ExpandableNotificationRow row = mNotificationTestHelper.createRow();
        row.setOnKeyguard(false);
        row.setSystemExpanded(true);
        row.setPinned(true);
        row.setHeadsUpAnimatingAway(true);

        // THEN
        assertThat(row.isExpanded()).isFalse();
    }

    @Test
    @EnableFlags(ExpandHeadsUpOnInlineReply.FLAG_NAME)
    public void isExpanded_HUNDisappearingsystemExpandedTrueForNotPinned_expanded()
            throws Exception {
        // GIVEN
        final ExpandableNotificationRow row = mNotificationTestHelper.createRow();
        row.setOnKeyguard(false);
        row.setSystemExpanded(true);
        row.setPinned(false);
        row.setHeadsUpAnimatingAway(true);

        // THEN
        assertThat(row.isExpanded()).isTrue();
    }

    @Test
    @EnableFlags(ExpandHeadsUpOnInlineReply.FLAG_NAME)
    public void isExpanded_userExpandedTrueForHeadsUp_expanded() throws Exception {