aidl: light: Construct HwLight in place

They aren't used outside the ctor, let's
inline their construction.

Change-Id: Ic4f2afb24caabc42a95f94c8c150fa028975c8a5
This commit is contained in:
Luca Stefani 2023-11-13 01:18:14 +01:00 committed by Sebastiano Barezzi
parent ad315044e4
commit 5981d19419
No known key found for this signature in database
GPG Key ID: 763BD3AE91A7A13F

View File

@ -37,15 +37,10 @@ static LED kLEDs[MAX_LEDS] = {
#define AutoHwLight(light) {.id = (int32_t)light, .type = light, .ordinal = 0}
static const HwLight kBacklightHwLight = AutoHwLight(LightType::BACKLIGHT);
static const HwLight kBatteryHwLight = AutoHwLight(LightType::BATTERY);
static const HwLight kButtonsHwLight = AutoHwLight(LightType::BUTTONS);
static const HwLight kNotificationHwLight = AutoHwLight(LightType::NOTIFICATIONS);
Lights::Lights() {
mBacklightDevice = getBacklightDevice();
if (mBacklightDevice) {
mLights.push_back(kBacklightHwLight);
mLights.push_back(AutoHwLight(LightType::BACKLIGHT));
}
for (auto& buttons : kAllButtonsPaths) {
@ -56,12 +51,12 @@ Lights::Lights() {
}
if (!mButtonsPaths.empty())
mLights.push_back(kButtonsHwLight);
mLights.push_back(AutoHwLight(LightType::BUTTONS));
mWhiteLED = kLEDs[WHITE].exists();
mLights.push_back(kBatteryHwLight);
mLights.push_back(kNotificationHwLight);
mLights.push_back(AutoHwLight(LightType::BATTERY));
mLights.push_back(AutoHwLight(LightType::NOTIFICATIONS));
}
ndk::ScopedAStatus Lights::setLightState(int32_t id, const HwLightState& state) {