Clear all pending transactions on screen wakeup

If an app sets a transaction that modifies layer state, but does not get
committed by an SF composition cycle, we may end up dangling some
callbacks.  Temporary fix is to clear and send callbacks on wakeup

Bug: 141111965
Test: build, boot, manual
Change-Id: I781124c3f96174cefd5eb67e597c13f923df4fc1
diff --git a/services/surfaceflinger/TransactionCompletedThread.cpp b/services/surfaceflinger/TransactionCompletedThread.cpp
index 8db03db..c15355d 100644
--- a/services/surfaceflinger/TransactionCompletedThread.cpp
+++ b/services/surfaceflinger/TransactionCompletedThread.cpp
@@ -189,6 +189,15 @@
     return NO_ERROR;
 }
 
+void TransactionCompletedThread::clearAllPending() {
+    std::lock_guard lock(mMutex);
+    if (!mRunning) {
+        return;
+    }
+    mPendingTransactions.clear();
+    mConditionVariable.notify_all();
+}
+
 status_t TransactionCompletedThread::registerUnpresentedCallbackHandle(
         const sp<CallbackHandle>& handle) {
     std::lock_guard lock(mMutex);