diff options
| author | 2021-03-12 04:18:38 +0000 | |
|---|---|---|
| committer | 2021-03-12 04:18:38 +0000 | |
| commit | b6957c6cf7676a90d9c091bf6bed33ed33a9652a (patch) | |
| tree | eb5a7d026bfe311656d6ddff92984b226113104f | |
| parent | 4bda0f54d87d15356f7589600e0c9dbaf6f7a060 (diff) | |
Revert "Update the usage of receiveFinishedSignal"
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: Idb3a44b4a920b1482375e26466cd81e3877f3898
| -rw-r--r-- | core/jni/android_view_InputEventSender.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/core/jni/android_view_InputEventSender.cpp b/core/jni/android_view_InputEventSender.cpp index 96326f591998..9746a07a1b77 100644 --- a/core/jni/android_view_InputEventSender.cpp +++ b/core/jni/android_view_InputEventSender.cpp @@ -34,8 +34,6 @@ #include "core_jni_helpers.h" -using android::base::Result; - namespace android { // Log debug messages about the dispatch cycle. @@ -199,9 +197,16 @@ status_t NativeInputEventSender::receiveFinishedSignals(JNIEnv* env) { ScopedLocalRef<jobject> senderObj(env, NULL); bool skipCallbacks = false; for (;;) { - Result<InputPublisher::Finished> result = mInputPublisher.receiveFinishedSignal(); - if (!result.ok()) { - const status_t status = result.error().code(); + uint32_t publishedSeq; + bool handled; + std::function<void(uint32_t seq, bool handled, nsecs_t consumeTime)> callback = + [&publishedSeq, &handled](uint32_t inSeq, bool inHandled, + nsecs_t inConsumeTime) -> void { + publishedSeq = inSeq; + handled = inHandled; + }; + status_t status = mInputPublisher.receiveFinishedSignal(callback); + if (status) { if (status == WOULD_BLOCK) { return OK; } @@ -210,7 +215,7 @@ status_t NativeInputEventSender::receiveFinishedSignals(JNIEnv* env) { return status; } - auto it = mPublishedSeqMap.find(result->seq); + auto it = mPublishedSeqMap.find(publishedSeq); if (it == mPublishedSeqMap.end()) { continue; } @@ -220,9 +225,9 @@ status_t NativeInputEventSender::receiveFinishedSignals(JNIEnv* env) { if (kDebugDispatchCycle) { ALOGD("channel '%s' ~ Received finished signal, seq=%u, handled=%s, " - "pendingEvents=%zu.", - getInputChannelName().c_str(), seq, result->handled ? "true" : "false", - mPublishedSeqMap.size()); + "pendingEvents=%zu.", + getInputChannelName().c_str(), seq, handled ? "true" : "false", + mPublishedSeqMap.size()); } if (!skipCallbacks) { @@ -236,9 +241,8 @@ status_t NativeInputEventSender::receiveFinishedSignals(JNIEnv* env) { } env->CallVoidMethod(senderObj.get(), - gInputEventSenderClassInfo.dispatchInputEventFinished, - static_cast<jint>(result->seq), - static_cast<jboolean>(result->handled)); + gInputEventSenderClassInfo.dispatchInputEventFinished, + jint(seq), jboolean(handled)); if (env->ExceptionCheck()) { ALOGE("Exception dispatching finished signal."); skipCallbacks = true; |