summaryrefslogtreecommitdiff
path: root/services/inputflinger
diff options
context:
space:
mode:
Diffstat (limited to 'services/inputflinger')
-rw-r--r--services/inputflinger/dispatcher/InputDispatcher.cpp15
-rw-r--r--services/inputflinger/dispatcher/InputDispatcher.h6
2 files changed, 8 insertions, 13 deletions
diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp
index 4c8147df2c..9efe74de6c 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.cpp
+++ b/services/inputflinger/dispatcher/InputDispatcher.cpp
@@ -4235,13 +4235,8 @@ void InputDispatcher::synthesizePointerDownEventsForConnectionLocked(
<< "channel '" << connection->getInputChannelName() << "' ~ Synthesized "
<< downEvents.size() << " down events to ensure consistent event stream.";
- auto touchedWindowHandleAndDisplay =
- mTouchStates.findTouchedWindowHandleAndDisplay(connection->getToken());
- if (!touchedWindowHandleAndDisplay.has_value()) {
- LOG(FATAL) << __func__ << ": Touch state is out of sync: No touched window for token";
- }
-
- const auto [windowHandle, displayId] = touchedWindowHandleAndDisplay.value();
+ const auto [windowHandle, displayId] =
+ mTouchStates.findExistingTouchedWindowHandleAndDisplay(connection->getToken());
const bool wasEmpty = connection->outboundQueue.empty();
for (std::unique_ptr<EventEntry>& downEventEntry : downEvents) {
@@ -7397,8 +7392,8 @@ bool InputDispatcher::DispatcherTouchState::isPointerInWindow(const sp<android::
return false;
}
-std::optional<std::tuple<const sp<gui::WindowInfoHandle>&, ui::LogicalDisplayId>>
-InputDispatcher::DispatcherTouchState::findTouchedWindowHandleAndDisplay(
+std::tuple<const sp<gui::WindowInfoHandle>&, ui::LogicalDisplayId>
+InputDispatcher::DispatcherTouchState::findExistingTouchedWindowHandleAndDisplay(
const sp<android::IBinder>& token) const {
for (const auto& [displayId, state] : mTouchStatesByDisplay) {
for (const TouchedWindow& w : state.windows) {
@@ -7407,7 +7402,7 @@ InputDispatcher::DispatcherTouchState::findTouchedWindowHandleAndDisplay(
}
}
}
- return std::nullopt;
+ LOG_ALWAYS_FATAL("%s : Touch state is out of sync: No touched window for token", __func__);
}
void InputDispatcher::DispatcherTouchState::forAllTouchedWindows(
diff --git a/services/inputflinger/dispatcher/InputDispatcher.h b/services/inputflinger/dispatcher/InputDispatcher.h
index e76bd8970f..db7ebfd4e3 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.h
+++ b/services/inputflinger/dispatcher/InputDispatcher.h
@@ -396,9 +396,9 @@ private:
bool isPointerInWindow(const sp<android::IBinder>& token, ui::LogicalDisplayId displayId,
DeviceId deviceId, int32_t pointerId) const;
- // Find touched windowHandle and display by token.
- std::optional<std::tuple<const sp<gui::WindowInfoHandle>&, ui::LogicalDisplayId>>
- findTouchedWindowHandleAndDisplay(const sp<IBinder>& token) const;
+ // Find an existing touched windowHandle and display by token.
+ std::tuple<const sp<gui::WindowInfoHandle>&, ui::LogicalDisplayId>
+ findExistingTouchedWindowHandleAndDisplay(const sp<IBinder>& token) const;
void forAllTouchedWindows(std::function<void(const sp<gui::WindowInfoHandle>&)> f) const;