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

Commit afbd1c12 authored by Corinna Vinschen's avatar Corinna Vinschen
Browse files

InputDispatcher: On keypress, deliver keycode to pokeUserActivity



Change-Id: I8f64a6fa9b4b2e4520e25731f55e89f5087c70da
Signed-off-by: default avatarCorinna Vinschen <xda@vinschen.de>
parent 766d692b
Loading
Loading
Loading
Loading
+19 −1
Original line number Diff line number Diff line
@@ -1876,6 +1876,11 @@ void InputDispatcher::pokeUserActivityLocked(const EventEntry* eventEntry) {
            & InputDispatcher::doPokeUserActivityLockedInterruptible);
    commandEntry->eventTime = eventEntry->eventTime;
    commandEntry->userActivityEventType = eventType;
    if (eventType == USER_ACTIVITY_EVENT_BUTTON) {
        const KeyEntry* keyEntry = static_cast<const KeyEntry*>(eventEntry);
        commandEntry->keyEntry = const_cast<KeyEntry*>(keyEntry);
        keyEntry->refCount += 1;
    }
}

void InputDispatcher::prepareDispatchCycleLocked(nsecs_t currentTime,
@@ -3866,7 +3871,20 @@ bool InputDispatcher::afterMotionEventLockedInterruptible(const sp<Connection>&
void InputDispatcher::doPokeUserActivityLockedInterruptible(CommandEntry* commandEntry) {
    mLock.unlock();

    mPolicy->pokeUserActivity(commandEntry->eventTime, commandEntry->userActivityEventType);
    int32_t keyCode = AKEYCODE_UNKNOWN;

    if (commandEntry->userActivityEventType == USER_ACTIVITY_EVENT_BUTTON &&
            commandEntry->keyEntry) {
        keyCode = commandEntry->keyEntry->keyCode;
    }

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

    if (commandEntry->userActivityEventType == USER_ACTIVITY_EVENT_BUTTON &&
            commandEntry->keyEntry) {
        commandEntry->keyEntry->release();
    }

    mLock.lock();
}
+1 −1
Original line number Diff line number Diff line
@@ -258,7 +258,7 @@ public:
            uint32_t switchValues, uint32_t switchMask, 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 keyCode) = 0;

    /* Checks whether a given application pid/uid has permission to inject input events
     * into other applications.