• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!-- Copyright 2016 The Chromium Authors. All rights reserved.
2     Use of this source code is governed by a BSD-style license that can be
3     found in the LICENSE file.
4-->
5
6# Devil: Device Blacklist
7
8## What is it?
9
10The device blacklist is a per-run list of devices detected to be in a known bad
11state along with the reason they are suspected of being in a bad state (offline,
12not responding, etc). It is stored as a json file. This gets reset every run
13during the device recovery step (currently part of `bb_device_status_check`).
14
15## Bots
16
17On bots, this is normally found at `//out/bad_devices.json`. If you are having
18problems with blacklisted devices locally even though a device is in a good
19state, you can safely delete this file.
20
21# Tools for interacting with device black list.
22
23You can interact with the device blacklist via [devil.android.device\_blacklist](https://cs.chromium.org/chromium/src/third_party/catapult/devil/devil/android/device_blacklist.py).
24This allows for any interaction you would need with a device blacklist:
25
26  - Reading
27  - Writing
28  - Extending
29  - Resetting
30
31An example usecase of this is:
32```python
33from devil.android import device_blacklist
34
35blacklist = device_blacklist.Blacklist(blacklist_path)
36blacklisted_devices = blacklist.Read()
37for device in blacklisted_devices:
38  print 'Device %s is blacklisted' % device
39blacklist.Reset()
40new_blacklist = {'device_id1': {'timestamp': ts, 'reason': reason}}
41blacklist.Write(new_blacklist)
42blacklist.Extend([device_2, device_3], reason='Reason for blacklisting')
43```
44
45
46## Where it is used.
47
48The blacklist file path is passed directly to the following scripts in chromium:
49
50  - [test\_runner.py](https://cs.chromium.org/chromium/src/build/android/test_runner.py)
51  - [provision\_devices.py](https://cs.chromium.org/chromium/src/build/android/provision_devices.py)
52  - [bb\_device\_status\_check.py](https://cs.chromium.org/chromium/src/build/android/buildbot/bb_device_status_check.py)
53
54The blacklist is also used in the following scripts:
55
56  - [device\_status.py](https://cs.chromium.org/chromium/src/third_party/catapult/devil/devil/android/tools/device_status.py)
57  - [device\_recovery.py](https://cs.chromium.org/chromium/src/third_party/catapult/devil/devil/android/tools/device_recovery.py)
58
59
60