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

Commit 1d0a1193 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Use chrono duration for input-related code"

parents 0cf7f4da e3d1af6d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -61,8 +61,8 @@ bool NativeInputApplicationHandle::updateInfo() {

    mInfo.name = getStringField(env, obj, gInputApplicationHandleClassInfo.name, "<null>");

    mInfo.dispatchingTimeout = env->GetLongField(obj,
            gInputApplicationHandleClassInfo.dispatchingTimeoutNanos);
    mInfo.dispatchingTimeout = decltype(mInfo.dispatchingTimeout)(
            env->GetLongField(obj, gInputApplicationHandleClassInfo.dispatchingTimeoutNanos));

    jobject tokenObj = env->GetObjectField(obj,
            gInputApplicationHandleClassInfo.token);
+2 −2
Original line number Diff line number Diff line
@@ -117,8 +117,8 @@ bool NativeInputWindowHandle::updateInfo() {
            gInputWindowHandleClassInfo.layoutParamsFlags);
    mInfo.layoutParamsType = env->GetIntField(obj,
            gInputWindowHandleClassInfo.layoutParamsType);
    mInfo.dispatchingTimeout = env->GetLongField(obj,
            gInputWindowHandleClassInfo.dispatchingTimeoutNanos);
    mInfo.dispatchingTimeout = decltype(mInfo.dispatchingTimeout)(
            env->GetLongField(obj, gInputWindowHandleClassInfo.dispatchingTimeoutNanos));
    mInfo.frameLeft = env->GetIntField(obj,
            gInputWindowHandleClassInfo.frameLeft);
    mInfo.frameTop = env->GetIntField(obj,
+24 −26
Original line number Diff line number Diff line
@@ -236,29 +236,26 @@ public:

    /* --- InputDispatcherPolicyInterface implementation --- */

    virtual void notifySwitch(nsecs_t when, uint32_t switchValues, uint32_t switchMask,
    void notifySwitch(nsecs_t when, uint32_t switchValues, uint32_t switchMask,
                      uint32_t policyFlags) override;
    virtual void notifyConfigurationChanged(nsecs_t when);
    virtual nsecs_t notifyAnr(const sp<InputApplicationHandle>& inputApplicationHandle,
                              const sp<IBinder>& token, const std::string& reason) override;
    virtual void notifyInputChannelBroken(const sp<IBinder>& token);
    virtual void notifyFocusChanged(const sp<IBinder>& oldToken,
                                    const sp<IBinder>& newToken) override;
    virtual bool filterInputEvent(const InputEvent* inputEvent, uint32_t policyFlags) override;
    virtual void getDispatcherConfiguration(InputDispatcherConfiguration* outConfig) override;
    virtual void interceptKeyBeforeQueueing(const KeyEvent* keyEvent,
                                            uint32_t& policyFlags) override;
    virtual void interceptMotionBeforeQueueing(const int32_t displayId, nsecs_t when,
    void notifyConfigurationChanged(nsecs_t when) override;
    std::chrono::nanoseconds notifyAnr(const sp<InputApplicationHandle>& inputApplicationHandle,
                                       const sp<IBinder>& token,
                                       const std::string& reason) override;
    void notifyInputChannelBroken(const sp<IBinder>& token) override;
    void notifyFocusChanged(const sp<IBinder>& oldToken, const sp<IBinder>& newToken) override;
    bool filterInputEvent(const InputEvent* inputEvent, uint32_t policyFlags) override;
    void getDispatcherConfiguration(InputDispatcherConfiguration* outConfig) override;
    void interceptKeyBeforeQueueing(const KeyEvent* keyEvent, uint32_t& policyFlags) override;
    void interceptMotionBeforeQueueing(const int32_t displayId, nsecs_t when,
                                       uint32_t& policyFlags) override;
    virtual nsecs_t interceptKeyBeforeDispatching(const sp<IBinder>& token,
                                                  const KeyEvent* keyEvent,
    nsecs_t interceptKeyBeforeDispatching(const sp<IBinder>& token, const KeyEvent* keyEvent,
                                          uint32_t policyFlags) override;
    virtual bool dispatchUnhandledKey(const sp<IBinder>& token, const KeyEvent* keyEvent,
    bool dispatchUnhandledKey(const sp<IBinder>& token, const KeyEvent* keyEvent,
                              uint32_t policyFlags, KeyEvent* outFallbackKeyEvent) override;
    virtual void pokeUserActivity(nsecs_t eventTime, int32_t eventType) override;
    virtual bool checkInjectEventsPermissionNonReentrant(int32_t injectorPid,
                                                         int32_t injectorUid) override;
    virtual void onPointerDownOutsideFocus(const sp<IBinder>& touchedToken) override;
    void pokeUserActivity(nsecs_t eventTime, int32_t eventType) override;
    bool checkInjectEventsPermissionNonReentrant(int32_t injectorPid, int32_t injectorUid) override;
    void onPointerDownOutsideFocus(const sp<IBinder>& touchedToken) override;

    /* --- PointerControllerPolicyInterface implementation --- */

@@ -695,8 +692,9 @@ static jobject getInputApplicationHandleObjLocalRef(JNIEnv* env,
    return handle->getInputApplicationHandleObjLocalRef(env);
}

nsecs_t NativeInputManager::notifyAnr(const sp<InputApplicationHandle>& inputApplicationHandle,
                                      const sp<IBinder>& token, const std::string& reason) {
std::chrono::nanoseconds NativeInputManager::notifyAnr(
        const sp<InputApplicationHandle>& inputApplicationHandle, const sp<IBinder>& token,
        const std::string& reason) {
#if DEBUG_INPUT_DISPATCHER_POLICY
    ALOGD("notifyANR");
#endif
@@ -719,7 +717,7 @@ nsecs_t NativeInputManager::notifyAnr(const sp<InputApplicationHandle>& inputApp
    } else {
        assert(newTimeout >= 0);
    }
    return newTimeout;
    return std::chrono::nanoseconds(newTimeout);
}

void NativeInputManager::notifyInputChannelBroken(const sp<IBinder>& token) {