Snap for 9184912 from e3e227d53d2db0d846ff42fe890e116fc912a373 to mainline-tzdata3-release
Change-Id: I6cc641871ed1bc2e17bd8ad3d3a61c30c3c69bcf
diff --git a/libraries/sts-common-util/host-side/src/com/android/sts/common/MallocDebug.java b/libraries/sts-common-util/host-side/src/com/android/sts/common/MallocDebug.java
index 5379592..498dd62 100644
--- a/libraries/sts-common-util/host-side/src/com/android/sts/common/MallocDebug.java
+++ b/libraries/sts-common-util/host-side/src/com/android/sts/common/MallocDebug.java
@@ -18,6 +18,7 @@
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
import static org.junit.Assume.assumeNoException;
import com.android.tradefed.device.DeviceNotAvailableException;
@@ -70,9 +71,21 @@
try {
this.killProcess = ProcessUtil.withProcessKill(device, processName, null);
ProcessUtil.waitProcessRunning(device, processName);
- } catch (TimeoutException e) {
+ } catch (TimeoutException e1) {
+ try {
+ setMallocDebugOptionsProperty.close();
+ setAttachedProgramProperty.close();
+ } catch (Exception e2) {
+ fail(
+ "Could not restart '"
+ + processName
+ + "' before enabling malloc debug. Additionally, there was an"
+ + " exception while trying to reset device state. Tests after"
+ + " this may not work as expected!\n"
+ + e2);
+ }
assumeNoException(
- "Could not restart '" + processName + "' before enabling malloc debug", e);
+ "Could not restart '" + processName + "' before enabling malloc debug", e1);
}
}
}
diff --git a/libraries/sts-common-util/host-side/src/com/android/sts/common/tradefed/testtype/RootSecurityTestCase.java b/libraries/sts-common-util/host-side/src/com/android/sts/common/tradefed/testtype/RootSecurityTestCase.java
index d299e71..2398713 100644
--- a/libraries/sts-common-util/host-side/src/com/android/sts/common/tradefed/testtype/RootSecurityTestCase.java
+++ b/libraries/sts-common-util/host-side/src/com/android/sts/common/tradefed/testtype/RootSecurityTestCase.java
@@ -19,8 +19,6 @@
import static org.junit.Assume.assumeTrue;
import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.log.LogUtil.CLog;
import org.junit.Before;
@@ -37,22 +35,4 @@
public void setUpRoot() throws DeviceNotAvailableException {
assumeTrue("Could not enable adb root on device.", getDevice().enableAdbRoot());
}
-
- /**
- * Try to enable adb root on device.
- *
- * <p>Use {@link NativeDevice#enableAdbRoot()} internally. The test methods calling this
- * function should run even if enableAdbRoot fails, which is why the return value is ignored.
- * However, we may want to act on that data point in the future.
- */
- protected static boolean enableAdbRoot(ITestDevice device) throws DeviceNotAvailableException {
- if (device.enableAdbRoot()) {
- return true;
- } else {
- CLog.e(
- "\"enable-root\" set to false! "
- + "Root is required to check if device is vulnerable.");
- return false;
- }
- }
}