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

Side by Side Diff: build/android/adb_reverse_forwarder.py

Issue 1334803002: Revert of [Android] Don't use a device blacklist if one isn't provided. (RELAND) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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/adb_install_apk.py ('k') | build/android/buildbot/bb_device_status_check.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 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Command line tool for forwarding ports from a device to the host. 7 """Command line tool for forwarding ports from a device to the host.
8 8
9 Allows an Android device to connect to services running on the host machine, 9 Allows an Android device to connect to services running on the host machine,
10 i.e., "adb forward" in reverse. Requires |host_forwarder| and |device_forwarder| 10 i.e., "adb forward" in reverse. Requires |host_forwarder| and |device_forwarder|
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 parser.error('Need even number of port pairs') 48 parser.error('Need even number of port pairs')
49 sys.exit(1) 49 sys.exit(1)
50 50
51 try: 51 try:
52 port_pairs = [int(a) for a in args[1:]] 52 port_pairs = [int(a) for a in args[1:]]
53 port_pairs = zip(port_pairs[::2], port_pairs[1::2]) 53 port_pairs = zip(port_pairs[::2], port_pairs[1::2])
54 except ValueError: 54 except ValueError:
55 parser.error('Bad port number') 55 parser.error('Bad port number')
56 sys.exit(1) 56 sys.exit(1)
57 57
58 blacklist = (device_blacklist.Blacklist(options.blacklist_file) 58 if options.blacklist_file:
59 if options.blacklist_file 59 blacklist = device_blacklist.Blacklist(options.blacklist_file)
60 else None) 60 else:
61 blacklist = None
62
61 devices = device_utils.DeviceUtils.HealthyDevices(blacklist) 63 devices = device_utils.DeviceUtils.HealthyDevices(blacklist)
62 64
63 if options.device: 65 if options.device:
64 device = next((d for d in devices if d == options.device), None) 66 device = next((d for d in devices if d == options.device), None)
65 if not device: 67 if not device:
66 raise device_errors.DeviceUnreachableError(options.device) 68 raise device_errors.DeviceUnreachableError(options.device)
67 elif devices: 69 elif devices:
68 device = devices[0] 70 device = devices[0]
69 logging.info('No device specified. Defaulting to %s', devices[0]) 71 logging.info('No device specified. Defaulting to %s', devices[0])
70 else: 72 else:
71 raise device_errors.NoDevicesError() 73 raise device_errors.NoDevicesError()
72 74
73 constants.SetBuildType(options.build_type) 75 constants.SetBuildType(options.build_type)
74 try: 76 try:
75 forwarder.Forwarder.Map(port_pairs, device) 77 forwarder.Forwarder.Map(port_pairs, device)
76 while True: 78 while True:
77 time.sleep(60) 79 time.sleep(60)
78 except KeyboardInterrupt: 80 except KeyboardInterrupt:
79 sys.exit(0) 81 sys.exit(0)
80 finally: 82 finally:
81 forwarder.Forwarder.UnmapAllDevicePorts(device) 83 forwarder.Forwarder.UnmapAllDevicePorts(device)
82 84
83 if __name__ == '__main__': 85 if __name__ == '__main__':
84 main(sys.argv) 86 main(sys.argv)
OLDNEW
« no previous file with comments | « build/android/adb_install_apk.py ('k') | build/android/buildbot/bb_device_status_check.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698