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

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

Issue 1282563003: [Android] Convert RestartAdbd to DeviceUtils again. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add device test Created 5 years, 4 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 | « no previous file | build/android/pylib/device/device_utils_device_test.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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 'enable_command': ( 69 'enable_command': (
70 'echo 0x4A > /sys/kernel/debug/bq24192/INPUT_SRC_CONT && ' 70 'echo 0x4A > /sys/kernel/debug/bq24192/INPUT_SRC_CONT && '
71 'echo 1 > /sys/class/power_supply/usb/online'), 71 'echo 1 > /sys/class/power_supply/usb/online'),
72 'disable_command': ( 72 'disable_command': (
73 'echo 0xCA > /sys/kernel/debug/bq24192/INPUT_SRC_CONT && ' 73 'echo 0xCA > /sys/kernel/debug/bq24192/INPUT_SRC_CONT && '
74 'chmod 644 /sys/class/power_supply/usb/online && ' 74 'chmod 644 /sys/class/power_supply/usb/online && '
75 'echo 0 > /sys/class/power_supply/usb/online'), 75 'echo 0 > /sys/class/power_supply/usb/online'),
76 }, 76 },
77 ] 77 ]
78 78
79 _RESTART_ADBD_SCRIPT = """
80 trap '' HUP
81 trap '' TERM
82 trap '' PIPE
83 function restart() {
84 stop adbd
85 start adbd
86 }
87 restart &
88 """
79 89
80 _CURRENT_FOCUS_CRASH_RE = re.compile( 90 _CURRENT_FOCUS_CRASH_RE = re.compile(
81 r'\s*mCurrentFocus.*Application (Error|Not Responding): (\S+)}') 91 r'\s*mCurrentFocus.*Application (Error|Not Responding): (\S+)}')
82 92
83 93
84 @decorators.WithExplicitTimeoutAndRetries( 94 @decorators.WithExplicitTimeoutAndRetries(
85 _DEFAULT_TIMEOUT, _DEFAULT_RETRIES) 95 _DEFAULT_TIMEOUT, _DEFAULT_RETRIES)
86 def GetAVDs(): 96 def GetAVDs():
87 """Returns a list of Android Virtual Devices. 97 """Returns a list of Android Virtual Devices.
88 98
(...skipping 1708 matching lines...) Expand 10 before | Expand all | Expand 10 after
1797 def HealthyDevices(cls): 1807 def HealthyDevices(cls):
1798 blacklist = device_blacklist.ReadBlacklist() 1808 blacklist = device_blacklist.ReadBlacklist()
1799 def blacklisted(adb): 1809 def blacklisted(adb):
1800 if adb.GetDeviceSerial() in blacklist: 1810 if adb.GetDeviceSerial() in blacklist:
1801 logging.warning('Device %s is blacklisted.', adb.GetDeviceSerial()) 1811 logging.warning('Device %s is blacklisted.', adb.GetDeviceSerial())
1802 return True 1812 return True
1803 return False 1813 return False
1804 1814
1805 return [cls(adb) for adb in adb_wrapper.AdbWrapper.Devices() 1815 return [cls(adb) for adb in adb_wrapper.AdbWrapper.Devices()
1806 if not blacklisted(adb)] 1816 if not blacklisted(adb)]
1817
1818 @decorators.WithTimeoutAndRetriesFromInstance()
1819 def RestartAdbd(self, timeout=None, retries=None):
1820 logging.info('Restarting adbd on device.')
1821 with device_temp_file.DeviceTempFile(self.adb, suffix='.sh') as script:
1822 self.WriteFile(script.name, _RESTART_ADBD_SCRIPT)
1823 self.RunShellCommand(['source', script.name], as_root=True)
1824 self.adb.WaitForDevice()
OLDNEW
« no previous file with comments | « no previous file | build/android/pylib/device/device_utils_device_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698