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

Unified Diff: build/android/provision_devices.py

Issue 255783008: Add option to wipe device. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add parallel device reboot after wipe. Created 6 years, 8 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
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)

Powered by Google App Engine
This is Rietveld 408576698