Closed gusainkun closed 3 months ago
Why no one is noticing this issue as it is really annoying to get super bright screen while overlaying anything(ex: messenger chat baubles)
So i did some digging into this issue and found that it's caused by the device's max brightness value being different than the standard.
The code responsible for setting the players brightness is:
Settings.System.getInt(resolver, Settings.System.SCREEN_BRIGHTNESS) / 255f
255: standard max brightness value.
The code will divide the value of brightness of the device by 255 to have a brightness range of 0 to 1. But my device uses 4095 as the max brightness value, when any value is received from the device in the range of 0-4095 it will always be a greater value than the correct brightness if we're dividing by 255.
Let's say i have my brightness as 5%.
5% is 12.75
so 12.75 / 255 = 0.05
which will have the player's brightness level as the same as the device5% is 204.75
so 204.75 / 255 = 0.8
which will have the player's brightness level much higher than the deviceSo i did some digging into this issue and found that it's caused by the device's max brightness value being different than the standard.
The code responsible for setting the players brightness is:
Settings.System.getInt(resolver, Settings.System.SCREEN_BRIGHTNESS) / 255f
255: standard max brightness value.
The code will divide the value of brightness of the device by 255 to have a brightness range of 0 to 1. But my device uses 4095 as the max brightness value, when any value is received from the device in the range of 0-4095 it will always be a greater value than the correct brightness if we're dividing by 255.
Let's say i have my brightness as 5%.
- in case device uses 255:
5% is 12.75
so12.75 / 255 = 0.05
which will have the player's brightness level as the same as the device- in case device uses 4095:
5% is 204.75
so204.75 / 255 = 0.8
which will have the player's brightness level much higher than the deviceSo i did some digging into this issue and found that it's caused by the device's max brightness value being different than the standard.
The code responsible for setting the players brightness is:
Settings.System.getInt(resolver, Settings.System.SCREEN_BRIGHTNESS) / 255f
255: standard max brightness value.
The code will divide the value of brightness of the device by 255 to have a brightness range of 0 to 1. But my device uses 4095 as the max brightness value, when any value is received from the device in the range of 0-4095 it will always be a greater value than the correct brightness if we're dividing by 255.
Let's say i have my brightness as 5%.
- in case device uses 255:
5% is 12.75
so12.75 / 255 = 0.05
which will have the player's brightness level as the same as the device- in case device uses 4095:
5% is 204.75
so204.75 / 255 = 0.8
which will have the player's brightness level much higher than the device
So now what? It's not something we can fix right?
Steps to reproduce
Expected behavior
The default brightness of the PLAYER should be equal to the device's current brightness.
Actual behavior
The default brightness of the player is automatically set to 0, which is 50% of the device's brightness and NOT the current brightness of device thus often blinding users while using the app in an low light enviornment.
Crash logs
No response
Aniyomi version
0.15.2.2
Android version
Android 12
Device
Moto G40 Fusion
Other details
Please fix this ASAP as it often flashes the users with sudden bright screen.
Acknowledgements