Merge "VCN: Remove hidden APIs for data directory and Settings constants" into main am: 5c75a96448

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/3273120

Change-Id: Id04c1773df566c59b623f2eb354ce0e35570305f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/services/core/java/com/android/server/VcnManagementService.java b/services/core/java/com/android/server/VcnManagementService.java
index d19899f..89dfc73 100644
--- a/services/core/java/com/android/server/VcnManagementService.java
+++ b/services/core/java/com/android/server/VcnManagementService.java
@@ -178,9 +178,10 @@
 
     public static final boolean VDBG = false; // STOPSHIP: if true
 
+    // The system path is copied from Environment.getDataSystemDirectory
     @VisibleForTesting(visibility = Visibility.PRIVATE)
     static final String VCN_CONFIG_FILE =
-            new File(Environment.getDataSystemDirectory(), "vcn/configs.xml").getPath();
+            new File(Environment.getDataDirectory(), "system/vcn/configs.xml").getPath();
 
     // TODO(b/176956496): Directly use CarrierServiceBindHelper.UNBIND_DELAY_MILLIS
     @VisibleForTesting(visibility = Visibility.PRIVATE)
diff --git a/services/core/java/com/android/server/vcn/Vcn.java b/services/core/java/com/android/server/vcn/Vcn.java
index 5a5f7ef..5bc2c2d 100644
--- a/services/core/java/com/android/server/vcn/Vcn.java
+++ b/services/core/java/com/android/server/vcn/Vcn.java
@@ -86,6 +86,9 @@
     private static final int MSG_EVENT_BASE = 0;
     private static final int MSG_CMD_BASE = 100;
 
+    // Copied from Settings.Global.MOBILE_DATA
+    private static final String SETTINGS_GLOBAL_MOBILE_DATA_STRING = "mobile_data";
+
     /**
      * A carrier app updated the configuration.
      *
@@ -219,7 +222,8 @@
         mContentResolver = mDeps.newVcnContentResolver(mVcnContext);
         mMobileDataSettingsObserver = new VcnMobileDataContentObserver(this /* handler */);
 
-        final Uri uri = Settings.Global.getUriFor(Settings.Global.MOBILE_DATA);
+        // TODO: b/364740845: Replace it with DataEnabledListener
+        final Uri uri = Settings.Global.getUriFor(SETTINGS_GLOBAL_MOBILE_DATA_STRING);
         mContentResolver.registerContentObserver(
                 uri, true /* notifyForDescendants */, mMobileDataSettingsObserver);