diff options
author | Andres Celis <celisa@google.com> | 2017-10-21 00:12:19 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-10-21 00:12:19 +0000 |
commit | 1fe4b4022c97ba63abb2e8c0605bf03f25b8a90e (patch) | |
tree | 4335c4274583b2b6fe9192767d4a72b880166168 | |
parent | 57fcac5b40d56705024018b16052fdd21c67fa6b (diff) | |
parent | 7d4643347f15d12b446369273dc515b50bb9d9df (diff) | |
download | cts-1fe4b4022c97ba63abb2e8c0605bf03f25b8a90e.tar.gz |
Merge "Fix for b/68051472" into nyc-dev
am: 7d4643347f
Change-Id: I7ae1abfcd477ce1c27bc4653bba731c1ca09a8f1
-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"); |