Add Apps.AppListSearchQueryLength UMA histogram.
[chromium-blink-merge.git] / build / android / pylib / device / device_list.py
blob0eb6acba2b28b66c0c473f6ecd615f70f39f73b9
1 # Copyright 2014 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.
5 """A module to keep track of devices across builds."""
7 import os
9 LAST_DEVICES_FILENAME = '.last_devices'
10 LAST_MISSING_DEVICES_FILENAME = '.last_missing'
13 def GetPersistentDeviceList(file_name):
14 """Returns a list of devices.
16 Args:
17 file_name: the file name containing a list of devices.
19 Returns: List of device serial numbers that were on the bot.
20 """
21 with open(file_name) as f:
22 return f.read().splitlines()
25 def WritePersistentDeviceList(file_name, device_list):
26 path = os.path.dirname(file_name)
27 if not os.path.exists(path):
28 os.makedirs(path)
29 with open(file_name, 'w') as f:
30 f.write('\n'.join(set(device_list)))