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

Commit bbb4247f authored by Ibrahim Yilmaz's avatar Ibrahim Yilmaz Committed by Android (Google) Code Review
Browse files

Merge "[Inline Reply] Use system expanded for not pinned hun" into main

parents 733a4a4c 3ec7017a
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 {