Home | History | Annotate | Download | only in docs
      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 
     10 The device blacklist is a per-run list of devices detected to be in a known bad
     11 state along with the reason they are suspected of being in a bad state (offline,
     12 not responding, etc). It is stored as a json file. This gets reset every run
     13 during the device recovery step (currently part of `bb_device_status_check`).
     14 
     15 ## Bots
     16 
     17 On bots, this is normally found at `//out/bad_devices.json`. If you are having
     18 problems with blacklisted devices locally even though a device is in a good
     19 state, you can safely delete this file.
     20 
     21 # Tools for interacting with device black list.
     22 
     23 You 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).
     24 This allows for any interaction you would need with a device blacklist:
     25 
     26   - Reading
     27   - Writing
     28   - Extending
     29   - Resetting
     30 
     31 An example usecase of this is:
     32 ```python
     33 from devil.android import device_blacklist
     34 
     35 blacklist = device_blacklist.Blacklist(blacklist_path)
     36 blacklisted_devices = blacklist.Read()
     37 for device in blacklisted_devices:
     38   print 'Device %s is blacklisted' % device
     39 blacklist.Reset()
     40 new_blacklist = {'device_id1': {'timestamp': ts, 'reason': reason}}
     41 blacklist.Write(new_blacklist)
     42 blacklist.Extend([device_2, device_3], reason='Reason for blacklisting')
     43 ```
     44 
     45 
     46 ## Where it is used.
     47 
     48 The 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 
     54 The 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