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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 device = device_utils.DeviceUtils(device_serial) | 57 device = device_utils.DeviceUtils(device_serial) |
58 # Kill if adb_reboot is already running. | 58 # Kill if adb_reboot is already running. |
59 device.old_interface.KillAllBlocking('adb_reboot', 2) | 59 device.old_interface.KillAllBlocking('adb_reboot', 2) |
60 # Push adb_reboot | 60 # Push adb_reboot |
61 print ' Pushing adb_reboot ...' | 61 print ' Pushing adb_reboot ...' |
62 adb_reboot = os.path.join(constants.DIR_SOURCE_ROOT, | 62 adb_reboot = os.path.join(constants.DIR_SOURCE_ROOT, |
63 'out/%s/adb_reboot' % target) | 63 'out/%s/adb_reboot' % target) |
64 device.old_interface.PushIfNeeded(adb_reboot, '/data/local/tmp/') | 64 device.old_interface.PushIfNeeded(adb_reboot, '/data/local/tmp/') |
65 # Launch adb_reboot | 65 # Launch adb_reboot |
66 print ' Launching adb_reboot ...' | 66 print ' Launching adb_reboot ...' |
67 # TODO(jbudorick) Try to convert this to RunShellCommand. | 67 device.old_interface.GetAndroidToolStatusAndOutput( |
68 p = subprocess.Popen(['adb', '-s', device_serial, 'shell'], | 68 '/data/local/tmp/adb_reboot') |
69 stdin=subprocess.PIPE) | |
70 p.communicate('/data/local/tmp/adb_reboot; exit\n') | |
71 LaunchHostHeartbeat() | 69 LaunchHostHeartbeat() |
72 | 70 |
73 | 71 |
74 def _ConfigureLocalProperties(device): | 72 def _ConfigureLocalProperties(device): |
75 """Set standard readonly testing device properties prior to reboot.""" | 73 """Set standard readonly testing device properties prior to reboot.""" |
76 local_props = [ | 74 local_props = [ |
77 'ro.monkey=1', | 75 'ro.monkey=1', |
78 'ro.test_harness=1', | 76 'ro.test_harness=1', |
79 'ro.audio.silent=1', | 77 'ro.audio.silent=1', |
80 'ro.setupwizard.mode=DISABLED', | 78 'ro.setupwizard.mode=DISABLED', |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 for device_serial in devices: | 172 for device_serial in devices: |
175 device = device_utils.DeviceUtils(device_serial) | 173 device = device_utils.DeviceUtils(device_serial) |
176 WipeDeviceData(device) | 174 WipeDeviceData(device) |
177 device_utils.RebootDevices() | 175 device_utils.RebootDevices() |
178 else: | 176 else: |
179 ProvisionDevices(options) | 177 ProvisionDevices(options) |
180 | 178 |
181 | 179 |
182 if __name__ == '__main__': | 180 if __name__ == '__main__': |
183 sys.exit(main(sys.argv)) | 181 sys.exit(main(sys.argv)) |
OLD | NEW |