From be737674afd67f67e7053d3c0c87ed5dc61f052d Mon Sep 17 00:00:00 2001 From: arthurhung Date: Wed, 24 Jun 2020 12:29:21 +0800 Subject: Clear spam log for INPUT_FEATURE_NO_INPUT_CHANNEL window Currently, in order to detect occlusion input, all buffered layers would update input info into InputFlinger, so the window may contain null token, we should check if id is also identical to prevent get the wrong result Bug: 159349058 Test: Enable show tap, open bubble and watch logs. Change-Id: I8412812e9b100988ab380ad64366f2548e50d9e5 --- services/inputflinger/dispatcher/InputDispatcher.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'services/inputflinger') diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp index f011992daa..fe016af01f 100644 --- a/services/inputflinger/dispatcher/InputDispatcher.cpp +++ b/services/inputflinger/dispatcher/InputDispatcher.cpp @@ -3569,6 +3569,10 @@ std::vector> InputDispatcher::getWindowHandlesLocked( sp InputDispatcher::getWindowHandleLocked( const sp& windowHandleToken) const { + if (windowHandleToken == nullptr) { + return nullptr; + } + for (auto& it : mWindowHandlesByDisplay) { const std::vector> windowHandles = it.second; for (const sp& windowHandle : windowHandles) { @@ -3584,7 +3588,8 @@ bool InputDispatcher::hasWindowHandleLocked(const sp& windowH for (auto& it : mWindowHandlesByDisplay) { const std::vector> windowHandles = it.second; for (const sp& handle : windowHandles) { - if (handle->getToken() == windowHandle->getToken()) { + if (handle->getId() == windowHandle->getId() && + handle->getToken() == windowHandle->getToken()) { if (windowHandle->getInfo()->displayId != it.first) { ALOGE("Found window %s in display %" PRId32 ", but it should belong to display %" PRId32, -- cgit v1.2.3-59-g8ed1b