Add a public test method to reset package version

Instead of having the cached version field protected, which is only
usable by DeviceConfigUtilsTest, have a public method to reset it to -1
so that other tests exercising feature flags can reset it before and
after running.

Bug: 173068192
Test: atest NetworkStaticLibTests
Change-Id: I8f5be3c91b2a47070507d5bf263e2e5d7d9d9d14
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