From a47d6c6521269b6ae8db30321f5a45a6a8a935ae Mon Sep 17 00:00:00 2001 From: Sergei Trofimov Date: Thu, 22 Jun 2017 14:31:25 +0100 Subject: [PATCH] ApkWorkload: only uninstall if package is already installed Attempting to uninstall an non-existing package will result in an error. So, when replace=True for install_apk(), only attempt to uninstall if the package is already present on the target. --- wlauto/common/android/workload.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wlauto/common/android/workload.py b/wlauto/common/android/workload.py index 41ae2b70..b55a8194 100755 --- a/wlauto/common/android/workload.py +++ b/wlauto/common/android/workload.py @@ -414,7 +414,7 @@ class ApkWorkload(Workload): def install_apk(self, context, replace=False): success = False - if replace: + if replace and self.device.package_is_installed(self.package): self.device.uninstall(self.package) output = self.device.install_apk(self.apk_file, timeout=self.install_timeout, replace=replace, allow_downgrade=True)