Change provision_devices.py to disable verity for remove webview on M

BUG=

Review-Url: https://codereview.chromium.org/1960363002
Cr-Original-Commit-Position: refs/heads/master@{#392796}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 161d167a91621178a83bff8febea1a849c7fda14
This commit is contained in:
yolandyan 2016-05-10 17:52:26 -07:00 коммит произвёл Commit bot
Родитель f2be3fbd30
Коммит b532bace3e
1 изменённых файлов: 19 добавлений и 8 удалений

Просмотреть файл

@ -295,15 +295,26 @@ def SetProperties(device, options):
check_return=True) check_return=True)
if options.remove_system_webview: if options.remove_system_webview:
if device.HasRoot(): if any(device.PathExists(p) for p in _SYSTEM_WEBVIEW_PATHS):
# This is required, e.g., to replace the system webview on a device. logging.info('System WebView exists and needs to be removed')
device.adb.Remount() if device.HasRoot():
device.RunShellCommand(['stop'], check_return=True) # Disabled Marshmallow's Verity security feature
device.RunShellCommand(['rm', '-rf'] + _SYSTEM_WEBVIEW_PATHS, if device.build_version_sdk >= version_codes.MARSHMALLOW:
check_return=True) device.adb.DisableVerity()
device.RunShellCommand(['start'], check_return=True) device.Reboot()
device.WaitUntilFullyBooted()
device.EnableRoot()
# This is required, e.g., to replace the system webview on a device.
device.adb.Remount()
device.RunShellCommand(['stop'], check_return=True)
device.RunShellCommand(['rm', '-rf'] + _SYSTEM_WEBVIEW_PATHS,
check_return=True)
device.RunShellCommand(['start'], check_return=True)
else:
logging.warning('Cannot remove system webview from a non-rooted device')
else: else:
logging.warning('Cannot remove system webview from a non-rooted device') logging.info('System WebView already removed')
# Some device types can momentarily disappear after setting properties. # Some device types can momentarily disappear after setting properties.
device.adb.WaitForDevice() device.adb.WaitForDevice()