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

Commit a6d93926 authored by Omar Abdelmonem's avatar Omar Abdelmonem Committed by Android (Google) Code Review
Browse files

Merge "Create Native getTouchpadHardwareProperties()" into main

parents 698344a5 5e70e961
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@

#include "PointerControllerInterface.h"
#include "VibrationElement.h"
#include "include/gestures.h"

// Maximum supported size of a vibration pattern.
// Must be at least 2.
@@ -367,6 +368,8 @@ public:

    virtual std::vector<InputDeviceSensorInfo> getSensors(int32_t deviceId) = 0;

    virtual std::optional<HardwareProperties> getTouchpadHardwareProperties(int32_t deviceId) = 0;

    /* Return true if the device can send input events to the specified display. */
    virtual bool canDispatchToDisplay(int32_t deviceId, ui::LogicalDisplayId displayId) = 0;

+9 −0
Original line number Diff line number Diff line
@@ -725,6 +725,15 @@ size_t InputDevice::getMapperCount() {
    return count;
}

std::optional<HardwareProperties> InputDevice::getTouchpadHardwareProperties() {
    std::optional<HardwareProperties> result = first_in_mappers<HardwareProperties>(
            [](InputMapper& mapper) -> std::optional<HardwareProperties> {
                return mapper.getTouchpadHardwareProperties();
            });

    return result;
}

void InputDevice::updateLedState(bool reset) {
    for_each_mapper([reset](InputMapper& mapper) { mapper.updateLedState(reset); });
}
+13 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@
#include <utils/Thread.h>

#include "InputDevice.h"
#include "include/gestures.h"

using android::base::StringPrintf;

@@ -817,6 +818,18 @@ std::vector<InputDeviceSensorInfo> InputReader::getSensors(int32_t deviceId) {
    return device->getDeviceInfo().getSensors();
}

std::optional<HardwareProperties> InputReader::getTouchpadHardwareProperties(int32_t deviceId) {
    std::scoped_lock _l(mLock);

    InputDevice* device = findInputDeviceLocked(deviceId);

    if (device == nullptr) {
        return {};
    }

    return device->getTouchpadHardwareProperties();
}

bool InputReader::setLightColor(int32_t deviceId, int32_t lightId, int32_t color) {
    std::scoped_lock _l(mLock);

+2 −0
Original line number Diff line number Diff line
@@ -141,6 +141,8 @@ public:

    size_t getMapperCount();

    std::optional<HardwareProperties> getTouchpadHardwareProperties();

    // construct and add a mapper to the input device
    template <class T, typename... Args>
    T& addMapper(int32_t eventHubId, Args... args) {
+2 −0
Original line number Diff line number Diff line
@@ -104,6 +104,8 @@ public:

    std::vector<InputDeviceSensorInfo> getSensors(int32_t deviceId) override;

    std::optional<HardwareProperties> getTouchpadHardwareProperties(int32_t deviceId) override;

    bool setLightColor(int32_t deviceId, int32_t lightId, int32_t color) override;

    bool setLightPlayerId(int32_t deviceId, int32_t lightId, int32_t playerId) override;
Loading