summaryrefslogtreecommitdiffstats
path: root/services/audiopolicy/service
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2015-09-16 15:49:30 -0700
committerEric Laurent <elaurent@google.com>2015-09-16 15:49:30 -0700
commitbeb07febdc0cae2f43a2008d3bd06b7bb933b19a (patch)
tree889fadf6fd8136b134f397010846c6b0334415b3 /services/audiopolicy/service
parent20baac2a934e9d968832a44809eecc8c46c17fe2 (diff)
downloadframeworks_av-beb07febdc0cae2f43a2008d3bd06b7bb933b19a.zip
frameworks_av-beb07febdc0cae2f43a2008d3bd06b7bb933b19a.tar.gz
frameworks_av-beb07febdc0cae2f43a2008d3bd06b7bb933b19a.tar.bz2
audio policy: bind setMode() and setPhoneState() operations
No routing operation should be allowed between setMode() and setPhoneState() when starting a call as the audio HAL relies on a precise sequence of mode change and routing change to select the initial audio device for the call. Bug: 24083591. Change-Id: I2d5ef62c11cf7aedc2ec7ca5e5fadd7ac875afbc
Diffstat (limited to 'services/audiopolicy/service')
-rw-r--r--services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp b/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
index 793c26a..ca365a5 100644
--- a/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
+++ b/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
@@ -76,10 +76,14 @@ status_t AudioPolicyService::setPhoneState(audio_mode_t state)
ALOGV("setPhoneState()");
+ // acquire lock before calling setMode() so that setMode() + setPhoneState() are an atomic
+ // operation from policy manager standpoint (no other operation (e.g track start or stop)
+ // can be interleaved).
+ Mutex::Autolock _l(mLock);
+
// TODO: check if it is more appropriate to do it in platform specific policy manager
AudioSystem::setMode(state);
- Mutex::Autolock _l(mLock);
mAudioPolicyManager->setPhoneState(state);
mPhoneState = state;
return NO_ERROR;