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

Unified Diff: build/android/provision_devices.py

Issue 1456283007: get provision_devices to not fall over on user builds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 | build/android/pylib/device_settings.py » ('j') | 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 caa9e23f6400f25236f3e6a05f7478230d1bd0c1..a474837d40edfb92d60cdcf6d4b25c5a5f1c02d0 100755
--- a/build/android/provision_devices.py
+++ b/build/android/provision_devices.py
@@ -27,6 +27,7 @@ from devil.android import device_blacklist
from devil.android import device_errors
from devil.android import device_temp_file
from devil.android import device_utils
+from devil.android.sdk import keyevent
from devil.android.sdk import version_codes
from devil.utils import run_tests_helper
from devil.utils import timeout_retry
@@ -104,8 +105,8 @@ def ProvisionDevice(device, blacklist, options):
try:
if should_run_phase(_PHASES.WIPE):
- if (options.chrome_specific_wipe or device.build_version_sdk >=
- version_codes.MARSHMALLOW):
+ if (options.chrome_specific_wipe or device.IsUserBuild() or
+ device.build_version_sdk >= version_codes.MARSHMALLOW):
run_phase(WipeChromeData)
else:
run_phase(WipeDevice)
@@ -175,19 +176,25 @@ def WipeChromeData(device, options):
return
try:
- device.EnableRoot()
- _UninstallIfMatch(device, _CHROME_PACKAGE_REGEX,
- constants.PACKAGE_INFO['chrome_stable'].package)
- _WipeUnderDirIfMatch(device, '/data/app-lib/', _CHROME_PACKAGE_REGEX)
- _WipeUnderDirIfMatch(device, '/data/tombstones/', _TOMBSTONE_REGEX)
-
- _WipeFileOrDir(device, '/data/local.prop')
- _WipeFileOrDir(device, '/data/local/chrome-command-line')
- _WipeFileOrDir(device, '/data/local/.config/')
- _WipeFileOrDir(device, '/data/local/tmp/')
-
- device.RunShellCommand('rm -rf %s/*' % device.GetExternalStoragePath(),
- check_return=True)
+ if device.IsUserBuild():
+ _UninstallIfMatch(device, _CHROME_PACKAGE_REGEX,
+ constants.PACKAGE_INFO['chrome_stable'].package)
+ device.RunShellCommand('rm -rf %s/*' % device.GetExternalStoragePath(),
+ check_return=True)
+ device.RunShellCommand('rm -rf /data/local/tmp/*', check_return=True)
+ else:
+ device.EnableRoot()
+ _UninstallIfMatch(device, _CHROME_PACKAGE_REGEX,
+ constants.PACKAGE_INFO['chrome_stable'].package)
+ _WipeUnderDirIfMatch(device, '/data/app-lib/', _CHROME_PACKAGE_REGEX)
+ _WipeUnderDirIfMatch(device, '/data/tombstones/', _TOMBSTONE_REGEX)
+
+ _WipeFileOrDir(device, '/data/local.prop')
+ _WipeFileOrDir(device, '/data/local/chrome-command-line')
+ _WipeFileOrDir(device, '/data/local/.config/')
+ _WipeFileOrDir(device, '/data/local/tmp/')
+ device.RunShellCommand('rm -rf %s/*' % device.GetExternalStoragePath(),
+ check_return=True)
except device_errors.CommandFailedError:
logging.exception('Possible failure while wiping the device. '
'Attempting to continue.')
@@ -250,7 +257,10 @@ def SetProperties(device, options):
except device_errors.CommandFailedError as e:
logging.warning(str(e))
- _ConfigureLocalProperties(device, options.enable_java_debug)
+ if not device.IsUserBuild():
+ _ConfigureLocalProperties(device, options.enable_java_debug)
+ else:
+ logging.warning('Cannot configure properties in user builds.')
device_settings.ConfigureContentSettings(
device, device_settings.DETERMINISTIC_DEVICE_SETTINGS)
if options.disable_location:
@@ -315,6 +325,11 @@ def _ConfigureLocalProperties(device, java_debug=True):
def FinishProvisioning(device, options):
+ # The lockscreen can't be disabled on user builds, so send a keyevent
+ # to unlock it.
+ if device.IsUserBuild():
+ device.SendKeyEvent(keyevent.KEYCODE_MENU)
+
if options.min_battery_level is not None:
try:
battery = battery_utils.BatteryUtils(device)
@@ -355,10 +370,14 @@ def FinishProvisioning(device, options):
return False
# Sometimes the date is not set correctly on the devices. Retry on failure.
- if not timeout_retry.WaitFor(_set_and_verify_date, wait_period=1,
- max_tries=2):
- raise device_errors.CommandFailedError(
- 'Failed to set date & time.', device_serial=str(device))
+ if device.IsUserBuild():
+ # TODO(bpastene): Figure out how to set the date & time on user builds.
+ pass
+ else:
+ if not timeout_retry.WaitFor(
+ _set_and_verify_date, wait_period=1, max_tries=2):
+ raise device_errors.CommandFailedError(
+ 'Failed to set date & time.', device_serial=str(device))
props = device.RunShellCommand('getprop', check_return=True)
for prop in props:
« no previous file with comments | « no previous file | build/android/pylib/device_settings.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698