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

Commit 4c1c433f authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Rename sequenceNum to ID. am: c51d1ba0 am: 64970eae

Change-Id: I3c1c7c77606c849db3f5acbf1f6c7ec4d1f3175c
parents 43e988a5 64970eae
Loading
Loading
Loading
Loading
+70 −76
Original line number Diff line number Diff line
@@ -27,18 +27,15 @@ namespace android {

// --- NotifyConfigurationChangedArgs ---

NotifyConfigurationChangedArgs::NotifyConfigurationChangedArgs(
        uint32_t sequenceNum, nsecs_t eventTime) :
        NotifyArgs(sequenceNum, eventTime) {
}
NotifyConfigurationChangedArgs::NotifyConfigurationChangedArgs(int32_t id, nsecs_t eventTime)
      : NotifyArgs(id, eventTime) {}

NotifyConfigurationChangedArgs::NotifyConfigurationChangedArgs(
        const NotifyConfigurationChangedArgs& other) :
        NotifyArgs(other.sequenceNum, other.eventTime) {
}
        const NotifyConfigurationChangedArgs& other)
      : NotifyArgs(other.id, other.eventTime) {}

bool NotifyConfigurationChangedArgs::operator==(const NotifyConfigurationChangedArgs& rhs) const {
    return sequenceNum == rhs.sequenceNum && eventTime == rhs.eventTime;
    return id == rhs.id && eventTime == rhs.eventTime;
}

void NotifyConfigurationChangedArgs::notify(const sp<InputListenerInterface>& listener) const {
@@ -48,37 +45,39 @@ void NotifyConfigurationChangedArgs::notify(const sp<InputListenerInterface>& li

// --- NotifyKeyArgs ---

NotifyKeyArgs::NotifyKeyArgs(uint32_t sequenceNum, nsecs_t eventTime, int32_t deviceId,
        uint32_t source, int32_t displayId, uint32_t policyFlags,
        int32_t action, int32_t flags, int32_t keyCode, int32_t scanCode,
        int32_t metaState, nsecs_t downTime) :
        NotifyArgs(sequenceNum, eventTime), deviceId(deviceId), source(source),
        displayId(displayId), policyFlags(policyFlags),
        action(action), flags(flags), keyCode(keyCode), scanCode(scanCode),
        metaState(metaState), downTime(downTime) {
}
NotifyKeyArgs::NotifyKeyArgs(int32_t id, nsecs_t eventTime, int32_t deviceId, uint32_t source,
                             int32_t displayId, uint32_t policyFlags, int32_t action, int32_t flags,
                             int32_t keyCode, int32_t scanCode, int32_t metaState, nsecs_t downTime)
      : NotifyArgs(id, eventTime),
        deviceId(deviceId),
        source(source),
        displayId(displayId),
        policyFlags(policyFlags),
        action(action),
        flags(flags),
        keyCode(keyCode),
        scanCode(scanCode),
        metaState(metaState),
        downTime(downTime) {}

NotifyKeyArgs::NotifyKeyArgs(const NotifyKeyArgs& other) :
        NotifyArgs(other.sequenceNum, other.eventTime), deviceId(other.deviceId),
        source(other.source), displayId(other.displayId), policyFlags(other.policyFlags),
        action(other.action), flags(other.flags),
        keyCode(other.keyCode), scanCode(other.scanCode),
        metaState(other.metaState), downTime(other.downTime) {
}
NotifyKeyArgs::NotifyKeyArgs(const NotifyKeyArgs& other)
      : NotifyArgs(other.id, other.eventTime),
        deviceId(other.deviceId),
        source(other.source),
        displayId(other.displayId),
        policyFlags(other.policyFlags),
        action(other.action),
        flags(other.flags),
        keyCode(other.keyCode),
        scanCode(other.scanCode),
        metaState(other.metaState),
        downTime(other.downTime) {}

bool NotifyKeyArgs::operator==(const NotifyKeyArgs& rhs) const {
    return sequenceNum == rhs.sequenceNum
            && eventTime == rhs.eventTime
            && deviceId == rhs.deviceId
            && source == rhs.source
            && displayId == rhs.displayId
            && policyFlags == rhs.policyFlags
            && action == rhs.action
            && flags == rhs.flags
            && keyCode == rhs.keyCode
            && scanCode == rhs.scanCode
            && metaState == rhs.metaState
            && downTime == rhs.downTime;
    return id == rhs.id && eventTime == rhs.eventTime && deviceId == rhs.deviceId &&
            source == rhs.source && displayId == rhs.displayId && policyFlags == rhs.policyFlags &&
            action == rhs.action && flags == rhs.flags && keyCode == rhs.keyCode &&
            scanCode == rhs.scanCode && metaState == rhs.metaState && downTime == rhs.downTime;
}

void NotifyKeyArgs::notify(const sp<InputListenerInterface>& listener) const {
@@ -88,15 +87,17 @@ void NotifyKeyArgs::notify(const sp<InputListenerInterface>& listener) const {

// --- NotifyMotionArgs ---

NotifyMotionArgs::NotifyMotionArgs(
        uint32_t sequenceNum, nsecs_t eventTime, int32_t deviceId, uint32_t source,
        int32_t displayId, uint32_t policyFlags, int32_t action, int32_t actionButton,
        int32_t flags, int32_t metaState, int32_t buttonState, MotionClassification classification,
        int32_t edgeFlags, uint32_t pointerCount, const PointerProperties* pointerProperties,
        const PointerCoords* pointerCoords, float xPrecision, float yPrecision,
        float xCursorPosition, float yCursorPosition, nsecs_t downTime,
NotifyMotionArgs::NotifyMotionArgs(int32_t id, nsecs_t eventTime, int32_t deviceId, uint32_t source,
                                   int32_t displayId, uint32_t policyFlags, int32_t action,
                                   int32_t actionButton, int32_t flags, int32_t metaState,
                                   int32_t buttonState, MotionClassification classification,
                                   int32_t edgeFlags, uint32_t pointerCount,
                                   const PointerProperties* pointerProperties,
                                   const PointerCoords* pointerCoords, float xPrecision,
                                   float yPrecision, float xCursorPosition, float yCursorPosition,
                                   nsecs_t downTime,
                                   const std::vector<TouchVideoFrame>& videoFrames)
      : NotifyArgs(sequenceNum, eventTime),
      : NotifyArgs(id, eventTime),
        deviceId(deviceId),
        source(source),
        displayId(displayId),
@@ -122,7 +123,7 @@ NotifyMotionArgs::NotifyMotionArgs(
}

NotifyMotionArgs::NotifyMotionArgs(const NotifyMotionArgs& other)
      : NotifyArgs(other.sequenceNum, other.eventTime),
      : NotifyArgs(other.id, other.eventTime),
        deviceId(other.deviceId),
        source(other.source),
        displayId(other.displayId),
@@ -152,12 +153,11 @@ static inline bool isCursorPositionEqual(float lhs, float rhs) {
}

bool NotifyMotionArgs::operator==(const NotifyMotionArgs& rhs) const {
    bool equal = sequenceNum == rhs.sequenceNum && eventTime == rhs.eventTime &&
            deviceId == rhs.deviceId && source == rhs.source && displayId == rhs.displayId &&
            policyFlags == rhs.policyFlags && action == rhs.action &&
            actionButton == rhs.actionButton && flags == rhs.flags && metaState == rhs.metaState &&
            buttonState == rhs.buttonState && classification == rhs.classification &&
            edgeFlags == rhs.edgeFlags &&
    bool equal = id == rhs.id && eventTime == rhs.eventTime && deviceId == rhs.deviceId &&
            source == rhs.source && displayId == rhs.displayId && policyFlags == rhs.policyFlags &&
            action == rhs.action && actionButton == rhs.actionButton && flags == rhs.flags &&
            metaState == rhs.metaState && buttonState == rhs.buttonState &&
            classification == rhs.classification && edgeFlags == rhs.edgeFlags &&
            pointerCount == rhs.pointerCount
            // PointerProperties and PointerCoords are compared separately below
            && xPrecision == rhs.xPrecision && yPrecision == rhs.yPrecision &&
@@ -186,23 +186,22 @@ void NotifyMotionArgs::notify(const sp<InputListenerInterface>& listener) const

// --- NotifySwitchArgs ---

NotifySwitchArgs::NotifySwitchArgs(uint32_t sequenceNum, nsecs_t eventTime, uint32_t policyFlags,
        uint32_t switchValues, uint32_t switchMask) :
        NotifyArgs(sequenceNum, eventTime), policyFlags(policyFlags),
        switchValues(switchValues), switchMask(switchMask) {
}
NotifySwitchArgs::NotifySwitchArgs(int32_t id, nsecs_t eventTime, uint32_t policyFlags,
                                   uint32_t switchValues, uint32_t switchMask)
      : NotifyArgs(id, eventTime),
        policyFlags(policyFlags),
        switchValues(switchValues),
        switchMask(switchMask) {}

NotifySwitchArgs::NotifySwitchArgs(const NotifySwitchArgs& other) :
        NotifyArgs(other.sequenceNum, other.eventTime), policyFlags(other.policyFlags),
        switchValues(other.switchValues), switchMask(other.switchMask) {
}
NotifySwitchArgs::NotifySwitchArgs(const NotifySwitchArgs& other)
      : NotifyArgs(other.id, other.eventTime),
        policyFlags(other.policyFlags),
        switchValues(other.switchValues),
        switchMask(other.switchMask) {}

bool NotifySwitchArgs::operator==(const NotifySwitchArgs rhs) const {
    return sequenceNum == rhs.sequenceNum
            && eventTime == rhs.eventTime
            && policyFlags == rhs.policyFlags
            && switchValues == rhs.switchValues
            && switchMask == rhs.switchMask;
    return id == rhs.id && eventTime == rhs.eventTime && policyFlags == rhs.policyFlags &&
            switchValues == rhs.switchValues && switchMask == rhs.switchMask;
}

void NotifySwitchArgs::notify(const sp<InputListenerInterface>& listener) const {
@@ -212,19 +211,14 @@ void NotifySwitchArgs::notify(const sp<InputListenerInterface>& listener) const

// --- NotifyDeviceResetArgs ---

NotifyDeviceResetArgs::NotifyDeviceResetArgs(
        uint32_t sequenceNum, nsecs_t eventTime, int32_t deviceId) :
        NotifyArgs(sequenceNum, eventTime), deviceId(deviceId) {
}
NotifyDeviceResetArgs::NotifyDeviceResetArgs(int32_t id, nsecs_t eventTime, int32_t deviceId)
      : NotifyArgs(id, eventTime), deviceId(deviceId) {}

NotifyDeviceResetArgs::NotifyDeviceResetArgs(const NotifyDeviceResetArgs& other) :
        NotifyArgs(other.sequenceNum, other.eventTime), deviceId(other.deviceId) {
}
NotifyDeviceResetArgs::NotifyDeviceResetArgs(const NotifyDeviceResetArgs& other)
      : NotifyArgs(other.id, other.eventTime), deviceId(other.deviceId) {}

bool NotifyDeviceResetArgs::operator==(const NotifyDeviceResetArgs& rhs) const {
    return sequenceNum == rhs.sequenceNum
            && eventTime == rhs.eventTime
            && deviceId == rhs.deviceId;
    return id == rhs.id && eventTime == rhs.eventTime && deviceId == rhs.deviceId;
}

void NotifyDeviceResetArgs::notify(const sp<InputListenerInterface>& listener) const {
+3 −3
Original line number Diff line number Diff line
@@ -229,7 +229,7 @@ static NotifyMotionArgs generateMotionArgs() {

    const nsecs_t currentTime = now();
    // Define a valid motion event.
    NotifyMotionArgs args(/* sequenceNum */ 0, currentTime, DEVICE_ID, AINPUT_SOURCE_TOUCHSCREEN,
    NotifyMotionArgs args(/* id */ 0, currentTime, DEVICE_ID, AINPUT_SOURCE_TOUCHSCREEN,
                          ADISPLAY_ID_DEFAULT, POLICY_FLAG_PASS_TO_USER, AMOTION_EVENT_ACTION_DOWN,
                          /* actionButton */ 0, /* flags */ 0, AMETA_NONE, /* buttonState */ 0,
                          MotionClassification::NONE, AMOTION_EVENT_EDGE_FLAG_NONE, 1,
@@ -259,14 +259,14 @@ static void benchmarkNotifyMotion(benchmark::State& state) {
    for (auto _ : state) {
        // Send ACTION_DOWN
        motionArgs.action = AMOTION_EVENT_ACTION_DOWN;
        motionArgs.sequenceNum = 0;
        motionArgs.id = 0;
        motionArgs.downTime = now();
        motionArgs.eventTime = motionArgs.downTime;
        dispatcher->notifyMotion(&motionArgs);

        // Send ACTION_UP
        motionArgs.action = AMOTION_EVENT_ACTION_UP;
        motionArgs.sequenceNum = 1;
        motionArgs.id = 1;
        motionArgs.eventTime = now();
        dispatcher->notifyMotion(&motionArgs);

+12 −13
Original line number Diff line number Diff line
@@ -86,8 +86,8 @@ VerifiedMotionEvent verifiedMotionEventFromMotionEntry(const MotionEntry& entry)

// --- EventEntry ---

EventEntry::EventEntry(uint32_t sequenceNum, Type type, nsecs_t eventTime, uint32_t policyFlags)
      : sequenceNum(sequenceNum),
EventEntry::EventEntry(int32_t id, Type type, nsecs_t eventTime, uint32_t policyFlags)
      : id(id),
        refCount(1),
        type(type),
        eventTime(eventTime),
@@ -117,8 +117,8 @@ void EventEntry::releaseInjectionState() {

// --- ConfigurationChangedEntry ---

ConfigurationChangedEntry::ConfigurationChangedEntry(uint32_t sequenceNum, nsecs_t eventTime)
      : EventEntry(sequenceNum, Type::CONFIGURATION_CHANGED, eventTime, 0) {}
ConfigurationChangedEntry::ConfigurationChangedEntry(int32_t id, nsecs_t eventTime)
      : EventEntry(id, Type::CONFIGURATION_CHANGED, eventTime, 0) {}

ConfigurationChangedEntry::~ConfigurationChangedEntry() {}

@@ -128,8 +128,8 @@ void ConfigurationChangedEntry::appendDescription(std::string& msg) const {

// --- DeviceResetEntry ---

DeviceResetEntry::DeviceResetEntry(uint32_t sequenceNum, nsecs_t eventTime, int32_t deviceId)
      : EventEntry(sequenceNum, Type::DEVICE_RESET, eventTime, 0), deviceId(deviceId) {}
DeviceResetEntry::DeviceResetEntry(int32_t id, nsecs_t eventTime, int32_t deviceId)
      : EventEntry(id, Type::DEVICE_RESET, eventTime, 0), deviceId(deviceId) {}

DeviceResetEntry::~DeviceResetEntry() {}

@@ -140,9 +140,8 @@ void DeviceResetEntry::appendDescription(std::string& msg) const {
// --- FocusEntry ---

// Focus notifications always go to apps, so set the flag POLICY_FLAG_PASS_TO_USER for all entries
FocusEntry::FocusEntry(uint32_t sequenceNum, nsecs_t eventTime, sp<IBinder> connectionToken,
                       bool hasFocus)
      : EventEntry(sequenceNum, Type::FOCUS, eventTime, POLICY_FLAG_PASS_TO_USER),
FocusEntry::FocusEntry(int32_t id, nsecs_t eventTime, sp<IBinder> connectionToken, bool hasFocus)
      : EventEntry(id, Type::FOCUS, eventTime, POLICY_FLAG_PASS_TO_USER),
        connectionToken(connectionToken),
        hasFocus(hasFocus) {}

@@ -154,11 +153,11 @@ void FocusEntry::appendDescription(std::string& msg) const {

// --- KeyEntry ---

KeyEntry::KeyEntry(uint32_t sequenceNum, nsecs_t eventTime, int32_t deviceId, uint32_t source,
KeyEntry::KeyEntry(int32_t id, nsecs_t eventTime, int32_t deviceId, uint32_t source,
                   int32_t displayId, uint32_t policyFlags, int32_t action, int32_t flags,
                   int32_t keyCode, int32_t scanCode, int32_t metaState, int32_t repeatCount,
                   nsecs_t downTime)
      : EventEntry(sequenceNum, Type::KEY, eventTime, policyFlags),
      : EventEntry(id, Type::KEY, eventTime, policyFlags),
        deviceId(deviceId),
        source(source),
        displayId(displayId),
@@ -198,7 +197,7 @@ void KeyEntry::recycle() {

// --- MotionEntry ---

MotionEntry::MotionEntry(uint32_t sequenceNum, nsecs_t eventTime, int32_t deviceId, uint32_t source,
MotionEntry::MotionEntry(int32_t id, nsecs_t eventTime, int32_t deviceId, uint32_t source,
                         int32_t displayId, uint32_t policyFlags, int32_t action,
                         int32_t actionButton, int32_t flags, int32_t metaState,
                         int32_t buttonState, MotionClassification classification,
@@ -206,7 +205,7 @@ MotionEntry::MotionEntry(uint32_t sequenceNum, nsecs_t eventTime, int32_t device
                         float xCursorPosition, float yCursorPosition, nsecs_t downTime,
                         uint32_t pointerCount, const PointerProperties* pointerProperties,
                         const PointerCoords* pointerCoords, float xOffset, float yOffset)
      : EventEntry(sequenceNum, Type::MOTION, eventTime, policyFlags),
      : EventEntry(id, Type::MOTION, eventTime, policyFlags),
        eventTime(eventTime),
        deviceId(deviceId),
        source(source),
+17 −20
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@
namespace android::inputdispatcher {

// Sequence number for synthesized or injected events.
constexpr uint32_t SYNTHESIZED_EVENT_SEQUENCE_NUM = 0;
constexpr int32_t SYNTHESIZED_EVENT_ID = 0;

struct EventEntry {
    enum class Type {
@@ -56,7 +56,7 @@ struct EventEntry {
        }
    }

    uint32_t sequenceNum;
    int32_t id;
    mutable int32_t refCount;
    Type type;
    nsecs_t eventTime;
@@ -78,22 +78,20 @@ struct EventEntry {
     * Key repeat is a synthesized event, because it is related to an actual hardware state
     * (a key is currently pressed), but the repeat itself is generated by the framework.
     */
    inline bool isSynthesized() const {
        return isInjected() || sequenceNum == SYNTHESIZED_EVENT_SEQUENCE_NUM;
    }
    inline bool isSynthesized() const { return isInjected() || id == SYNTHESIZED_EVENT_ID; }

    void release();

    virtual void appendDescription(std::string& msg) const = 0;

protected:
    EventEntry(uint32_t sequenceNum, Type type, nsecs_t eventTime, uint32_t policyFlags);
    EventEntry(int32_t id, Type type, nsecs_t eventTime, uint32_t policyFlags);
    virtual ~EventEntry();
    void releaseInjectionState();
};

struct ConfigurationChangedEntry : EventEntry {
    explicit ConfigurationChangedEntry(uint32_t sequenceNum, nsecs_t eventTime);
    explicit ConfigurationChangedEntry(int32_t id, nsecs_t eventTime);
    virtual void appendDescription(std::string& msg) const;

protected:
@@ -103,7 +101,7 @@ protected:
struct DeviceResetEntry : EventEntry {
    int32_t deviceId;

    DeviceResetEntry(uint32_t sequenceNum, nsecs_t eventTime, int32_t deviceId);
    DeviceResetEntry(int32_t id, nsecs_t eventTime, int32_t deviceId);
    virtual void appendDescription(std::string& msg) const;

protected:
@@ -114,7 +112,7 @@ struct FocusEntry : EventEntry {
    sp<IBinder> connectionToken;
    bool hasFocus;

    FocusEntry(uint32_t sequenceNum, nsecs_t eventTime, sp<IBinder> connectionToken, bool hasFocus);
    FocusEntry(int32_t id, nsecs_t eventTime, sp<IBinder> connectionToken, bool hasFocus);
    virtual void appendDescription(std::string& msg) const;

protected:
@@ -144,10 +142,9 @@ struct KeyEntry : EventEntry {
    InterceptKeyResult interceptKeyResult; // set based on the interception result
    nsecs_t interceptKeyWakeupTime;        // used with INTERCEPT_KEY_RESULT_TRY_AGAIN_LATER

    KeyEntry(uint32_t sequenceNum, nsecs_t eventTime, int32_t deviceId, uint32_t source,
             int32_t displayId, uint32_t policyFlags, int32_t action, int32_t flags,
             int32_t keyCode, int32_t scanCode, int32_t metaState, int32_t repeatCount,
             nsecs_t downTime);
    KeyEntry(int32_t id, nsecs_t eventTime, int32_t deviceId, uint32_t source, int32_t displayId,
             uint32_t policyFlags, int32_t action, int32_t flags, int32_t keyCode, int32_t scanCode,
             int32_t metaState, int32_t repeatCount, nsecs_t downTime);
    virtual void appendDescription(std::string& msg) const;
    void recycle();

@@ -176,13 +173,13 @@ struct MotionEntry : EventEntry {
    PointerProperties pointerProperties[MAX_POINTERS];
    PointerCoords pointerCoords[MAX_POINTERS];

    MotionEntry(uint32_t sequenceNum, nsecs_t eventTime, int32_t deviceId, uint32_t source,
                int32_t displayId, uint32_t policyFlags, int32_t action, int32_t actionButton,
                int32_t flags, int32_t metaState, int32_t buttonState,
                MotionClassification classification, int32_t edgeFlags, float xPrecision,
                float yPrecision, float xCursorPosition, float yCursorPosition, nsecs_t downTime,
                uint32_t pointerCount, const PointerProperties* pointerProperties,
                const PointerCoords* pointerCoords, float xOffset, float yOffset);
    MotionEntry(int32_t id, nsecs_t eventTime, int32_t deviceId, uint32_t source, int32_t displayId,
                uint32_t policyFlags, int32_t action, int32_t actionButton, int32_t flags,
                int32_t metaState, int32_t buttonState, MotionClassification classification,
                int32_t edgeFlags, float xPrecision, float yPrecision, float xCursorPosition,
                float yCursorPosition, nsecs_t downTime, uint32_t pointerCount,
                const PointerProperties* pointerProperties, const PointerCoords* pointerCoords,
                float xOffset, float yOffset);
    virtual void appendDescription(std::string& msg) const;

protected:
+32 −34

File changed.

Preview size limit exceeded, changes collapsed.

Loading