cyb3rko / flashdim

Modern flashlight app with dim functionality on Android 13+
Apache License 2.0
431 stars 19 forks source link

Xiaomi/Redmi Support #74

Open EmilEmilchen opened 1 month ago

EmilEmilchen commented 1 month ago

I really love this app but unfortunately it doesn't work with Xiaomi/Redmi devices, for example the Redmi Note 12 Pro Plus 5g. As far as I can tell it is impossible to get this feature working on this device without root permissions. Since I only have access to the Redmi device I mentioned I couldn't check on any other one but on the Note 12 Pro Plus the brightness is controlled by a 0-16 integer value in /sys/class/leds/torch-light0/brightness which is only accessible on a rooted device (as far as I can tell anyway). I haven't looked much into the inner workings of FlashDim but I'd love Xiaomi devices to be supported. I wrote a quick and dirty proof of concept (Github Repo) which just does echo BRIGHTNESS_VALUE > /sys/class/leds/torch-light0/brightness using the Shell.cmd(command).exec() method provided by the topjohnwu libsu API.