Index: build/android/provision_devices.py |
diff --git a/build/android/provision_devices.py b/build/android/provision_devices.py |
index 824e64202e78787d1096eedd73ddaa4e7b704dc1..8b3f0fbd85add520e49ee5866f1f036db71f3467 100755 |
--- a/build/android/provision_devices.py |
+++ b/build/android/provision_devices.py |
@@ -25,6 +25,7 @@ from pylib.device import device_blacklist |
from pylib.device import device_errors |
from pylib.device import device_utils |
from pylib.utils import run_tests_helper |
+from sets import Set |
friedman1
2015/02/24 23:33:43
set is a python builtin
navabi
2015/02/25 01:22:35
Done.
|
sys.path.append(os.path.join(constants.DIR_SOURCE_ROOT, |
'third_party', 'android_testrunner')) |
@@ -128,18 +129,27 @@ def WipeDeviceData(device): |
""" |
device_authorized = device.FileExists(constants.ADB_KEYS_FILE) |
if device_authorized: |
- adb_keys = device.ReadFile(constants.ADB_KEYS_FILE, as_root=True) |
+ adb_key_files = [adb_key_file for adb_key_file in |
+ os.listdir('%s/.android' % os.environ['HOME']) |
+ if adb_key_file.endswith('adbkey.pub')] |
+ adb_keys = Set([]) |
friedman1
2015/02/24 23:33:43
adb_keys = set()
navabi
2015/02/25 01:22:35
Done.
|
+ for adb_key_file in adb_key_files: |
+ with open(adb_key_file, 'r') as f: |
+ adb_public_key = f.readlines() |
+ adb_keys.add(adb_public_key) |
device.RunShellCommand('wipe data', as_root=True) |
if device_authorized: |
path_list = constants.ADB_KEYS_FILE.split('/') |
dir_path = '/'.join(path_list[:len(path_list)-1]) |
device.RunShellCommand('mkdir -p %s' % dir_path, as_root=True) |
device.RunShellCommand('restorecon %s' % dir_path, as_root=True) |
- device.WriteFile(constants.ADB_KEYS_FILE, adb_keys, as_root=True) |
+ adb_key_contents = '' |
+ for adb_key in adb_keys: |
+ adb_key_contents = '%s/n%s' % (adb_key_contents, adb_key) |
friedman1
2015/02/24 23:33:43
\n
I take it this is to avoid deailing with the e
|
+ device.WriteFile(constants.ADB_KEYS_FILE, adb_key_contents, as_root=True) |
device.RunShellCommand('restorecon %s' % constants.ADB_KEYS_FILE, |
as_root=True) |
- |
def WipeDeviceIfPossible(device, timeout): |
try: |
device.EnableRoot() |