summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndres Celis <celisa@google.com>2017-10-21 00:22:56 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-10-21 00:22:56 +0000
commit2d7a3dca17e1743be43b5f4428cac41ff7e8b5fa (patch)
tree8024c159c2d00eaeefad54eca8d65c1ec2b906d1
parent582dd4db23d2bd3f3c7a6421cc6a46ee57e78310 (diff)
parent89d9036a9d5bb7d1d167e46ca89bf7dbf92ac02d (diff)
downloadcts-2d7a3dca17e1743be43b5f4428cac41ff7e8b5fa.tar.gz
Merge "Fix for b/68051472" into nyc-dev am: 7d4643347f am: 1fe4b4022c
am: 89d9036a9d Change-Id: Ie2e975d4b92f033003a4ea9a828e9d3e841594dd
-rw-r--r--hostsidetests/security/src/android/security/cts/SecurityTestCase.java6
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");