system/core
Révision | f6a78079a81a177a3edebc9980829cbf39bf6655 (tree) |
---|---|
l'heure | 2017-06-28 07:39:52 |
Auteur | android-build-team Robot <android-build-team-robot@goog...> |
Commiter | android-build-team Robot |
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-release
Change-Id: Iaeea349ef72436af0b5da51537514d4fc64cbce0
@@ -36,9 +36,19 @@ void BatteryPropertiesRegistrar::publish( | ||
36 | 36 | } |
37 | 37 | |
38 | 38 | void BatteryPropertiesRegistrar::notifyListeners(const struct BatteryProperties& props) { |
39 | - Mutex::Autolock _l(mRegistrationLock); | |
40 | - for (size_t i = 0; i < mListeners.size(); i++) { | |
41 | - mListeners[i]->batteryPropertiesChanged(props); | |
39 | + Vector<sp<IBatteryPropertiesListener> > listenersCopy; | |
40 | + | |
41 | + // Binder currently may service an incoming oneway transaction whenever an | |
42 | + // outbound oneway call is made (if there is already a pending incoming | |
43 | + // oneway call waiting). This is considered a bug and may change in the | |
44 | + // future. For now, avoid recursive mutex lock while making outbound | |
45 | + // calls by making a local copy of the current list of listeners. | |
46 | + { | |
47 | + Mutex::Autolock _l(mRegistrationLock); | |
48 | + listenersCopy = mListeners; | |
49 | + } | |
50 | + for (size_t i = 0; i < listenersCopy.size(); i++) { | |
51 | + listenersCopy[i]->batteryPropertiesChanged(props); | |
42 | 52 | } |
43 | 53 | } |
44 | 54 |