light: Remove backlight support in favour of hwcomposer
Signed-off-by: DennySPb <dennyspb@gmail.com> Change-Id: Ia05d24423bb80bb5df6a5352ea68bd8e971d5b32
This commit is contained in:
parent
0e256fece3
commit
d06a7361f4
2 changed files with 0 additions and 21 deletions
|
@ -48,32 +48,12 @@ static T get(const std::string& path, const T& def) {
|
||||||
return file.fail() ? def : result;
|
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() {
|
Light::Light() {
|
||||||
mLights.emplace(Type::ATTENTION, std::bind(&Light::handleRgb, this, std::placeholders::_1, 0));
|
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::BATTERY, std::bind(&Light::handleRgb, this, std::placeholders::_1, 2));
|
||||||
mLights.emplace(Type::NOTIFICATIONS, std::bind(&Light::handleRgb, this, std::placeholders::_1, 1));
|
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) {
|
void Light::handleRgb(const LightState& state, size_t index) {
|
||||||
mLightStates.at(index) = state;
|
mLightStates.at(index) = state;
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,6 @@ class Light : public ILight {
|
||||||
Return<void> getSupportedTypes(getSupportedTypes_cb _hidl_cb) override;
|
Return<void> getSupportedTypes(getSupportedTypes_cb _hidl_cb) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void handleBacklight(const LightState& state);
|
|
||||||
void handleRgb(const LightState& state, size_t index);
|
void handleRgb(const LightState& state, size_t index);
|
||||||
|
|
||||||
std::mutex mLock;
|
std::mutex mLock;
|
||||||
|
|
Loading…
Reference in a new issue