From 6ce834112017fa6b36e6a4b83d688d62d5ffe1fb Mon Sep 17 00:00:00 2001 From: LinkBoi00 Date: Sun, 14 Aug 2022 00:23:54 +0300 Subject: [PATCH] rosemary: lights: Adapt brightness scaling behaviour to match MIUI MIUI's lowest brightness value is '19' and using lower values can cause the backlight to completely power off inadvertedly Therefore, let's just account for this behaviour in the light AIDL by adding '19' instead of '1' to the final brightness value Signed-off-by: LinkBoi00 Change-Id: I0e31bda9a0cc505f1246209810eae624dfe5d068 --- lights/Light.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lights/Light.cpp b/lights/Light.cpp index 86c0c14..61519e2 100644 --- a/lights/Light.cpp +++ b/lights/Light.cpp @@ -86,7 +86,7 @@ static inline uint32_t scaleBrightness(uint32_t brightness, uint32_t maxBrightne return 0; } - return (brightness - 1) * (maxBrightness - 1) / (0xFF - 1) + 1; + return (brightness - 1) * (maxBrightness - 19) / (0xFF - 1) + 19; } static inline uint32_t getScaledBrightness(const HwLightState& state, uint32_t maxBrightness) {