Revert "Introduce SurfaceFlinger Queued Transaction"

This reverts commit 3e95285e5bc67a5e5a33ac72e3fff3f234b24de8.

Reason for revert: broken test b/169245126

Bug: 169245126

Change-Id: I9d4b01619433a31ad8d8b2698926599359322e83
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 4c95253..305dbf8 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -433,15 +433,13 @@
     struct TransactionState {
         TransactionState(const Vector<ComposerState>& composerStates,
                          const Vector<DisplayState>& displayStates, uint32_t transactionFlags,
-                         const InputWindowCommands& inputWindowCommands, int64_t desiredPresentTime,
-                         const client_cache_t& uncacheBuffer, int64_t postTime, bool privileged,
-                         bool hasListenerCallbacks,
+                         int64_t desiredPresentTime, const client_cache_t& uncacheBuffer,
+                         int64_t postTime, bool privileged, bool hasListenerCallbacks,
                          std::vector<ListenerCallbacks> listenerCallbacks, int originPID,
                          int originUID)
               : states(composerStates),
                 displays(displayStates),
                 flags(transactionFlags),
-                inputWindowCommands(inputWindowCommands),
                 desiredPresentTime(desiredPresentTime),
                 buffer(uncacheBuffer),
                 postTime(postTime),
@@ -454,7 +452,6 @@
         Vector<ComposerState> states;
         Vector<DisplayState> displays;
         uint32_t flags;
-        InputWindowCommands inputWindowCommands;
         const int64_t desiredPresentTime;
         client_cache_t buffer;
         const int64_t postTime;
@@ -707,7 +704,6 @@
     /*
      * Transactions
      */
-    void flushTransactionQueue();
     void applyTransactionState(const Vector<ComposerState>& state,
                                const Vector<DisplayState>& displays, uint32_t flags,
                                const InputWindowCommands& inputWindowCommands,
@@ -715,9 +711,10 @@
                                const client_cache_t& uncacheBuffer, const int64_t postTime,
                                bool privileged, bool hasListenerCallbacks,
                                const std::vector<ListenerCallbacks>& listenerCallbacks,
-                               int32_t originPID, int32_t originUID) REQUIRES(mStateLock);
-    // flush pending transaction that was presented after desiredPresentTime.
-    void flushPendingTransactionQueues();
+                               int originPID, int originUID, bool isMainThread = false)
+            REQUIRES(mStateLock);
+    // Returns true if at least one transaction was flushed
+    bool flushTransactionQueues();
     // Returns true if there is at least one transaction that needs to be flushed
     bool transactionFlushNeeded();
     uint32_t getTransactionFlags(uint32_t flags);
@@ -1161,10 +1158,8 @@
     uint32_t mTexturePoolSize = 0;
     std::vector<uint32_t> mTexturePool;
 
-    mutable Mutex mQueueLock;
-    std::unordered_map<sp<IBinder>, std::queue<TransactionState>, IListenerHash>
-            mPendingTransactionQueues GUARDED_BY(mQueueLock);
-    std::vector<TransactionState> mTransactionQueue GUARDED_BY(mQueueLock);
+    std::unordered_map<sp<IBinder>, std::queue<TransactionState>, IListenerHash> mTransactionQueues;
+
     /*
      * Feature prototyping
      */
@@ -1241,6 +1236,7 @@
     const float mEmulatedDisplayDensity;
 
     sp<os::IInputFlinger> mInputFlinger;
+    InputWindowCommands mPendingInputWindowCommands GUARDED_BY(mStateLock);
     // Should only be accessed by the main thread.
     InputWindowCommands mInputWindowCommands;