Chromium Code Reviews| Index: build/android/provision_devices.py |
| diff --git a/build/android/provision_devices.py b/build/android/provision_devices.py |
| index 2bde2b5ff2dfcf1a43966c6be923286ff3c80b25..314afae634c1d2a5f63b00ecdc7e2954e9cc2496 100755 |
| --- a/build/android/provision_devices.py |
| +++ b/build/android/provision_devices.py |
| @@ -26,6 +26,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 |
| @@ -106,7 +107,10 @@ def ProvisionDevice(device, blacklist, options): |
| if options.chrome_specific_wipe: |
| run_phase(WipeChromeData) |
| else: |
| - run_phase(WipeDevice) |
| + if device.IsUserBuild(): |
|
jbudorick
2015/12/09 18:09:01
We should just do the chrome-specific wipe on user
bpastene
2015/12/09 18:59:13
Was planning on setting non_device_wipe_provisioni
|
| + logging.warning('Cannot wipe data in user builds.') |
| + else: |
| + run_phase(WipeDevice) |
| if should_run_phase(_PHASES.PROPERTIES): |
| run_phase(SetProperties) |
| @@ -171,19 +175,24 @@ 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) |
| + 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/') |
|
jbudorick
2015/12/09 18:09:01
should be able to remove the contents of /data/loc
bpastene
2015/12/09 18:59:13
Good catch
|
| + 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.') |
| @@ -246,7 +255,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: |
| @@ -311,6 +323,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) |
| @@ -351,10 +368,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: |