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:
Matías Hernández
2024-08-30 11:03:45 +02:00
parent 2d07418b8b
commit 50c954923f
19 changed files with 151 additions and 53 deletions

View File

@@ -61,7 +61,7 @@ class ZenModeOtherLinkPreferenceController extends AbstractZenModePreferenceCont
@Override
public boolean isAvailable(ZenMode zenMode) {
return zenMode.getRule().getInterruptionFilter() != INTERRUPTION_FILTER_ALL;
return zenMode.getInterruptionFilter() != INTERRUPTION_FILTER_ALL;
}
@Override
@@ -70,7 +70,7 @@ class ZenModeOtherLinkPreferenceController extends AbstractZenModePreferenceCont
ZenSubSettingLauncher.forModeFragment(mContext, ZenModeOtherFragment.class,
zenMode.getId(), SettingsEnums.ZEN_PRIORITY_MODE).toIntent());
preference.setEnabled(zenMode.isEnabled());
preference.setEnabled(zenMode.isEnabled() && zenMode.canEditPolicy());
preference.setSummary(mSummaryHelper.getOtherSoundCategoriesSummary(zenMode));
((CircularIconsPreference) preference).setIcons(getSoundIcons(zenMode.getPolicy()));
}