aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-09-26 08:20:58 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-09-26 08:20:58 +0000
commit3121280439d90b691d6ac6d2bd5f785971f35878 (patch)
treedb57cd48d617c77bb3b3af7f2a9b3a24d0cb0bf6
parentf2ebea1023512168c9b8d39e0c5c1fe4e19aab6b (diff)
parentc3c0e1780fb7e894af237133c3c9b1a4424eb752 (diff)
downloadlisa-3121280439d90b691d6ac6d2bd5f785971f35878.tar.gz
release-request-37e26775-0485-4a3d-a06c-026b3663c922-for-git_pi-release-4359872 snap-temp-L83600000106066915
Change-Id: I97ac93ea193c1a71809a0101db4979f22fb6c1d5
-rw-r--r--libs/utils/android/system.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/libs/utils/android/system.py b/libs/utils/android/system.py
index a461d0a..be7b0b3 100644
--- a/libs/utils/android/system.py
+++ b/libs/utils/android/system.py
@@ -20,6 +20,7 @@ import logging
from devlib.utils.android import adb_command
from devlib import TargetError
import os
+import re
import time
import pexpect as pe
@@ -165,6 +166,9 @@ class System(object):
def set_property(target, prop, value, restart=False):
"""
Set a system property, then run adb shell stop && start if necessary
+
+ When restart=True, this function clears logcat to avoid detecting old
+ "Boot is finished" messages.
"""
try:
target.execute('setprop {} {}'.format(prop, value), as_root=True)
@@ -174,13 +178,14 @@ class System(object):
if not restart:
return
+ target.execute('logcat -c', check_exit_code=False)
+ BOOT_FINISHED_RE = re.compile(r'Boot is finished')
+ logcat = target.background('logcat SurfaceFlinger:* *:S')
target.execute('stop && start', as_root=True)
while True:
- try:
- System.wakeup(target)
- except TargetError:
- time.sleep(1)
- else:
+ message = logcat.stdout.readline(1024)
+ match = BOOT_FINISHED_RE.search(message)
+ if match:
return
@staticmethod