From dc38701d384887ef00167a3aedacd6aeb74b44b5 Mon Sep 17 00:00:00 2001 From: Oscar Azucena Date: Wed, 12 Jan 2022 20:09:32 -0800 Subject: [PATCH] Fixed silent mode alarm play at full volume During do not disturb mode, privilege alarms sometimes were not played at full volume. This was happening when alarm was disabled and the setting to play priviledge alarms at full volume was enabled. Specifically, the new event for device changed was decrementing the privilege alarm active count which was incremented during the playback start event. The device change event was resetting the count to zero, signaling that there were no more privilege active alarms and thus reducing the volume back to zero when it should have played at full volume. Bug: 211324401 Test: 1) Set volume to minimum for alarms 2) Enable do not disturb mode 3) Turn off alarm in do not disturb 4) Send ETWS text message 5) Alarm should be heard at full volume Change-Id: Id591975ef6bf1b72ab9a4d23e98c93603e0ab914 (cherry picked from commit de364ea6476c060a6449b842ef306c328d38929e) --- .../java/com/android/server/audio/PlaybackActivityMonitor.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java b/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java index b94cea4d5d401..40c8f1940bda0 100644 --- a/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java +++ b/services/core/java/com/android/server/audio/PlaybackActivityMonitor.java @@ -225,6 +225,9 @@ public final class PlaybackActivityMonitor AudioAttributes.FLAG_BYPASS_MUTE; private void checkVolumeForPrivilegedAlarm(AudioPlaybackConfiguration apc, int event) { + if (event == AudioPlaybackConfiguration.PLAYER_UPDATE_DEVICE_ID) { + return; + } if (event == AudioPlaybackConfiguration.PLAYER_STATE_STARTED || apc.getPlayerState() == AudioPlaybackConfiguration.PLAYER_STATE_STARTED) { if ((apc.getAudioAttributes().getAllFlags() & FLAGS_FOR_SILENCE_OVERRIDE)