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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 def ProvisionDevices(options): | 119 def ProvisionDevices(options): |
120 if options.device is not None: | 120 if options.device is not None: |
121 devices = [options.device] | 121 devices = [options.device] |
122 else: | 122 else: |
123 devices = android_commands.GetAttachedDevices() | 123 devices = android_commands.GetAttachedDevices() |
124 for device_serial in devices: | 124 for device_serial in devices: |
125 device = device_utils.DeviceUtils(device_serial) | 125 device = device_utils.DeviceUtils(device_serial) |
126 device.old_interface.EnableAdbRoot() | 126 device.old_interface.EnableAdbRoot() |
127 install_output = GetCmdOutput( | 127 install_output = GetCmdOutput( |
128 ['%s/build/android/adb_install_apk.py' % constants.DIR_SOURCE_ROOT, | 128 ['%s/build/android/adb_install_apk.py' % constants.DIR_SOURCE_ROOT, |
129 '--apk', | |
130 '%s/build/android/CheckInstallApk-debug.apk' % constants.DIR_SOURCE_ROOT | 129 '%s/build/android/CheckInstallApk-debug.apk' % constants.DIR_SOURCE_ROOT |
131 ]) | 130 ]) |
132 failure_string = 'Failure [INSTALL_FAILED_INSUFFICIENT_STORAGE]' | 131 failure_string = 'Failure [INSTALL_FAILED_INSUFFICIENT_STORAGE]' |
133 if failure_string in install_output: | 132 if failure_string in install_output: |
134 WipeDeviceData(device) | 133 WipeDeviceData(device) |
135 _ConfigureLocalProperties(device) | 134 _ConfigureLocalProperties(device) |
136 device_settings.ConfigureContentSettingsDict( | 135 device_settings.ConfigureContentSettingsDict( |
137 device, device_settings.DETERMINISTIC_DEVICE_SETTINGS) | 136 device, device_settings.DETERMINISTIC_DEVICE_SETTINGS) |
138 # TODO(tonyg): We eventually want network on. However, currently radios | 137 # TODO(tonyg): We eventually want network on. However, currently radios |
139 # can cause perfbots to drain faster than they charge. | 138 # can cause perfbots to drain faster than they charge. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 for device_serial in devices: | 171 for device_serial in devices: |
173 device = device_utils.DeviceUtils(device_serial) | 172 device = device_utils.DeviceUtils(device_serial) |
174 WipeDeviceData(device) | 173 WipeDeviceData(device) |
175 device_utils.RebootDevices() | 174 device_utils.RebootDevices() |
176 else: | 175 else: |
177 ProvisionDevices(options) | 176 ProvisionDevices(options) |
178 | 177 |
179 | 178 |
180 if __name__ == '__main__': | 179 if __name__ == '__main__': |
181 sys.exit(main(sys.argv)) | 180 sys.exit(main(sys.argv)) |
OLD | NEW |