commit | 38fe60094d61bd0301d17d6a298627edbb786313 | [log] [tgz] |
---|---|---|
author | Remi NGUYEN VAN <reminv@google.com> | Wed Feb 24 00:29:34 2021 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Wed Feb 24 00:29:34 2021 +0000 |
tree | 29f617fc52796181898f6c83a641c4eb5eadee6c | |
parent | 499578ad17f271cb366a80d462012a10ea6e2d45 [diff] | |
parent | 779cba3698cd3fc083dca448f4a8a8e474794cbf [diff] |
Merge "Add a public test method to reset package version" am: 8bed9edeea Original change: https://android-review.googlesource.com/c/platform/frameworks/libs/net/+/1596433 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: Ic18f75a74d9aa24faa179f8950293e738c05b938
diff --git a/staticlibs/device/com/android/net/module/util/DeviceConfigUtils.java b/staticlibs/device/com/android/net/module/util/DeviceConfigUtils.java index 271cc6e..5d03dfd 100644 --- a/staticlibs/device/com/android/net/module/util/DeviceConfigUtils.java +++ b/staticlibs/device/com/android/net/module/util/DeviceConfigUtils.java
@@ -36,7 +36,11 @@ private static final String TAG = DeviceConfigUtils.class.getSimpleName(); @VisibleForTesting - protected static volatile long sPackageVersion = -1; + public static void resetPackageVersionCacheForTest() { + sPackageVersion = -1; + } + + private static volatile long sPackageVersion = -1; private static long getPackageVersion(@NonNull final Context context) throws PackageManager.NameNotFoundException { // sPackageVersion may be set by another thread just after this check, but querying the
diff --git a/staticlibs/tests/unit/src/com/android/net/module/util/DeviceConfigUtilsTest.java b/staticlibs/tests/unit/src/com/android/net/module/util/DeviceConfigUtilsTest.java index 982dbe7..57316b2 100644 --- a/staticlibs/tests/unit/src/com/android/net/module/util/DeviceConfigUtilsTest.java +++ b/staticlibs/tests/unit/src/com/android/net/module/util/DeviceConfigUtilsTest.java
@@ -88,7 +88,7 @@ @After public void tearDown() { mSession.finishMocking(); - DeviceConfigUtils.sPackageVersion = -1L; + DeviceConfigUtils.resetPackageVersionCacheForTest(); } @Test