Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(508)

Unified Diff: build/android/provision_devices.py

Issue 949323003: Write adb public key to devices during provision. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Write adb public keys from $HOME/.android/ Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698