Tweak error detection in incremental_install.py .
The old one failed to work with Android N.
--
MOS_MIGRATED_REVID=110335879
diff --git a/tools/android/incremental_install.py b/tools/android/incremental_install.py
index 47515f5..bef9246 100644
--- a/tools/android/incremental_install.py
+++ b/tools/android/incremental_install.py
@@ -225,7 +225,7 @@
pkg_args = ["-p", pkg] if pkg else []
ret, stdout, stderr, args = self._Exec(
["install-multiple", "-r"] + pkg_args + [apk])
- if "Success" not in stderr and "Success" not in stdout:
+ if "FAILED" in stdout or "FAILED" in stderr:
raise AdbError(args, ret, stdout, stderr)
def Install(self, apk):
@@ -240,7 +240,7 @@
# and yet it will still have a return code of 0. At least for the install
# command, it will print "Success" if it succeeded, so check for that in
# standard out instead of relying on the return code.
- if "Success" not in stderr and "Success" not in stdout:
+ if "FAILED" in stdout or "FAILED" in stderr:
raise AdbError(args, ret, stdout, stderr)
def Uninstall(self, pkg):
@@ -716,7 +716,6 @@
adb.GetInstallTime(app_package),
"%s/%s/install_timestamp" % (DEVICE_DIRECTORY, app_package))
future.result()
-
else:
if start_type == "warm":
adb.StopAppAndSaveState(app_package)
diff --git a/tools/android/incremental_install_test.py b/tools/android/incremental_install_test.py
index 1bf2aa7..64b31eb 100644
--- a/tools/android/incremental_install_test.py
+++ b/tools/android/incremental_install_test.py
@@ -504,7 +504,7 @@
self.assertTrue("Device unauthorized." in str(e))
def testInstallFailure(self):
- self._mock_adb.SetError(0, "Failure", "", for_arg="install")
+ self._mock_adb.SetError(0, "Failure", "INSTALL_FAILED", for_arg="install")
self._CreateZip()
self._CreateLocalManifest("zip1 zp1 ip1 0")
try: