aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar Lukacs Berki <lberki@google.com>2015-09-15 07:18:47 +0000
committerGravatar John Field <jfield@google.com>2015-09-15 20:26:25 +0000
commit0dffeac00d6be0e37a75b564190a4f4a62908beb (patch)
tree2eee97d676c26407f7f757f30c7237fec67df3f3 /tools
parent415aae660a932ead71628072610948afd11d7dc2 (diff)
Make --split_apk mobile-install work with a pristine device.
-- MOS_MIGRATED_REVID=103068396
Diffstat (limited to 'tools')
-rw-r--r--tools/android/incremental_install.py11
-rw-r--r--tools/android/incremental_install_test.py9
2 files changed, 12 insertions, 8 deletions
diff --git a/tools/android/incremental_install.py b/tools/android/incremental_install.py
index 088af54f0d..04da8cd0bf 100644
--- a/tools/android/incremental_install.py
+++ b/tools/android/incremental_install.py
@@ -178,10 +178,7 @@ class Adb(object):
if match:
return match.group(1)
else:
- raise TimestampException(
- "Package '%s' is not installed on the device. At least one "
- "non-incremental 'mobile-install' must precede incremental "
- "installs." % package)
+ return None
def GetAbi(self):
"""Returns the ABI the device supports."""
@@ -586,6 +583,12 @@ def VerifyInstallTimestamp(adb, app_package):
"'mobile-install' must precede incremental installs")
actual_timestamp = adb.GetInstallTime(app_package)
+ if actual_timestamp is None:
+ raise TimestampException(
+ "Package '%s' is not installed on the device. At least one "
+ "non-incremental 'mobile-install' must precede incremental "
+ "installs." % app_package)
+
if actual_timestamp != expected_timestamp:
raise TimestampException("Installed app '%s' has an unexpected timestamp. "
"Did you last install the app in a way other than "
diff --git a/tools/android/incremental_install_test.py b/tools/android/incremental_install_test.py
index 87500fc24f..e16a00b92c 100644
--- a/tools/android/incremental_install_test.py
+++ b/tools/android/incremental_install_test.py
@@ -86,10 +86,11 @@ class MockAdb(object):
if shell_cmdln.startswith(("mkdir", "am", "monkey", "input")):
pass
elif shell_cmdln.startswith("dumpsys package "):
- return self._CreatePopenMock(
- 0,
- "firstInstallTime=%s" % self.package_timestamp,
- "")
+ if self.package_timestamp is not None:
+ timestamp = "firstInstallTime=%s" % self.package_timestamp
+ else:
+ timestamp = ""
+ return self._CreatePopenMock(0, timestamp, "")
elif shell_cmdln.startswith("rm"):
file_path = shell_cmdln.split()[2]
self.files.pop(file_path, None)