diff options
author | Yan Wang <yawanng@google.com> | 2019-07-08 17:47:39 -0700 |
---|---|---|
committer | Yan Wang <yawanng@google.com> | 2019-07-10 16:53:47 -0700 |
commit | 34e2dabcf966102906f2b9e33b96bea2fa9728a4 (patch) | |
tree | fee227dab6a40e8b4eb6319c5160d2f2da6cb5c6 /startop/scripts/app_startup/lib/adb_utils.py | |
parent | 90bc5ac1e03c4c99e417e65dca4bcfcd7374757a (diff) |
startop: Move compiled trace file installation after activity checking (bugfix).
Test: pytest run_app_with_prefetch_test.py
Test: python run_app_with_prefetch.py -p com.android.settings -i input -d -r fadvise
Bug: 135286022
Change-Id: I06040bb10bfd8edf3f520576c4aed5a28587b142
Diffstat (limited to 'startop/scripts/app_startup/lib/adb_utils.py')
-rw-r--r-- | startop/scripts/app_startup/lib/adb_utils.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/startop/scripts/app_startup/lib/adb_utils.py b/startop/scripts/app_startup/lib/adb_utils.py index 00e2e9995863..761dc2e82204 100644 --- a/startop/scripts/app_startup/lib/adb_utils.py +++ b/startop/scripts/app_startup/lib/adb_utils.py @@ -18,6 +18,7 @@ import os import sys +import time sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname( os.path.abspath(__file__))))) @@ -54,10 +55,13 @@ def disable_selinux(): cmd_utils.run_shell_command('adb wait-for-device') def pkill(procname: str): - """Kills a process in device by its package name.""" + """Kills a process on device specified by the substring pattern in procname""" _, pids = cmd_utils.run_shell_command('adb shell ps | grep "{}" | ' 'awk \'{{print $2;}}\''. format(procname)) for pid in pids.split('\n'): - cmd_utils.run_adb_shell_command('kill {}'.format(pid)) + pid = pid.strip() + if pid: + passed,_ = cmd_utils.run_adb_shell_command('kill {}'.format(pid)) + time.sleep(1) |