light: Remove backlight support in favour of hwcomposer

Signed-off-by: DennySPb <dennyspb@gmail.com>
Change-Id: Ia05d24423bb80bb5df6a5352ea68bd8e971d5b32
This commit is contained in:
Pig 2020-12-17 15:04:59 +03:00 committed by Giammarco Senatore
parent 0e256fece3
commit d06a7361f4
No known key found for this signature in database
GPG key ID: 661348FC1E144F04
2 changed files with 0 additions and 21 deletions

View file

@ -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;

View file

@ -44,7 +44,6 @@ class Light : public ILight {
Return<void> getSupportedTypes(getSupportedTypes_cb _hidl_cb) override;
private:
void handleBacklight(const LightState& state);
void handleRgb(const LightState& state, size_t index);
std::mutex mLock;