aniyomi icon indicating copy to clipboard operation
aniyomi copied to clipboard

Default brightness (0) doesn't matches device's current brightness.

Open gusainkun opened this issue 1 year ago • 1 comments

Steps to reproduce

  1. Disable remeber and switch last used brightness under player settings.
  2. Play any video.
  3. The brightness of the player is now set to zero.

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

  • [X] I have searched the existing issues and this is a new ticket, NOT a duplicate or related to another open or closed issue.
  • [X] I have written a short but informative title.
  • [X] If this is an issue with an official extension, I should be opening an issue in the extensions repository.
  • [X] If this is an issue with an official manga extension and this issue can be replicated in the Tachiyomi app, that I should be opening an issue in Tachiyomi's extensions repository.
  • [X] I have gone through the FAQ and troubleshooting guide.
  • [X] I have updated the app to version 0.15.2.2.
  • [X] I have updated all installed extensions.
  • [X] I will fill out all of the requested information in this form.

gusainkun avatar Jan 20 '24 16:01 gusainkun

Why no one is noticing this issue as it is really annoying to get super bright screen while overlaying anything(ex: messenger chat baubles)

ShoyebOP avatar Feb 09 '24 14:02 ShoyebOP

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%.

  • in case device uses 255: 5% is 12.75 so 12.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 so 204.75 / 255 = 0.8 which will have the player's brightness level much higher than the device

Snipyer avatar May 24 '24 17:05 Snipyer

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%.

  • in case device uses 255: 5% is 12.75 so 12.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 so 204.75 / 255 = 0.8 which will have the player's brightness level much higher than the device

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%.

  • in case device uses 255: 5% is 12.75 so 12.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 so 204.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?

ShoyebOP avatar May 26 '24 13:05 ShoyebOP

https://github.com/aniyomiorg/aniyomi/commit/fb9f46331625b87deceb219a8132c25a99774472

jmir1 avatar Jun 30 '24 21:06 jmir1