Mock on-battery state correctly on batteryless devices.

The setup command `dumpsys battery unplug` fakes only the
"(AC|USB|Wireless) powered" battery service state.

In addition to it, for simulating the on-battery status on batteryless devices,
the "status" field of the service needs to be altered. The field is "unknown"
on Android P batteryless devices, and com.android.internal.os.BatteryStatsImpl
never considers itself as on-battery under the state.

Bug: 126827395
Test: -t com.android.server.cts.BatteryStatsValidationTest on Chromebase
Test: -t com.android.server.cts.BatteryStatsValidationTest on Pixel 3
Change-Id: I089539dd2e0111c57597404d4f72ce25bd20e30f
1 file changed