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

Commit f9ea2a52 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Exclude implicit modes from the summary of the Modes entry in Settings" into main

parents 229a1dbc 0baf70a4
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -500,10 +500,13 @@ class ZenModeSummaryHelper {
                    Locale.getDefault());
            return buildModesSummary(msgFormat, activeModes);
        } else {
            List<ZenMode> modesExcludingImplicit = modes.stream()
                    .filter(m -> m.getKind() != ZenMode.Kind.IMPLICIT)
                    .toList();
            MessageFormat msgFormat = new MessageFormat(
                    mContext.getString(R.string.zen_modes_summary),
                    Locale.getDefault());
            return buildModesSummary(msgFormat, modes);
            return buildModesSummary(msgFormat, modesExcludingImplicit);
        }
    }

+12 −0
Original line number Diff line number Diff line
@@ -526,6 +526,18 @@ public class ZenModeSummaryHelperTest {
        assertThat(summary).isEqualTo("Juggling, Rhyming, Meandering");
    }

    @Test
    public void getModesSummary_excludesImplicitModes() {
        ImmutableList<ZenMode> modes = ImmutableList.of(
                TestModeBuilder.MANUAL_DND_INACTIVE,
                new TestModeBuilder().implicitForPackage("com.annoying.one").build(),
                new TestModeBuilder().setName("Chirping").build()
        );

        String summary = mSummaryHelper.getModesSummary(modes);
        assertThat(summary).isEqualTo("Do Not Disturb, Chirping");
    }

    @Test
    public void getModesSummary_oneModeActive_listsActiveMode() {
        ImmutableList<ZenMode> modes = ImmutableList.of(