Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 591a1503 authored by Piotr Wilczyński's avatar Piotr Wilczyński
Browse files

Fix brightness per user

- Don't set user serial to -1. When brightness is set without providing a user serial, the current user serial should be used.

- Make sure that handleBrightnessModeChange is called before a new brightness is set for the new user, otherwise auto-brightness might overwrite the brightness for the new user even if the new user has auto-brightness turned off. To that end, handleBrightnessModeChange won't be posting to the handler thread any more (it doesn't need to - everything happens on the power thread anyway) and DPC will set the brightness for the new user instead of DisplayManagerService.

- Remove the call to updatePowerState from handleBrightnessModeChange - it was only needed if handleBrightnessModeChange was called from SettingsObserver.onChange and it was making DPC tests difficult to write because there would sometimes be two calls to updatePowerState. Now DPC tests are easier to write and we only have to verify single interactions with mocks.

- DisplayPowerControllerTest#testReleaseProxSuspendBlockersOnExit was incorrect - it was checking if wake locks were acquired twice, which is not necessary. It should check if they were released instead because that's what should happen when we stop the DPC.

- Separate handleSettingsChange and handleOnSwitchUser.

- Don't process auto-brightness adjustment when switching users - the adjustment is related to the short-term model. We're resetting the short-term model when switching users.

- Use the default brightness for new users.

Bug: 279109106
Test: Switch users and see what happens to the brightness.
Test: adb shell dumpsys display
Test: atest com.android.server.display
Change-Id: I2469ce8a78c8c3c6eb3f66059cef6318db4428ef
parent d8851476
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment