SurfaceFlinger: Send all BufferedLayers to InputFlinger

Currently if an InputWindow is obscured by a window with
FLAG_NO_INPUT_CHANNEL or a Surface with no window (and input) at all
then InputDispatcher will not be aware of the window and it will
fail to generate FLAG_(PARTIALLY)_OCLUDED for windows underneath. To fix
this we make sure we generate an InputWindow for every buffered
element on the screen and make them all known to InputDispatcher.

Bug: 152064592
Test: ObscuredInputTests
Change-Id: I90a813be9b650dceb0a20ffbf33aa27f95d38771
diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp
index 1dbcf98..e8cadee 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.cpp
+++ b/services/inputflinger/dispatcher/InputDispatcher.cpp
@@ -3653,7 +3653,8 @@
             continue;
         }
 
-        if (oldHandlesById.find(handle->getId()) != oldHandlesById.end()) {
+        if ((oldHandlesById.find(handle->getId()) != oldHandlesById.end()) &&
+                (oldHandlesById.at(handle->getId())->getToken() == handle->getToken())) {
             const sp<InputWindowHandle>& oldHandle = oldHandlesById.at(handle->getId());
             oldHandle->updateFrom(handle);
             newHandles.push_back(oldHandle);