Merge "Exclude implicit modes from the summary of the Modes entry in Settings" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
f9ea2a52d3
@@ -500,10 +500,13 @@ class ZenModeSummaryHelper {
|
|||||||
Locale.getDefault());
|
Locale.getDefault());
|
||||||
return buildModesSummary(msgFormat, activeModes);
|
return buildModesSummary(msgFormat, activeModes);
|
||||||
} else {
|
} else {
|
||||||
|
List<ZenMode> modesExcludingImplicit = modes.stream()
|
||||||
|
.filter(m -> m.getKind() != ZenMode.Kind.IMPLICIT)
|
||||||
|
.toList();
|
||||||
MessageFormat msgFormat = new MessageFormat(
|
MessageFormat msgFormat = new MessageFormat(
|
||||||
mContext.getString(R.string.zen_modes_summary),
|
mContext.getString(R.string.zen_modes_summary),
|
||||||
Locale.getDefault());
|
Locale.getDefault());
|
||||||
return buildModesSummary(msgFormat, modes);
|
return buildModesSummary(msgFormat, modesExcludingImplicit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -526,6 +526,18 @@ public class ZenModeSummaryHelperTest {
|
|||||||
assertThat(summary).isEqualTo("Juggling, Rhyming, Meandering");
|
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
|
@Test
|
||||||
public void getModesSummary_oneModeActive_listsActiveMode() {
|
public void getModesSummary_oneModeActive_listsActiveMode() {
|
||||||
ImmutableList<ZenMode> modes = ImmutableList.of(
|
ImmutableList<ZenMode> modes = ImmutableList.of(
|
||||||
|
Reference in New Issue
Block a user