SF: Update InputFlinger outside main thread

Avoids parceling data inside  main thread and hot path. Also
avoids any binder contention with one way binder calls. See
bug for more details.

Re landing with the following changes:
Don't discard input commands if input dispatcher is not
available. This can happen if system server crashes and
recovers. We want to keep input commands until
input dispatcher becomes available.

Bug: 206380308
Test: presubmit
Test: systrace
Test: flickertests
Test: health/microbench/display/microbench-test-suite
Change-Id: If0344abdeb28c8a409eb2f641c1e78d53e6f59b2
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 9794639..49fbb15 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -690,7 +690,8 @@
     void updateLayerGeometry();
 
     void updateInputFlinger();
-    void notifyWindowInfos();
+    void buildWindowInfos(std::vector<gui::WindowInfo>& outWindowInfos,
+                          std::vector<gui::DisplayInfo>& outDisplayInfos);
     void commitInputWindowCommands() REQUIRES(mStateLock);
     void updateCursorAsync();
 
@@ -1294,8 +1295,8 @@
     const float mInternalDisplayDensity;
     const float mEmulatedDisplayDensity;
 
-    sp<os::IInputFlinger> mInputFlinger;
     // Should only be accessed by the main thread.
+    sp<os::IInputFlinger> mInputFlinger;
     InputWindowCommands mInputWindowCommands;
 
     Hwc2::impl::PowerAdvisor mPowerAdvisor;