summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authormlliu <mlliu@chromium.org>2015-09-24 00:55:38 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-24 07:57:21 +0000
commit44ebcee850caa9e1c7783eb94a3fb512c6681181 (patch)
treeef0074fec007b560139ce0dd4282e4d190055e70 /build
parentb0c4dc40cdb8de16b3ad73701e21b09efd35bed4 (diff)
downloadchromium_src-44ebcee850caa9e1c7783eb94a3fb512c6681181.zip
chromium_src-44ebcee850caa9e1c7783eb94a3fb512c6681181.tar.gz
chromium_src-44ebcee850caa9e1c7783eb94a3fb512c6681181.tar.bz2
uninstall chrome related packages rather than just removing them during provision device
BUG=534313 Review URL: https://codereview.chromium.org/1366703002 Cr-Commit-Position: refs/heads/master@{#350500}
Diffstat (limited to 'build')
-rwxr-xr-xbuild/android/provision_devices.py38
1 files changed, 23 insertions, 15 deletions
diff --git a/build/android/provision_devices.py b/build/android/provision_devices.py
index 2ec66a4..faf980f 100755
--- a/build/android/provision_devices.py
+++ b/build/android/provision_devices.py
@@ -129,15 +129,17 @@ def ProvisionDevice(device, blacklist, options):
def WipeChromeData(device, options):
"""Wipes chrome specific data from device
- Chrome specific data is:
- (1) any dir under /data/data/ whose name matches *chrom*, except
- com.android.chrome, which is the chrome stable package
- (2) any dir under /data/app/ and /data/app-lib/ whose name matches *chrom*
- (3) any files under /data/tombstones/ whose name matches "tombstone*"
- (4) /data/local.prop if there is any
- (5) /data/local/chrome-command-line if there is any
- (6) dir /data/local/.config/ if there is any (this is telemetry related)
- (7) dir /data/local/tmp/
+
+ (1) uninstall any app whose name matches *chrom*, except
+ com.android.chrome, which is the chrome stable package. Doing so also
+ removes the corresponding dirs under /data/data/ and /data/app/
+ (2) remove any dir under /data/app-lib/ whose name matches *chrom*
+ (3) remove any files under /data/tombstones/ whose name matches "tombstone*"
+ (4) remove /data/local.prop if there is any
+ (5) remove /data/local/chrome-command-line if there is any
+ (6) remove anything under /data/local/.config/ if the dir exists
+ (this is telemetry related)
+ (7) remove anything under /data/local/tmp/
Arguments:
device: the device to wipe
@@ -147,9 +149,8 @@ def WipeChromeData(device, options):
try:
device.EnableRoot()
- _WipeUnderDirIfMatch(device, '/data/data/', _CHROME_PACKAGE_REGEX,
- constants.PACKAGE_INFO['chrome_stable'].package)
- _WipeUnderDirIfMatch(device, '/data/app/', _CHROME_PACKAGE_REGEX)
+ _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)
@@ -339,12 +340,19 @@ def FinishProvisioning(device, options):
_PushAndLaunchAdbReboot(device, options.target)
-def _WipeUnderDirIfMatch(device, path, pattern, app_to_keep=None):
+def _UninstallIfMatch(device, pattern, app_to_keep):
+ installed_packages = device.RunShellCommand(['pm', 'list', 'packages'])
+ for package_output in installed_packages:
+ package = package_output.split(":")[1]
+ if pattern.match(package) and not package == app_to_keep:
+ device.Uninstall(package)
+
+
+def _WipeUnderDirIfMatch(device, path, pattern):
ls_result = device.Ls(path)
for (content, _) in ls_result:
if pattern.match(content):
- if content != app_to_keep:
- _WipeFileOrDir(device, path + content)
+ _WipeFileOrDir(device, path + content)
def _WipeFileOrDir(device, path):