summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorZach Jang <zachjang@google.com>2015-10-27 02:33:12 +0000
committerandroid-build-merger <android-build-merger@google.com>2015-10-27 02:33:12 +0000
commitf6224dece52c569e27322580407c3f5898fa042b (patch)
treeb7182ca18dcb96894fdad365403b17f12a3908c7 /services
parent8c5b71ce473517ea1270f6467fa518274bd54b35 (diff)
parent681bc45d2592ed447f70d1dd14e92ad584499c9d (diff)
downloadframeworks_av-f6224dece52c569e27322580407c3f5898fa042b.zip
frameworks_av-f6224dece52c569e27322580407c3f5898fa042b.tar.gz
frameworks_av-f6224dece52c569e27322580407c3f5898fa042b.tar.bz2
Merge "Revert "Revert "audio policy: bind setMode() and setPhoneState() operations""" into mnc-dev
am: 681bc45d25 * commit '681bc45d2592ed447f70d1dd14e92ad584499c9d': Revert "Revert "audio policy: bind setMode() and setPhoneState() operations""
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;