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

Commit 92f6ebac authored by Yeabkal Wubshit's avatar Yeabkal Wubshit Committed by Android (Google) Code Review
Browse files

Merge "Pass input source and action in interceptMotionBeforeQueueing" into main

parents e9ef6bc8 88a90414
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -4449,7 +4449,8 @@ void InputDispatcher::notifyMotion(const NotifyMotionArgs& args) {
    policyFlags |= POLICY_FLAG_TRUSTED;

    android::base::Timer t;
    mPolicy.interceptMotionBeforeQueueing(args.displayId, args.eventTime, policyFlags);
    mPolicy.interceptMotionBeforeQueueing(args.displayId, args.source, args.action, args.eventTime,
                                          policyFlags);
    if (t.duration() > SLOW_INTERCEPTION_THRESHOLD) {
        ALOGW("Excessive delay in interceptMotionBeforeQueueing; took %s ms",
              std::to_string(t.duration().count()).c_str());
@@ -4710,7 +4711,9 @@ InputEventInjectionResult InputDispatcher::injectInputEvent(const InputEvent* ev
            if (!(policyFlags & POLICY_FLAG_FILTERED)) {
                nsecs_t eventTime = motionEvent.getEventTime();
                android::base::Timer t;
                mPolicy.interceptMotionBeforeQueueing(displayId, eventTime, /*byref*/ policyFlags);
                mPolicy.interceptMotionBeforeQueueing(displayId, motionEvent.getSource(),
                                                      motionEvent.getAction(), eventTime,
                                                      /*byref*/ policyFlags);
                if (t.duration() > SLOW_INTERCEPTION_THRESHOLD) {
                    ALOGW("Excessive delay in interceptMotionBeforeQueueing; took %s ms",
                          std::to_string(t.duration().count()).c_str());
+2 −2
Original line number Diff line number Diff line
@@ -99,8 +99,8 @@ public:
     * This method is expected to set the POLICY_FLAG_PASS_TO_USER policy flag if the event
     * should be dispatched to applications.
     */
    virtual void interceptMotionBeforeQueueing(int32_t displayId, nsecs_t when,
                                               uint32_t& policyFlags) = 0;
    virtual void interceptMotionBeforeQueueing(int32_t displayId, uint32_t source, int32_t action,
                                               nsecs_t when, uint32_t& policyFlags) = 0;

    /* Allows the policy a chance to intercept a key before dispatching. */
    virtual nsecs_t interceptKeyBeforeDispatching(const sp<IBinder>& token,
+1 −1
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ private:

    void interceptKeyBeforeQueueing(const KeyEvent&, uint32_t&) override {}

    void interceptMotionBeforeQueueing(int32_t, nsecs_t, uint32_t&) override {}
    void interceptMotionBeforeQueueing(int32_t, uint32_t, int32_t, nsecs_t, uint32_t&) override {}

    nsecs_t interceptKeyBeforeDispatching(const sp<IBinder>&, const KeyEvent&, uint32_t) override {
        return 0;
+1 −1
Original line number Diff line number Diff line
@@ -549,7 +549,7 @@ private:
        }
    }
    void interceptMotionBeforeQueueing(int32_t, nsecs_t, uint32_t&) override {}
    void interceptMotionBeforeQueueing(int32_t, uint32_t, int32_t, nsecs_t, uint32_t&) override {}
    nsecs_t interceptKeyBeforeDispatching(const sp<IBinder>&, const KeyEvent&, uint32_t) override {
        nsecs_t delay = std::chrono::nanoseconds(mInterceptKeyTimeout).count();