Loading core/java/android/app/NotificationManager.java +3 −3 Original line number Original line Diff line number Diff line Loading @@ -1638,7 +1638,7 @@ public class NotificationManager { @Override @Override public int hashCode() { public int hashCode() { return Objects.hash(priorityCategories, priorityCallSenders, priorityMessageSenders, return Objects.hash(priorityCategories, priorityCallSenders, priorityMessageSenders, suppressedVisualEffects); suppressedVisualEffects, state); } } @Override @Override Loading @@ -1650,10 +1650,10 @@ public class NotificationManager { && other.priorityCallSenders == priorityCallSenders && other.priorityCallSenders == priorityCallSenders && other.priorityMessageSenders == priorityMessageSenders && other.priorityMessageSenders == priorityMessageSenders && suppressedVisualEffectsEqual(suppressedVisualEffects, && suppressedVisualEffectsEqual(suppressedVisualEffects, other.suppressedVisualEffects); other.suppressedVisualEffects) && other.state == this.state; } } private boolean suppressedVisualEffectsEqual(int suppressedEffects, private boolean suppressedVisualEffectsEqual(int suppressedEffects, int otherSuppressedVisualEffects) { int otherSuppressedVisualEffects) { if (suppressedEffects == otherSuppressedVisualEffects) { if (suppressedEffects == otherSuppressedVisualEffects) { Loading services/core/java/com/android/server/audio/AudioService.java +13 −7 Original line number Original line Diff line number Diff line Loading @@ -3911,8 +3911,7 @@ public class AudioService extends IAudioService.Stub final boolean muteSystem = (zenPolicy.priorityCategories final boolean muteSystem = (zenPolicy.priorityCategories & NotificationManager.Policy.PRIORITY_CATEGORY_SYSTEM) == 0; & NotificationManager.Policy.PRIORITY_CATEGORY_SYSTEM) == 0; final boolean muteNotificationAndRing = ZenModeConfig final boolean muteNotificationAndRing = ZenModeConfig .areAllPriorityOnlyNotificationZenSoundsMuted( .areAllPriorityOnlyNotificationZenSoundsMuted(zenPolicy); mNm.getConsolidatedNotificationPolicy()); return muteAlarms && isAlarm(streamType) return muteAlarms && isAlarm(streamType) || muteMedia && isMedia(streamType) || muteMedia && isMedia(streamType) || muteSystem && isSystem(streamType) || muteSystem && isSystem(streamType) Loading @@ -3924,11 +3923,13 @@ public class AudioService extends IAudioService.Stub } } /** /** * DND total silence: media and alarms streams are tied to the muted ringer * Notifications, ringer and system sounds are controlled by the ringer: * {@link ZenModeHelper.RingerModeDelegate#getRingerModeAffectedStreams(int)} * {@link ZenModeHelper.RingerModeDelegate#getRingerModeAffectedStreams(int)} but can * DND alarms only: notification, ringer + system muted (by default tied to muted ringer mode) * also be muted by DND based on the DND mode: * DND priority only: alarms, media, system streams can be muted separate from ringer based on * DND total silence: media and alarms streams can be muted by DND * zenPolicy (this method determines which streams) * DND alarms only: no streams additionally controlled by DND * DND priority only: alarms, media, system, ringer and notification streams can be muted by * DND. The current applied zenPolicy determines which streams will be muted by DND. * @return true if changed, else false * @return true if changed, else false */ */ private boolean updateZenModeAffectedStreams() { private boolean updateZenModeAffectedStreams() { Loading @@ -3949,6 +3950,11 @@ public class AudioService extends IAudioService.Stub & NotificationManager.Policy.PRIORITY_CATEGORY_SYSTEM) == 0) { & NotificationManager.Policy.PRIORITY_CATEGORY_SYSTEM) == 0) { zenModeAffectedStreams |= 1 << AudioManager.STREAM_SYSTEM; zenModeAffectedStreams |= 1 << AudioManager.STREAM_SYSTEM; } } if (ZenModeConfig.areAllPriorityOnlyNotificationZenSoundsMuted(zenPolicy)) { zenModeAffectedStreams |= 1 << AudioManager.STREAM_NOTIFICATION; zenModeAffectedStreams |= 1 << AudioManager.STREAM_RING; } } } if (mZenModeAffectedStreams != zenModeAffectedStreams) { if (mZenModeAffectedStreams != zenModeAffectedStreams) { Loading services/tests/uiservicestests/src/com/android/server/notification/ZenModeConfigTest.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -98,7 +98,7 @@ public class ZenModeConfigTest extends UiServiceTestCase { suppressedVisualEffects |= Policy.SUPPRESSED_EFFECT_AMBIENT; suppressedVisualEffects |= Policy.SUPPRESSED_EFFECT_AMBIENT; Policy expectedPolicy = new Policy(priorityCategories, priorityCallSenders, Policy expectedPolicy = new Policy(priorityCategories, priorityCallSenders, priorityMessageSenders, suppressedVisualEffects); priorityMessageSenders, suppressedVisualEffects, 0); assertEquals(expectedPolicy, config.toNotificationPolicy(zenPolicy)); assertEquals(expectedPolicy, config.toNotificationPolicy(zenPolicy)); } } Loading Loading
core/java/android/app/NotificationManager.java +3 −3 Original line number Original line Diff line number Diff line Loading @@ -1638,7 +1638,7 @@ public class NotificationManager { @Override @Override public int hashCode() { public int hashCode() { return Objects.hash(priorityCategories, priorityCallSenders, priorityMessageSenders, return Objects.hash(priorityCategories, priorityCallSenders, priorityMessageSenders, suppressedVisualEffects); suppressedVisualEffects, state); } } @Override @Override Loading @@ -1650,10 +1650,10 @@ public class NotificationManager { && other.priorityCallSenders == priorityCallSenders && other.priorityCallSenders == priorityCallSenders && other.priorityMessageSenders == priorityMessageSenders && other.priorityMessageSenders == priorityMessageSenders && suppressedVisualEffectsEqual(suppressedVisualEffects, && suppressedVisualEffectsEqual(suppressedVisualEffects, other.suppressedVisualEffects); other.suppressedVisualEffects) && other.state == this.state; } } private boolean suppressedVisualEffectsEqual(int suppressedEffects, private boolean suppressedVisualEffectsEqual(int suppressedEffects, int otherSuppressedVisualEffects) { int otherSuppressedVisualEffects) { if (suppressedEffects == otherSuppressedVisualEffects) { if (suppressedEffects == otherSuppressedVisualEffects) { Loading
services/core/java/com/android/server/audio/AudioService.java +13 −7 Original line number Original line Diff line number Diff line Loading @@ -3911,8 +3911,7 @@ public class AudioService extends IAudioService.Stub final boolean muteSystem = (zenPolicy.priorityCategories final boolean muteSystem = (zenPolicy.priorityCategories & NotificationManager.Policy.PRIORITY_CATEGORY_SYSTEM) == 0; & NotificationManager.Policy.PRIORITY_CATEGORY_SYSTEM) == 0; final boolean muteNotificationAndRing = ZenModeConfig final boolean muteNotificationAndRing = ZenModeConfig .areAllPriorityOnlyNotificationZenSoundsMuted( .areAllPriorityOnlyNotificationZenSoundsMuted(zenPolicy); mNm.getConsolidatedNotificationPolicy()); return muteAlarms && isAlarm(streamType) return muteAlarms && isAlarm(streamType) || muteMedia && isMedia(streamType) || muteMedia && isMedia(streamType) || muteSystem && isSystem(streamType) || muteSystem && isSystem(streamType) Loading @@ -3924,11 +3923,13 @@ public class AudioService extends IAudioService.Stub } } /** /** * DND total silence: media and alarms streams are tied to the muted ringer * Notifications, ringer and system sounds are controlled by the ringer: * {@link ZenModeHelper.RingerModeDelegate#getRingerModeAffectedStreams(int)} * {@link ZenModeHelper.RingerModeDelegate#getRingerModeAffectedStreams(int)} but can * DND alarms only: notification, ringer + system muted (by default tied to muted ringer mode) * also be muted by DND based on the DND mode: * DND priority only: alarms, media, system streams can be muted separate from ringer based on * DND total silence: media and alarms streams can be muted by DND * zenPolicy (this method determines which streams) * DND alarms only: no streams additionally controlled by DND * DND priority only: alarms, media, system, ringer and notification streams can be muted by * DND. The current applied zenPolicy determines which streams will be muted by DND. * @return true if changed, else false * @return true if changed, else false */ */ private boolean updateZenModeAffectedStreams() { private boolean updateZenModeAffectedStreams() { Loading @@ -3949,6 +3950,11 @@ public class AudioService extends IAudioService.Stub & NotificationManager.Policy.PRIORITY_CATEGORY_SYSTEM) == 0) { & NotificationManager.Policy.PRIORITY_CATEGORY_SYSTEM) == 0) { zenModeAffectedStreams |= 1 << AudioManager.STREAM_SYSTEM; zenModeAffectedStreams |= 1 << AudioManager.STREAM_SYSTEM; } } if (ZenModeConfig.areAllPriorityOnlyNotificationZenSoundsMuted(zenPolicy)) { zenModeAffectedStreams |= 1 << AudioManager.STREAM_NOTIFICATION; zenModeAffectedStreams |= 1 << AudioManager.STREAM_RING; } } } if (mZenModeAffectedStreams != zenModeAffectedStreams) { if (mZenModeAffectedStreams != zenModeAffectedStreams) { Loading
services/tests/uiservicestests/src/com/android/server/notification/ZenModeConfigTest.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -98,7 +98,7 @@ public class ZenModeConfigTest extends UiServiceTestCase { suppressedVisualEffects |= Policy.SUPPRESSED_EFFECT_AMBIENT; suppressedVisualEffects |= Policy.SUPPRESSED_EFFECT_AMBIENT; Policy expectedPolicy = new Policy(priorityCategories, priorityCallSenders, Policy expectedPolicy = new Policy(priorityCategories, priorityCallSenders, priorityMessageSenders, suppressedVisualEffects); priorityMessageSenders, suppressedVisualEffects, 0); assertEquals(expectedPolicy, config.toNotificationPolicy(zenPolicy)); assertEquals(expectedPolicy, config.toNotificationPolicy(zenPolicy)); } } Loading