SurfaceFlinger: Ensure syncInputWindows is processed.
Imagine the following situation:
1. We set mPendingInputWindowCommands.syncInputWindows = true, and block
on the condition variable from a binder thread.
2. We Handle MessageQueue::INVALIDATE
3. This will invoke handleTransaction which will copy
mPendingInputWindowCommands to mInputWindowCommands and clear
mPendingInputWindowCommands
4. Now imagine due to the performSetActiveConfig conditional in
MessageQueue::INVALIDATE handler we break out of our handling
before calling updateInputFlinger.
5. Since we didn't call updateInputFlinger we will never receive
setInputWindowsFinished and the condition variable is still blocking
6. The next time we enter MessageQueue::INVALIDATE we have already cleared
mPendingInput WindowCommands, and so by the time we get to
updateInputFligner we no longer think a sync is required and don't request
the callback.
7. No callback ever arrives, our binder thread blocks for the whole 5 seconds.
To fix this we just ensure mInputWindowCommands.syncInputWindows wont become
false after becoming true until we actually are sure we will broadcast
the condition variable.
Bug: 147257069
Test: Existing tests pass
Change-Id: I5f5728c29f36bb5e0bdf11b3f34e956bb529706f
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index ffb8ae9..28c6eaf 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -2808,7 +2808,7 @@
}
void SurfaceFlinger::commitInputWindowCommands() {
- mInputWindowCommands = mPendingInputWindowCommands;
+ mInputWindowCommands.merge(mPendingInputWindowCommands);
mPendingInputWindowCommands.clear();
}
@@ -5783,6 +5783,7 @@
Mutex::Autolock _l(mStateLock);
mPendingSyncInputWindows = false;
+
mTransactionCV.broadcast();
}