am 772c7b82: am 903ebd15: am 56d82dd2: BatteryStats: Fix deadlock

* commit '772c7b82aedb4eb2103aa17cdbdc7131e214eef7':
  BatteryStats: Fix deadlock
This commit is contained in:
Adam Lesinski
2015-07-15 01:08:26 +00:00
committed by Android Git Automerger

View File

@@ -101,8 +101,12 @@ public final class BatteryStatsService extends IBatteryStats.Stub
mUpdateFlags = 0;
}
updateExternalStats((String)msg.obj, updateFlags);
synchronized (this) {
synchronized (mStats) {
// other parts of the system could be calling into us
// from mStats in order to report of changes. We must grab the mStats
// lock before grabbing our own or we'll end up in a deadlock.
synchronized (mStats) {
synchronized (this) {
final int numUidsToRemove = mUidsToRemove.size();
for (int i = 0; i < numUidsToRemove; i++) {
mStats.removeIsolatedUidLocked(mUidsToRemove.get(i));