Fix and expand battery saver stats tracking.
The STATE_CHARGING value had the BatterySaverState bits to resemble "ON", so dumpsys would incorrectly say battery saver was on whenever the device was plugged in. It also meant that the enabled count would incorrectly increase whenever the device was plugged and unplugged. This change fixes that by explicitly checking for the magic values before incrementing the counters. In addition, this adds more logging around adaptive battery saver stats and removes the STATE_CHARGING magic value in favor of an explicit PLUGGED/UNPLUGGED state to move away from the assumption that battery saver is off whenever the device is plugged in. Bug: 32423528 Bug: 119261320 Bug: 158581564 Test: atest com.android.server.power.batterysaver.BatterySaverPolicyTest Test: atest com.android.server.power.batterysaver.BatterySaverStateMachineTest Test: atest com.android.server.power.batterysaver.BatterySavingStatsTest Test: atest com.android.server.power.PowerManagerServiceTest Change-Id: I071d47299360a003febd5251c2515c0b55b3cfff
Loading
Please register or sign in to comment