Sever the link to inputflinger when system_server crashes

When system_server and inputflinger goes down, we want to clear the
reference to the inputflinger service. This prevent SF making any
invalid binder calls to input. Instead the input commands will be queued up
and sent when system_server recovers via SurfaceFlinger::bootFinished
signal.

Test: adb shell su root kill `pid system_server` & check we have a focused window when the server recovers
Fixes: 181246754
Bug: 171130500
Change-Id: Id9091a29b651e4ceece30c3b81b9708262132787
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 6a98e36..9518f61 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -496,6 +496,9 @@
     // the window manager died on us. prepare its eulogy.
     mBootFinished = false;
 
+    // Sever the link to inputflinger since its gone as well.
+    static_cast<void>(schedule([=] { mInputFlinger = nullptr; }));
+
     // restore initial conditions (default device unblank, etc)
     initializeDisplays();