Battery Simulator is a simple command line interface for developers to use in testing behavior of their code with respect to different battery states independent (or in the absence) of a physical battery.
Build and update your project on the target device (note that the product configuration must include //src/power:battery). Then run fx shell to enter the shell. To run the simulator, type battery_cli.
Disconnects the BatteryManager from the physical battery, providing clients with simulated BatteryInfo data.
Reconnects the BatteryManager to the physical battery, providing clients with read BatteryInfo data.
To get the current BatteryInfo, run
Modifies the state of the simulated battery. Must call ‘disconnect’ prior to ‘set’. Arguments of the commands are separated by spaces.
battman> set battery_attribute1 battery_attribute_value1 ... battery_attributeN battery_attribute_valueN
Where attribute is any of the following:
Some example commands
battman> set BatteryPercentage 95 battman> set LevelStatus LOW ChargeSource WIRELESS BatteryPercentage 12