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

Skip to content
Commit f57f99ed authored by Kweku Adams's avatar Kweku Adams
Browse files

Formalizing states in BatterySaverStateMachine.

Formalizing the states and transitions makes it easier to add new
functionality and guarantee correctness.

This also fixes the issue where automatically turning off sticky
accidentally turns off battery saver since the transition is only
done when in the correct state. The problem was that when the battery
level changed (above the sticky auto disable threshold),
doAutoBatterySaver would be called. stickyEnabled would be true,
and the level would be above the threshold, so it would disable sticky.
Then at the next level drop, doAutoBatterySaver would be called again,
but this time, sticky would be false, so it would go to automatic check
and see that the level is above the threshold and then turn off battery saver.

Bug: 127659938
Bug: 119764865
Bug: 112232746
Bug: 79580230
Test: atest com.android.server.power.batterysaver.BatterySaverStateMachineTest
Test: atest CtsBatterySavingTestCases
Change-Id: Ia311d8bdc593a1680eda82d4d06fee21ea45c0ba
parent 0718f9d0
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