summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorZach Jang <zachjang@google.com>2015-10-27 01:29:45 +0000
committerZach Jang <zachjang@google.com>2015-10-27 01:29:45 +0000
commit3994ffdd2c280aa5fad9f3c41255371cd545c7cf (patch)
treee815c94f3630142e34d22d8493cda4e8a95dc646 /services
parent26ce11a1dd2a9b70865aec1b42c365dd19172511 (diff)
downloadframeworks_av-3994ffdd2c280aa5fad9f3c41255371cd545c7cf.zip
frameworks_av-3994ffdd2c280aa5fad9f3c41255371cd545c7cf.tar.gz
frameworks_av-3994ffdd2c280aa5fad9f3c41255371cd545c7cf.tar.bz2
Revert "Revert "audio policy: bind setMode() and setPhoneState() operations""
This reverts commit 26ce11a1dd2a9b70865aec1b42c365dd19172511. Change-Id: I0affb97e7f2eb541ebd6f26c33e8f32261e9e221
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;