Index: build/android/adb_install_apk.py |
diff --git a/build/android/adb_install_apk.py b/build/android/adb_install_apk.py |
index 50faea7d29110ce38ff924e1ed1c74e8266b526a..3000b811385abb1c3853755ab1a7f2a549667898 100755 |
--- a/build/android/adb_install_apk.py |
+++ b/build/android/adb_install_apk.py |
@@ -53,6 +53,7 @@ def main(): |
'Default is env var BUILDTYPE or Debug.') |
parser.add_argument('-d', '--device', dest='device', |
help='Target device for apk to install on.') |
+ parser.add_argument('--blacklist-file', help='Device blacklist JSON file.') |
parser.add_argument('-v', '--verbose', action='count', |
help='Enable verbose logging.') |
@@ -82,7 +83,13 @@ def main(): |
and helper.GetSplitName()): |
splits.append(f) |
- devices = device_utils.DeviceUtils.HealthyDevices() |
+ if args.blacklist_file: |
+ blacklist = device_blacklist.Blacklist(args.blacklist_file) |
+ else: |
+ # TODO(jbudorick): Remove this once the bots are converted. |
+ blacklist = device_blacklist.Blacklist(device_blacklist.BLACKLIST_JSON) |
+ |
+ devices = device_utils.DeviceUtils.HealthyDevices(blacklist) |
if args.device: |
devices = [d for d in devices if d == args.device] |
@@ -99,12 +106,14 @@ def main(): |
device.Install(apk, reinstall=args.keep_data) |
except device_errors.CommandFailedError: |
logging.exception('Failed to install %s', args.apk_name) |
- device_blacklist.ExtendBlacklist([str(device)]) |
- logging.warning('Blacklisting %s', str(device)) |
+ if blacklist: |
+ blacklist.Extend([str(device)]) |
+ logging.warning('Blacklisting %s', str(device)) |
except device_errors.CommandTimeoutError: |
logging.exception('Timed out while installing %s', args.apk_name) |
- device_blacklist.ExtendBlacklist([str(device)]) |
- logging.warning('Blacklisting %s', str(device)) |
+ if blacklist: |
+ blacklist.Extend([str(device)]) |
+ logging.warning('Blacklisting %s', str(device)) |
device_utils.DeviceUtils.parallel(devices).pMap(blacklisting_install) |