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

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

Merge "Add vibrator state listener support for input device vibrator" into sc-dev

parents e5d7b701 fb552905
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -396,6 +396,11 @@ void InputClassifier::notifySensor(const NotifySensorArgs* args) {
    mListener->notifySensor(args);
}

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

void InputClassifier::notifySwitch(const NotifySwitchArgs* args) {
    // pass through
    mListener->notifySwitch(args);
+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 notifySensor(const NotifySensorArgs* args) override;
    virtual void notifyVibratorState(const NotifyVibratorStateArgs* args) override;
    virtual void notifyDeviceReset(const NotifyDeviceResetArgs* args) override;
    void notifyPointerCaptureChanged(const NotifyPointerCaptureChangedArgs* args) override;

+23 −0
Original line number Diff line number Diff line
@@ -246,6 +246,24 @@ void NotifySensorArgs::notify(const sp<InputListenerInterface>& listener) const
    listener->notifySensor(this);
}

// --- NotifyVibratorStateArgs ---

NotifyVibratorStateArgs::NotifyVibratorStateArgs(int32_t id, nsecs_t eventTime, int32_t deviceId,
                                                 bool isOn)
      : NotifyArgs(id, eventTime), deviceId(deviceId), isOn(isOn) {}

NotifyVibratorStateArgs::NotifyVibratorStateArgs(const NotifyVibratorStateArgs& other)
      : NotifyArgs(other.id, other.eventTime), deviceId(other.deviceId), isOn(other.isOn) {}

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

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

// --- NotifyDeviceResetArgs ---

NotifyDeviceResetArgs::NotifyDeviceResetArgs(int32_t id, nsecs_t eventTime, int32_t deviceId)
@@ -326,6 +344,11 @@ void QueuedInputListener::notifySensor(const NotifySensorArgs* args) {
    mArgsQueue.push_back(new NotifySensorArgs(*args));
}

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

void QueuedInputListener::notifyDeviceReset(const NotifyDeviceResetArgs* args) {
    traceEvent(__func__, args->id);
    mArgsQueue.push_back(new NotifyDeviceResetArgs(*args));
+2 −0
Original line number Diff line number Diff line
@@ -79,6 +79,8 @@ private:
    void notifySensorAccuracy(int32_t deviceId, InputDeviceSensorType sensorType,
                              InputDeviceSensorAccuracy accuracy) override {}

    void notifyVibratorState(int32_t deviceId, bool isOn) override {}

    void notifyUntrustedTouch(const std::string& obscuringPackage) override {}

    void getDispatcherConfiguration(InputDispatcherConfiguration* outConfig) override {
+8 −0
Original line number Diff line number Diff line
@@ -3747,6 +3747,14 @@ void InputDispatcher::notifySensor(const NotifySensorArgs* args) {
    }
}

void InputDispatcher::notifyVibratorState(const NotifyVibratorStateArgs* args) {
#if DEBUG_INBOUND_EVENT_DETAILS
    ALOGD("notifyVibratorState - eventTime=%" PRId64 ", device=%d,  isOn=%d", args->eventTime,
          args->deviceId, args->isOn);
#endif
    mPolicy->notifyVibratorState(args->deviceId, args->isOn);
}

bool InputDispatcher::shouldSendMotionToInputFilterLocked(const NotifyMotionArgs* args) {
    return mInputFilterEnabled;
}
Loading