From d06a7361f4aebdde35db56318a7836c367a705ac Mon Sep 17 00:00:00 2001 From: Pig Date: Thu, 17 Dec 2020 15:04:59 +0300 Subject: [PATCH] light: Remove backlight support in favour of hwcomposer Signed-off-by: DennySPb Change-Id: Ia05d24423bb80bb5df6a5352ea68bd8e971d5b32 --- light/Light.cpp | 20 -------------------- light/Light.h | 1 - 2 files changed, 21 deletions(-) diff --git a/light/Light.cpp b/light/Light.cpp index d914e55..366dc68 100644 --- a/light/Light.cpp +++ b/light/Light.cpp @@ -48,32 +48,12 @@ static T get(const std::string& path, const T& def) { return file.fail() ? def : result; } -static int rgbToBrightness(const LightState& state) { - int color = state.color & 0x00ffffff; - return ((77 * ((color >> 16) & 0x00ff)) - + (150 * ((color >> 8) & 0x00ff)) - + (29 * (color & 0x00ff))) >> 8; -} - Light::Light() { mLights.emplace(Type::ATTENTION, std::bind(&Light::handleRgb, this, std::placeholders::_1, 0)); - mLights.emplace(Type::BACKLIGHT, std::bind(&Light::handleBacklight, this, std::placeholders::_1)); mLights.emplace(Type::BATTERY, std::bind(&Light::handleRgb, this, std::placeholders::_1, 2)); mLights.emplace(Type::NOTIFICATIONS, std::bind(&Light::handleRgb, 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 = 255; - } - int sentBrightness = rgbToBrightness(state); - int brightness = sentBrightness * maxBrightness / 255; - LOG(DEBUG) << "Writing backlight brightness " << brightness - << " (orig " << sentBrightness << ")"; - set("/sys/class/backlight/panel0-backlight/brightness", brightness); -} - void Light::handleRgb(const LightState& state, size_t index) { mLightStates.at(index) = state; diff --git a/light/Light.h b/light/Light.h index 27a701a..bf8e59e 100644 --- a/light/Light.h +++ b/light/Light.h @@ -44,7 +44,6 @@ class Light : public ILight { Return getSupportedTypes(getSupportedTypes_cb _hidl_cb) override; private: - void handleBacklight(const LightState& state); void handleRgb(const LightState& state, size_t index); std::mutex mLock;