Loading core/java/android/app/NotificationManager.java +15 −0 Original line number Diff line number Diff line Loading @@ -292,6 +292,21 @@ public class NotificationManager { public static final String ACTION_AUTOMATIC_ZEN_RULE_STATUS_CHANGED = "android.app.action.AUTOMATIC_ZEN_RULE_STATUS_CHANGED"; /** * Intent that is broadcast when the Zen configuration has changed. This includes any * modification to a {@code ZenRule}, including creation, modification, deletion, or activation * status change of {@link AutomaticZenRule} instances or the manual DND rule. * * <p>This broadcast is only sent to packages holding the * {@link android.Manifest.permission#MANAGE_NOTIFICATIONS} permission (which is only allowed * for system processes). * * @hide */ @SdkConstant(SdkConstant.SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_ZEN_CONFIGURATION_CHANGED_INTERNAL = "android.app.action.ZEN_CONFIGURATION_CHANGED_INTERNAL"; /** * Integer extra for {@link #ACTION_AUTOMATIC_ZEN_RULE_STATUS_CHANGED} containing the state of * the {@link AutomaticZenRule}. Loading core/java/android/app/notification.aconfig +10 −0 Original line number Diff line number Diff line Loading @@ -90,6 +90,16 @@ flag { } } flag { name: "modes_ui_dnd_slice" namespace: "systemui" description: "Restores a (tweaked) DND slice in Settings; dependent on modes_ui" bug: "406238205" metadata { purpose: PURPOSE_BUGFIX } } flag { name: "modes_cleanup_implicit" namespace: "systemui" Loading packages/SettingsLib/src/com/android/settingslib/notification/modes/ZenMode.java +2 −1 Original line number Diff line number Diff line Loading @@ -67,7 +67,8 @@ public class ZenMode implements Parcelable { private static final String TAG = "ZenMode"; static final String MANUAL_DND_MODE_ID = ZenModeConfig.MANUAL_RULE_ID; public static final String MANUAL_DND_MODE_ID = ZenModeConfig.MANUAL_RULE_ID; static final String TEMP_NEW_MODE_ID = "temp_new_mode"; private static final Comparator<Integer> PRIORITIZED_TYPE_COMPARATOR = new Comparator<>() { Loading services/core/java/com/android/server/notification/NotificationManagerService.java +7 −0 Original line number Diff line number Diff line Loading @@ -2730,6 +2730,13 @@ public class NotificationManagerService extends SystemService { @Override public void onConfigChanged() { handleSavePolicyFile(); if (android.app.Flags.modesUiDndSlice()) { getContext().sendBroadcastAsUser( new Intent( NotificationManager.ACTION_ZEN_CONFIGURATION_CHANGED_INTERNAL) .addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT), UserHandle.ALL, android.Manifest.permission.MANAGE_NOTIFICATIONS); } } @Override Loading services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +12 −0 Original line number Diff line number Diff line Loading @@ -11391,6 +11391,18 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { verify(mContext).sendBroadcastAsUser(eqIntent(expected), eq(UserHandle.of(mUserId))); } @Test @EnableFlags(android.app.Flags.FLAG_MODES_UI_DND_SLICE) public void onConfigChanged_sendsInternalZenChangedBroadcast() throws Exception { mService.mZenModeHelper.getCallbacks().forEach(c -> c.onConfigChanged()); Intent expected = new Intent(NotificationManager.ACTION_ZEN_CONFIGURATION_CHANGED_INTERNAL) .addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); verify(mContext).sendBroadcastAsUser(eqIntent(expected), eq(UserHandle.ALL), eq(android.Manifest.permission.MANAGE_NOTIFICATIONS)); } private static Intent isIntentWithAction(String wantedAction) { return argThat( intent -> intent != null && wantedAction.equals(intent.getAction()) Loading
core/java/android/app/NotificationManager.java +15 −0 Original line number Diff line number Diff line Loading @@ -292,6 +292,21 @@ public class NotificationManager { public static final String ACTION_AUTOMATIC_ZEN_RULE_STATUS_CHANGED = "android.app.action.AUTOMATIC_ZEN_RULE_STATUS_CHANGED"; /** * Intent that is broadcast when the Zen configuration has changed. This includes any * modification to a {@code ZenRule}, including creation, modification, deletion, or activation * status change of {@link AutomaticZenRule} instances or the manual DND rule. * * <p>This broadcast is only sent to packages holding the * {@link android.Manifest.permission#MANAGE_NOTIFICATIONS} permission (which is only allowed * for system processes). * * @hide */ @SdkConstant(SdkConstant.SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_ZEN_CONFIGURATION_CHANGED_INTERNAL = "android.app.action.ZEN_CONFIGURATION_CHANGED_INTERNAL"; /** * Integer extra for {@link #ACTION_AUTOMATIC_ZEN_RULE_STATUS_CHANGED} containing the state of * the {@link AutomaticZenRule}. Loading
core/java/android/app/notification.aconfig +10 −0 Original line number Diff line number Diff line Loading @@ -90,6 +90,16 @@ flag { } } flag { name: "modes_ui_dnd_slice" namespace: "systemui" description: "Restores a (tweaked) DND slice in Settings; dependent on modes_ui" bug: "406238205" metadata { purpose: PURPOSE_BUGFIX } } flag { name: "modes_cleanup_implicit" namespace: "systemui" Loading
packages/SettingsLib/src/com/android/settingslib/notification/modes/ZenMode.java +2 −1 Original line number Diff line number Diff line Loading @@ -67,7 +67,8 @@ public class ZenMode implements Parcelable { private static final String TAG = "ZenMode"; static final String MANUAL_DND_MODE_ID = ZenModeConfig.MANUAL_RULE_ID; public static final String MANUAL_DND_MODE_ID = ZenModeConfig.MANUAL_RULE_ID; static final String TEMP_NEW_MODE_ID = "temp_new_mode"; private static final Comparator<Integer> PRIORITIZED_TYPE_COMPARATOR = new Comparator<>() { Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +7 −0 Original line number Diff line number Diff line Loading @@ -2730,6 +2730,13 @@ public class NotificationManagerService extends SystemService { @Override public void onConfigChanged() { handleSavePolicyFile(); if (android.app.Flags.modesUiDndSlice()) { getContext().sendBroadcastAsUser( new Intent( NotificationManager.ACTION_ZEN_CONFIGURATION_CHANGED_INTERNAL) .addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT), UserHandle.ALL, android.Manifest.permission.MANAGE_NOTIFICATIONS); } } @Override Loading
services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +12 −0 Original line number Diff line number Diff line Loading @@ -11391,6 +11391,18 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { verify(mContext).sendBroadcastAsUser(eqIntent(expected), eq(UserHandle.of(mUserId))); } @Test @EnableFlags(android.app.Flags.FLAG_MODES_UI_DND_SLICE) public void onConfigChanged_sendsInternalZenChangedBroadcast() throws Exception { mService.mZenModeHelper.getCallbacks().forEach(c -> c.onConfigChanged()); Intent expected = new Intent(NotificationManager.ACTION_ZEN_CONFIGURATION_CHANGED_INTERNAL) .addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); verify(mContext).sendBroadcastAsUser(eqIntent(expected), eq(UserHandle.ALL), eq(android.Manifest.permission.MANAGE_NOTIFICATIONS)); } private static Intent isIntentWithAction(String wantedAction) { return argThat( intent -> intent != null && wantedAction.equals(intent.getAction())