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

Commit b4e0a599 authored by Sean Stout's avatar Sean Stout
Browse files

Include display ID in user activity reporting

When reporting user activity, include the display ID that was interacted
with. This will facilitate supporting per-DisplayGroup timeout behavior.

Bug: 175764389
Test: manual - ensure display ID is sent correctly
Change-Id: I4b9e615cbda06e8c8b26a88a5193563ab3739148
parent 44e9f3b5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -105,7 +105,7 @@ private:

    void notifySwitch(nsecs_t, uint32_t, uint32_t, uint32_t) override {}

    void pokeUserActivity(nsecs_t, int32_t) override {}
    void pokeUserActivity(nsecs_t, int32_t, int32_t) override {}

    bool checkInjectEventsPermissionNonReentrant(int32_t, int32_t) override { return false; }

+1 −0
Original line number Diff line number Diff line
@@ -273,6 +273,7 @@ struct CommandEntry {
    bool enabled;
    int32_t pid;
    nsecs_t consumeTime; // time when the event was consumed by InputConsumer
    int32_t displayId;
};

} // namespace android::inputdispatcher
+3 −1
Original line number Diff line number Diff line
@@ -2591,6 +2591,7 @@ void InputDispatcher::pokeUserActivityLocked(const EventEntry& eventEntry) {
            std::make_unique<CommandEntry>(&InputDispatcher::doPokeUserActivityLockedInterruptible);
    commandEntry->eventTime = eventEntry.eventTime;
    commandEntry->userActivityEventType = eventType;
    commandEntry->displayId = displayId;
    postCommandLocked(std::move(commandEntry));
}

@@ -5715,7 +5716,8 @@ bool InputDispatcher::afterMotionEventLockedInterruptible(const sp<Connection>&
void InputDispatcher::doPokeUserActivityLockedInterruptible(CommandEntry* commandEntry) {
    mLock.unlock();

    mPolicy->pokeUserActivity(commandEntry->eventTime, commandEntry->userActivityEventType);
    mPolicy->pokeUserActivity(commandEntry->eventTime, commandEntry->userActivityEventType,
                              commandEntry->displayId);

    mLock.lock();
}
+1 −1
Original line number Diff line number Diff line
@@ -134,7 +134,7 @@ public:
                              uint32_t policyFlags) = 0;

    /* Poke user activity for an event dispatched to a window. */
    virtual void pokeUserActivity(nsecs_t eventTime, int32_t eventType) = 0;
    virtual void pokeUserActivity(nsecs_t eventTime, int32_t eventType, int32_t displayId) = 0;

    /* Checks whether a given application pid/uid has permission to inject input events
     * into other applications.
+1 −1
Original line number Diff line number Diff line
@@ -377,7 +377,7 @@ private:
        mLastNotifySwitch = NotifySwitchArgs(1 /*id*/, when, policyFlags, switchValues, switchMask);
    }

    void pokeUserActivity(nsecs_t, int32_t) override {}
    void pokeUserActivity(nsecs_t, int32_t, int32_t) override {}

    bool checkInjectEventsPermissionNonReentrant(int32_t, int32_t) override { return false; }