diff options
author | Eric Laurent <elaurent@google.com> | 2011-01-18 18:39:02 -0800 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2011-01-19 09:04:27 -0800 |
commit | 935752053ef2691dbb6d5a6d149e0e362c6e3c74 (patch) | |
tree | d0c6d5a1666aa6935a032a07d7c947bc8381a747 /services/audioflinger/AudioPolicyService.cpp | |
parent | de16890e98cdd241398ed155cd47daf061584a77 (diff) | |
download | frameworks_av-935752053ef2691dbb6d5a6d149e0e362c6e3c74.zip frameworks_av-935752053ef2691dbb6d5a6d149e0e362c6e3c74.tar.gz frameworks_av-935752053ef2691dbb6d5a6d149e0e362c6e3c74.tar.bz2 |
Tentative fix for issue 3362362.
The problem is likely that one method is called on the AudioPolicyManagerBase
instance while it is still being constructed by AudioPolicyService.
To avoid this, the AudioPolicyService mutex is held by the constructor until the
platform specific AudioPolicyManager is constructed and the member
mpPolicyManager initialized.
Also added an initCheck() method to AudioPolicyInterface to verify successful
initialization of AudioPolicyManager.
A similar change is done in AudioFlinger constructor.
Also added some missing protections in AudioFlinger methods where the
playback thread list is parsed.
Change-Id: I006b244ec057e1bb0aa5ebe426ef006e3b171056
Diffstat (limited to 'services/audioflinger/AudioPolicyService.cpp')
-rw-r--r-- | services/audioflinger/AudioPolicyService.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/services/audioflinger/AudioPolicyService.cpp b/services/audioflinger/AudioPolicyService.cpp index f24e08e..46a01ad 100644 --- a/services/audioflinger/AudioPolicyService.cpp +++ b/services/audioflinger/AudioPolicyService.cpp @@ -68,6 +68,8 @@ AudioPolicyService::AudioPolicyService() { char value[PROPERTY_VALUE_MAX]; + Mutex::Autolock _l(mLock); + // start tone playback thread mTonePlaybackThread = new AudioCommandThread(String8("")); // start audio commands thread @@ -88,9 +90,18 @@ AudioPolicyService::AudioPolicyService() } #endif - // load properties - property_get("ro.camera.sound.forced", value, "0"); - mpPolicyManager->setSystemProperty("ro.camera.sound.forced", value); + if ((mpPolicyManager != NULL) && (mpPolicyManager->initCheck() != NO_ERROR)) { + delete mpPolicyManager; + mpPolicyManager = NULL; + } + + if (mpPolicyManager == NULL) { + LOGE("Could not create AudioPolicyManager"); + } else { + // load properties + property_get("ro.camera.sound.forced", value, "0"); + mpPolicyManager->setSystemProperty("ro.camera.sound.forced", value); + } } AudioPolicyService::~AudioPolicyService() |