| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 WipeDeviceData(device) | 133 WipeDeviceData(device) |
| 134 _ConfigureLocalProperties(device) | 134 _ConfigureLocalProperties(device) |
| 135 device_settings.ConfigureContentSettingsDict( | 135 device_settings.ConfigureContentSettingsDict( |
| 136 device, device_settings.DETERMINISTIC_DEVICE_SETTINGS) | 136 device, device_settings.DETERMINISTIC_DEVICE_SETTINGS) |
| 137 # TODO(tonyg): We eventually want network on. However, currently radios | 137 # TODO(tonyg): We eventually want network on. However, currently radios |
| 138 # can cause perfbots to drain faster than they charge. | 138 # can cause perfbots to drain faster than they charge. |
| 139 if 'perf' in os.environ.get('BUILDBOT_BUILDERNAME', '').lower(): | 139 if 'perf' in os.environ.get('BUILDBOT_BUILDERNAME', '').lower(): |
| 140 device_settings.ConfigureContentSettingsDict( | 140 device_settings.ConfigureContentSettingsDict( |
| 141 device, device_settings.NETWORK_DISABLED_SETTINGS) | 141 device, device_settings.NETWORK_DISABLED_SETTINGS) |
| 142 device.old_interface.RunShellCommandWithSU('date -u %f' % time.time()) | 142 device.old_interface.RunShellCommandWithSU('date -u %f' % time.time()) |
| 143 (_, props) = device.old_interface.GetShellCommandStatusAndOutput( |
| 144 'getprop', |
| 145 skip_check='True') |
| 146 for prop in props: |
| 147 print prop |
| 143 if options.auto_reconnect: | 148 if options.auto_reconnect: |
| 144 PushAndLaunchAdbReboot(devices, options.target) | 149 PushAndLaunchAdbReboot(devices, options.target) |
| 145 | 150 |
| 146 | 151 |
| 147 def main(argv): | 152 def main(argv): |
| 148 logging.basicConfig(level=logging.INFO) | 153 logging.basicConfig(level=logging.INFO) |
| 149 | 154 |
| 150 parser = optparse.OptionParser() | 155 parser = optparse.OptionParser() |
| 151 parser.add_option('-d', '--device', | 156 parser.add_option('-d', '--device', |
| 152 help='The serial number of the device to be provisioned') | 157 help='The serial number of the device to be provisioned') |
| 153 parser.add_option('-t', '--target', default='Debug', help='The build target') | 158 parser.add_option('-t', '--target', default='Debug', help='The build target') |
| 154 parser.add_option( | 159 parser.add_option( |
| 155 '-r', '--auto-reconnect', action='store_true', | 160 '-r', '--auto-reconnect', action='store_true', |
| 156 help='Push binary which will reboot the device on adb disconnections.') | 161 help='Push binary which will reboot the device on adb disconnections.') |
| 157 options, args = parser.parse_args(argv[1:]) | 162 options, args = parser.parse_args(argv[1:]) |
| 158 constants.SetBuildType(options.target) | 163 constants.SetBuildType(options.target) |
| 159 | 164 |
| 160 if args: | 165 if args: |
| 161 print >> sys.stderr, 'Unused args %s' % args | 166 print >> sys.stderr, 'Unused args %s' % args |
| 162 return 1 | 167 return 1 |
| 163 | 168 |
| 164 ProvisionDevices(options) | 169 ProvisionDevices(options) |
| 165 | 170 |
| 166 | 171 |
| 167 if __name__ == '__main__': | 172 if __name__ == '__main__': |
| 168 sys.exit(main(sys.argv)) | 173 sys.exit(main(sys.argv)) |
| OLD | NEW |