Ensure we always restart the framework at the end of the test
Python side disable framework and apparently never re-enable
it.
Ensure that the test runner always return the device to the
original state.
Test: unit tests
Bug: 144076709
Change-Id: If362e45c05815e5f5bda90f208385cbe9720b0a0
Merged-In: Ia634177c839b0768f9acdc33b0c5adcfee994927
diff --git a/harnesses/tradefed/src/com/android/tradefed/testtype/VtsMultiDeviceTest.java b/harnesses/tradefed/src/com/android/tradefed/testtype/VtsMultiDeviceTest.java
index d76dc28..c9d904f 100644
--- a/harnesses/tradefed/src/com/android/tradefed/testtype/VtsMultiDeviceTest.java
+++ b/harnesses/tradefed/src/com/android/tradefed/testtype/VtsMultiDeviceTest.java
@@ -1109,7 +1109,7 @@
* @throws IllegalArgumentException
*/
private void doRunTest(ITestLifeCycleReceiver listener)
- throws RuntimeException, IllegalArgumentException {
+ throws RuntimeException, IllegalArgumentException, DeviceNotAvailableException {
CLog.i("Device serial number: " + mDevice.getSerialNumber());
setTestCaseDataDir();
@@ -1255,6 +1255,14 @@
CLog.i("Deleted the runner json config file, %s.", jsonFilePath);
}
+ // If the framework was disabled in python, make sure we re-enable it no matter what.
+ // The python side never re-enable the framework.
+ if (mBinaryTestDisableFramework) {
+ for (ITestDevice device : mInvocationContext.getDevices()) {
+ device.executeShellCommand("start");
+ }
+ }
+
if (interruptMessage != null) {
throw new RunInterruptedException(interruptMessage);
}