| Index: build/android/provision_devices.py
|
| diff --git a/build/android/provision_devices.py b/build/android/provision_devices.py
|
| index 3f5ef5a637c4eb84a5e4465dee224e602ca1302a..e396cbdc24a8805e94426953057dbc0d477021df 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():
|
| @@ -95,8 +94,8 @@ def WipeDeviceData(device):
|
| After wiping data on a device that has been authorized, adb can still
|
| communicate with the device, but after reboot the device will need to be
|
| re-authorized because the adb keys file is stored in /data/misc/adb/.
|
| - Thus, before reboot the adb_keys file is rewritten so the device does not need
|
| - to be re-authorized.
|
| + Thus, adb_keys file is rewritten so the device does not need to be
|
| + re-authorized.
|
|
|
| Arguments:
|
| device: the device to wipe
|
| @@ -105,15 +104,17 @@ 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))
|
|
|
|
|
| def ProvisionDevices(options):
|
| @@ -122,16 +123,11 @@ def ProvisionDevices(options):
|
| else:
|
| devices = android_commands.GetAttachedDevices()
|
| for device_serial in devices:
|
| + WipeDeviceData(device_utils.DeviceUtils(device_serial))
|
| + device_utils.RebootDevices()
|
| + for device_serial in devices:
|
| device = device_utils.DeviceUtils(device_serial)
|
| device.old_interface.EnableAdbRoot()
|
| - 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)
|
| _ConfigureLocalProperties(device)
|
| device_settings.ConfigureContentSettingsDict(
|
| device, device_settings.DETERMINISTIC_DEVICE_SETTINGS)
|
|
|