Support (non-editable) display of DND with a filter != PRIORITY
Whenever setInterruptionFilter() is called with NONE or ALARMS, the Do Not Disturb mode now shows the current policy (nothing allowed or alarms/media allowed), instead of the normal PRIORITY policy. This policy is read-only in the UI since it cannot be customized. This should be, or at least become, pretty rare (with small exceptions, apps targeting V that call setInterruptionFilter() will use an implicit mode instead of changing the global zen mode, plus using these filters is quite nonstandard in itself). Fixes: 361586248 Test: atest & manual (toggling DND via cmd shell) Flag: android.app.modes_ui Change-Id: If2439480235d30aa310ad8925341183b9761784c
This commit is contained in:
@@ -209,48 +209,46 @@ class ZenModeSummaryHelper {
|
||||
boolean isFirst = true;
|
||||
List<String> enabledEffects = new ArrayList<>();
|
||||
if (!zenMode.getPolicy().shouldShowAllVisualEffects()
|
||||
&& zenMode.getRule().getInterruptionFilter() != INTERRUPTION_FILTER_ALL) {
|
||||
&& zenMode.getInterruptionFilter() != INTERRUPTION_FILTER_ALL) {
|
||||
enabledEffects.add(getBlockedEffectsSummary(zenMode));
|
||||
isFirst = false;
|
||||
}
|
||||
ZenDeviceEffects currEffects = zenMode.getRule().getDeviceEffects();
|
||||
if (currEffects != null) {
|
||||
if (currEffects.shouldDisplayGrayscale()) {
|
||||
if (isFirst) {
|
||||
enabledEffects.add(mContext.getString(R.string.mode_grayscale_title));
|
||||
} else {
|
||||
enabledEffects.add(mContext.getString(
|
||||
R.string.mode_grayscale_title_secondary_list));
|
||||
}
|
||||
isFirst = false;
|
||||
ZenDeviceEffects currEffects = zenMode.getDeviceEffects();
|
||||
if (currEffects.shouldDisplayGrayscale()) {
|
||||
if (isFirst) {
|
||||
enabledEffects.add(mContext.getString(R.string.mode_grayscale_title));
|
||||
} else {
|
||||
enabledEffects.add(mContext.getString(
|
||||
R.string.mode_grayscale_title_secondary_list));
|
||||
}
|
||||
if (currEffects.shouldSuppressAmbientDisplay()) {
|
||||
if (isFirst) {
|
||||
enabledEffects.add(mContext.getString(R.string.mode_aod_title));
|
||||
} else {
|
||||
enabledEffects.add(mContext.getString(
|
||||
R.string.mode_aod_title_secondary_list));
|
||||
}
|
||||
isFirst = false;
|
||||
isFirst = false;
|
||||
}
|
||||
if (currEffects.shouldSuppressAmbientDisplay()) {
|
||||
if (isFirst) {
|
||||
enabledEffects.add(mContext.getString(R.string.mode_aod_title));
|
||||
} else {
|
||||
enabledEffects.add(mContext.getString(
|
||||
R.string.mode_aod_title_secondary_list));
|
||||
}
|
||||
if (currEffects.shouldDimWallpaper()) {
|
||||
if (isFirst) {
|
||||
enabledEffects.add(mContext.getString(R.string.mode_wallpaper_title));
|
||||
} else {
|
||||
enabledEffects.add(mContext.getString(
|
||||
R.string.mode_wallpaper_title_secondary_list));
|
||||
}
|
||||
isFirst = false;
|
||||
isFirst = false;
|
||||
}
|
||||
if (currEffects.shouldDimWallpaper()) {
|
||||
if (isFirst) {
|
||||
enabledEffects.add(mContext.getString(R.string.mode_wallpaper_title));
|
||||
} else {
|
||||
enabledEffects.add(mContext.getString(
|
||||
R.string.mode_wallpaper_title_secondary_list));
|
||||
}
|
||||
if (currEffects.shouldUseNightMode()) {
|
||||
if (isFirst) {
|
||||
enabledEffects.add(mContext.getString(R.string.mode_dark_theme_title));
|
||||
} else {
|
||||
enabledEffects.add(mContext.getString(
|
||||
R.string.mode_dark_theme_title_secondary_list));
|
||||
}
|
||||
isFirst = false;
|
||||
isFirst = false;
|
||||
}
|
||||
if (currEffects.shouldUseNightMode()) {
|
||||
if (isFirst) {
|
||||
enabledEffects.add(mContext.getString(R.string.mode_dark_theme_title));
|
||||
} else {
|
||||
enabledEffects.add(mContext.getString(
|
||||
R.string.mode_dark_theme_title_secondary_list));
|
||||
}
|
||||
isFirst = false;
|
||||
}
|
||||
|
||||
int numCategories = enabledEffects.size();
|
||||
|
||||
Reference in New Issue
Block a user