summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXin Li <delphij@google.com>2018-06-08 11:08:08 -0700
committerXin Li <delphij@google.com>2018-06-08 11:08:08 -0700
commit4faff14b4f97957f3416092608001f68f4c7908f (patch)
tree9d8d14a95523d2af62a9ed2e04b7f3f438bd833b
parent8a9f33b8a7a26d3038ce825bce344cea9aa830b0 (diff)
parentf030dd503f8432c0d5d1bb1fb516f032d30b94f1 (diff)
downloadTimeZoneData-4faff14b4f97957f3416092608001f68f4c7908f.tar.gz
Merge pi-dev-plus-aosp-without-vendor into stage-aosp-mastertemp_p_merge
Bug: 79597307 Change-Id: If1770133fc72bec99239088a2798b9f5dfb2c460
-rw-r--r--Android.mk2
-rw-r--r--src/main/com/android/timezone/data/TimeZoneRulesDataProvider.java4
-rw-r--r--testing/xts/src/com/android/timezone/xts/TimeZoneUpdateHostTest.java29
3 files changed, 22 insertions, 13 deletions
diff --git a/Android.mk b/Android.mk
index ba2a1cb..593db19 100644
--- a/Android.mk
+++ b/Android.mk
@@ -22,7 +22,7 @@ LOCAL_MODULE := time_zone_distro_provider
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := $(call all-java-files-under, src/main)
LOCAL_PROGUARD_FLAG_FILES := $(LOCAL_PATH)/proguard.cfg
-LOCAL_STATIC_JAVA_LIBRARIES := time_zone_distro_unbundled android-support-annotations
+LOCAL_STATIC_JAVA_LIBRARIES := time_zone_distro_unbundled androidx.annotation_annotation
LOCAL_SDK_VERSION := system_current
include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/src/main/com/android/timezone/data/TimeZoneRulesDataProvider.java b/src/main/com/android/timezone/data/TimeZoneRulesDataProvider.java
index d92665a..0c1b39c 100644
--- a/src/main/com/android/timezone/data/TimeZoneRulesDataProvider.java
+++ b/src/main/com/android/timezone/data/TimeZoneRulesDataProvider.java
@@ -34,8 +34,8 @@ import android.os.ParcelFileDescriptor;
import android.os.UserHandle;
import android.provider.TimeZoneRulesDataContract;
import android.provider.TimeZoneRulesDataContract.Operation;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import java.io.File;
import java.io.FileNotFoundException;
diff --git a/testing/xts/src/com/android/timezone/xts/TimeZoneUpdateHostTest.java b/testing/xts/src/com/android/timezone/xts/TimeZoneUpdateHostTest.java
index 85c6019..e3300bb 100644
--- a/testing/xts/src/com/android/timezone/xts/TimeZoneUpdateHostTest.java
+++ b/testing/xts/src/com/android/timezone/xts/TimeZoneUpdateHostTest.java
@@ -151,24 +151,33 @@ 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();
+ } else {
+ // There was an apk installed, but no time zone distro was installed. It was
+ // probably a "bad" .apk that was rejected. The update app will request an uninstall
+ // anyway just to be sure, so we'll give it a chance to do that before continuing
+ // otherwise we could get an "operation in progress" later on when we're not
+ // expecting it.
+ Thread.sleep(10000);
}
}
assertActiveRulesVersion(getSystemRulesVersion());