Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3275)

Unified Diff: build/android/provision_devices.py

Issue 338353004: [Android] Switch KillAll, StartActivity, and BroadcastIntent to DeviceUtils. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: appeasing windows Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | build/android/pylib/android_commands.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/provision_devices.py
diff --git a/build/android/provision_devices.py b/build/android/provision_devices.py
index 41044254caaae7a6ea81707a3d0f8436f5d9ff40..f80eea2c73217dfff261e1e79c46ad76cb38fbed 100755
--- a/build/android/provision_devices.py
+++ b/build/android/provision_devices.py
@@ -21,6 +21,7 @@ import time
from pylib import android_commands
from pylib import constants
from pylib import device_settings
+from pylib.device import device_errors
from pylib.device import device_utils
sys.path.append(os.path.join(constants.DIR_SOURCE_ROOT,
@@ -59,7 +60,14 @@ def PushAndLaunchAdbReboot(devices, target):
print 'Will push and launch adb_reboot on %s' % device_serial
device = device_utils.DeviceUtils(device_serial)
# Kill if adb_reboot is already running.
- device.old_interface.KillAllBlocking('adb_reboot', 2)
+ try:
+ # Don't try to kill adb_reboot more than once. We don't expect it to be
+ # running at all.
+ device.KillAll('adb_reboot', blocking=True, timeout=2, retries=0)
+ except device_errors.CommandFailedError:
+ # We can safely ignore the exception because we don't expect adb_reboot
+ # to be running.
+ pass
# Push adb_reboot
print ' Pushing adb_reboot ...'
adb_reboot = os.path.join(constants.DIR_SOURCE_ROOT,
@@ -89,7 +97,7 @@ def _ConfigureLocalProperties(device, is_perf):
# Android will not respect the local props file if it is world writable.
device.RunShellCommand(
'chmod 644 %s' % constants.DEVICE_LOCAL_PROPERTIES_PATH,
- root=True)
+ as_root=True)
# LOCAL_PROPERTIES_PATH = '/data/local.prop'
@@ -110,12 +118,12 @@ def WipeDeviceData(device):
constants.ADB_KEYS_FILE)
if device_authorized:
adb_keys = device.RunShellCommand('cat %s' % constants.ADB_KEYS_FILE,
- root=True)
- device.RunShellCommand('wipe data', root=True)
+ as_root=True)
+ device.RunShellCommand('wipe data', as_root=True)
if device_authorized:
path_list = constants.ADB_KEYS_FILE.split('/')
dir_path = '/'.join(path_list[:len(path_list)-1])
- device.RunShellCommand('mkdir -p %s' % dir_path, root=True)
+ device.RunShellCommand('mkdir -p %s' % dir_path, as_root=True)
device.RunShellCommand('echo %s > %s' %
(adb_keys[0], constants.ADB_KEYS_FILE))
for adb_key in adb_keys[1:]:
@@ -182,7 +190,7 @@ def ProvisionDevices(options):
battery_info.get('level', 0))
time.sleep(60)
battery_info = device.old_interface.GetBatteryInfo()
- device.RunShellCommand('date -u %f' % time.time(), root=True)
+ device.RunShellCommand('date -u %f' % time.time(), as_root=True)
try:
device_utils.DeviceUtils.parallel(devices).Reboot(True)
except errors.DeviceUnresponsiveError:
« no previous file with comments | « no previous file | build/android/pylib/android_commands.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698