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

Commit 88a90414 authored by Yeabkal Wubshit's avatar Yeabkal Wubshit
Browse files

Pass input source and action in interceptMotionBeforeQueueing

In a follow up change, the source and action will be passed to
a separate helper class that would handle input-based wake ups.

Bug: 317432315
Test: build passes
Change-Id: I6a3519c4e9465e212b204553585e976083deefd5
parent c8e73561
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -4436,7 +4436,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());
@@ -4697,7 +4698,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();