summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2018-01-24 08:23:23 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2018-01-24 08:23:23 +0000
commita26739907836b314b940f643dda839c972ed6150 (patch)
treecb1c56f29d3c6192f6cf55063f012af28de5d37d
parentae4bea7947828a05ef1c3344311e7012a752fd1a (diff)
parentb076368fe573f3dda0525f63bfacf0f000bcdefb (diff)
downloadTimeZoneData-a26739907836b314b940f643dda839c972ed6150.tar.gz
Snap for 4562879 from b076368fe573f3dda0525f63bfacf0f000bcdefb to pi-release
Change-Id: Ia4517b6766120af31600ad82aa6d3cec37454169
-rw-r--r--testing/xts/src/com/android/timezone/xts/TimeZoneUpdateHostTest.java23
1 files changed, 13 insertions, 10 deletions
diff --git a/testing/xts/src/com/android/timezone/xts/TimeZoneUpdateHostTest.java b/testing/xts/src/com/android/timezone/xts/TimeZoneUpdateHostTest.java
index 85c6019..f34df62 100644
--- a/testing/xts/src/com/android/timezone/xts/TimeZoneUpdateHostTest.java
+++ b/testing/xts/src/com/android/timezone/xts/TimeZoneUpdateHostTest.java
@@ -151,21 +151,24 @@ public class TimeZoneUpdateHostTest implements IDeviceTest, IBuildReceiver {
for (int i = 0; i < 2; i++) {
logDeviceTimeZoneState();
+ // Even if there's no distro installed, there may be an updated APK installed, so try to
+ // remove it unconditionally.
String errorCode = uninstallPackage(getTimeZoneDataPackageName());
if (errorCode != null) {
// Failed to uninstall, which we take to mean the device is "clean".
break;
}
- // Success, meaning there was something that could be uninstalled, so we should wait
- // for the device to react to the uninstall and reboot. If the time zone update system
- // is not configured correctly this is likely to be where tests fail.
-
- // If the package we uninstalled was not valid then there would be nothing installed and
- // so nothing will be staged by the uninstall. Check and do what it takes to get the
- // device to having nothing installed again.
- if (INSTALL_STATE_INSTALLED.equals(getCurrentInstallState())) {
- // We expect the device to get to the staged state "UNINSTALL", meaning it will try
- // to revert to no distro installed on next boot.
+ // Success, meaning there was an APK that could be uninstalled.
+
+ // If there is a distro installed we need wait for the distro uninstall that should now
+ // become staged.
+ boolean distroIsInstalled = INSTALL_STATE_INSTALLED.equals(getCurrentInstallState());
+ if (distroIsInstalled) {
+ // It may take a short while before we can detect anything: the package manager
+ // should have triggered an intent, and the PackageTracker has to receive that and
+ // send its own intent, which then has to be acted on before we could detect an
+ // operation in progress. We expect the device eventually to get to the staged state
+ // "UNINSTALL", meaning it will try to revert to no distro installed on next boot.
waitForStagedUninstall();
rebootDeviceAndWaitForRestart();