Update the battery charging status when turning battery on/off.

Bug: 72656089
Test: cts-tradefed run singleCommand cts-dev -m CtsHostsideNetworkTests -t \
      com.android.cts.net.HostsideRestrictBackgroundNetworkTests

Change-Id: Ida6d3ff4a78c91e656b49a26006603973753c808
This commit is contained in:
Sudheer Shanka
2018-02-13 15:56:15 -08:00
parent dc134af7aa
commit 2bf68eba3a

View File

@@ -810,11 +810,15 @@ abstract class AbstractRestrictBackgroundNetworkTestCase extends Instrumentation
protected void turnBatteryOn() throws Exception {
executeSilentShellCommand("cmd battery unplug");
executeSilentShellCommand("cmd battery set status "
+ BatteryManager.BATTERY_STATUS_NOT_CHARGING);
assertBatteryState(false);
}
protected void turnBatteryOff() throws Exception {
executeSilentShellCommand("cmd battery set ac " + BatteryManager.BATTERY_PLUGGED_AC);
executeSilentShellCommand("cmd battery set status "
+ BatteryManager.BATTERY_STATUS_CHARGING);
assertBatteryState(true);
}