From 852cd7d7d4734081162ea7be8650bbbcfd3a862b Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Tue, 25 Aug 2020 17:49:15 -0700 Subject: [PATCH] audio service: add watchdog for audio mode Add a watchdog to remove an application from the audio mode owner stack if it has requested mode IN_COMMUNICATION and has not been playing or capturing audio for more than 3 seconds. This will prevent volume, routing and recording issues when misbehaving apps do not properly reset the audio mode at the end of a call. Bug: 161564483 Test: Manual regression tests for VoIP use cases Change-Id: I7c6f57a2c9a6c31d107a1bba2d7dfac6e3f275bd --- services/core/java/com/android/server/audio/AudioService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java index d59780d7f6099..3f29eb5636eaf 100755 --- a/services/core/java/com/android/server/audio/AudioService.java +++ b/services/core/java/com/android/server/audio/AudioService.java @@ -6528,8 +6528,8 @@ public class AudioService extends IAudioService.Stub CHECK_MODE_FOR_UID_PERIOD_MS); break; } - // For now just log the fact that an app is hogging the audio mode. - // TODO(b/160260850): remove abusive app from audio mode stack. + setModeInt(AudioSystem.MODE_NORMAL, h.getBinder(), h.getPid(), h.getUid(), + h.isPrivileged(), "MSG_CHECK_MODE_FOR_UID"); mModeLogger.log(new PhoneStateEvent(h.getPackage(), h.getPid())); } break;