Chromium Code Reviews| Index: build/android/provision_devices.py |
| diff --git a/build/android/provision_devices.py b/build/android/provision_devices.py |
| index 6dc320ad2c5fde1a5e80deacbfd2d3397a0f9da1..8dfdce10e1c5d73ff22c70f515f62baf91d99480 100755 |
| --- a/build/android/provision_devices.py |
| +++ b/build/android/provision_devices.py |
| @@ -21,7 +21,6 @@ import time |
| from pylib import android_commands |
| from pylib import constants |
| from pylib import device_settings |
| -from pylib.cmd_helper import GetCmdOutput |
| from pylib.device import device_utils |
| def KillHostHeartbeat(): |
| @@ -89,7 +88,7 @@ def _ConfigureLocalProperties(device): |
| # LOCAL_PROPERTIES_PATH = '/data/local.prop' |
| -def WipeDeviceData(device): |
| +def WipeDeviceData(device, reboot=True): |
|
Dan Jacques
2014/04/26 01:11:26
Is this ever called with 'reboot=True'? If not, I
navabi
2014/04/26 01:15:36
Done.
|
| """Wipes data from device, keeping only the adb_keys for authorization. |
| After wiping data on a device that has been authorized, adb can still |
| @@ -105,15 +104,19 @@ def WipeDeviceData(device): |
| constants.ADB_KEYS_FILE) |
| if device_authorized: |
| adb_keys = device.old_interface.RunShellCommandWithSU( |
| - 'cat %s' % constants.ADB_KEYS_FILE)[0] |
| + 'cat %s' % constants.ADB_KEYS_FILE) |
| device.old_interface.RunShellCommandWithSU('wipe data') |
| if device_authorized: |
| path_list = constants.ADB_KEYS_FILE.split('/') |
| dir_path = '/'.join(path_list[:len(path_list)-1]) |
| device.old_interface.RunShellCommandWithSU('mkdir -p %s' % dir_path) |
| - adb_keys = device.old_interface.RunShellCommand( |
| - 'echo %s > %s' % (adb_keys, constants.ADB_KEYS_FILE)) |
| - device.old_interface.Reboot() |
| + device.old_interface.RunShellCommandWithSU('touch %s' % |
| + constants.ADB_KEYS_FILE) |
| + for adb_key in adb_keys: |
| + device.old_interface.RunShellCommand( |
| + 'echo %s >> %s' % (adb_key, constants.ADB_KEYS_FILE)) |
| + if reboot: |
| + device.old_interface.Reboot() |
| def ProvisionDevices(options): |
| @@ -123,14 +126,8 @@ def ProvisionDevices(options): |
| devices = android_commands.GetAttachedDevices() |
| for device_serial in devices: |
| device = device_utils.DeviceUtils(device_serial) |
| - install_output = GetCmdOutput( |
| - ['%s/build/android/adb_install_apk.py' % constants.DIR_SOURCE_ROOT, |
| - '--apk', |
| - '%s/build/android/CheckInstallApk-debug.apk' % constants.DIR_SOURCE_ROOT |
| - ]) |
| - failure_string = 'Failure [INSTALL_FAILED_INSUFFICIENT_STORAGE]' |
| - if failure_string in install_output: |
| - WipeDeviceData(device) |
| + # Wipe device data, but don't reboot devices (takes too long) |
| + WipeDeviceData(device, reboot=False) |
| _ConfigureLocalProperties(device) |
| device_settings.ConfigureContentSettingsDict( |
| device, device_settings.DETERMINISTIC_DEVICE_SETTINGS) |