Revert "Clear spam log for INPUT_FEATURE_NO_INPUT_CHANNEL window" am: 017bcd179d am: 58d24469ad am: 6112e05102 am: 87ed341f41
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/11974384
Change-Id: I27525310ecc854f70883e963e00a505625541436
diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp
index 9cb1ee6..91803c8 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.cpp
+++ b/services/inputflinger/dispatcher/InputDispatcher.cpp
@@ -3568,10 +3568,6 @@
sp<InputWindowHandle> InputDispatcher::getWindowHandleLocked(
const sp<IBinder>& windowHandleToken) const {
- if (windowHandleToken == nullptr) {
- return nullptr;
- }
-
for (auto& it : mWindowHandlesByDisplay) {
const std::vector<sp<InputWindowHandle>> windowHandles = it.second;
for (const sp<InputWindowHandle>& windowHandle : windowHandles) {
@@ -3583,22 +3579,21 @@
return nullptr;
}
-bool InputDispatcher::hasWindowHandleLocked(const sp<InputWindowHandle>& windowHandle,
- int32_t displayId) const {
- const std::vector<sp<InputWindowHandle>> windowHandles = getWindowHandlesLocked(displayId);
- for (const sp<InputWindowHandle>& handle : windowHandles) {
- if (handle->getId() == windowHandle->getId() &&
- handle->getToken() == windowHandle->getToken()) {
- if (handle->getInfo()->displayId != displayId) {
- ALOGE("Found window %s in display %" PRId32
- ", but it should belong to display %" PRId32,
- windowHandle->getName().c_str(), displayId,
- windowHandle->getInfo()->displayId);
+bool InputDispatcher::hasWindowHandleLocked(const sp<InputWindowHandle>& windowHandle) const {
+ for (auto& it : mWindowHandlesByDisplay) {
+ const std::vector<sp<InputWindowHandle>> windowHandles = it.second;
+ for (const sp<InputWindowHandle>& handle : windowHandles) {
+ if (handle->getToken() == windowHandle->getToken()) {
+ if (windowHandle->getInfo()->displayId != it.first) {
+ ALOGE("Found window %s in display %" PRId32
+ ", but it should belong to display %" PRId32,
+ windowHandle->getName().c_str(), it.first,
+ windowHandle->getInfo()->displayId);
+ }
+ return true;
}
- return true;
}
}
-
return false;
}
@@ -3758,7 +3753,7 @@
TouchState& state = stateIt->second;
for (size_t i = 0; i < state.windows.size();) {
TouchedWindow& touchedWindow = state.windows[i];
- if (!hasWindowHandleLocked(touchedWindow.windowHandle, displayId)) {
+ if (!hasWindowHandleLocked(touchedWindow.windowHandle)) {
if (DEBUG_FOCUS) {
ALOGD("Touched window was removed: %s in display %" PRId32,
touchedWindow.windowHandle->getName().c_str(), displayId);
@@ -3782,7 +3777,7 @@
// Otherwise, they might stick around until the window handle is destroyed
// which might not happen until the next GC.
for (const sp<InputWindowHandle>& oldWindowHandle : oldWindowHandles) {
- if (!hasWindowHandleLocked(oldWindowHandle, displayId)) {
+ if (!hasWindowHandleLocked(oldWindowHandle)) {
if (DEBUG_FOCUS) {
ALOGD("Window went away: %s", oldWindowHandle->getName().c_str());
}
diff --git a/services/inputflinger/dispatcher/InputDispatcher.h b/services/inputflinger/dispatcher/InputDispatcher.h
index 0f558b4..e679c6b 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.h
+++ b/services/inputflinger/dispatcher/InputDispatcher.h
@@ -301,8 +301,7 @@
sp<InputWindowHandle> getWindowHandleLocked(const sp<IBinder>& windowHandleToken) const
REQUIRES(mLock);
sp<InputChannel> getInputChannelLocked(const sp<IBinder>& windowToken) const REQUIRES(mLock);
- bool hasWindowHandleLocked(const sp<InputWindowHandle>& windowHandle, int32_t displayId) const
- REQUIRES(mLock);
+ bool hasWindowHandleLocked(const sp<InputWindowHandle>& windowHandle) const REQUIRES(mLock);
/*
* Validate and update InputWindowHandles for a given display.