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

Commit 1dd2e5c7 authored by Chris Ye's avatar Chris Ye
Browse files

Refactor InputController into PeripheralController.

Rename the InputController and related class to PeripheralController,
and rename MiscDevice to AssociatedDevice to better reflect the behavior
of these hardwares.

Bug: 13831915
Test: atest inputflinger_tests
Change-Id: Ib61f7f6cc4fe616d08afc29bf1f1e08c1c9f565d
parent 8414e168
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -36,7 +36,7 @@ filegroup {
    srcs: [
    srcs: [
        "EventHub.cpp",
        "EventHub.cpp",
        "InputDevice.cpp",
        "InputDevice.cpp",
        "controller/InputController.cpp",
        "controller/PeripheralController.cpp",
        "mapper/accumulator/CursorButtonAccumulator.cpp",
        "mapper/accumulator/CursorButtonAccumulator.cpp",
        "mapper/accumulator/CursorScrollAccumulator.cpp",
        "mapper/accumulator/CursorScrollAccumulator.cpp",
        "mapper/accumulator/SingleTouchMotionAccumulator.cpp",
        "mapper/accumulator/SingleTouchMotionAccumulator.cpp",
+19 −31
Original line number Original line Diff line number Diff line
@@ -363,7 +363,7 @@ EventHub::Device::Device(int fd, int32_t id, const std::string& path,
        virtualKeyMap(nullptr),
        virtualKeyMap(nullptr),
        ffEffectPlaying(false),
        ffEffectPlaying(false),
        ffEffectId(-1),
        ffEffectId(-1),
        miscDevice(nullptr),
        associatedDevice(nullptr),
        controllerNumber(0),
        controllerNumber(0),
        enabled(true),
        enabled(true),
        isVirtual(fd < 0) {}
        isVirtual(fd < 0) {}
@@ -554,7 +554,7 @@ status_t EventHub::Device::mapLed(int32_t led, int32_t* outScanCode) const {
}
}


// Check the sysfs path for any input device batteries, returns true if battery found.
// Check the sysfs path for any input device batteries, returns true if battery found.
bool EventHub::MiscDevice::configureBatteryLocked() {
bool EventHub::AssociatedDevice::configureBatteryLocked() {
    nextBatteryId = 0;
    nextBatteryId = 0;
    // Check if device has any battery.
    // Check if device has any battery.
    const auto& paths = findSysfsNodes(sysfsRootPath, SysfsClass::POWER_SUPPLY);
    const auto& paths = findSysfsNodes(sysfsRootPath, SysfsClass::POWER_SUPPLY);
@@ -580,7 +580,7 @@ bool EventHub::MiscDevice::configureBatteryLocked() {
}
}


// Check the sysfs path for any input device lights, returns true if lights found.
// Check the sysfs path for any input device lights, returns true if lights found.
bool EventHub::MiscDevice::configureLightsLocked() {
bool EventHub::AssociatedDevice::configureLightsLocked() {
    nextLightId = 0;
    nextLightId = 0;
    // Check if device has any lights.
    // Check if device has any lights.
    const auto& paths = findSysfsNodes(sysfsRootPath, SysfsClass::LEDS);
    const auto& paths = findSysfsNodes(sysfsRootPath, SysfsClass::LEDS);
@@ -988,14 +988,10 @@ const std::unordered_map<int32_t, RawBatteryInfo>& EventHub::getBatteryInfoLocke
        int32_t deviceId) const {
        int32_t deviceId) const {
    static const std::unordered_map<int32_t, RawBatteryInfo> EMPTY_BATTERY_INFO = {};
    static const std::unordered_map<int32_t, RawBatteryInfo> EMPTY_BATTERY_INFO = {};
    Device* device = getDeviceLocked(deviceId);
    Device* device = getDeviceLocked(deviceId);
    if (device == nullptr) {
    if (device == nullptr || !device->associatedDevice) {
        return EMPTY_BATTERY_INFO;
    }
    auto it = mMiscDevices.find(device->identifier.descriptor);
    if (it == mMiscDevices.end()) {
        return EMPTY_BATTERY_INFO;
        return EMPTY_BATTERY_INFO;
    }
    }
    return it->second->batteryInfos;
    return device->associatedDevice->batteryInfos;
}
}


const std::vector<int32_t> EventHub::getRawBatteryIds(int32_t deviceId) {
const std::vector<int32_t> EventHub::getRawBatteryIds(int32_t deviceId) {
@@ -1028,14 +1024,10 @@ const std::unordered_map<int32_t, RawLightInfo>& EventHub::getLightInfoLocked(
        int32_t deviceId) const {
        int32_t deviceId) const {
    static const std::unordered_map<int32_t, RawLightInfo> EMPTY_LIGHT_INFO = {};
    static const std::unordered_map<int32_t, RawLightInfo> EMPTY_LIGHT_INFO = {};
    Device* device = getDeviceLocked(deviceId);
    Device* device = getDeviceLocked(deviceId);
    if (device == nullptr) {
    if (device == nullptr || !device->associatedDevice) {
        return EMPTY_LIGHT_INFO;
    }
    auto it = mMiscDevices.find(device->identifier.descriptor);
    if (it == mMiscDevices.end()) {
        return EMPTY_LIGHT_INFO;
        return EMPTY_LIGHT_INFO;
    }
    }
    return it->second->lightInfos;
    return device->associatedDevice->lightInfos;
}
}


const std::vector<int32_t> EventHub::getRawLightIds(int32_t deviceId) {
const std::vector<int32_t> EventHub::getRawLightIds(int32_t deviceId) {
@@ -1946,18 +1938,20 @@ void EventHub::openDeviceLocked(const std::string& devicePath) {
    // Check the sysfs root path
    // Check the sysfs root path
    std::optional<std::filesystem::path> sysfsRootPath = getSysfsRootPath(devicePath.c_str());
    std::optional<std::filesystem::path> sysfsRootPath = getSysfsRootPath(devicePath.c_str());
    if (sysfsRootPath.has_value()) {
    if (sysfsRootPath.has_value()) {
        std::shared_ptr<MiscDevice> miscDevice;
        std::shared_ptr<AssociatedDevice> associatedDevice;
        auto it = mMiscDevices.find(device->identifier.descriptor);
        for (const auto& [id, dev] : mDevices) {
        if (it == mMiscDevices.end()) {
            if (device->identifier.descriptor == dev->identifier.descriptor &&
            miscDevice = std::make_shared<MiscDevice>(sysfsRootPath.value());
                !dev->associatedDevice) {
        } else {
                associatedDevice = dev->associatedDevice;
            miscDevice = it->second;
            }
        }
        }
        hasBattery = miscDevice->configureBatteryLocked();
        if (!associatedDevice) {
        hasLights = miscDevice->configureLightsLocked();
            associatedDevice = std::make_shared<AssociatedDevice>(sysfsRootPath.value());
        }
        hasBattery = associatedDevice->configureBatteryLocked();
        hasLights = associatedDevice->configureLightsLocked();


        device->miscDevice = miscDevice;
        device->associatedDevice = associatedDevice;
        mMiscDevices.insert_or_assign(device->identifier.descriptor, std::move(miscDevice));
    }
    }


    // Figure out the kinds of events the device reports.
    // Figure out the kinds of events the device reports.
@@ -2329,12 +2323,6 @@ void EventHub::closeDeviceLocked(Device& device) {
    mClosingDevices.push_back(std::move(mDevices[device.id]));
    mClosingDevices.push_back(std::move(mDevices[device.id]));


    mDevices.erase(device.id);
    mDevices.erase(device.id);
    // If all devices with the descriptor have been removed then the miscellaneous device should
    // be removed too.
    std::string descriptor = device.identifier.descriptor;
    if (getDeviceByDescriptorLocked(descriptor) == nullptr) {
        mMiscDevices.erase(descriptor);
    }
}
}


status_t EventHub::readNotifyLocked() {
status_t EventHub::readNotifyLocked() {
+3 −5
Original line number Original line Diff line number Diff line
@@ -23,11 +23,11 @@


#include "CursorInputMapper.h"
#include "CursorInputMapper.h"
#include "ExternalStylusInputMapper.h"
#include "ExternalStylusInputMapper.h"
#include "InputController.h"
#include "InputReaderContext.h"
#include "InputReaderContext.h"
#include "JoystickInputMapper.h"
#include "JoystickInputMapper.h"
#include "KeyboardInputMapper.h"
#include "KeyboardInputMapper.h"
#include "MultiTouchInputMapper.h"
#include "MultiTouchInputMapper.h"
#include "PeripheralController.h"
#include "RotaryEncoderInputMapper.h"
#include "RotaryEncoderInputMapper.h"
#include "SensorInputMapper.h"
#include "SensorInputMapper.h"
#include "SingleTouchInputMapper.h"
#include "SingleTouchInputMapper.h"
@@ -165,9 +165,9 @@ void InputDevice::addEventHubDevice(int32_t eventHubId, bool populateMappers) {
    }
    }


    // Battery-like devices or light-containing devices.
    // Battery-like devices or light-containing devices.
    // InputController will be created with associated EventHub device.
    // PeripheralController will be created with associated EventHub device.
    if (classes.test(InputDeviceClass::BATTERY) || classes.test(InputDeviceClass::LIGHT)) {
    if (classes.test(InputDeviceClass::BATTERY) || classes.test(InputDeviceClass::LIGHT)) {
        mController = std::make_unique<InputController>(*contextPtr);
        mController = std::make_unique<PeripheralController>(*contextPtr);
    }
    }


    // Keyboard-like devices.
    // Keyboard-like devices.
@@ -504,8 +504,6 @@ void InputDevice::cancelTouch(nsecs_t when, nsecs_t readTime) {
    for_each_mapper([when, readTime](InputMapper& mapper) { mapper.cancelTouch(when, readTime); });
    for_each_mapper([when, readTime](InputMapper& mapper) { mapper.cancelTouch(when, readTime); });
}
}


// TODO b/180733860 support multiple battery in API and remove this.
constexpr int32_t DEFAULT_BATTERY_ID = 1;
std::optional<int32_t> InputDevice::getBatteryCapacity() {
std::optional<int32_t> InputDevice::getBatteryCapacity() {
    return mController ? mController->getBatteryCapacity(DEFAULT_BATTERY_ID) : std::nullopt;
    return mController ? mController->getBatteryCapacity(DEFAULT_BATTERY_ID) : std::nullopt;
}
}
+27 −27
Original line number Original line Diff line number Diff line
@@ -19,7 +19,7 @@


#include "../Macros.h"
#include "../Macros.h"


#include "InputController.h"
#include "PeripheralController.h"
#include "input/NamedEnum.h"
#include "input/NamedEnum.h"


// Log detailed debug messages about input device lights.
// Log detailed debug messages about input device lights.
@@ -52,15 +52,15 @@ static inline int32_t toArgb(int32_t brightness, int32_t red, int32_t green, int
 * lights, getting and setting the lights brightness and color, by interacting with EventHub
 * lights, getting and setting the lights brightness and color, by interacting with EventHub
 * devices.
 * devices.
 */
 */
InputController::InputController(InputDeviceContext& deviceContext)
PeripheralController::PeripheralController(InputDeviceContext& deviceContext)
      : mDeviceContext(deviceContext) {
      : mDeviceContext(deviceContext) {
    configureBattries();
    configureBattries();
    configureLights();
    configureLights();
}
}


InputController::~InputController() {}
PeripheralController::~PeripheralController() {}


std::optional<std::int32_t> InputController::Light::getRawLightBrightness(int32_t rawLightId) {
std::optional<std::int32_t> PeripheralController::Light::getRawLightBrightness(int32_t rawLightId) {
    std::optional<RawLightInfo> rawInfoOpt = context.getRawLightInfo(rawLightId);
    std::optional<RawLightInfo> rawInfoOpt = context.getRawLightInfo(rawLightId);
    if (!rawInfoOpt.has_value()) {
    if (!rawInfoOpt.has_value()) {
        return std::nullopt;
        return std::nullopt;
@@ -85,7 +85,7 @@ std::optional<std::int32_t> InputController::Light::getRawLightBrightness(int32_
    return brightness;
    return brightness;
}
}


void InputController::Light::setRawLightBrightness(int32_t rawLightId, int32_t brightness) {
void PeripheralController::Light::setRawLightBrightness(int32_t rawLightId, int32_t brightness) {
    std::optional<RawLightInfo> rawInfo = context.getRawLightInfo(rawLightId);
    std::optional<RawLightInfo> rawInfo = context.getRawLightInfo(rawLightId);
    if (!rawInfo.has_value()) {
    if (!rawInfo.has_value()) {
        return;
        return;
@@ -104,14 +104,14 @@ void InputController::Light::setRawLightBrightness(int32_t rawLightId, int32_t b
    context.setLightBrightness(rawLightId, brightness);
    context.setLightBrightness(rawLightId, brightness);
}
}


bool InputController::SingleLight::setLightColor(int32_t color) {
bool PeripheralController::SingleLight::setLightColor(int32_t color) {
    int32_t brightness = getAlpha(color);
    int32_t brightness = getAlpha(color);
    setRawLightBrightness(rawId, brightness);
    setRawLightBrightness(rawId, brightness);


    return true;
    return true;
}
}


bool InputController::RgbLight::setLightColor(int32_t color) {
bool PeripheralController::RgbLight::setLightColor(int32_t color) {
    // Compose color value as per:
    // Compose color value as per:
    // https://developer.android.com/reference/android/graphics/Color?hl=en
    // https://developer.android.com/reference/android/graphics/Color?hl=en
    // int color = (A & 0xff) << 24 | (R & 0xff) << 16 | (G & 0xff) << 8 | (B & 0xff);
    // int color = (A & 0xff) << 24 | (R & 0xff) << 16 | (G & 0xff) << 8 | (B & 0xff);
@@ -137,7 +137,7 @@ bool InputController::RgbLight::setLightColor(int32_t color) {
    return true;
    return true;
}
}


bool InputController::MultiColorLight::setLightColor(int32_t color) {
bool PeripheralController::MultiColorLight::setLightColor(int32_t color) {
    std::unordered_map<LightColor, int32_t> intensities;
    std::unordered_map<LightColor, int32_t> intensities;
    intensities.emplace(LightColor::RED, getRed(color));
    intensities.emplace(LightColor::RED, getRed(color));
    intensities.emplace(LightColor::GREEN, getGreen(color));
    intensities.emplace(LightColor::GREEN, getGreen(color));
@@ -148,7 +148,7 @@ bool InputController::MultiColorLight::setLightColor(int32_t color) {
    return true;
    return true;
}
}


std::optional<int32_t> InputController::SingleLight::getLightColor() {
std::optional<int32_t> PeripheralController::SingleLight::getLightColor() {
    std::optional<int32_t> brightness = getRawLightBrightness(rawId);
    std::optional<int32_t> brightness = getRawLightBrightness(rawId);
    if (!brightness.has_value()) {
    if (!brightness.has_value()) {
        return std::nullopt;
        return std::nullopt;
@@ -157,7 +157,7 @@ std::optional<int32_t> InputController::SingleLight::getLightColor() {
    return toArgb(brightness.value(), 0 /* red */, 0 /* green */, 0 /* blue */);
    return toArgb(brightness.value(), 0 /* red */, 0 /* green */, 0 /* blue */);
}
}


std::optional<int32_t> InputController::RgbLight::getLightColor() {
std::optional<int32_t> PeripheralController::RgbLight::getLightColor() {
    // If the Alpha component is zero, then return color 0.
    // If the Alpha component is zero, then return color 0.
    if (brightness == 0) {
    if (brightness == 0) {
        return 0;
        return 0;
@@ -192,7 +192,7 @@ std::optional<int32_t> InputController::RgbLight::getLightColor() {
    return toArgb(brightness, red, green, blue);
    return toArgb(brightness, red, green, blue);
}
}


std::optional<int32_t> InputController::MultiColorLight::getLightColor() {
std::optional<int32_t> PeripheralController::MultiColorLight::getLightColor() {
    auto ret = context.getLightIntensities(rawId);
    auto ret = context.getLightIntensities(rawId);
    if (!ret.has_value()) {
    if (!ret.has_value()) {
        return std::nullopt;
        return std::nullopt;
@@ -210,7 +210,7 @@ std::optional<int32_t> InputController::MultiColorLight::getLightColor() {
    return std::nullopt;
    return std::nullopt;
}
}


bool InputController::PlayerIdLight::setLightPlayerId(int32_t playerId) {
bool PeripheralController::PlayerIdLight::setLightPlayerId(int32_t playerId) {
    if (rawLightIds.find(playerId) == rawLightIds.end()) {
    if (rawLightIds.find(playerId) == rawLightIds.end()) {
        return false;
        return false;
    }
    }
@@ -224,7 +224,7 @@ bool InputController::PlayerIdLight::setLightPlayerId(int32_t playerId) {
    return true;
    return true;
}
}


std::optional<int32_t> InputController::PlayerIdLight::getLightPlayerId() {
std::optional<int32_t> PeripheralController::PlayerIdLight::getLightPlayerId() {
    for (const auto& [id, rawId] : rawLightIds) {
    for (const auto& [id, rawId] : rawLightIds) {
        std::optional<int32_t> brightness = getRawLightBrightness(rawId);
        std::optional<int32_t> brightness = getRawLightBrightness(rawId);
        if (brightness.has_value() && brightness.value() > 0) {
        if (brightness.has_value() && brightness.value() > 0) {
@@ -234,11 +234,11 @@ std::optional<int32_t> InputController::PlayerIdLight::getLightPlayerId() {
    return std::nullopt;
    return std::nullopt;
}
}


void InputController::SingleLight::dump(std::string& dump) {
void PeripheralController::SingleLight::dump(std::string& dump) {
    dump += StringPrintf(INDENT4 "Color: 0x%x\n", getLightColor().value_or(0));
    dump += StringPrintf(INDENT4 "Color: 0x%x\n", getLightColor().value_or(0));
}
}


void InputController::PlayerIdLight::dump(std::string& dump) {
void PeripheralController::PlayerIdLight::dump(std::string& dump) {
    dump += StringPrintf(INDENT4 "PlayerId: %d\n", getLightPlayerId().value_or(-1));
    dump += StringPrintf(INDENT4 "PlayerId: %d\n", getLightPlayerId().value_or(-1));
    dump += StringPrintf(INDENT4 "Raw Player ID LEDs:");
    dump += StringPrintf(INDENT4 "Raw Player ID LEDs:");
    for (const auto& [id, rawId] : rawLightIds) {
    for (const auto& [id, rawId] : rawLightIds) {
@@ -247,7 +247,7 @@ void InputController::PlayerIdLight::dump(std::string& dump) {
    dump += "\n";
    dump += "\n";
}
}


void InputController::RgbLight::dump(std::string& dump) {
void PeripheralController::RgbLight::dump(std::string& dump) {
    dump += StringPrintf(INDENT4 "Color: 0x%x\n", getLightColor().value_or(0));
    dump += StringPrintf(INDENT4 "Color: 0x%x\n", getLightColor().value_or(0));
    dump += StringPrintf(INDENT4 "Raw RGB LEDs: [%d, %d, %d] ", rawRgbIds.at(LightColor::RED),
    dump += StringPrintf(INDENT4 "Raw RGB LEDs: [%d, %d, %d] ", rawRgbIds.at(LightColor::RED),
                         rawRgbIds.at(LightColor::GREEN), rawRgbIds.at(LightColor::BLUE));
                         rawRgbIds.at(LightColor::GREEN), rawRgbIds.at(LightColor::BLUE));
@@ -257,11 +257,11 @@ void InputController::RgbLight::dump(std::string& dump) {
    dump += "\n";
    dump += "\n";
}
}


void InputController::MultiColorLight::dump(std::string& dump) {
void PeripheralController::MultiColorLight::dump(std::string& dump) {
    dump += StringPrintf(INDENT4 "Color: 0x%x\n", getLightColor().value_or(0));
    dump += StringPrintf(INDENT4 "Color: 0x%x\n", getLightColor().value_or(0));
}
}


void InputController::populateDeviceInfo(InputDeviceInfo* deviceInfo) {
void PeripheralController::populateDeviceInfo(InputDeviceInfo* deviceInfo) {
    // TODO: b/180733860 Remove this after enabling multi-battery
    // TODO: b/180733860 Remove this after enabling multi-battery
    if (!mBatteries.empty()) {
    if (!mBatteries.empty()) {
        deviceInfo->setHasBattery(true);
        deviceInfo->setHasBattery(true);
@@ -279,7 +279,7 @@ void InputController::populateDeviceInfo(InputDeviceInfo* deviceInfo) {
    }
    }
}
}


void InputController::dump(std::string& dump) {
void PeripheralController::dump(std::string& dump) {
    dump += INDENT2 "Input Controller:\n";
    dump += INDENT2 "Input Controller:\n";
    if (!mLights.empty()) {
    if (!mLights.empty()) {
        dump += INDENT3 "Lights:\n";
        dump += INDENT3 "Lights:\n";
@@ -340,7 +340,7 @@ void InputController::dump(std::string& dump) {
    }
    }
}
}


void InputController::configureBattries() {
void PeripheralController::configureBattries() {
    // Check raw batteries
    // Check raw batteries
    const std::vector<int32_t> rawBatteryIds = getDeviceContext().getRawBatteryIds();
    const std::vector<int32_t> rawBatteryIds = getDeviceContext().getRawBatteryIds();


@@ -355,7 +355,7 @@ void InputController::configureBattries() {
    }
    }
}
}


void InputController::configureLights() {
void PeripheralController::configureLights() {
    bool hasRedLed = false;
    bool hasRedLed = false;
    bool hasGreenLed = false;
    bool hasGreenLed = false;
    bool hasBlueLed = false;
    bool hasBlueLed = false;
@@ -472,15 +472,15 @@ void InputController::configureLights() {
    }
    }
}
}


std::optional<int32_t> InputController::getBatteryCapacity(int batteryId) {
std::optional<int32_t> PeripheralController::getBatteryCapacity(int batteryId) {
    return getDeviceContext().getBatteryCapacity(batteryId);
    return getDeviceContext().getBatteryCapacity(batteryId);
}
}


std::optional<int32_t> InputController::getBatteryStatus(int batteryId) {
std::optional<int32_t> PeripheralController::getBatteryStatus(int batteryId) {
    return getDeviceContext().getBatteryStatus(batteryId);
    return getDeviceContext().getBatteryStatus(batteryId);
}
}


bool InputController::setLightColor(int32_t lightId, int32_t color) {
bool PeripheralController::setLightColor(int32_t lightId, int32_t color) {
    auto it = mLights.find(lightId);
    auto it = mLights.find(lightId);
    if (it == mLights.end()) {
    if (it == mLights.end()) {
        return false;
        return false;
@@ -493,7 +493,7 @@ bool InputController::setLightColor(int32_t lightId, int32_t color) {
    return light->setLightColor(color);
    return light->setLightColor(color);
}
}


std::optional<int32_t> InputController::getLightColor(int32_t lightId) {
std::optional<int32_t> PeripheralController::getLightColor(int32_t lightId) {
    auto it = mLights.find(lightId);
    auto it = mLights.find(lightId);
    if (it == mLights.end()) {
    if (it == mLights.end()) {
        return std::nullopt;
        return std::nullopt;
@@ -507,7 +507,7 @@ std::optional<int32_t> InputController::getLightColor(int32_t lightId) {
    return color;
    return color;
}
}


bool InputController::setLightPlayerId(int32_t lightId, int32_t playerId) {
bool PeripheralController::setLightPlayerId(int32_t lightId, int32_t playerId) {
    auto it = mLights.find(lightId);
    auto it = mLights.find(lightId);
    if (it == mLights.end()) {
    if (it == mLights.end()) {
        return false;
        return false;
@@ -516,7 +516,7 @@ bool InputController::setLightPlayerId(int32_t lightId, int32_t playerId) {
    return light->setLightPlayerId(playerId);
    return light->setLightPlayerId(playerId);
}
}


std::optional<int32_t> InputController::getLightPlayerId(int32_t lightId) {
std::optional<int32_t> PeripheralController::getLightPlayerId(int32_t lightId) {
    auto it = mLights.find(lightId);
    auto it = mLights.find(lightId);
    if (it == mLights.end()) {
    if (it == mLights.end()) {
        return std::nullopt;
        return std::nullopt;
+4 −4
Original line number Original line Diff line number Diff line
@@ -17,19 +17,19 @@
#ifndef _UI_INPUTREADER_LIGHT_CONTROLLER_H
#ifndef _UI_INPUTREADER_LIGHT_CONTROLLER_H
#define _UI_INPUTREADER_LIGHT_CONTROLLER_H
#define _UI_INPUTREADER_LIGHT_CONTROLLER_H


#include "InputControllerInterface.h"
#include "PeripheralControllerInterface.h"


namespace android {
namespace android {


class InputController : public InputControllerInterface {
class PeripheralController : public PeripheralControllerInterface {
    // Refer to https://developer.android.com/reference/kotlin/android/graphics/Color
    // Refer to https://developer.android.com/reference/kotlin/android/graphics/Color
    /* Number of colors : {red, green, blue} */
    /* Number of colors : {red, green, blue} */
    static constexpr size_t COLOR_NUM = 3;
    static constexpr size_t COLOR_NUM = 3;
    static constexpr int32_t MAX_BRIGHTNESS = 0xff;
    static constexpr int32_t MAX_BRIGHTNESS = 0xff;


public:
public:
    explicit InputController(InputDeviceContext& deviceContext);
    explicit PeripheralController(InputDeviceContext& deviceContext);
    ~InputController() override;
    ~PeripheralController() override;


    void populateDeviceInfo(InputDeviceInfo* deviceInfo) override;
    void populateDeviceInfo(InputDeviceInfo* deviceInfo) override;
    void dump(std::string& dump) override;
    void dump(std::string& dump) override;
Loading