| OLD | NEW |
| 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 """Provisions Android devices with settings required for bots. | 7 """Provisions Android devices with settings required for bots. |
| 8 | 8 |
| 9 Usage: | 9 Usage: |
| 10 ./provision_devices.py [-d <device serial number>] | 10 ./provision_devices.py [-d <device serial number>] |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 device, device_settings.DISABLE_LOCATION_SETTINGS) | 200 device, device_settings.DISABLE_LOCATION_SETTINGS) |
| 201 else: | 201 else: |
| 202 device_settings.ConfigureContentSettings( | 202 device_settings.ConfigureContentSettings( |
| 203 device, device_settings.ENABLE_LOCATION_SETTINGS) | 203 device, device_settings.ENABLE_LOCATION_SETTINGS) |
| 204 device_settings.SetLockScreenSettings(device) | 204 device_settings.SetLockScreenSettings(device) |
| 205 if options.disable_network: | 205 if options.disable_network: |
| 206 device_settings.ConfigureContentSettings( | 206 device_settings.ConfigureContentSettings( |
| 207 device, device_settings.NETWORK_DISABLED_SETTINGS) | 207 device, device_settings.NETWORK_DISABLED_SETTINGS) |
| 208 if options.min_battery_level is not None: | 208 if options.min_battery_level is not None: |
| 209 try: | 209 try: |
| 210 device.SetUsbCharging(True) | 210 device.SetCharging(True) |
| 211 ChargeDeviceToLevel(device, options.min_battery_level) | 211 ChargeDeviceToLevel(device, options.min_battery_level) |
| 212 except device_errors.CommandFailedError as e: | 212 except device_errors.CommandFailedError as e: |
| 213 logging.exception('Unable to charge device to specified level.') | 213 logging.exception('Unable to charge device to specified level.') |
| 214 | 214 |
| 215 if not options.skip_wipe: | 215 if not options.skip_wipe: |
| 216 device.Reboot(True, timeout=reboot_timeout, retries=0) | 216 device.Reboot(True, timeout=reboot_timeout, retries=0) |
| 217 device.RunShellCommand('date -s %s' % time.strftime('%Y%m%d.%H%M%S', | 217 device.RunShellCommand('date -s %s' % time.strftime('%Y%m%d.%H%M%S', |
| 218 time.gmtime()), | 218 time.gmtime()), |
| 219 as_root=True) | 219 as_root=True) |
| 220 props = device.RunShellCommand('getprop') | 220 props = device.RunShellCommand('getprop') |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 parser.add_argument('--adb-key-files', type=str, nargs='+', | 294 parser.add_argument('--adb-key-files', type=str, nargs='+', |
| 295 help='list of adb keys to push to device') | 295 help='list of adb keys to push to device') |
| 296 args = parser.parse_args() | 296 args = parser.parse_args() |
| 297 constants.SetBuildType(args.target) | 297 constants.SetBuildType(args.target) |
| 298 | 298 |
| 299 return ProvisionDevices(args) | 299 return ProvisionDevices(args) |
| 300 | 300 |
| 301 | 301 |
| 302 if __name__ == '__main__': | 302 if __name__ == '__main__': |
| 303 sys.exit(main()) | 303 sys.exit(main()) |
| OLD | NEW |