Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 30f699bc authored by Siarhei Vishniakou's avatar Siarhei Vishniakou Committed by Automerger Merge Worker
Browse files

Merge "Revert "Update the usage of receiveFinishedSignal"" into sc-dev am: 99942809

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13838212

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I1d7f63d5832646cecd5d81855a6d305ac4f518a6
parents 7603b544 99942809
Loading
Loading
Loading
Loading
+16 −12
Original line number Diff line number Diff line
@@ -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;
        }
@@ -221,7 +226,7 @@ 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",
                    getInputChannelName().c_str(), seq, handled ? "true" : "false",
                    mPublishedSeqMap.size());
        }

@@ -237,8 +242,7 @@ status_t NativeInputEventSender::receiveFinishedSignals(JNIEnv* env) {

            env->CallVoidMethod(senderObj.get(),
                    gInputEventSenderClassInfo.dispatchInputEventFinished,
                                static_cast<jint>(result->seq),
                                static_cast<jboolean>(result->handled));
                    jint(seq), jboolean(handled));
            if (env->ExceptionCheck()) {
                ALOGE("Exception dispatching finished signal.");
                skipCallbacks = true;