| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 for device_serial in devices: | 157 for device_serial in devices: |
| 158 device = device_utils.DeviceUtils(device_serial) | 158 device = device_utils.DeviceUtils(device_serial) |
| 159 device.old_interface.EnableAdbRoot() | 159 device.old_interface.EnableAdbRoot() |
| 160 _ConfigureLocalProperties(device, is_perf) | 160 _ConfigureLocalProperties(device, is_perf) |
| 161 device_settings_map = device_settings.DETERMINISTIC_DEVICE_SETTINGS | 161 device_settings_map = device_settings.DETERMINISTIC_DEVICE_SETTINGS |
| 162 if options.disable_location: | 162 if options.disable_location: |
| 163 device_settings_map.update(device_settings.DISABLE_LOCATION_SETTING) | 163 device_settings_map.update(device_settings.DISABLE_LOCATION_SETTING) |
| 164 else: | 164 else: |
| 165 device_settings_map.update(device_settings.ENABLE_LOCATION_SETTING) | 165 device_settings_map.update(device_settings.ENABLE_LOCATION_SETTING) |
| 166 device_settings.ConfigureContentSettingsDict(device, device_settings_map) | 166 device_settings.ConfigureContentSettingsDict(device, device_settings_map) |
| 167 device_settings.SetLockScreenSettings(device) |
| 167 if is_perf: | 168 if is_perf: |
| 168 # TODO(tonyg): We eventually want network on. However, currently radios | 169 # TODO(tonyg): We eventually want network on. However, currently radios |
| 169 # can cause perfbots to drain faster than they charge. | 170 # can cause perfbots to drain faster than they charge. |
| 170 device_settings.ConfigureContentSettingsDict( | 171 device_settings.ConfigureContentSettingsDict( |
| 171 device, device_settings.NETWORK_DISABLED_SETTINGS) | 172 device, device_settings.NETWORK_DISABLED_SETTINGS) |
| 172 # Some perf bots run benchmarks with USB charging disabled which leads | 173 # Some perf bots run benchmarks with USB charging disabled which leads |
| 173 # to gradual draining of the battery. We must wait for a full charge | 174 # to gradual draining of the battery. We must wait for a full charge |
| 174 # before starting a run in order to keep the devices online. | 175 # before starting a run in order to keep the devices online. |
| 175 try: | 176 try: |
| 176 battery_info = device.old_interface.GetBatteryInfo() | 177 battery_info = device.old_interface.GetBatteryInfo() |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 225 |
| 225 if args: | 226 if args: |
| 226 print >> sys.stderr, 'Unused args %s' % args | 227 print >> sys.stderr, 'Unused args %s' % args |
| 227 return 1 | 228 return 1 |
| 228 | 229 |
| 229 ProvisionDevices(options) | 230 ProvisionDevices(options) |
| 230 | 231 |
| 231 | 232 |
| 232 if __name__ == '__main__': | 233 if __name__ == '__main__': |
| 233 sys.exit(main(sys.argv)) | 234 sys.exit(main(sys.argv)) |
| OLD | NEW |