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

Side by Side Diff: build/android/pylib/device/device_utils.py

Issue 1049993003: Revert of [Android] Clean up old_interface in build/android/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 unified diff | Download patch
« no previous file with comments | « build/android/pylib/base/base_test_runner.py ('k') | build/android/pylib/gtest/test_options.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Provides a variety of device interactions based on adb. 5 """Provides a variety of device interactions based on adb.
6 6
7 Eventually, this will be based on adb_wrapper. 7 Eventually, this will be based on adb_wrapper.
8 """ 8 """
9 # pylint: disable=unused-argument 9 # pylint: disable=unused-argument
10 10
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 'enable_command': ( 65 'enable_command': (
66 'echo 0x4A > /sys/kernel/debug/bq24192/INPUT_SRC_CONT && ' 66 'echo 0x4A > /sys/kernel/debug/bq24192/INPUT_SRC_CONT && '
67 'echo 1 > /sys/class/power_supply/usb/online'), 67 'echo 1 > /sys/class/power_supply/usb/online'),
68 'disable_command': ( 68 'disable_command': (
69 'echo 0xCA > /sys/kernel/debug/bq24192/INPUT_SRC_CONT && ' 69 'echo 0xCA > /sys/kernel/debug/bq24192/INPUT_SRC_CONT && '
70 'chmod 644 /sys/class/power_supply/usb/online && ' 70 'chmod 644 /sys/class/power_supply/usb/online && '
71 'echo 0 > /sys/class/power_supply/usb/online'), 71 'echo 0 > /sys/class/power_supply/usb/online'),
72 }, 72 },
73 ] 73 ]
74 74
75 # This must be done in a single shell command.
76 _RESTART_ADBD_SCRIPT = """
77 function restart() {
78 stop adbd
79 start adbd
80 }
81
82 restart &
83 """
84
85
86 @decorators.WithExplicitTimeoutAndRetries( 75 @decorators.WithExplicitTimeoutAndRetries(
87 _DEFAULT_TIMEOUT, _DEFAULT_RETRIES) 76 _DEFAULT_TIMEOUT, _DEFAULT_RETRIES)
88 def GetAVDs(): 77 def GetAVDs():
89 """Returns a list of Android Virtual Devices. 78 """Returns a list of Android Virtual Devices.
90 79
91 Returns: 80 Returns:
92 A list containing the configured AVDs. 81 A list containing the configured AVDs.
93 """ 82 """
94 lines = cmd_helper.GetCmdOutput([ 83 lines = cmd_helper.GetCmdOutput([
95 os.path.join(constants.ANDROID_SDK_ROOT, 'tools', 'android'), 84 os.path.join(constants.ANDROID_SDK_ROOT, 'tools', 'android'),
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 return 'Wi-Fi is enabled' in self.RunShellCommand(['dumpsys', 'wifi'], 375 return 'Wi-Fi is enabled' in self.RunShellCommand(['dumpsys', 'wifi'],
387 check_return=False) 376 check_return=False)
388 377
389 self.adb.WaitForDevice() 378 self.adb.WaitForDevice()
390 timeout_retry.WaitFor(sd_card_ready) 379 timeout_retry.WaitFor(sd_card_ready)
391 timeout_retry.WaitFor(pm_ready) 380 timeout_retry.WaitFor(pm_ready)
392 timeout_retry.WaitFor(boot_completed) 381 timeout_retry.WaitFor(boot_completed)
393 if wifi: 382 if wifi:
394 timeout_retry.WaitFor(wifi_enabled) 383 timeout_retry.WaitFor(wifi_enabled)
395 384
396 @decorators.WithTimeoutAndRetriesFromInstance()
397 def RestartAdbd(self, timeout=None, retries=None):
398 self.RunShellCommand(['sh', '-c', _RESTART_ADBD_SCRIPT],
399 as_root=True, check_return=True)
400 self.adb.WaitForDevice()
401
402 REBOOT_DEFAULT_TIMEOUT = 10 * _DEFAULT_TIMEOUT 385 REBOOT_DEFAULT_TIMEOUT = 10 * _DEFAULT_TIMEOUT
403 REBOOT_DEFAULT_RETRIES = _DEFAULT_RETRIES 386 REBOOT_DEFAULT_RETRIES = _DEFAULT_RETRIES
404 387
405 @decorators.WithTimeoutAndRetriesDefaults( 388 @decorators.WithTimeoutAndRetriesDefaults(
406 REBOOT_DEFAULT_TIMEOUT, 389 REBOOT_DEFAULT_TIMEOUT,
407 REBOOT_DEFAULT_RETRIES) 390 REBOOT_DEFAULT_RETRIES)
408 def Reboot(self, block=True, wifi=False, timeout=None, retries=None): 391 def Reboot(self, block=True, wifi=False, timeout=None, retries=None):
409 """Reboot the device. 392 """Reboot the device.
410 393
411 Args: 394 Args:
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after
1658 """ 1641 """
1659 if not devices: 1642 if not devices:
1660 devices = adb_wrapper.AdbWrapper.GetDevices() 1643 devices = adb_wrapper.AdbWrapper.GetDevices()
1661 if not devices: 1644 if not devices:
1662 raise device_errors.NoDevicesError() 1645 raise device_errors.NoDevicesError()
1663 devices = [d if isinstance(d, cls) else cls(d) for d in devices] 1646 devices = [d if isinstance(d, cls) else cls(d) for d in devices]
1664 if async: 1647 if async:
1665 return parallelizer.Parallelizer(devices) 1648 return parallelizer.Parallelizer(devices)
1666 else: 1649 else:
1667 return parallelizer.SyncParallelizer(devices) 1650 return parallelizer.SyncParallelizer(devices)
OLDNEW
« no previous file with comments | « build/android/pylib/base/base_test_runner.py ('k') | build/android/pylib/gtest/test_options.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698