diff options
author | Andres Celis <celisa@google.com> | 2017-10-21 00:18:40 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-10-21 00:18:40 +0000 |
commit | 89d9036a9d5bb7d1d167e46ca89bf7dbf92ac02d (patch) | |
tree | f21a01095eafab98906308e0bad8fa09254ce297 | |
parent | 31f0655eb4e47f6368444878fa15b0e374795d4a (diff) | |
parent | 1fe4b4022c97ba63abb2e8c0605bf03f25b8a90e (diff) | |
download | cts-89d9036a9d5bb7d1d167e46ca89bf7dbf92ac02d.tar.gz |
Merge "Fix for b/68051472" into nyc-dev am: 7d4643347f
am: 1fe4b4022c
Change-Id: If8468bd35e9f126caf4e44bfd9e011825e64d8d3
-rw-r--r-- | hostsidetests/security/src/android/security/cts/SecurityTestCase.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/hostsidetests/security/src/android/security/cts/SecurityTestCase.java b/hostsidetests/security/src/android/security/cts/SecurityTestCase.java index b3144e14905..f1c5ed30612 100644 --- a/hostsidetests/security/src/android/security/cts/SecurityTestCase.java +++ b/hostsidetests/security/src/android/security/cts/SecurityTestCase.java @@ -42,8 +42,9 @@ public class SecurityTestCase extends DeviceTestCase { public void setUp() throws Exception { super.setUp(); + String uptime = getDevice().executeShellCommand("cat /proc/uptime"); kernelStartTime = System.currentTimeMillis()/1000 - - Integer.parseInt(getDevice().executeShellCommand("cut -f1 -d. /proc/uptime").trim()); + Integer.parseInt(uptime.substring(0, uptime.indexOf('.'))); //TODO:(badash@): Watch for other things to track. // Specifically time when app framework starts } @@ -81,9 +82,10 @@ public class SecurityTestCase extends DeviceTestCase { @Override public void tearDown() throws Exception { getDevice().waitForDeviceOnline(60 * 1000); + String uptime = getDevice().executeShellCommand("cat /proc/uptime"); assertTrue("Phone has had a hard reset", (System.currentTimeMillis()/1000 - - Integer.parseInt(getDevice().executeShellCommand("cut -f1 -d. /proc/uptime").trim()) + Integer.parseInt(uptime.substring(0, uptime.indexOf('.'))) - kernelStartTime < 2)); //TODO(badash@): add ability to catch runtime restart getDevice().executeAdbCommand("unroot"); |