Don't reset battery status before disabling battery saver mode.
Resetting battery status makes the "disabling battery saver mode"
operation that follows it a no-op if the device is plugged-in to power.
In this case, sticky battery saver status won't get reset and might
affect the tests following it.
Also, change back turnBatteryOff -> "cmd battery reset" since issue "72502904"
is fixed now.
Fixes: 77236363
Test: cts-tradefed run singleCommand cts-dev -m CtsHostsideNetworkTests -t \
com.android.cts.net.HostsideRestrictBackgroundNetworkTests
Change-Id: I93e11c714200e8de6864a3bd7627eb66842a39d1
This commit is contained in:
@@ -17,6 +17,12 @@
|
||||
<option name="test-suite-tag" value="cts" />
|
||||
<option name="config-descriptor:metadata" key="component" value="networking" />
|
||||
<target_preparer class="com.android.cts.net.NetPolicyTestsPreparer" />
|
||||
|
||||
<target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
|
||||
<option name="teardown-command" value="cmd power set-mode 0" />
|
||||
<option name="teardown-command" value="cmd battery reset" />
|
||||
</target_preparer>
|
||||
|
||||
<test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
|
||||
<option name="jar" value="CtsHostsideNetworkTests.jar" />
|
||||
<option name="runtime-hint" value="3m56s" />
|
||||
|
||||
@@ -148,7 +148,6 @@ abstract class AbstractRestrictBackgroundNetworkTestCase extends Instrumentation
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
batteryReset();
|
||||
if (!mIsLocationOn) {
|
||||
disableLocation();
|
||||
}
|
||||
@@ -810,20 +809,12 @@ 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);
|
||||
}
|
||||
|
||||
private void batteryReset() throws Exception {
|
||||
executeSilentShellCommand("cmd battery reset");
|
||||
assertBatteryState(true);
|
||||
}
|
||||
|
||||
private void assertBatteryState(boolean pluggedIn) throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user