Index: build/android/provision_devices.py |
diff --git a/build/android/provision_devices.py b/build/android/provision_devices.py |
index 824e64202e78787d1096eedd73ddaa4e7b704dc1..403d77568f2bf820b22949a83b614e7c1947f3c7 100755 |
--- a/build/android/provision_devices.py |
+++ b/build/android/provision_devices.py |
@@ -158,6 +158,22 @@ def ProvisionDevice(device, options): |
else: |
reboot_timeout = _DEFAULT_TIMEOUTS.PRE_LOLLIPOP |
+ if options.adb_key_files: |
+ adb_keys = set() |
+ for adb_key_file in options.adb_key_files: |
+ file_path = os.path.join(os.environ['HOME'], '.android', adb_key_file) |
jbudorick
2015/02/25 01:32:46
to be clear: I don't think this should be locked i
navabi
2015/02/25 01:37:21
Yep. This is a mistake. options.adb_key_files will
|
+ with open(file_path, 'r') as f: |
+ adb_public_key = f.readlines()[0] |
+ adb_keys.add(adb_public_key) |
+ path_list = constants.ADB_KEYS_FILE.split('/') |
jbudorick
2015/02/25 01:32:46
Why is this now just duplicating the logic from Wi
navabi
2015/02/25 01:37:21
The only part that is duplicated, is the part that
|
+ 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) |
+ adb_key_contents = '\n'.join(adb_keys) |
+ device.WriteFile(constants.ADB_KEYS_FILE, adb_key_contents, as_root=True) |
+ device.RunShellCommand('restorecon %s' % constants.ADB_KEYS_FILE, |
+ as_root=True) |
+ |
try: |
if not options.skip_wipe: |
WipeDeviceIfPossible(device, reboot_timeout) |
@@ -276,6 +292,8 @@ def main(): |
parser.add_argument('-r', '--auto-reconnect', action='store_true', |
help='push binary which will reboot the device on adb' |
' disconnections') |
+ parser.add_argument('--adb-key-files', type=str, nargs='+', |
+ help='list of adb keys to push to device') |
args = parser.parse_args() |
constants.SetBuildType(args.target) |