Fix saving Policy with STATE_PRIORITY_CHANNELS_BLOCKED
The state field was always dropped in NM.setNotificationPolicy(). This was okay when the only bit in the state was STATE_CHANNELS_BYPASSING_DND, which cannot be set from outside NMS. However, STATE_PRIORITY_CHANNELS_BLOCKED can be -- although, as a hidden API, only from some callers. One subtlety is that we cannot just forward the state verbatim from the supplied Policy, because the caller likely doesn't know the current value of STATE_CHANNELS_BYPASSING_DND (in fact, with the NM.Policy <-> ZenPolicy conversion that Settings does, this value is outright dropped). Since ZenModeHelper will take the state (unless it's STATE_UNSET), NMS must be careful to merge the modifiable bits from the new Policy with the unmodifiable bits from the current Policy before passing it on. Fixes: 369721344 Test: atest NotificationManagerServiceTest Flag: android.app.modes_ui Change-Id: I71d81b32e4dda482f2e738582baba36a79efc19a
Loading
Please register or sign in to comment