Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(976)

Side by Side Diff: build/android/provision_devices.py

Issue 1672543002: [Android] Detect if device is not charging properly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/android/devil/android/device_errors.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 logging.exception('Failed to configure local properties.') 329 logging.exception('Failed to configure local properties.')
330 330
331 331
332 def FinishProvisioning(device, options): 332 def FinishProvisioning(device, options):
333 # The lockscreen can't be disabled on user builds, so send a keyevent 333 # The lockscreen can't be disabled on user builds, so send a keyevent
334 # to unlock it. 334 # to unlock it.
335 if device.IsUserBuild(): 335 if device.IsUserBuild():
336 device.SendKeyEvent(keyevent.KEYCODE_MENU) 336 device.SendKeyEvent(keyevent.KEYCODE_MENU)
337 337
338 if options.min_battery_level is not None: 338 if options.min_battery_level is not None:
339 battery = battery_utils.BatteryUtils(device)
339 try: 340 try:
340 battery = battery_utils.BatteryUtils(device)
341 battery.ChargeDeviceToLevel(options.min_battery_level) 341 battery.ChargeDeviceToLevel(options.min_battery_level)
342 except device_errors.CommandFailedError: 342 except device_errors.DeviceChargingError:
343 logging.exception('Unable to charge device to specified level.') 343 device.Reboot()
344 battery.ChargeDeviceToLevel(options.min_battery_level)
344 345
345 if options.max_battery_temp is not None: 346 if options.max_battery_temp is not None:
346 try: 347 try:
347 battery = battery_utils.BatteryUtils(device) 348 battery = battery_utils.BatteryUtils(device)
348 battery.LetBatteryCoolToTemperature(options.max_battery_temp) 349 battery.LetBatteryCoolToTemperature(options.max_battery_temp)
349 except device_errors.CommandFailedError: 350 except device_errors.CommandFailedError:
350 logging.exception('Unable to let battery cool to specified temperature.') 351 logging.exception('Unable to let battery cool to specified temperature.')
351 352
352 def _set_and_verify_date(): 353 def _set_and_verify_date():
353 if device.build_version_sdk >= version_codes.MARSHMALLOW: 354 if device.build_version_sdk >= version_codes.MARSHMALLOW:
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 }, 531 },
531 } 532 }
532 533
533 devil_chromium.Initialize(custom_deps=devil_custom_deps) 534 devil_chromium.Initialize(custom_deps=devil_custom_deps)
534 535
535 return ProvisionDevices(args) 536 return ProvisionDevices(args)
536 537
537 538
538 if __name__ == '__main__': 539 if __name__ == '__main__':
539 sys.exit(main()) 540 sys.exit(main())
OLDNEW
« no previous file with comments | « build/android/devil/android/device_errors.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698