OLD | NEW |
1 # Copyright 2015 The Swarming Authors. All rights reserved. | 1 # Copyright 2015 The Swarming Authors. All rights reserved. |
2 # Use of this source code is governed by the Apache v2.0 license that can be | 2 # Use of this source code is governed by the Apache v2.0 license that can be |
3 # found in the LICENSE file. | 3 # 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 |
11 import collections | 11 import collections |
12 import logging | 12 import logging |
13 import os | 13 import os |
14 | 14 |
15 | 15 |
16 from adb import adb_commands_safe | 16 from adb import adb_commands_safe |
| 17 from adb import adb_protocol |
| 18 from adb import common |
17 from adb import high | 19 from adb import high |
18 | 20 |
19 | 21 |
| 22 LEVEL = logging.WARNING |
| 23 adb_commands_safe._LOG.setLevel(LEVEL) |
| 24 adb_protocol._LOG.setLevel(LEVEL) |
| 25 common._LOG.setLevel(LEVEL) |
| 26 high._LOG.setLevel(LEVEL) |
| 27 |
| 28 |
20 def initialize(pub_key, priv_key): | 29 def initialize(pub_key, priv_key): |
21 return high.Initialize(pub_key, priv_key) | 30 return high.Initialize(pub_key, priv_key) |
22 | 31 |
23 | 32 |
24 def get_devices(bot): | 33 def get_devices(bot): |
25 return high.GetDevices( | 34 return high.GetDevices( |
26 'swarming', 10000, 10000, on_error=bot.post_error if bot else None, | 35 'swarming', 10000, 10000, on_error=bot.post_error if bot else None, |
27 as_root=True) | 36 as_root=True) |
28 | 37 |
29 | 38 |
30 def close_devices(devices): | 39 def close_devices(devices): |
31 return high.CloseDevices(devices) | 40 return high.CloseDevices(devices) |
| 41 |
| 42 |
| 43 def kill_adb(): |
| 44 return adb_commands_safe.KillADB() |
OLD | NEW |