| OLD | NEW |
| 1 # Copyright 2015 The LUCI Authors. All rights reserved. | 1 # Copyright 2015 The LUCI Authors. All rights reserved. |
| 2 # Use of this source code is governed under the Apache License, Version 2.0 | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
| 3 # that can be found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
| 4 | 4 |
| 5 """Android specific utility functions. | 5 """Android specific utility functions. |
| 6 | 6 |
| 7 This file serves as an API to bot_config.py. bot_config.py can be replaced on | 7 This file serves as an API to bot_config.py. bot_config.py can be replaced on |
| 8 the server to allow additional server-specific functionality. | 8 the server to allow additional server-specific functionality. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 p for p in device.GetPackages() or [] | 99 p for p in device.GetPackages() or [] |
| 100 if (not p.startswith(('com.android.', 'com.google.')) and | 100 if (not p.startswith(('com.android.', 'com.google.')) and |
| 101 p not in KNOWN_APPS) | 101 p not in KNOWN_APPS) |
| 102 ] | 102 ] |
| 103 | 103 |
| 104 | 104 |
| 105 def initialize(pub_key, priv_key): | 105 def initialize(pub_key, priv_key): |
| 106 return high.Initialize(pub_key, priv_key) | 106 return high.Initialize(pub_key, priv_key) |
| 107 | 107 |
| 108 | 108 |
| 109 def get_devices(bot, endpoints=None): | 109 def get_devices(bot, endpoints=None, enable_resets=False): |
| 110 devices = [] | 110 devices = [] |
| 111 if not gce.is_gce(): | 111 if not gce.is_gce(): |
| 112 devices += high.GetLocalDevices( | 112 devices += high.GetLocalDevices( |
| 113 'swarming', 10000, 10000, on_error=bot.post_error if bot else None, | 113 'swarming', 10000, 10000, on_error=bot.post_error if bot else None, |
| 114 as_root=False) | 114 as_root=False, enable_resets=enable_resets) |
| 115 | 115 |
| 116 if endpoints: | 116 if endpoints: |
| 117 devices += high.GetRemoteDevices( | 117 devices += high.GetRemoteDevices( |
| 118 'swarming', endpoints, 10000, 10000, | 118 'swarming', endpoints, 10000, 10000, |
| 119 on_error=bot.post_error if bot else None, as_root=False) | 119 on_error=bot.post_error if bot else None, as_root=False) |
| 120 | 120 |
| 121 return devices | 121 return devices |
| 122 | 122 |
| 123 | 123 |
| 124 def close_devices(devices): | 124 def close_devices(devices): |
| 125 return high.CloseDevices(devices) | 125 return high.CloseDevices(devices) |
| 126 | 126 |
| 127 | 127 |
| 128 def kill_adb(): | 128 def kill_adb(): |
| 129 return adb_commands_safe.KillADB() | 129 return adb_commands_safe.KillADB() |
| OLD | NEW |