diff options
| author | Chris Ye <lzye@google.com> | 2021-05-16 23:05:17 -0700 |
|---|---|---|
| committer | Chris Ye <lzye@google.com> | 2021-05-16 23:07:40 -0700 |
| commit | 857583385bd7504f89780c99d24b0da073fd43ce (patch) | |
| tree | cec33402f6188d35091559e9925ff9edb006fd6c /services/inputflinger/reader/controller/PeripheralController.cpp | |
| parent | d16d3a03fcab524ace2e27c3bdb8b0dd8510e940 (diff) | |
Change native lights to be consistent with java API.
Change native lights type to match java API light types.
Bug: 181743615
Test: atest InputDeviceLightsManagerTest, atest LightsManagerTest, atest android.hardware.input.cts.tests
Change-Id: I45fe0489fdc070bb4057f4bea061f0cbeacad0de
Diffstat (limited to 'services/inputflinger/reader/controller/PeripheralController.cpp')
| -rw-r--r-- | services/inputflinger/reader/controller/PeripheralController.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/services/inputflinger/reader/controller/PeripheralController.cpp b/services/inputflinger/reader/controller/PeripheralController.cpp index 1a40d06f45..16251ee0ca 100644 --- a/services/inputflinger/reader/controller/PeripheralController.cpp +++ b/services/inputflinger/reader/controller/PeripheralController.cpp @@ -104,7 +104,7 @@ void PeripheralController::Light::setRawLightBrightness(int32_t rawLightId, int3 context.setLightBrightness(rawLightId, brightness); } -bool PeripheralController::SingleLight::setLightColor(int32_t color) { +bool PeripheralController::MonoLight::setLightColor(int32_t color) { int32_t brightness = getAlpha(color); setRawLightBrightness(rawId, brightness); @@ -148,7 +148,7 @@ bool PeripheralController::MultiColorLight::setLightColor(int32_t color) { return true; } -std::optional<int32_t> PeripheralController::SingleLight::getLightColor() { +std::optional<int32_t> PeripheralController::MonoLight::getLightColor() { std::optional<int32_t> brightness = getRawLightBrightness(rawId); if (!brightness.has_value()) { return std::nullopt; @@ -234,7 +234,7 @@ std::optional<int32_t> PeripheralController::PlayerIdLight::getLightPlayerId() { return std::nullopt; } -void PeripheralController::SingleLight::dump(std::string& dump) { +void PeripheralController::MonoLight::dump(std::string& dump) { dump += StringPrintf(INDENT4 "Color: 0x%x\n", getLightColor().value_or(0)); } @@ -423,7 +423,7 @@ void PeripheralController::configureLights() { playerIdLightIds); mLights.insert_or_assign(light->id, std::move(light)); // Remove these raw lights from raw light info as they've been used to compose a - // Player ID light, so we do not expose these raw lights as single lights. + // Player ID light, so we do not expose these raw lights as mono lights. for (const auto& [playerId, rawId] : playerIdLightIds) { rawInfos.erase(rawId); } @@ -460,13 +460,12 @@ void PeripheralController::configureLights() { mLights.insert_or_assign(light->id, std::move(light)); continue; } - // Construct a single LED light + // Construct a Mono LED light if (DEBUG_LIGHT_DETAILS) { - ALOGD("Single light Id %d name %s \n", rawInfo.id, rawInfo.name.c_str()); + ALOGD("Mono light Id %d name %s \n", rawInfo.id, rawInfo.name.c_str()); } - std::unique_ptr<Light> light = - std::make_unique<SingleLight>(getDeviceContext(), rawInfo.name, ++mNextId, - rawInfo.id); + std::unique_ptr<Light> light = std::make_unique<MonoLight>(getDeviceContext(), rawInfo.name, + ++mNextId, rawInfo.id); mLights.insert_or_assign(light->id, std::move(light)); } |
