aaassseee / screen_brightness

A Plugin for controlling screen brightness with application life cycle set and reset brightness implemented
https://pub.dev/packages/screen_brightness
MIT License
25 stars 20 forks source link

[bug] brightness value in iOS is always accurate, but Android is not #36

Open CillianMyles opened 3 days ago

CillianMyles commented 3 days ago

Description (bug summary)

My app is using the system brightness controls (previously the application controls) but I have observed on multiple iOS devices the value for brightness always seems accurate (compared to the OS), whereas on Android it seems like the plugin value and the OS value are off.

Step to reproduce (how to reproduce the bug)

iOS

https://github.com/user-attachments/assets/ff5ad5aa-f756-4642-8756-506872678eae

Android

https://github.com/user-attachments/assets/e98e92c5-aea9-4b48-981b-950191598e48

Platform (Android/iOS/macOS/Windows)

Notice how the OS and values from the plugin are aligned in iOS, but not Android, from the screen recordings above.

iPhone 12 - iOS 18

Google Pixel 6A - Android 14

I'll dig a little deeper if I get time, but my guess is it's something to do with the calculation of brightness vs max brightness on Android, but also please let me know if you need any more information from me.

And thanks for the great package! 🙏

aaassseee commented 3 days ago

Hi @CillianMyles. Thanks for reporting this problem with video. I will check it later too.

CillianMyles commented 3 days ago

Hi @CillianMyles. Thanks for reporting this problem with video. I will check it later too.

Let me know if you need minimal repro sample, but the above just makes use of onSystemScreenBrightnessChanged and setSystemScreenBrightness (pretty straightforward).

aaassseee commented 14 hours ago

found that the maximum brightness is not match with the system setting bar will dig deep to the Android code