Revert "Use Result<InputPublisher::Finished> instead of callback"
Revert submission 13780058-receiveFinishedSignal
Reason for revert:
Caused severe delay in back navigation on IME-focusable window.
Reverted Changes:
I301c6e9c3:Use Result<InputPublisher::Finished> instead of ca...
I43a0f2d31:Update the usage of receiveFinishedSignal
Bug: 167947340
Fix: 182514338
Test: Manually verified as follows:
1. Set up the device as "Set up offline" mode.
2. adb shell am start -n com.google.android.dialer/.extensions.GoogleDialtactsActivity
3. On one terminal, run adb logcat -s InputMethodManager:*
4. On another terminal, run adb shell input keyevent 4
5. Make sure that the following message is not shown.
"Timeout waiting for IME to handle input event after 2500 ms"
Change-Id: I1e71010f5f4ae268dfcbc3bde50881c2fa3d51d5
diff --git a/libs/input/InputTransport.cpp b/libs/input/InputTransport.cpp
index c2a3cf1..6ef0173 100644
--- a/libs/input/InputTransport.cpp
+++ b/libs/input/InputTransport.cpp
@@ -629,26 +629,24 @@
return mChannel->sendMessage(&msg);
}
-android::base::Result<InputPublisher::Finished> InputPublisher::receiveFinishedSignal() {
+status_t InputPublisher::receiveFinishedSignal(
+ const std::function<void(uint32_t seq, bool handled, nsecs_t consumeTime)>& callback) {
if (DEBUG_TRANSPORT_ACTIONS) {
- ALOGD("channel '%s' publisher ~ %s", mChannel->getName().c_str(), __func__);
+ ALOGD("channel '%s' publisher ~ receiveFinishedSignal", mChannel->getName().c_str());
}
InputMessage msg;
status_t result = mChannel->receiveMessage(&msg);
if (result) {
- return android::base::Error(result);
+ return result;
}
if (msg.header.type != InputMessage::Type::FINISHED) {
ALOGE("channel '%s' publisher ~ Received unexpected %s message from consumer",
mChannel->getName().c_str(), NamedEnum::string(msg.header.type).c_str());
- return android::base::Error(UNKNOWN_ERROR);
+ return UNKNOWN_ERROR;
}
- return Finished{
- .seq = msg.header.seq,
- .handled = msg.body.finished.handled,
- .consumeTime = msg.body.finished.consumeTime,
- };
+ callback(msg.header.seq, msg.body.finished.handled, msg.body.finished.consumeTime);
+ return OK;
}
// --- InputConsumer ---