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

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

Merge "Use <chrono> for injectInputEvent timeout" into rvc-dev am: 9467e10d am: eac4741e

Change-Id: I1c24cae9ae5ba58829e8aa9dc594c428dd1b58f9
parents a6e2e819 eac4741e
Loading
Loading
Loading
Loading
+14 −6
Original line number Diff line number Diff line
@@ -1453,9 +1453,13 @@ static jint nativeInjectInputEvent(JNIEnv* env, jclass /* clazz */,
            return INPUT_EVENT_INJECTION_FAILED;
        }

        return (jint) im->getInputManager()->getDispatcher()->injectInputEvent(
                & keyEvent, injectorPid, injectorUid, syncMode, timeoutMillis,
        const int32_t result =
                im->getInputManager()->getDispatcher()->injectInputEvent(&keyEvent, injectorPid,
                                                                         injectorUid, syncMode,
                                                                         std::chrono::milliseconds(
                                                                                 timeoutMillis),
                                                                         uint32_t(policyFlags));
        return static_cast<jint>(result);
    } else if (env->IsInstanceOf(inputEventObj, gMotionEventClassInfo.clazz)) {
        const MotionEvent* motionEvent = android_view_MotionEvent_getNativePtr(env, inputEventObj);
        if (!motionEvent) {
@@ -1463,9 +1467,13 @@ static jint nativeInjectInputEvent(JNIEnv* env, jclass /* clazz */,
            return INPUT_EVENT_INJECTION_FAILED;
        }

        return (jint) im->getInputManager()->getDispatcher()->injectInputEvent(
                motionEvent, injectorPid, injectorUid, syncMode, timeoutMillis,
        const int32_t result =
                (jint)im->getInputManager()
                        ->getDispatcher()
                        ->injectInputEvent(motionEvent, injectorPid, injectorUid, syncMode,
                                           std::chrono::milliseconds(timeoutMillis),
                                           uint32_t(policyFlags));
        return static_cast<jint>(result);
    } else {
        jniThrowRuntimeException(env, "Invalid input event type.");
        return INPUT_EVENT_INJECTION_FAILED;