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

Side by Side Diff: tools/telemetry/telemetry/internal/platform/android_device.py

Issue 1502033002: Revert of [Android] Add a configurable environment for devil/. (RELAND 2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
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 import logging 4 import logging
5 import os 5 import os
6 import re 6 import re
7 import subprocess 7 import subprocess
8 8
9 from telemetry.core import util 9 from telemetry.core import util
10 from telemetry.internal.platform import device 10 from telemetry.internal.platform import device
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 if len(devices) > 1: 122 if len(devices) > 1:
123 logging.warn( 123 logging.warn(
124 'Multiple devices attached. Please specify one of the following:\n' + 124 'Multiple devices attached. Please specify one of the following:\n' +
125 '\n'.join([' --device=%s' % d.device_id for d in devices])) 125 '\n'.join([' --device=%s' % d.device_id for d in devices]))
126 return None 126 return None
127 return devices[0] 127 return devices[0]
128 128
129 129
130 def CanDiscoverDevices(): 130 def CanDiscoverDevices():
131 """Returns true if devices are discoverable via adb.""" 131 """Returns true if devices are discoverable via adb."""
132 if os.name != 'posix':
133 return False
134
135 adb_path = constants.GetAdbPath() 132 adb_path = constants.GetAdbPath()
136 if os.path.isabs(adb_path) and not os.path.exists(adb_path): 133 if os.path.isabs(adb_path) and not os.path.exists(adb_path):
137 return False 134 return False
138 try: 135 try:
139 with open(os.devnull, 'w') as devnull: 136 with open(os.devnull, 'w') as devnull:
140 adb_process = subprocess.Popen( 137 adb_process = subprocess.Popen(
141 ['adb', 'devices'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, 138 ['adb', 'devices'], stdout=subprocess.PIPE, stderr=subprocess.PIPE,
142 stdin=devnull) 139 stdin=devnull)
143 stdout = adb_process.communicate()[0] 140 stdout = adb_process.communicate()[0]
144 if re.search(re.escape('????????????\tno permissions'), stdout) != None: 141 if re.search(re.escape('????????????\tno permissions'), stdout) != None:
(...skipping 19 matching lines...) Expand all
164 """ 161 """
165 if options.android_blacklist_file: 162 if options.android_blacklist_file:
166 blacklist = device_blacklist.Blacklist(options.android_blacklist_file) 163 blacklist = device_blacklist.Blacklist(options.android_blacklist_file)
167 else: 164 else:
168 blacklist = None 165 blacklist = None
169 166
170 if not CanDiscoverDevices(): 167 if not CanDiscoverDevices():
171 return [] 168 return []
172 else: 169 else:
173 return AndroidDevice.GetAllConnectedDevices(blacklist) 170 return AndroidDevice.GetAllConnectedDevices(blacklist)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698