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

Commit 95bd9a3b authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "SyncPointerCapture (1/n): Notify PointerCaptureChanged through InputListener"

parents c6a96aa7 7e186182
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -405,6 +405,11 @@ void InputClassifier::notifyDeviceReset(const NotifyDeviceResetArgs* args) {
    mListener->notifyDeviceReset(args);
}

void InputClassifier::notifyPointerCaptureChanged(const NotifyPointerCaptureChangedArgs* args) {
    // pass through
    mListener->notifyPointerCaptureChanged(args);
}

void InputClassifier::setMotionClassifier(
        std::unique_ptr<MotionClassifierInterface> motionClassifier) {
    std::scoped_lock lock(mLock);
+1 −0
Original line number Diff line number Diff line
@@ -230,6 +230,7 @@ public:
    virtual void notifyMotion(const NotifyMotionArgs* args) override;
    virtual void notifySwitch(const NotifySwitchArgs* args) override;
    virtual void notifyDeviceReset(const NotifyDeviceResetArgs* args) override;
    void notifyPointerCaptureChanged(const NotifyPointerCaptureChangedArgs* args) override;

    virtual void dump(std::string& dump) override;

+22 −5
Original line number Diff line number Diff line
@@ -48,7 +48,6 @@ void NotifyConfigurationChangedArgs::notify(const sp<InputListenerInterface>& li
    listener->notifyConfigurationChanged(this);
}


// --- NotifyKeyArgs ---

NotifyKeyArgs::NotifyKeyArgs(int32_t id, nsecs_t eventTime, int32_t deviceId, uint32_t source,
@@ -90,7 +89,6 @@ void NotifyKeyArgs::notify(const sp<InputListenerInterface>& listener) const {
    listener->notifyKey(this);
}


// --- NotifyMotionArgs ---

NotifyMotionArgs::NotifyMotionArgs(int32_t id, nsecs_t eventTime, int32_t deviceId, uint32_t source,
@@ -189,7 +187,6 @@ void NotifyMotionArgs::notify(const sp<InputListenerInterface>& listener) const
    listener->notifyMotion(this);
}


// --- NotifySwitchArgs ---

NotifySwitchArgs::NotifySwitchArgs(int32_t id, nsecs_t eventTime, uint32_t policyFlags,
@@ -214,7 +211,6 @@ void NotifySwitchArgs::notify(const sp<InputListenerInterface>& listener) const
    listener->notifySwitch(this);
}


// --- NotifyDeviceResetArgs ---

NotifyDeviceResetArgs::NotifyDeviceResetArgs(int32_t id, nsecs_t eventTime, int32_t deviceId)
@@ -231,6 +227,23 @@ void NotifyDeviceResetArgs::notify(const sp<InputListenerInterface>& listener) c
    listener->notifyDeviceReset(this);
}

// --- NotifyPointerCaptureChangedArgs ---

NotifyPointerCaptureChangedArgs::NotifyPointerCaptureChangedArgs(int32_t id, nsecs_t eventTime,
                                                                 bool enabled)
      : NotifyArgs(id, eventTime), enabled(enabled) {}

NotifyPointerCaptureChangedArgs::NotifyPointerCaptureChangedArgs(
        const NotifyPointerCaptureChangedArgs& other)
      : NotifyArgs(other.id, other.eventTime), enabled(other.enabled) {}

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

void NotifyPointerCaptureChangedArgs::notify(const sp<InputListenerInterface>& listener) const {
    listener->notifyPointerCaptureChanged(this);
}

// --- QueuedInputListener ---

@@ -278,6 +291,11 @@ void QueuedInputListener::notifyDeviceReset(const NotifyDeviceResetArgs* args) {
    mArgsQueue.push_back(new NotifyDeviceResetArgs(*args));
}

void QueuedInputListener::notifyPointerCaptureChanged(const NotifyPointerCaptureChangedArgs* args) {
    traceEvent(__func__, args->id);
    mArgsQueue.push_back(new NotifyPointerCaptureChangedArgs(*args));
}

void QueuedInputListener::flush() {
    size_t count = mArgsQueue.size();
    for (size_t i = 0; i < count; i++) {
@@ -288,5 +306,4 @@ void QueuedInputListener::flush() {
    mArgsQueue.clear();
}


} // namespace android
+9 −0
Original line number Diff line number Diff line
@@ -3542,6 +3542,15 @@ void InputDispatcher::notifyDeviceReset(const NotifyDeviceResetArgs* args) {
    }
}

void InputDispatcher::notifyPointerCaptureChanged(const NotifyPointerCaptureChangedArgs* args) {
#if DEBUG_INBOUND_EVENT_DETAILS
    ALOGD("notifyPointerCaptureChanged - eventTime=%" PRId64 ", enabled=%s", args->eventTime,
          args->enabled ? "true" : "false");
#endif

    // TODO(prabirmsp): Implement.
}

InputEventInjectionResult InputDispatcher::injectInputEvent(
        const InputEvent* event, int32_t injectorPid, int32_t injectorUid,
        InputEventInjectionSync syncMode, std::chrono::milliseconds timeout, uint32_t policyFlags) {
+1 −0
Original line number Diff line number Diff line
@@ -94,6 +94,7 @@ public:
    virtual void notifyMotion(const NotifyMotionArgs* args) override;
    virtual void notifySwitch(const NotifySwitchArgs* args) override;
    virtual void notifyDeviceReset(const NotifyDeviceResetArgs* args) override;
    virtual void notifyPointerCaptureChanged(const NotifyPointerCaptureChangedArgs* args) override;

    virtual android::os::InputEventInjectionResult injectInputEvent(
            const InputEvent* event, int32_t injectorPid, int32_t injectorUid,
Loading