diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2017-06-27 22:39:52 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2017-06-27 22:39:52 +0000 |
commit | f6a78079a81a177a3edebc9980829cbf39bf6655 (patch) | |
tree | 28fe1f14a63d898dbac17b7b1ce7419009c734c8 | |
parent | 509678ce9efa2824092d3c2ddca04b8f88f31f61 (diff) | |
parent | 05807fa1afd29f8c93bf8525280ddf21e58e89d4 (diff) | |
download | core-f6a78079a81a177a3edebc9980829cbf39bf6655.tar.gz |
Merge cherrypicks of [2467803, 2467786, 2467717, 2467598, 2467823, 2467734, 2467671, 2467718, 2467599, 2467753, 2467672, 2467600, 2467735, 2467841, 2467638, 2467824, 2467736, 2467754, 2467737, 2467674] into oc-releaseandroid-cts-8.0_r1android-8.0.0_r9android-8.0.0_r7android-8.0.0_r4android-8.0.0_r3android-8.0.0_r2android-8.0.0_r17android-8.0.0_r16android-8.0.0_r15android-8.0.0_r13android-8.0.0_r12android-8.0.0_r11android-8.0.0_r10android-8.0.0_r1
Change-Id: Iaeea349ef72436af0b5da51537514d4fc64cbce0
-rw-r--r-- | healthd/BatteryPropertiesRegistrar.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/healthd/BatteryPropertiesRegistrar.cpp b/healthd/BatteryPropertiesRegistrar.cpp index 523e1f136..e51a06d5e 100644 --- a/healthd/BatteryPropertiesRegistrar.cpp +++ b/healthd/BatteryPropertiesRegistrar.cpp @@ -36,9 +36,19 @@ void BatteryPropertiesRegistrar::publish( } void BatteryPropertiesRegistrar::notifyListeners(const struct BatteryProperties& props) { - Mutex::Autolock _l(mRegistrationLock); - for (size_t i = 0; i < mListeners.size(); i++) { - mListeners[i]->batteryPropertiesChanged(props); + Vector<sp<IBatteryPropertiesListener> > listenersCopy; + + // Binder currently may service an incoming oneway transaction whenever an + // outbound oneway call is made (if there is already a pending incoming + // oneway call waiting). This is considered a bug and may change in the + // future. For now, avoid recursive mutex lock while making outbound + // calls by making a local copy of the current list of listeners. + { + Mutex::Autolock _l(mRegistrationLock); + listenersCopy = mListeners; + } + for (size_t i = 0; i < listenersCopy.size(); i++) { + listenersCopy[i]->batteryPropertiesChanged(props); } } |