Skip waiting for idle if the message queue is already idle

Bug: 142514365
Change-Id: I22eb94c234766a40eac4c8dcc33d204b2417c2d6
This commit is contained in:
Winson Chung committed 2019-10-17 22:51:40 -07:00
1 parent dfd8b5e07d
commit cebfec6245
2 files changed
+9 -8

No files matched your search

@@ -300,8 +300,8 @@ public abstract class BaseLoaderResults {
public LooperIdleLock newIdleLock(Object lock) {
LooperIdleLock idleLock = new LooperIdleLock(lock, Looper.getMainLooper());
// If we are not binding, there is no reason to wait for idle.
if (mCallbacks.get() == null) {
// If we are not binding or if the main looper is already idle, there is no reason to wait
if (mCallbacks.get() == null || Looper.getMainLooper().getQueue().isIdle()) {
idleLock.queueIdle();
}
return idleLock;