Merge "Don't hold the battery stats lock while waiting for completion"

This commit is contained in:
Jing Ji
2020-09-21 23:34:40 +00:00
committed by Android (Google) Code Review

View File

@@ -276,15 +276,13 @@ public final class BatteryStatsService extends IBatteryStats.Stub
}
private void awaitCompletion() {
synchronized (mLock) {
final CountDownLatch latch = new CountDownLatch(1);
mHandler.post(() -> {
latch.countDown();
});
try {
latch.await();
} catch (InterruptedException e) {
}
final CountDownLatch latch = new CountDownLatch(1);
mHandler.post(() -> {
latch.countDown();
});
try {
latch.await();
} catch (InterruptedException e) {
}
}