Bringing CTS in line with how STS did this fix.
Bug: 111403569
Test: None
Change-Id: I8093aff55f937e7b8928e82dd194813b8f89e2be
diff --git a/hostsidetests/securitybulletin/src/android/security/cts/SecurityTestCase.java b/hostsidetests/securitybulletin/src/android/security/cts/SecurityTestCase.java
index c059923..172fbe0 100644
--- a/hostsidetests/securitybulletin/src/android/security/cts/SecurityTestCase.java
+++ b/hostsidetests/securitybulletin/src/android/security/cts/SecurityTestCase.java
@@ -101,32 +101,29 @@
*/
@Override
public void tearDown() throws Exception {
- try {
- getDevice().waitForDeviceAvailable(120 * 1000);
- String uptime = getDevice().executeShellCommand("cat /proc/uptime");
- assertTrue("Phone has had a hard reset",
- (System.currentTimeMillis()/1000 -
- Integer.parseInt(uptime.substring(0, uptime.indexOf('.')))
- - kernelStartTime < 2));
- //TODO(badash@): add ability to catch runtime restart
- getDevice().executeAdbCommand("unroot");
+ oomCatcher.stop(getDevice().getSerialNumber());
- if (oomCatcher.isOomDetected()) {
- switch (oomCatcher.getOomBehavior()) {
- case FAIL_AND_LOG:
- fail("The device ran out of memory.");
- return;
- case PASS_AND_LOG:
- Log.logAndDisplay(Log.LogLevel.INFO, LOG_TAG, "Skipping test.");
- return;
- case FAIL_NO_LOG:
- fail();
- return;
- }
+ getDevice().waitForDeviceAvailable(120 * 1000);
+ String uptime = getDevice().executeShellCommand("cat /proc/uptime");
+ assertTrue("Phone has had a hard reset",
+ (System.currentTimeMillis()/1000 -
+ Integer.parseInt(uptime.substring(0, uptime.indexOf('.')))
+ - kernelStartTime < 2));
+ //TODO(badash@): add ability to catch runtime restart
+ getDevice().executeAdbCommand("unroot");
+
+ if (oomCatcher.isOomDetected()) {
+ switch (oomCatcher.getOomBehavior()) {
+ case FAIL_AND_LOG:
+ fail("The device ran out of memory.");
+ return;
+ case PASS_AND_LOG:
+ Log.logAndDisplay(Log.LogLevel.INFO, LOG_TAG, "Skipping test.");
+ return;
+ case FAIL_NO_LOG:
+ fail();
+ return;
}
-
- } finally {
- oomCatcher.stop(getDevice().getSerialNumber());
}
}