Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 3aef8236 authored by Matías Hernández's avatar Matías Hernández
Browse files

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
parent 6f273d49
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment