diff --git a/light/Light.cpp b/light/Light.cpp index d912ae8..9ccdf6b 100644 --- a/light/Light.cpp +++ b/light/Light.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 The LineageOS Project + * Copyright (C) 2018-2020 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -75,32 +75,12 @@ static uint32_t getBrightness(const LightState& state) { return (77 * red + 150 * green + 29 * blue) >> 8; } -static uint32_t rgbToBrightness(const LightState& state) { - uint32_t color = state.color & 0x00ffffff; - return ((77 * ((color >> 16) & 0xff)) - + (150 * ((color >> 8) & 0xff)) - + (29 * (color & 0xff))) >> 8; -} - Light::Light() { mLights.emplace(Type::ATTENTION, std::bind(&Light::handleNotification, this, std::placeholders::_1, 0)); - mLights.emplace(Type::BACKLIGHT, std::bind(&Light::handleBacklight, this, std::placeholders::_1)); mLights.emplace(Type::BATTERY, std::bind(&Light::handleBattery, this, std::placeholders::_1)); mLights.emplace(Type::NOTIFICATIONS, std::bind(&Light::handleNotification, this, std::placeholders::_1, 1)); } -void Light::handleBacklight(const LightState& state) { - int maxBrightness = get("/sys/class/backlight/panel0-backlight/max_brightness", -1); - if (maxBrightness < 0) { - maxBrightness = kDefaultMaxBrightness; - } - uint32_t sentBrightness = rgbToBrightness(state); - uint32_t brightness = sentBrightness * maxBrightness / kDefaultMaxBrightness; - LOG(DEBUG) << "Writing backlight brightness " << brightness - << " (orig " << sentBrightness << ")"; - set("/sys/class/backlight/panel0-backlight/brightness", brightness); -} - void Light::handleBattery(const LightState& state) { uint32_t whiteBrightness = getBrightness(state); diff --git a/light/Light.h b/light/Light.h index 44f4732..32ee2c1 100644 --- a/light/Light.h +++ b/light/Light.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2019 The LineageOS Project + * Copyright (C) 2018-2020 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,7 +45,6 @@ class Light : public ILight { Return getSupportedTypes(getSupportedTypes_cb _hidl_cb) override; private: - void handleBacklight(const LightState& state); void handleBattery(const LightState& state); void handleNotification(const LightState& state, size_t index);