diff options
author | Eric Laurent <elaurent@google.com> | 2016-09-07 16:58:39 -0700 |
---|---|---|
committer | gitbuildkicker <android-build@google.com> | 2016-09-27 15:56:39 -0700 |
commit | d8cf9aa813be5363fb5425b4f818a267edd5e750 (patch) | |
tree | 32dee67c0b6fd952baec8ca54bda27c1d9e67f16 /soundtrigger | |
parent | ace612c5f838944d1b88be18e317709e640becc2 (diff) | |
download | frameworks_av-d8cf9aa813be5363fb5425b4f818a267edd5e750.zip frameworks_av-d8cf9aa813be5363fb5425b4f818a267edd5e750.tar.gz frameworks_av-d8cf9aa813be5363fb5425b4f818a267edd5e750.tar.bz2 |
SoundTrigger: get service by value.
Get strong pointer to service interface by value and not reference to
prevent race conditions where the service pointer can be cleared
by another thread while in use.
Bug: 30907212
Change-Id: I6f02ec3fd1e6392b842b334e1cc4f9aa23916009
(cherry picked from commit 3b01b3019b1c62132792a1a94e2dc1f7cfc84f2e)
Diffstat (limited to 'soundtrigger')
-rw-r--r-- | soundtrigger/SoundTrigger.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/soundtrigger/SoundTrigger.cpp b/soundtrigger/SoundTrigger.cpp index 2138cb7..e959b83 100644 --- a/soundtrigger/SoundTrigger.cpp +++ b/soundtrigger/SoundTrigger.cpp @@ -55,7 +55,7 @@ namespace { sp<DeathNotifier> gDeathNotifier; }; // namespace anonymous -const sp<ISoundTriggerHwService>& SoundTrigger::getSoundTriggerHwService() +const sp<ISoundTriggerHwService> SoundTrigger::getSoundTriggerHwService() { Mutex::Autolock _l(gLock); if (gSoundTriggerHwService.get() == 0) { @@ -84,7 +84,7 @@ status_t SoundTrigger::listModules(struct sound_trigger_module_descriptor *modul uint32_t *numModules) { ALOGV("listModules()"); - const sp<ISoundTriggerHwService>& service = getSoundTriggerHwService(); + const sp<ISoundTriggerHwService> service = getSoundTriggerHwService(); if (service == 0) { return NO_INIT; } @@ -96,7 +96,7 @@ sp<SoundTrigger> SoundTrigger::attach(const sound_trigger_module_handle_t module { ALOGV("attach()"); sp<SoundTrigger> soundTrigger; - const sp<ISoundTriggerHwService>& service = getSoundTriggerHwService(); + const sp<ISoundTriggerHwService> service = getSoundTriggerHwService(); if (service == 0) { return soundTrigger; } @@ -116,7 +116,7 @@ sp<SoundTrigger> SoundTrigger::attach(const sound_trigger_module_handle_t module status_t SoundTrigger::setCaptureState(bool active) { ALOGV("setCaptureState(%d)", active); - const sp<ISoundTriggerHwService>& service = getSoundTriggerHwService(); + const sp<ISoundTriggerHwService> service = getSoundTriggerHwService(); if (service == 0) { return NO_INIT; } |