aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuexi Ma <yuexima@google.com>2021-03-02 19:55:56 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-03-02 19:55:56 +0000
commit33fcd63bd0cc87cef3f59ea48e69da8d6bdf9c41 (patch)
treeafeefc22d63920d710433c19ca64307315d5f540
parent03843acaf24579efcc80d8e928dd9b9c7d671574 (diff)
parenta2b2ba7289958a0d3150c00725de07757a27895e (diff)
downloadplatform_test_app_compat_csuite-33fcd63bd0cc87cef3f59ea48e69da8d6bdf9c41.tar.gz
platform_test_app_compat_csuite-33fcd63bd0cc87cef3f59ea48e69da8d6bdf9c41.tar.bz2
platform_test_app_compat_csuite-33fcd63bd0cc87cef3f59ea48e69da8d6bdf9c41.zip
Check whether a system app is installed before trying to uninstall it am: a2b2ba7289
Original change: https://android-review.googlesource.com/c/platform/test/app_compat/csuite/+/1584432 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I3ed347736d1c55fc180aa1a68439e8ede0fa1fcc
-rw-r--r--harness/src/main/java/com/android/compatibility/targetprep/SystemAppRemovalPreparer.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/harness/src/main/java/com/android/compatibility/targetprep/SystemAppRemovalPreparer.java b/harness/src/main/java/com/android/compatibility/targetprep/SystemAppRemovalPreparer.java
index d5438cc..8ab58d6 100644
--- a/harness/src/main/java/com/android/compatibility/targetprep/SystemAppRemovalPreparer.java
+++ b/harness/src/main/java/com/android/compatibility/targetprep/SystemAppRemovalPreparer.java
@@ -61,13 +61,18 @@ public final class SystemAppRemovalPreparer implements ITargetPreparer {
throws TargetSetupError, DeviceNotAvailableException {
checkNotNull(mPackageName);
+ if (!isPackageInstalled(mPackageName, device)) {
+ CLog.i("Package %s is not installed.", mPackageName);
+ return;
+ }
+
// Attempts to uninstall the package/updates from user partition.
// This method should be called before the other methods and requires
// the framework to be running.
removePackageUpdates(mPackageName, device);
if (!isPackageInstalled(mPackageName, device)) {
- CLog.i("Package %s is not installed.", mPackageName);
+ CLog.i("Package %s has been removed.", mPackageName);
return;
}