From 0ebd5f95b68a3a5c9e5509f21938c9e51e74d71b Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Wed, 19 Nov 2014 19:04:52 -0800 Subject: AudioSystem: fix cross deadlock Do not hold gLockAPS when calling AudioPolicyService::registerClient() in get_audio_policy_service(). registerClient() will need to acquire the AudioPolicyService mutex and if at the same time a method called from AudioPolicyService (with mutex held) calls back into AudioSystem and get_audio_policy_service() a cross deadlock occurs. Same preventive fix for get_audio_flinger(). Use a separate mutex for notification client list in AudioPolicyService. This prevents deadlocking if registerClient() is called as a consequence of AudioFlinger calling back into AudioPolicyManager while executing a method with AudioPolicyService locked Bug: 18403952. Bug: 18450065. Change-Id: Ia832e41aede8bc6c843fc615508fbdd74e0863b5 --- include/media/AudioSystem.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/media/AudioSystem.h b/include/media/AudioSystem.h index d54eca7..1614525 100644 --- a/include/media/AudioSystem.h +++ b/include/media/AudioSystem.h @@ -90,7 +90,7 @@ public: static void setErrorCallback(audio_error_callback cb); // helper function to obtain AudioFlinger service handle - static const sp& get_audio_flinger(); + static const sp get_audio_flinger(); static float linearToLog(int volume); static int logToLinear(float volume); @@ -270,7 +270,7 @@ public: // and output configuration cache (gOutputs) static void clearAudioConfigCache(); - static const sp& get_audio_policy_service(); + static const sp get_audio_policy_service(); // helpers for android.media.AudioManager.getProperty(), see description there for meaning static uint32_t getPrimaryOutputSamplingRate(); -- cgit v1.1