Loading res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -8924,6 +8924,9 @@ <!-- [CHAR LIMIT=100] Zen mode settings: Allow apps to bypass DND title--> <string name="zen_mode_bypassing_apps_title">App exceptions</string> <!-- [CHAR LIMIT=120] Zen mode settings: No apps are bypassing DND --> <string name="zen_mode_bypassing_apps_subtext_none">No apps can override Do Not Disturb</string> <!-- [CHAR LIMIT=120] Zen mode settings: Allow apps to bypass DND --> <plurals name="zen_mode_bypassing_apps_subtext"> <item quantity="zero">No apps can override Do Not Disturb</item> res/xml/zen_mode_settings.xml +1 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ <Preference android:key="zen_mode_behavior_apps" android:title="@string/zen_category_apps" settings:controller="com.android.settings.notification.zen.ZenModeBypassingAppsPreferenceController" android:fragment="com.android.settings.notification.zen.ZenModeBypassingAppsSettings" /> <!-- All sounds --> Loading src/com/android/settings/notification/zen/ZenModeAllBypassingAppsPreferenceController.java +9 −3 Original line number Diff line number Diff line Loading @@ -105,10 +105,8 @@ public class ZenModeAllBypassingAppsPreferenceController extends AbstractPrefere ApplicationsState.AppFilter filter = ApplicationsState.FILTER_ALL_ENABLED; List<ApplicationsState.AppEntry> apps = mAppSession.rebuild(filter, ApplicationsState.ALPHA_COMPARATOR); if (apps != null) { updateNotificationChannelList(apps); } } @VisibleForTesting void updateNotificationChannelList(List<ApplicationsState.AppEntry> apps) { Loading @@ -116,6 +114,8 @@ public class ZenModeAllBypassingAppsPreferenceController extends AbstractPrefere return; } boolean showEmptyState = true; List<Preference> channelsBypassingDnd = new ArrayList<>(); for (ApplicationsState.AppEntry entry : apps) { String pkg = entry.info.packageName; Loading Loading @@ -148,6 +148,7 @@ public class ZenModeAllBypassingAppsPreferenceController extends AbstractPrefere return true; }); channelsBypassingDnd.add(pref); showEmptyState = false; } mPreferenceScreen.removeAll(); Loading @@ -156,6 +157,11 @@ public class ZenModeAllBypassingAppsPreferenceController extends AbstractPrefere mPreferenceScreen.addPreference(prefToAdd); } } if (showEmptyState) { Preference pref = new Preference(mPrefContext); pref.setTitle(R.string.zen_mode_bypassing_apps_subtext_none); mPreferenceScreen.addPreference(pref); } } } Loading src/com/android/settings/notification/zen/ZenModeBypassingAppsPreferenceController.java +5 −2 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ import com.android.settingslib.core.lifecycle.Lifecycle; public class ZenModeBypassingAppsPreferenceController extends AbstractZenModePreferenceController { protected static final String KEY = "zen_mode_bypassing_apps"; protected static final String KEY = "zen_mode_behavior_apps"; private NotificationBackend mNotificationBackend = new NotificationBackend(); public ZenModeBypassingAppsPreferenceController(Context context, Lifecycle lifecycle) { Loading @@ -18,13 +18,16 @@ public class ZenModeBypassingAppsPreferenceController extends AbstractZenModePre @Override public boolean isAvailable() { return mNotificationBackend.getNumAppsBypassingDnd(UserHandle.getCallingUserId()) != 0; return true; } @Override public String getSummary() { final int channelsBypassing = mNotificationBackend.getNumAppsBypassingDnd(UserHandle.getCallingUserId()); if (channelsBypassing == 0) { return mContext.getResources().getString(R.string.zen_mode_bypassing_apps_subtext_none); } return mContext.getResources().getQuantityString(R.plurals.zen_mode_bypassing_apps_subtext, channelsBypassing, channelsBypassing); } Loading Loading
res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -8924,6 +8924,9 @@ <!-- [CHAR LIMIT=100] Zen mode settings: Allow apps to bypass DND title--> <string name="zen_mode_bypassing_apps_title">App exceptions</string> <!-- [CHAR LIMIT=120] Zen mode settings: No apps are bypassing DND --> <string name="zen_mode_bypassing_apps_subtext_none">No apps can override Do Not Disturb</string> <!-- [CHAR LIMIT=120] Zen mode settings: Allow apps to bypass DND --> <plurals name="zen_mode_bypassing_apps_subtext"> <item quantity="zero">No apps can override Do Not Disturb</item>
res/xml/zen_mode_settings.xml +1 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ <Preference android:key="zen_mode_behavior_apps" android:title="@string/zen_category_apps" settings:controller="com.android.settings.notification.zen.ZenModeBypassingAppsPreferenceController" android:fragment="com.android.settings.notification.zen.ZenModeBypassingAppsSettings" /> <!-- All sounds --> Loading
src/com/android/settings/notification/zen/ZenModeAllBypassingAppsPreferenceController.java +9 −3 Original line number Diff line number Diff line Loading @@ -105,10 +105,8 @@ public class ZenModeAllBypassingAppsPreferenceController extends AbstractPrefere ApplicationsState.AppFilter filter = ApplicationsState.FILTER_ALL_ENABLED; List<ApplicationsState.AppEntry> apps = mAppSession.rebuild(filter, ApplicationsState.ALPHA_COMPARATOR); if (apps != null) { updateNotificationChannelList(apps); } } @VisibleForTesting void updateNotificationChannelList(List<ApplicationsState.AppEntry> apps) { Loading @@ -116,6 +114,8 @@ public class ZenModeAllBypassingAppsPreferenceController extends AbstractPrefere return; } boolean showEmptyState = true; List<Preference> channelsBypassingDnd = new ArrayList<>(); for (ApplicationsState.AppEntry entry : apps) { String pkg = entry.info.packageName; Loading Loading @@ -148,6 +148,7 @@ public class ZenModeAllBypassingAppsPreferenceController extends AbstractPrefere return true; }); channelsBypassingDnd.add(pref); showEmptyState = false; } mPreferenceScreen.removeAll(); Loading @@ -156,6 +157,11 @@ public class ZenModeAllBypassingAppsPreferenceController extends AbstractPrefere mPreferenceScreen.addPreference(prefToAdd); } } if (showEmptyState) { Preference pref = new Preference(mPrefContext); pref.setTitle(R.string.zen_mode_bypassing_apps_subtext_none); mPreferenceScreen.addPreference(pref); } } } Loading
src/com/android/settings/notification/zen/ZenModeBypassingAppsPreferenceController.java +5 −2 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ import com.android.settingslib.core.lifecycle.Lifecycle; public class ZenModeBypassingAppsPreferenceController extends AbstractZenModePreferenceController { protected static final String KEY = "zen_mode_bypassing_apps"; protected static final String KEY = "zen_mode_behavior_apps"; private NotificationBackend mNotificationBackend = new NotificationBackend(); public ZenModeBypassingAppsPreferenceController(Context context, Lifecycle lifecycle) { Loading @@ -18,13 +18,16 @@ public class ZenModeBypassingAppsPreferenceController extends AbstractZenModePre @Override public boolean isAvailable() { return mNotificationBackend.getNumAppsBypassingDnd(UserHandle.getCallingUserId()) != 0; return true; } @Override public String getSummary() { final int channelsBypassing = mNotificationBackend.getNumAppsBypassingDnd(UserHandle.getCallingUserId()); if (channelsBypassing == 0) { return mContext.getResources().getString(R.string.zen_mode_bypassing_apps_subtext_none); } return mContext.getResources().getQuantityString(R.plurals.zen_mode_bypassing_apps_subtext, channelsBypassing, channelsBypassing); } Loading