summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2015-09-16 15:49:30 -0700
committerChristian Bejram <cbejram@google.com>2015-10-16 16:49:31 -0700
commit9ddf1c76121caef55a05c537d6a9a1d76c1d17be (patch)
treee815c94f3630142e34d22d8493cda4e8a95dc646 /services
parent74ce88ff0f24a8c08fdab3a1140212183089c2b5 (diff)
downloadframeworks_av-9ddf1c76121caef55a05c537d6a9a1d76c1d17be.zip
frameworks_av-9ddf1c76121caef55a05c537d6a9a1d76c1d17be.tar.gz
frameworks_av-9ddf1c76121caef55a05c537d6a9a1d76c1d17be.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')
-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;