Merge "Add OWNERS"
diff --git a/Android.bp b/Android.bp
index 03b4c36..866b706 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,3 +1,20 @@
+package {
+    default_applicable_licenses: ["packages_apps_Settings_license"],
+}
+
+// Added automatically by a large-scale-change
+// See: http://go/android-license-faq
+license {
+    name: "packages_apps_Settings_license",
+    visibility: [":__subpackages__"],
+    license_kinds: [
+        "SPDX-license-identifier-Apache-2.0",
+    ],
+    license_text: [
+        "NOTICE",
+    ],
+}
+
 java_library {
     name: "settings-logtags",
     srcs: ["src/**/*.logtags"],
diff --git a/protos/Android.bp b/protos/Android.bp
index 5184218..e09b941 100644
--- a/protos/Android.bp
+++ b/protos/Android.bp
@@ -1,3 +1,12 @@
+package {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "packages_apps_Settings_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["packages_apps_Settings_license"],
+}
+
 java_library_static {
     name: "settings-contextual-card-protos-lite",
     host_supported: true,
@@ -14,4 +23,4 @@
         type: "lite",
     },
     srcs: ["settings_log_bridge.proto"],
-}
\ No newline at end of file
+}
diff --git a/res/values/strings.xml b/res/values/strings.xml
index a2b28e9..69fc43c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -11791,7 +11791,7 @@
     <string name="carrier_settings_euicc">Carrier</string>
     <!-- Mobile network settings screen, a string showing the version of carrier settings for this
          subscription [CHAR LIMIT=NONE] -->
-    <string name="carrier_settings_version">Settings version</string>
+    <string name="carrier_settings_version">Carrier settings version</string>
 
     <!-- Mobile network settings screen, name for call settings category [CHAR LIMIT=NONE] -->
     <string name="call_category">Calling</string>
diff --git a/src/com/android/settings/AllInOneTetherSettings.java b/src/com/android/settings/AllInOneTetherSettings.java
index ed3b5b0..f7a68a0 100644
--- a/src/com/android/settings/AllInOneTetherSettings.java
+++ b/src/com/android/settings/AllInOneTetherSettings.java
@@ -16,8 +16,8 @@
 
 package com.android.settings;
 
-import static android.net.ConnectivityManager.ACTION_TETHER_STATE_CHANGED;
 import static android.net.ConnectivityManager.TETHERING_WIFI;
+import static android.net.TetheringManager.ACTION_TETHER_STATE_CHANGED;
 import static android.net.wifi.WifiManager.WIFI_AP_STATE_CHANGED_ACTION;
 
 import android.app.settings.SettingsEnums;
diff --git a/src/com/android/settings/ResetNetworkConfirm.java b/src/com/android/settings/ResetNetworkConfirm.java
index 6856a5a..d625251 100644
--- a/src/com/android/settings/ResetNetworkConfirm.java
+++ b/src/com/android/settings/ResetNetworkConfirm.java
@@ -28,6 +28,7 @@
 import android.net.ConnectivityManager;
 import android.net.NetworkPolicyManager;
 import android.net.Uri;
+import android.net.VpnManager;
 import android.net.wifi.WifiManager;
 import android.net.wifi.p2p.WifiP2pManager;
 import android.os.AsyncTask;
@@ -93,6 +94,11 @@
                 connectivityManager.factoryReset();
             }
 
+            VpnManager vpnManager = mContext.getSystemService(VpnManager.class);
+            if (vpnManager != null) {
+                vpnManager.factoryReset();
+            }
+
             WifiManager wifiManager = (WifiManager)
                     mContext.getSystemService(Context.WIFI_SERVICE);
             if (wifiManager != null) {
diff --git a/src/com/android/settings/TetherSettings.java b/src/com/android/settings/TetherSettings.java
index 26c699b..008100b 100644
--- a/src/com/android/settings/TetherSettings.java
+++ b/src/com/android/settings/TetherSettings.java
@@ -167,8 +167,8 @@
         mEm = (EthernetManager) getSystemService(Context.ETHERNET_SERVICE);
         mTm = (TetheringManager) getSystemService(Context.TETHERING_SERVICE);
 
-        mUsbRegexs = mCm.getTetherableUsbRegexs();
-        mBluetoothRegexs = mCm.getTetherableBluetoothRegexs();
+        mUsbRegexs = mTm.getTetherableUsbRegexs();
+        mBluetoothRegexs = mTm.getTetherableBluetoothRegexs();
         mEthernetRegex = getContext().getResources().getString(
                 com.android.internal.R.string.config_ethernet_iface_regex);
 
@@ -251,14 +251,14 @@
         public void onReceive(Context content, Intent intent) {
             String action = intent.getAction();
             // TODO: stop using ACTION_TETHER_STATE_CHANGED and use mTetheringEventCallback instead.
-            if (action.equals(ConnectivityManager.ACTION_TETHER_STATE_CHANGED)) {
+            if (action.equals(TetheringManager.ACTION_TETHER_STATE_CHANGED)) {
                 // TODO - this should understand the interface types
                 ArrayList<String> available = intent.getStringArrayListExtra(
-                        ConnectivityManager.EXTRA_AVAILABLE_TETHER);
+                        TetheringManager.EXTRA_AVAILABLE_TETHER);
                 ArrayList<String> active = intent.getStringArrayListExtra(
-                        ConnectivityManager.EXTRA_ACTIVE_TETHER);
+                        TetheringManager.EXTRA_ACTIVE_TETHER);
                 ArrayList<String> errored = intent.getStringArrayListExtra(
-                        ConnectivityManager.EXTRA_ERRORED_TETHER);
+                        TetheringManager.EXTRA_ERRORED_TETHER);
                 updateState(available.toArray(new String[available.size()]),
                         active.toArray(new String[active.size()]),
                         errored.toArray(new String[errored.size()]));
@@ -345,7 +345,7 @@
         final Activity activity = getActivity();
 
         mTetherChangeReceiver = new TetherChangeReceiver();
-        IntentFilter filter = new IntentFilter(ConnectivityManager.ACTION_TETHER_STATE_CHANGED);
+        IntentFilter filter = new IntentFilter(TetheringManager.ACTION_TETHER_STATE_CHANGED);
         final Intent intent = activity.registerReceiver(mTetherChangeReceiver, filter);
 
         filter = new IntentFilter();
@@ -367,11 +367,10 @@
     }
 
     private void updateState() {
-        final ConnectivityManager cm =
-                (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
-        final String[] available = cm.getTetherableIfaces();
-        final String[] tethered = cm.getTetheredIfaces();
-        final String[] errored = cm.getTetheringErroredIfaces();
+        final TetheringManager tm = getContext().getSystemService(TetheringManager.class);
+        final String[] available = tm.getTetherableIfaces();
+        final String[] tethered = tm.getTetheredIfaces();
+        final String[] errored = tm.getTetheringErroredIfaces();
         updateState(available, tethered, errored);
     }
 
@@ -391,7 +390,7 @@
             for (String regex : mUsbRegexs) {
                 if (s.matches(regex)) {
                     if (usbError == ConnectivityManager.TETHER_ERROR_NO_ERROR) {
-                        usbError = mCm.getLastTetherError(s);
+                        usbError = mTm.getLastTetherError(s);
                     }
                 }
             }
@@ -556,8 +555,8 @@
                 @Override
                 public List<String> getNonIndexableKeys(Context context) {
                     final List<String> keys = super.getNonIndexableKeys(context);
-                    final ConnectivityManager cm =
-                            context.getSystemService(ConnectivityManager.class);
+                    final TetheringManager tm =
+                            context.getSystemService(TetheringManager.class);
 
                     if (!TetherUtil.isTetherAvailable(context)) {
                         keys.add(KEY_TETHER_PREFS_SCREEN);
@@ -565,13 +564,13 @@
                     }
 
                     final boolean usbAvailable =
-                            cm.getTetherableUsbRegexs().length != 0;
+                            tm.getTetherableUsbRegexs().length != 0;
                     if (!usbAvailable || Utils.isMonkeyRunning()) {
                         keys.add(KEY_USB_TETHER_SETTINGS);
                     }
 
                     final boolean bluetoothAvailable =
-                            cm.getTetherableBluetoothRegexs().length != 0;
+                            tm.getTetherableBluetoothRegexs().length != 0;
                     if (!bluetoothAvailable) {
                         keys.add(KEY_ENABLE_BLUETOOTH_TETHERING);
                     }
diff --git a/src/com/android/settings/applications/specialaccess/notificationaccess/OWNERS b/src/com/android/settings/applications/specialaccess/notificationaccess/OWNERS
new file mode 100644
index 0000000..4338198
--- /dev/null
+++ b/src/com/android/settings/applications/specialaccess/notificationaccess/OWNERS
@@ -0,0 +1,4 @@
+# Default reviewers for this and subdirectories.
+beverlyt@google.com
+dsandler@android.com
+juliacr@google.com
\ No newline at end of file
diff --git a/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProvider.java b/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProvider.java
index 46f9b71..22fe760 100644
--- a/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProvider.java
+++ b/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProvider.java
@@ -85,11 +85,6 @@
     boolean isAlwaysOnVpnSetInManagedProfile();
 
     /**
-     * Returns whether the Device Owner set a recommended global HTTP proxy.
-     */
-    boolean isGlobalHttpProxySet();
-
-    /**
      * Returns the number of failed login attempts that the Device Owner or Profile Owner allows
      * before the current user is wiped, or zero if no such limit is set.
      */
diff --git a/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProviderImpl.java b/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProviderImpl.java
index 429c537..ad57c3c 100644
--- a/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProviderImpl.java
+++ b/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProviderImpl.java
@@ -25,6 +25,7 @@
 import android.content.pm.UserInfo;
 import android.content.res.Resources;
 import android.net.ConnectivityManager;
+import android.net.VpnManager;
 import android.os.UserHandle;
 import android.os.UserManager;
 import android.provider.Settings;
@@ -45,18 +46,20 @@
     private final PackageManager mPm;
     private final UserManager mUm;
     private final ConnectivityManager mCm;
+    private final VpnManager mVm;
     private final Resources mResources;
 
     private static final int MY_USER_ID = UserHandle.myUserId();
 
     public EnterprisePrivacyFeatureProviderImpl(Context context, DevicePolicyManager dpm,
-            PackageManager pm, UserManager um, ConnectivityManager cm,
+            PackageManager pm, UserManager um, ConnectivityManager cm, VpnManager vm,
             Resources resources) {
         mContext = context.getApplicationContext();
         mDpm = dpm;
         mPm = pm;
         mUm = um;
         mCm = cm;
+        mVm = vm;
         mResources = resources;
     }
 
@@ -130,19 +133,14 @@
 
     @Override
     public boolean isAlwaysOnVpnSetInCurrentUser() {
-        return VpnUtils.isAlwaysOnVpnSet(mCm, MY_USER_ID);
+        return VpnUtils.isAlwaysOnVpnSet(mVm, MY_USER_ID);
     }
 
     @Override
     public boolean isAlwaysOnVpnSetInManagedProfile() {
         final int managedProfileUserId = getManagedProfileUserId();
         return managedProfileUserId != UserHandle.USER_NULL &&
-                VpnUtils.isAlwaysOnVpnSet(mCm, managedProfileUserId);
-    }
-
-    @Override
-    public boolean isGlobalHttpProxySet() {
-        return mCm.getGlobalProxy() != null;
+                VpnUtils.isAlwaysOnVpnSet(mVm, managedProfileUserId);
     }
 
     @Override
diff --git a/src/com/android/settings/enterprise/GlobalHttpProxyPreferenceController.java b/src/com/android/settings/enterprise/GlobalHttpProxyPreferenceController.java
index 04e63aa..6de6cde 100644
--- a/src/com/android/settings/enterprise/GlobalHttpProxyPreferenceController.java
+++ b/src/com/android/settings/enterprise/GlobalHttpProxyPreferenceController.java
@@ -14,26 +14,25 @@
 package com.android.settings.enterprise;
 
 import android.content.Context;
+import android.net.ConnectivityManager;
 
 import com.android.settings.core.PreferenceControllerMixin;
-import com.android.settings.overlay.FeatureFactory;
 import com.android.settingslib.core.AbstractPreferenceController;
 
 public class GlobalHttpProxyPreferenceController extends AbstractPreferenceController implements
         PreferenceControllerMixin {
 
     private static final String KEY_GLOBAL_HTTP_PROXY = "global_http_proxy";
-    private final EnterprisePrivacyFeatureProvider mFeatureProvider;
+    private final ConnectivityManager mCm;
 
     public GlobalHttpProxyPreferenceController(Context context) {
         super(context);
-        mFeatureProvider = FeatureFactory.getFactory(context)
-                .getEnterprisePrivacyFeatureProvider(context);
+        mCm = context.getSystemService(ConnectivityManager.class);
     }
 
     @Override
     public boolean isAvailable() {
-        return mFeatureProvider.isGlobalHttpProxySet();
+        return mCm.getGlobalProxy() != null;
     }
 
     @Override
diff --git a/src/com/android/settings/fuelgauge/OWNERS b/src/com/android/settings/fuelgauge/OWNERS
index 4e5ee0e..d68dc98 100644
--- a/src/com/android/settings/fuelgauge/OWNERS
+++ b/src/com/android/settings/fuelgauge/OWNERS
@@ -1,3 +1,7 @@
 # Default reviewers for this and subdirectories.
-millchen@google.com
-tmfang@google.com
+tifn@google.com
+wesleycwwang@google.com
+ykhung@google.com
+
+# BatteryStats
+per-file FakeUid.java = file:platform/frameworks/base:/BATTERY_STATS_OWNERS
diff --git a/src/com/android/settings/network/BluetoothTetherPreferenceController.java b/src/com/android/settings/network/BluetoothTetherPreferenceController.java
index ab507da..96d39e3 100644
--- a/src/com/android/settings/network/BluetoothTetherPreferenceController.java
+++ b/src/com/android/settings/network/BluetoothTetherPreferenceController.java
@@ -70,7 +70,7 @@
 
     @Override
     public boolean shouldShow() {
-        final String[] bluetoothRegexs = mCm.getTetherableBluetoothRegexs();
+        final String[] bluetoothRegexs = mTm.getTetherableBluetoothRegexs();
         return bluetoothRegexs != null && bluetoothRegexs.length != 0;
     }
 
diff --git a/src/com/android/settings/network/EthernetTetherPreferenceController.java b/src/com/android/settings/network/EthernetTetherPreferenceController.java
index 19c410d..06cd6a7 100644
--- a/src/com/android/settings/network/EthernetTetherPreferenceController.java
+++ b/src/com/android/settings/network/EthernetTetherPreferenceController.java
@@ -65,7 +65,7 @@
 
     @Override
     public boolean shouldEnable() {
-        String[] available = mCm.getTetherableIfaces();
+        String[] available = mTm.getTetherableIfaces();
         for (String s : available) {
             if (s.matches(mEthernetRegex)) {
                 return true;
diff --git a/src/com/android/settings/network/OWNERS b/src/com/android/settings/network/OWNERS
index 4f17e3f..8b16bc9 100644
--- a/src/com/android/settings/network/OWNERS
+++ b/src/com/android/settings/network/OWNERS
@@ -6,6 +6,7 @@
 leechou@google.com
 songferngwang@google.com
 tomhsu@google.com
+wengsu@google.com
 zoeychen@google.com
 
 # Emergency approvers in case the above are not available
diff --git a/src/com/android/settings/network/TetherBasePreferenceController.java b/src/com/android/settings/network/TetherBasePreferenceController.java
index 36ce2a4..0a10207 100644
--- a/src/com/android/settings/network/TetherBasePreferenceController.java
+++ b/src/com/android/settings/network/TetherBasePreferenceController.java
@@ -17,7 +17,7 @@
 package com.android.settings.network;
 
 import android.content.Context;
-import android.net.ConnectivityManager;
+import android.net.TetheringManager;
 
 import androidx.lifecycle.Lifecycle;
 import androidx.lifecycle.LifecycleObserver;
@@ -33,7 +33,7 @@
         TetherEnabler.OnTetherStateUpdateListener {
 
     private static final String TAG = "TetherBasePreferenceController";
-    final ConnectivityManager mCm;
+    final TetheringManager mTm;
     private final DataSaverBackend mDataSaverBackend;
 
     private TetherEnabler mTetherEnabler;
@@ -43,7 +43,7 @@
 
     TetherBasePreferenceController(Context context, String preferenceKey) {
         super(context, preferenceKey);
-        mCm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
+        mTm = context.getSystemService(TetheringManager.class);
         mDataSaverBackend = new DataSaverBackend(context);
         mDataSaverEnabled = mDataSaverBackend.isDataSaverEnabled();
     }
diff --git a/src/com/android/settings/network/TetherEnabler.java b/src/com/android/settings/network/TetherEnabler.java
index b3c6d61..4475085 100644
--- a/src/com/android/settings/network/TetherEnabler.java
+++ b/src/com/android/settings/network/TetherEnabler.java
@@ -147,7 +147,7 @@
         mSwitchWidgetController.setListener(this);
         mSwitchWidgetController.startListening();
         final IntentFilter filter = new IntentFilter(
-                ConnectivityManager.ACTION_TETHER_STATE_CHANGED);
+                TetheringManager.ACTION_TETHER_STATE_CHANGED);
         filter.addAction(WifiManager.WIFI_AP_STATE_CHANGED_ACTION);
         filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
         mContext.registerReceiver(mTetherChangeReceiver, filter);
@@ -222,7 +222,7 @@
     int getTetheringState(@Nullable String[] tethered) {
         int tetherState = TETHERING_OFF;
         if (tethered == null) {
-            tethered = mConnectivityManager.getTetheredIfaces();
+            tethered = mTetheringManager.getTetheredIfaces();
         }
 
         if (mWifiManager.isWifiApEnabled()) {
@@ -239,7 +239,7 @@
             }
         }
 
-        String[] usbRegexs = mConnectivityManager.getTetherableUsbRegexs();
+        String[] usbRegexs = mTetheringManager.getTetherableUsbRegexs();
         for (String s : tethered) {
             for (String regex : usbRegexs) {
                 if (s.matches(regex)) {
diff --git a/src/com/android/settings/network/TetherPreferenceController.java b/src/com/android/settings/network/TetherPreferenceController.java
index 2409544..8df0ac1 100644
--- a/src/com/android/settings/network/TetherPreferenceController.java
+++ b/src/com/android/settings/network/TetherPreferenceController.java
@@ -28,6 +28,7 @@
 import android.content.IntentFilter;
 import android.database.ContentObserver;
 import android.net.ConnectivityManager;
+import android.net.TetheringManager;
 import android.net.Uri;
 import android.os.Bundle;
 import android.os.Handler;
@@ -62,6 +63,7 @@
     private final AtomicReference<BluetoothPan> mBluetoothPan;
     private final ConnectivityManager mConnectivityManager;
     private final BluetoothAdapter mBluetoothAdapter;
+    private final TetheringManager mTetheringManager;
     @VisibleForTesting
     final BluetoothProfile.ServiceListener mBtProfileServiceListener =
             new android.bluetooth.BluetoothProfile.ServiceListener() {
@@ -86,6 +88,7 @@
         mBluetoothPan = new AtomicReference<>();
         mConnectivityManager = null;
         mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
+        mTetheringManager = null;
     }
 
     public TetherPreferenceController(Context context, Lifecycle lifecycle) {
@@ -95,6 +98,7 @@
         mConnectivityManager =
                 (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
         mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
+        mTetheringManager = context.getSystemService(TetheringManager.class);
         if (lifecycle != null) {
             lifecycle.addObserver(this);
         }
@@ -144,7 +148,7 @@
             mTetherReceiver = new TetherBroadcastReceiver();
         }
         mContext.registerReceiver(
-                mTetherReceiver, new IntentFilter(ConnectivityManager.ACTION_TETHER_STATE_CHANGED));
+                mTetherReceiver, new IntentFilter(TetheringManager.ACTION_TETHER_STATE_CHANGED));
         mContext.getContentResolver()
                 .registerContentObserver(mAirplaneModeObserver.uri, false, mAirplaneModeObserver);
     }
@@ -178,9 +182,9 @@
             // Preference is not ready yet.
             return;
         }
-        String[] allTethered = mConnectivityManager.getTetheredIfaces();
-        String[] wifiTetherRegex = mConnectivityManager.getTetherableWifiRegexs();
-        String[] bluetoothRegex = mConnectivityManager.getTetherableBluetoothRegexs();
+        String[] allTethered = mTetheringManager.getTetheredIfaces();
+        String[] wifiTetherRegex = mTetheringManager.getTetherableWifiRegexs();
+        String[] bluetoothRegex = mTetheringManager.getTetherableBluetoothRegexs();
 
         boolean hotSpotOn = false;
         boolean tetherOn = false;
@@ -211,7 +215,7 @@
                 && bluetoothRegex != null && bluetoothRegex.length > 0
                 && mBluetoothAdapter != null
                 && mBluetoothAdapter.getState() == BluetoothAdapter.STATE_ON) {
-            // Check bluetooth state. It's not included in mConnectivityManager.getTetheredIfaces.
+            // Check bluetooth state. It's not included in mTetheringManager.getTetheredIfaces.
             final BluetoothPan pan = mBluetoothPan.get();
             tetherOn = pan != null && pan.isTetheringOn();
         }
diff --git a/src/com/android/settings/network/UsbTetherPreferenceController.java b/src/com/android/settings/network/UsbTetherPreferenceController.java
index 7cf1ddf..7a5cc21 100644
--- a/src/com/android/settings/network/UsbTetherPreferenceController.java
+++ b/src/com/android/settings/network/UsbTetherPreferenceController.java
@@ -68,7 +68,7 @@
 
     @Override
     public boolean shouldShow() {
-        String[] usbRegexs = mCm.getTetherableUsbRegexs();
+        String[] usbRegexs = mTm.getTetherableUsbRegexs();
         return  usbRegexs != null && usbRegexs.length != 0 && !Utils.isMonkeyRunning();
     }
 
diff --git a/src/com/android/settings/network/VpnPreferenceController.java b/src/com/android/settings/network/VpnPreferenceController.java
index 62589d5..9295414 100644
--- a/src/com/android/settings/network/VpnPreferenceController.java
+++ b/src/com/android/settings/network/VpnPreferenceController.java
@@ -19,12 +19,10 @@
 import android.content.pm.PackageManager;
 import android.content.pm.UserInfo;
 import android.net.ConnectivityManager;
-import android.net.IConnectivityManager;
 import android.net.Network;
 import android.net.NetworkCapabilities;
 import android.net.NetworkRequest;
-import android.os.RemoteException;
-import android.os.ServiceManager;
+import android.net.VpnManager;
 import android.os.UserHandle;
 import android.os.UserManager;
 import android.provider.Settings;
@@ -64,7 +62,7 @@
     private final String mToggleable;
     private final UserManager mUserManager;
     private final ConnectivityManager mConnectivityManager;
-    private final IConnectivityManager mConnectivityManagerService;
+    private final VpnManager mVpnManager;
     private Preference mPreference;
 
     public VpnPreferenceController(Context context) {
@@ -74,8 +72,7 @@
         mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
         mConnectivityManager =
                 (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
-        mConnectivityManagerService = IConnectivityManager.Stub.asInterface(
-                ServiceManager.getService(Context.CONNECTIVITY_SERVICE));
+        mVpnManager = context.getSystemService(VpnManager.class);
     }
 
     @Override
@@ -122,27 +119,20 @@
         }
         // Copied from SystemUI::SecurityControllerImpl
         SparseArray<VpnConfig> vpns = new SparseArray<>();
-        try {
-            final List<UserInfo> users = mUserManager.getUsers();
-            for (UserInfo user : users) {
-                VpnConfig cfg = mConnectivityManagerService.getVpnConfig(user.id);
-                if (cfg == null) {
+        final List<UserInfo> users = mUserManager.getUsers();
+        for (UserInfo user : users) {
+            VpnConfig cfg = mVpnManager.getVpnConfig(user.id);
+            if (cfg == null) {
+                continue;
+            } else if (cfg.legacy) {
+                // Legacy VPNs should do nothing if the network is disconnected. Third-party
+                // VPN warnings need to continue as traffic can still go to the app.
+                final LegacyVpnInfo legacyVpn = mVpnManager.getLegacyVpnInfo(user.id);
+                if (legacyVpn == null || legacyVpn.state != LegacyVpnInfo.STATE_CONNECTED) {
                     continue;
-                } else if (cfg.legacy) {
-                    // Legacy VPNs should do nothing if the network is disconnected. Third-party
-                    // VPN warnings need to continue as traffic can still go to the app.
-                    final LegacyVpnInfo legacyVpn =
-                            mConnectivityManagerService.getLegacyVpnInfo(user.id);
-                    if (legacyVpn == null || legacyVpn.state != LegacyVpnInfo.STATE_CONNECTED) {
-                        continue;
-                    }
                 }
-                vpns.put(user.id, cfg);
             }
-        } catch (RemoteException rme) {
-            // Roll back to previous state
-            Log.e(TAG, "Unable to list active VPNs", rme);
-            return;
+            vpns.put(user.id, cfg);
         }
         final UserInfo userInfo = mUserManager.getUserInfo(UserHandle.myUserId());
         final int uid;
diff --git a/src/com/android/settings/network/WifiTetherDisablePreferenceController.java b/src/com/android/settings/network/WifiTetherDisablePreferenceController.java
index 38e831b..783f78f 100644
--- a/src/com/android/settings/network/WifiTetherDisablePreferenceController.java
+++ b/src/com/android/settings/network/WifiTetherDisablePreferenceController.java
@@ -68,7 +68,7 @@
 
     @Override
     public boolean shouldShow() {
-        final String[] wifiRegexs = mCm.getTetherableWifiRegexs();
+        final String[] wifiRegexs = mTm.getTetherableWifiRegexs();
         return wifiRegexs != null && wifiRegexs.length != 0 && !Utils.isMonkeyRunning()
                 && getTetheringStateOfOtherInterfaces() != TetherEnabler.TETHERING_OFF;
     }
diff --git a/src/com/android/settings/network/telephony/NetworkSelectSettings.java b/src/com/android/settings/network/telephony/NetworkSelectSettings.java
index ff641e9..c8121c4 100644
--- a/src/com/android/settings/network/telephony/NetworkSelectSettings.java
+++ b/src/com/android/settings/network/telephony/NetworkSelectSettings.java
@@ -343,16 +343,6 @@
                     mPreferenceCategory.getPreference(numberOfPreferences));
         }
 
-        // update selected preference instance by index
-        for (int index = 0; index < mCellInfoList.size(); index++) {
-            final CellInfo cellInfo = mCellInfoList.get(index);
-
-            if ((mSelectedPreference != null) && mSelectedPreference.isSameCell(cellInfo)) {
-                mSelectedPreference = (NetworkOperatorPreference)
-                        (mPreferenceCategory.getPreference(index));
-            }
-        }
-
         // update the content of preference
         NetworkOperatorPreference connectedPref = null;
         for (int index = 0; index < mCellInfoList.size(); index++) {
@@ -386,6 +376,16 @@
             }
         }
 
+        // update selected preference instance by index
+        for (int index = 0; index < mCellInfoList.size(); index++) {
+            final CellInfo cellInfo = mCellInfoList.get(index);
+
+            if ((mSelectedPreference != null) && mSelectedPreference.isSameCell(cellInfo)) {
+                mSelectedPreference = (NetworkOperatorPreference)
+                        (mPreferenceCategory.getPreference(index));
+            }
+        }
+
         return connectedPref;
     }
 
diff --git a/src/com/android/settings/overlay/FeatureFactoryImpl.java b/src/com/android/settings/overlay/FeatureFactoryImpl.java
index d4d396f..41bfb21 100644
--- a/src/com/android/settings/overlay/FeatureFactoryImpl.java
+++ b/src/com/android/settings/overlay/FeatureFactoryImpl.java
@@ -20,6 +20,7 @@
 import android.app.admin.DevicePolicyManager;
 import android.content.Context;
 import android.net.ConnectivityManager;
+import android.net.VpnManager;
 import android.os.UserManager;
 
 import androidx.annotation.Keep;
@@ -169,7 +170,8 @@
                             Context.DEVICE_POLICY_SERVICE),
                     appContext.getPackageManager(),
                     UserManager.get(appContext),
-                    (ConnectivityManager) appContext.getSystemService(Context.CONNECTIVITY_SERVICE),
+                    appContext.getSystemService(ConnectivityManager.class),
+                    appContext.getSystemService(VpnManager.class),
                     appContext.getResources());
         }
         return mEnterprisePrivacyFeatureProvider;
diff --git a/src/com/android/settings/vpn2/AppDialogFragment.java b/src/com/android/settings/vpn2/AppDialogFragment.java
index ea9e546..626a271 100644
--- a/src/com/android/settings/vpn2/AppDialogFragment.java
+++ b/src/com/android/settings/vpn2/AppDialogFragment.java
@@ -18,17 +18,12 @@
 
 import android.app.Dialog;
 import android.app.settings.SettingsEnums;
-import android.content.Context;
 import android.content.DialogInterface;
 import android.content.pm.PackageInfo;
-import android.net.IConnectivityManager;
 import android.net.VpnManager;
 import android.os.Bundle;
-import android.os.RemoteException;
-import android.os.ServiceManager;
 import android.os.UserHandle;
 import android.os.UserManager;
-import android.util.Log;
 
 import androidx.appcompat.app.AlertDialog;
 import androidx.fragment.app.Fragment;
@@ -53,8 +48,7 @@
     private Listener mListener;
 
     private UserManager mUserManager;
-    private final IConnectivityManager mService = IConnectivityManager.Stub.asInterface(
-            ServiceManager.getService(Context.CONNECTIVITY_SERVICE));
+    private VpnManager mVpnManager;
 
     @Override
     public int getMetricsCategory() {
@@ -98,6 +92,7 @@
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         mUserManager = UserManager.get(getContext());
+        mVpnManager = getContext().getSystemService(VpnManager.class);
     }
 
     @Override
@@ -145,14 +140,9 @@
             return;
         }
         final int userId = getUserId();
-        try {
-            mService.setVpnPackageAuthorization(
-                    mPackageInfo.packageName, userId, VpnManager.TYPE_VPN_NONE);
-            onDisconnect(dialog);
-        } catch (RemoteException e) {
-            Log.e(TAG, "Failed to forget authorization of " + mPackageInfo.packageName +
-                    " for user " + userId, e);
-        }
+        mVpnManager.setVpnPackageAuthorization(
+                mPackageInfo.packageName, userId, VpnManager.TYPE_VPN_NONE);
+        onDisconnect(dialog);
 
         if (mListener != null) {
             mListener.onForget();
@@ -164,15 +154,10 @@
             return;
         }
         final int userId = getUserId();
-        try {
-            if (mPackageInfo.packageName.equals(VpnUtils.getConnectedPackage(mService, userId))) {
-                mService.setAlwaysOnVpnPackage(userId, null, /* lockdownEnabled */ false,
-                        /* lockdownWhitelist */ null);
-                mService.prepareVpn(mPackageInfo.packageName, VpnConfig.LEGACY_VPN, userId);
-            }
-        } catch (RemoteException e) {
-            Log.e(TAG, "Failed to disconnect package " + mPackageInfo.packageName +
-                    " for user " + userId, e);
+        if (mPackageInfo.packageName.equals(VpnUtils.getConnectedPackage(mVpnManager, userId))) {
+            mVpnManager.setAlwaysOnVpnPackageForUser(userId, null, /* lockdownEnabled */ false,
+                    /* lockdownAllowlist */ null);
+            mVpnManager.prepareVpn(mPackageInfo.packageName, VpnConfig.LEGACY_VPN, userId);
         }
     }
 
diff --git a/src/com/android/settings/vpn2/AppManagementFragment.java b/src/com/android/settings/vpn2/AppManagementFragment.java
index 8280a3d..0543fee 100644
--- a/src/com/android/settings/vpn2/AppManagementFragment.java
+++ b/src/com/android/settings/vpn2/AppManagementFragment.java
@@ -28,11 +28,8 @@
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
 import android.content.pm.PackageManager.NameNotFoundException;
-import android.net.ConnectivityManager;
-import android.net.IConnectivityManager;
+import android.net.VpnManager;
 import android.os.Bundle;
-import android.os.RemoteException;
-import android.os.ServiceManager;
 import android.os.UserHandle;
 import android.os.UserManager;
 import android.text.TextUtils;
@@ -71,8 +68,7 @@
 
     private PackageManager mPackageManager;
     private DevicePolicyManager mDevicePolicyManager;
-    private ConnectivityManager mConnectivityManager;
-    private IConnectivityManager mConnectivityService;
+    private VpnManager mVpnManager;
 
     // VPN app info
     private final int mUserId = UserHandle.myUserId();
@@ -124,9 +120,7 @@
 
         mPackageManager = getContext().getPackageManager();
         mDevicePolicyManager = getContext().getSystemService(DevicePolicyManager.class);
-        mConnectivityManager = getContext().getSystemService(ConnectivityManager.class);
-        mConnectivityService = IConnectivityManager.Stub
-                .asInterface(ServiceManager.getService(Context.CONNECTIVITY_SERVICE));
+        mVpnManager = getContext().getSystemService(VpnManager.class);
 
         mPreferenceVersion = findPreference(KEY_VERSION);
         mPreferenceAlwaysOn = (RestrictedSwitchPreference) findPreference(KEY_ALWAYS_ON_VPN);
@@ -230,8 +224,8 @@
     }
 
     private boolean setAlwaysOnVpn(boolean isEnabled, boolean isLockdown) {
-        return mConnectivityManager.setAlwaysOnVpnPackageForUser(mUserId,
-                isEnabled ? mPackageName : null, isLockdown, /* lockdownWhitelist */ null);
+        return mVpnManager.setAlwaysOnVpnPackageForUser(mUserId,
+                isEnabled ? mPackageName : null, isLockdown, /* lockdownAllowlist */ null);
     }
 
     private void updateUI() {
@@ -264,7 +258,7 @@
                     mPreferenceLockdown.setDisabledByAdmin(admin);
                 }
             }
-            if (mConnectivityManager.isAlwaysOnVpnPackageSupportedForUser(mUserId, mPackageName)) {
+            if (mVpnManager.isAlwaysOnVpnPackageSupportedForUser(mUserId, mPackageName)) {
                 // setSummary doesn't override the admin message when user restriction is applied
                 mPreferenceAlwaysOn.setSummary(R.string.vpn_always_on_summary);
                 // setEnabled is not required here, as checkRestrictionAndSetDisabled
@@ -278,7 +272,7 @@
     }
 
     private String getAlwaysOnVpnPackage() {
-        return mConnectivityManager.getAlwaysOnVpnPackageForUser(mUserId);
+        return mVpnManager.getAlwaysOnVpnPackageForUser(mUserId);
     }
 
     private boolean isVpnAlwaysOn() {
@@ -335,13 +329,8 @@
      * @return {@code true} if another VPN (VpnService or legacy) is connected or set as always-on.
      */
     private boolean isAnotherVpnActive() {
-        try {
-            final VpnConfig config = mConnectivityService.getVpnConfig(mUserId);
-            return config != null && !TextUtils.equals(config.user, mPackageName);
-        } catch (RemoteException e) {
-            Log.w(TAG, "Failure to look up active VPN", e);
-            return false;
-        }
+        final VpnConfig config = mVpnManager.getVpnConfig(mUserId);
+        return config != null && !TextUtils.equals(config.user, mPackageName);
     }
 
     public static class CannotConnectFragment extends InstrumentedDialogFragment {
diff --git a/src/com/android/settings/vpn2/ConfigDialogFragment.java b/src/com/android/settings/vpn2/ConfigDialogFragment.java
index 57ba8bf..f339a69 100644
--- a/src/com/android/settings/vpn2/ConfigDialogFragment.java
+++ b/src/com/android/settings/vpn2/ConfigDialogFragment.java
@@ -20,11 +20,9 @@
 import android.app.settings.SettingsEnums;
 import android.content.Context;
 import android.content.DialogInterface;
-import android.net.ConnectivityManager;
-import android.net.IConnectivityManager;
+import android.net.VpnManager;
 import android.os.Bundle;
 import android.os.RemoteException;
-import android.os.ServiceManager;
 import android.os.UserHandle;
 import android.security.Credentials;
 import android.security.KeyStore;
@@ -52,9 +50,8 @@
     private static final String ARG_EDITING = "editing";
     private static final String ARG_EXISTS = "exists";
 
-    private final IConnectivityManager mService = IConnectivityManager.Stub.asInterface(
-            ServiceManager.getService(Context.CONNECTIVITY_SERVICE));
     private Context mContext;
+    private VpnManager mService;
 
 
     @Override
@@ -80,6 +77,7 @@
     public void onAttach(final Context context) {
         super.onAttach(context);
         mContext = context;
+        mService = context.getSystemService(VpnManager.class);
     }
 
     @Override
@@ -178,9 +176,8 @@
                 return;
             }
 
-            final ConnectivityManager conn = ConnectivityManager.from(mContext);
-            conn.setAlwaysOnVpnPackageForUser(UserHandle.myUserId(), null,
-                    /* lockdownEnabled */ false, /* lockdownWhitelist */ null);
+            mService.setAlwaysOnVpnPackageForUser(UserHandle.myUserId(), null,
+                    /* lockdownEnabled */ false, /* lockdownAllowlist */ null);
             VpnUtils.setLockdownVpn(mContext, profile.key);
         } else {
             // update only if lockdown vpn has been changed
@@ -212,8 +209,6 @@
                 mService.startLegacyVpn(profile);
             } catch (IllegalStateException e) {
                 Toast.makeText(mContext, R.string.vpn_no_network, Toast.LENGTH_LONG).show();
-            } catch (RemoteException e) {
-                Log.e(TAG, "Failed to connect", e);
             }
         }
     }
diff --git a/src/com/android/settings/vpn2/VpnSettings.java b/src/com/android/settings/vpn2/VpnSettings.java
index 8a2b465..0a3b2b0 100644
--- a/src/com/android/settings/vpn2/VpnSettings.java
+++ b/src/com/android/settings/vpn2/VpnSettings.java
@@ -30,16 +30,14 @@
 import android.content.pm.PackageManager;
 import android.net.ConnectivityManager;
 import android.net.ConnectivityManager.NetworkCallback;
-import android.net.IConnectivityManager;
 import android.net.Network;
 import android.net.NetworkCapabilities;
 import android.net.NetworkRequest;
+import android.net.VpnManager;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.HandlerThread;
 import android.os.Message;
-import android.os.RemoteException;
-import android.os.ServiceManager;
 import android.os.UserHandle;
 import android.os.UserManager;
 import android.security.Credentials;
@@ -92,10 +90,9 @@
             .removeCapability(NetworkCapabilities.NET_CAPABILITY_TRUSTED)
             .build();
 
-    private final IConnectivityManager mConnectivityService = IConnectivityManager.Stub
-            .asInterface(ServiceManager.getService(Context.CONNECTIVITY_SERVICE));
     private ConnectivityManager mConnectivityManager;
     private UserManager mUserManager;
+    private VpnManager mVpnManager;
 
     private final KeyStore mKeyStore = KeyStore.getInstance();
 
@@ -124,6 +121,7 @@
 
         mUserManager = (UserManager) getSystemService(Context.USER_SERVICE);
         mConnectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
+        mVpnManager = (VpnManager) getSystemService(Context.VPN_MANAGEMENT_SERVICE);
 
         mUnavailable = isUiRestricted();
         setHasOptionsMenu(!mUnavailable);
@@ -467,13 +465,9 @@
 
     @WorkerThread
     private Map<String, LegacyVpnInfo> getConnectedLegacyVpns() {
-        try {
-            mConnectedLegacyVpn = mConnectivityService.getLegacyVpnInfo(UserHandle.myUserId());
-            if (mConnectedLegacyVpn != null) {
-                return Collections.singletonMap(mConnectedLegacyVpn.key, mConnectedLegacyVpn);
-            }
-        } catch (RemoteException e) {
-            Log.e(LOG_TAG, "Failure updating VPN list with connected legacy VPNs", e);
+        mConnectedLegacyVpn = mVpnManager.getLegacyVpnInfo(UserHandle.myUserId());
+        if (mConnectedLegacyVpn != null) {
+            return Collections.singletonMap(mConnectedLegacyVpn.key, mConnectedLegacyVpn);
         }
         return Collections.emptyMap();
     }
@@ -482,15 +476,11 @@
     private Set<AppVpnInfo> getConnectedAppVpns() {
         // Mark connected third-party services
         Set<AppVpnInfo> connections = new ArraySet<>();
-        try {
-            for (UserHandle profile : mUserManager.getUserProfiles()) {
-                VpnConfig config = mConnectivityService.getVpnConfig(profile.getIdentifier());
-                if (config != null && !config.legacy) {
-                    connections.add(new AppVpnInfo(profile.getIdentifier(), config.user));
-                }
+        for (UserHandle profile : mUserManager.getUserProfiles()) {
+            VpnConfig config = mVpnManager.getVpnConfig(profile.getIdentifier());
+            if (config != null && !config.legacy) {
+                connections.add(new AppVpnInfo(profile.getIdentifier(), config.user));
             }
-        } catch (RemoteException e) {
-            Log.e(LOG_TAG, "Failure updating VPN list with connected app VPNs", e);
         }
         return connections;
     }
@@ -500,7 +490,7 @@
         Set<AppVpnInfo> result = new ArraySet<>();
         for (UserHandle profile : mUserManager.getUserProfiles()) {
             final int profileId = profile.getIdentifier();
-            final String packageName = mConnectivityManager.getAlwaysOnVpnPackageForUser(profileId);
+            final String packageName = mVpnManager.getAlwaysOnVpnPackageForUser(profileId);
             if (packageName != null) {
                 result.add(new AppVpnInfo(profileId, packageName));
             }
diff --git a/src/com/android/settings/vpn2/VpnUtils.java b/src/com/android/settings/vpn2/VpnUtils.java
index 38c56c5..4c9338c 100644
--- a/src/com/android/settings/vpn2/VpnUtils.java
+++ b/src/com/android/settings/vpn2/VpnUtils.java
@@ -16,14 +16,11 @@
 package com.android.settings.vpn2;
 
 import android.content.Context;
-import android.net.ConnectivityManager;
-import android.net.IConnectivityManager;
+import android.net.VpnManager;
 import android.os.RemoteException;
-import android.os.ServiceManager;
 import android.provider.Settings;
 import android.security.Credentials;
 import android.security.KeyStore;
-import android.util.Log;
 
 import com.android.internal.net.LegacyVpnInfo;
 import com.android.internal.net.VpnConfig;
@@ -45,15 +42,15 @@
 
     public static void clearLockdownVpn(Context context) {
         KeyStore.getInstance().delete(Credentials.LOCKDOWN_VPN);
-        // Always notify ConnectivityManager after keystore update
-        getConnectivityManager(context).updateLockdownVpn();
+        // Always notify VpnManager after keystore update
+        getVpnManager(context).updateLockdownVpn();
     }
 
     public static void setLockdownVpn(Context context, String lockdownKey) {
         KeyStore.getInstance().put(Credentials.LOCKDOWN_VPN, lockdownKey.getBytes(),
                 KeyStore.UID_SELF, /* flags */ 0);
-        // Always notify ConnectivityManager after keystore update
-        getConnectivityManager(context).updateLockdownVpn();
+        // Always notify VpnManager after keystore update
+        getVpnManager(context).updateLockdownVpn();
     }
 
     public static boolean isVpnLockdown(String key) {
@@ -65,46 +62,35 @@
         if (getLockdownVpn() != null) {
             return true;
         }
-        return getConnectivityManager(context).getAlwaysOnVpnPackageForUser(userId) != null
+        return getVpnManager(context).getAlwaysOnVpnPackageForUser(userId) != null
                 && Settings.Secure.getIntForUser(context.getContentResolver(),
                         Settings.Secure.ALWAYS_ON_VPN_LOCKDOWN, /* default */ 0, userId) != 0;
     }
 
     public static boolean isVpnActive(Context context) throws RemoteException {
-        return getIConnectivityManager().getVpnConfig(context.getUserId()) != null;
+        return getVpnManager(context).getVpnConfig(context.getUserId()) != null;
     }
 
-    public static String getConnectedPackage(IConnectivityManager service, final int userId)
-            throws RemoteException {
-        final VpnConfig config = service.getVpnConfig(userId);
+    public static String getConnectedPackage(VpnManager vpnManager, final int userId) {
+        final VpnConfig config = vpnManager.getVpnConfig(userId);
         return config != null ? config.user : null;
     }
 
-    private static ConnectivityManager getConnectivityManager(Context context) {
-        return context.getSystemService(ConnectivityManager.class);
+    private static VpnManager getVpnManager(Context context) {
+        return context.getSystemService(VpnManager.class);
     }
 
-    private static IConnectivityManager getIConnectivityManager() {
-        return IConnectivityManager.Stub.asInterface(
-                ServiceManager.getService(Context.CONNECTIVITY_SERVICE));
-    }
-
-    public static boolean isAlwaysOnVpnSet(ConnectivityManager cm, final int userId) {
-        return cm.getAlwaysOnVpnPackageForUser(userId) != null;
+    public static boolean isAlwaysOnVpnSet(VpnManager vm, final int userId) {
+        return vm.getAlwaysOnVpnPackageForUser(userId) != null;
     }
 
     public static boolean disconnectLegacyVpn(Context context) {
-        try {
-            int userId = context.getUserId();
-            IConnectivityManager connectivityService = getIConnectivityManager();
-            LegacyVpnInfo currentLegacyVpn = connectivityService.getLegacyVpnInfo(userId);
-            if (currentLegacyVpn != null) {
-                clearLockdownVpn(context);
-                connectivityService.prepareVpn(null, VpnConfig.LEGACY_VPN, userId);
-                return true;
-            }
-        } catch (RemoteException e) {
-            Log.e(TAG, "Legacy VPN could not be disconnected", e);
+        int userId = context.getUserId();
+        LegacyVpnInfo currentLegacyVpn = getVpnManager(context).getLegacyVpnInfo(userId);
+        if (currentLegacyVpn != null) {
+            clearLockdownVpn(context);
+            getVpnManager(context).prepareVpn(null, VpnConfig.LEGACY_VPN, userId);
+            return true;
         }
         return false;
     }
diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java
index 29e4fb7..d0b5a40 100644
--- a/src/com/android/settings/wifi/WifiConfigController.java
+++ b/src/com/android/settings/wifi/WifiConfigController.java
@@ -18,12 +18,12 @@
 
 import android.content.Context;
 import android.content.res.Resources;
+import android.net.InetAddresses;
 import android.net.IpConfiguration;
 import android.net.IpConfiguration.IpAssignment;
 import android.net.IpConfiguration.ProxySettings;
 import android.net.LinkAddress;
 import android.net.NetworkInfo.DetailedState;
-import android.net.NetworkUtils;
 import android.net.ProxyInfo;
 import android.net.StaticIpConfiguration;
 import android.net.Uri;
@@ -69,6 +69,7 @@
 
 import androidx.annotation.VisibleForTesting;
 
+import com.android.net.module.util.NetUtils;
 import com.android.net.module.util.ProxyUtils;
 import com.android.settings.ProxySelector;
 import com.android.settings.R;
@@ -898,7 +899,7 @@
 
     private Inet4Address getIPv4Address(String text) {
         try {
-            return (Inet4Address) NetworkUtils.numericToInetAddress(text);
+            return (Inet4Address) InetAddresses.parseNumericAddress(text);
         } catch (IllegalArgumentException | ClassCastException e) {
             return null;
         }
@@ -934,7 +935,7 @@
         if (TextUtils.isEmpty(gateway)) {
             try {
                 //Extract a default gateway from IP address
-                InetAddress netPart = NetworkUtils.getNetworkPart(inetAddr, networkPrefixLength);
+                InetAddress netPart = NetUtils.getNetworkPart(inetAddr, networkPrefixLength);
                 byte[] addr = netPart.getAddress();
                 addr[addr.length - 1] = 1;
                 mGatewayView.setText(InetAddress.getByAddress(addr).getHostAddress());
diff --git a/src/com/android/settings/wifi/WifiConfigController2.java b/src/com/android/settings/wifi/WifiConfigController2.java
index 4d31105..6b7505f 100644
--- a/src/com/android/settings/wifi/WifiConfigController2.java
+++ b/src/com/android/settings/wifi/WifiConfigController2.java
@@ -18,11 +18,11 @@
 
 import android.content.Context;
 import android.content.res.Resources;
+import android.net.InetAddresses;
 import android.net.IpConfiguration;
 import android.net.IpConfiguration.IpAssignment;
 import android.net.IpConfiguration.ProxySettings;
 import android.net.LinkAddress;
-import android.net.NetworkUtils;
 import android.net.ProxyInfo;
 import android.net.StaticIpConfiguration;
 import android.net.Uri;
@@ -67,6 +67,7 @@
 
 import androidx.annotation.VisibleForTesting;
 
+import com.android.net.module.util.NetUtils;
 import com.android.net.module.util.ProxyUtils;
 import com.android.settings.ProxySelector;
 import com.android.settings.R;
@@ -879,7 +880,7 @@
 
     private Inet4Address getIPv4Address(String text) {
         try {
-            return (Inet4Address) NetworkUtils.numericToInetAddress(text);
+            return (Inet4Address) InetAddresses.parseNumericAddress(text);
         } catch (IllegalArgumentException | ClassCastException e) {
             return null;
         }
@@ -915,7 +916,7 @@
         if (TextUtils.isEmpty(gateway)) {
             try {
                 //Extract a default gateway from IP address
-                InetAddress netPart = NetworkUtils.getNetworkPart(inetAddr, networkPrefixLength);
+                InetAddress netPart = NetUtils.getNetworkPart(inetAddr, networkPrefixLength);
                 byte[] addr = netPart.getAddress();
                 addr[addr.length - 1] = 1;
                 mGatewayView.setText(InetAddress.getByAddress(addr).getHostAddress());
diff --git a/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java b/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
index 8dd8d7a..b30360c 100644
--- a/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
+++ b/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
@@ -40,7 +40,6 @@
 import android.net.NetworkCapabilities;
 import android.net.NetworkInfo;
 import android.net.NetworkRequest;
-import android.net.NetworkUtils;
 import android.net.RouteInfo;
 import android.net.Uri;
 import android.net.wifi.WifiConfiguration;
@@ -61,6 +60,7 @@
 import androidx.preference.PreferenceFragmentCompat;
 import androidx.preference.PreferenceScreen;
 
+import com.android.net.module.util.Inet4AddressUtils;
 import com.android.settings.R;
 import com.android.settings.Utils;
 import com.android.settings.core.FeatureFlags;
@@ -87,7 +87,6 @@
 import java.net.Inet4Address;
 import java.net.Inet6Address;
 import java.net.InetAddress;
-import java.net.UnknownHostException;
 import java.time.Duration;
 import java.time.Instant;
 import java.time.ZonedDateTime;
@@ -930,10 +929,8 @@
 
     private static String ipv4PrefixLengthToSubnetMask(int prefixLength) {
         try {
-            InetAddress all = InetAddress.getByAddress(
-                    new byte[]{(byte) 255, (byte) 255, (byte) 255, (byte) 255});
-            return NetworkUtils.getNetworkPart(all, prefixLength).getHostAddress();
-        } catch (UnknownHostException e) {
+            return Inet4AddressUtils.getPrefixMaskAsInet4Address(prefixLength).getHostAddress();
+        } catch (IllegalArgumentException e) {
             return null;
         }
     }
diff --git a/src/com/android/settings/wifi/details2/WifiDetailPreferenceController2.java b/src/com/android/settings/wifi/details2/WifiDetailPreferenceController2.java
index 7ef950f..e432b07 100644
--- a/src/com/android/settings/wifi/details2/WifiDetailPreferenceController2.java
+++ b/src/com/android/settings/wifi/details2/WifiDetailPreferenceController2.java
@@ -40,7 +40,6 @@
 import android.net.NetworkCapabilities;
 import android.net.NetworkInfo;
 import android.net.NetworkRequest;
-import android.net.NetworkUtils;
 import android.net.RouteInfo;
 import android.net.Uri;
 import android.net.wifi.WifiConfiguration;
@@ -64,6 +63,7 @@
 import androidx.preference.PreferenceFragmentCompat;
 import androidx.preference.PreferenceScreen;
 
+import com.android.net.module.util.Inet4AddressUtils;
 import com.android.settings.R;
 import com.android.settings.Utils;
 import com.android.settings.core.FeatureFlags;
@@ -99,7 +99,6 @@
 import java.net.Inet4Address;
 import java.net.Inet6Address;
 import java.net.InetAddress;
-import java.net.UnknownHostException;
 import java.time.Duration;
 import java.time.Instant;
 import java.time.ZonedDateTime;
@@ -867,10 +866,8 @@
 
     private static String ipv4PrefixLengthToSubnetMask(int prefixLength) {
         try {
-            InetAddress all = InetAddress.getByAddress(
-                    new byte[]{(byte) 255, (byte) 255, (byte) 255, (byte) 255});
-            return NetworkUtils.getNetworkPart(all, prefixLength).getHostAddress();
-        } catch (UnknownHostException e) {
+            return Inet4AddressUtils.getPrefixMaskAsInet4Address(prefixLength).getHostAddress();
+        } catch (IllegalArgumentException e) {
             return null;
         }
     }
diff --git a/src/com/android/settings/wifi/tether/WifiTetherBasePreferenceController.java b/src/com/android/settings/wifi/tether/WifiTetherBasePreferenceController.java
index 7ba0216..46da097 100644
--- a/src/com/android/settings/wifi/tether/WifiTetherBasePreferenceController.java
+++ b/src/com/android/settings/wifi/tether/WifiTetherBasePreferenceController.java
@@ -17,7 +17,7 @@
 package com.android.settings.wifi.tether;
 
 import android.content.Context;
-import android.net.ConnectivityManager;
+import android.net.TetheringManager;
 import android.net.wifi.WifiManager;
 
 import androidx.preference.Preference;
@@ -36,7 +36,7 @@
 
     protected final WifiManager mWifiManager;
     protected final String[] mWifiRegexs;
-    protected final ConnectivityManager mCm;
+    protected final TetheringManager mTm;
     protected final OnTetherConfigUpdateListener mListener;
 
     protected Preference mPreference;
@@ -46,8 +46,8 @@
         super(context);
         mListener = listener;
         mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
-        mCm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
-        mWifiRegexs = mCm.getTetherableWifiRegexs();
+        mTm = (TetheringManager) context.getSystemService(Context.TETHERING_SERVICE);
+        mWifiRegexs = mTm.getTetherableWifiRegexs();
     }
 
     @Override
diff --git a/src/com/android/settings/wifi/tether/WifiTetherPreferenceController.java b/src/com/android/settings/wifi/tether/WifiTetherPreferenceController.java
index 5049002..70b6a45 100644
--- a/src/com/android/settings/wifi/tether/WifiTetherPreferenceController.java
+++ b/src/com/android/settings/wifi/tether/WifiTetherPreferenceController.java
@@ -18,7 +18,7 @@
 
 import android.annotation.NonNull;
 import android.content.Context;
-import android.net.ConnectivityManager;
+import android.net.TetheringManager;
 import android.net.wifi.SoftApConfiguration;
 import android.net.wifi.WifiClient;
 import android.net.wifi.WifiManager;
@@ -44,7 +44,7 @@
 
     private static final String WIFI_TETHER_SETTINGS = "wifi_tether";
 
-    private final ConnectivityManager mConnectivityManager;
+    private final TetheringManager mTetheringManager;
     private final String[] mWifiRegexs;
     private final WifiManager mWifiManager;
     private final Lifecycle mLifecycle;
@@ -62,10 +62,9 @@
     WifiTetherPreferenceController(Context context, Lifecycle lifecycle,
             boolean initSoftApManager) {
         super(context);
-        mConnectivityManager =
-                (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
+        mTetheringManager = context.getSystemService(TetheringManager.class);
         mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
-        mWifiRegexs = mConnectivityManager.getTetherableWifiRegexs();
+        mWifiRegexs = mTetheringManager.getTetherableWifiRegexs();
         mLifecycle = lifecycle;
         if (lifecycle != null) {
             lifecycle.addObserver(this);
diff --git a/src/com/android/settings/wifi/tether/WifiTetherSettings.java b/src/com/android/settings/wifi/tether/WifiTetherSettings.java
index 9e68202..2b201b1 100644
--- a/src/com/android/settings/wifi/tether/WifiTetherSettings.java
+++ b/src/com/android/settings/wifi/tether/WifiTetherSettings.java
@@ -16,7 +16,7 @@
 
 package com.android.settings.wifi.tether;
 
-import static android.net.ConnectivityManager.ACTION_TETHER_STATE_CHANGED;
+import static android.net.TetheringManager.ACTION_TETHER_STATE_CHANGED;
 import static android.net.wifi.WifiManager.WIFI_AP_STATE_CHANGED_ACTION;
 
 import android.app.settings.SettingsEnums;
diff --git a/tests/anomaly-tester/Android.bp b/tests/anomaly-tester/Android.bp
index 29181af..c897d75 100644
--- a/tests/anomaly-tester/Android.bp
+++ b/tests/anomaly-tester/Android.bp
@@ -1,3 +1,12 @@
+package {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "packages_apps_Settings_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["packages_apps_Settings_license"],
+}
+
 android_test {
     name: "AnomalyTester",
 
diff --git a/tests/perftests/Android.bp b/tests/perftests/Android.bp
index 1ba5d9c..c03c57f 100644
--- a/tests/perftests/Android.bp
+++ b/tests/perftests/Android.bp
@@ -1,3 +1,12 @@
+package {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "packages_apps_Settings_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["packages_apps_Settings_license"],
+}
+
 android_test {
     name: "SettingsPerfTests",
 
diff --git a/tests/robotests/Android.bp b/tests/robotests/Android.bp
index d6c56be..6f0931e 100644
--- a/tests/robotests/Android.bp
+++ b/tests/robotests/Android.bp
@@ -2,6 +2,15 @@
 // Build SettingsRoboTestStub.apk which includes test-only resources.#
 //############################################################
 
+package {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "packages_apps_Settings_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["packages_apps_Settings_license"],
+}
+
 android_app {
     name: "SettingsRoboTestStub",
     defaults: [
diff --git a/tests/robotests/src/com/android/settings/AllInOneTetherSettingsTest.java b/tests/robotests/src/com/android/settings/AllInOneTetherSettingsTest.java
index c9a8c44..cd33663 100644
--- a/tests/robotests/src/com/android/settings/AllInOneTetherSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/AllInOneTetherSettingsTest.java
@@ -33,6 +33,7 @@
 
 import android.content.Context;
 import android.net.ConnectivityManager;
+import android.net.TetheringManager;
 import android.net.wifi.SoftApConfiguration;
 import android.os.UserHandle;
 import android.os.UserManager;
@@ -74,6 +75,8 @@
     @Mock
     private ConnectivityManager mConnectivityManager;
     @Mock
+    private TetheringManager mTetheringManager;
+    @Mock
     private UserManager mUserManager;
     @Mock
     private WifiTetherSecurityPreferenceController mSecurityPreferenceController;
@@ -89,10 +92,12 @@
         MockitoAnnotations.initMocks(this);
         doReturn(mConnectivityManager)
                 .when(mContext).getSystemService(Context.CONNECTIVITY_SERVICE);
-        doReturn(WIFI_REGEXS).when(mConnectivityManager).getTetherableWifiRegexs();
-        doReturn(USB_REGEXS).when(mConnectivityManager).getTetherableUsbRegexs();
-        doReturn(BT_REGEXS).when(mConnectivityManager).getTetherableBluetoothRegexs();
-        doReturn(ETHERNET_REGEXS).when(mConnectivityManager).getTetherableIfaces();
+        doReturn(mTetheringManager)
+                .when(mContext).getSystemService(Context.TETHERING_SERVICE);
+        doReturn(WIFI_REGEXS).when(mTetheringManager).getTetherableWifiRegexs();
+        doReturn(USB_REGEXS).when(mTetheringManager).getTetherableUsbRegexs();
+        doReturn(BT_REGEXS).when(mTetheringManager).getTetherableBluetoothRegexs();
+        doReturn(ETHERNET_REGEXS).when(mTetheringManager).getTetherableIfaces();
         doReturn(mUserManager).when(mContext).getSystemService(Context.USER_SERVICE);
         // Assume the feature is enabled for most test cases.
         FeatureFlagUtils.setEnabled(mContext, FeatureFlags.TETHER_ALL_IN_ONE, true);
diff --git a/tests/robotests/src/com/android/settings/TetherSettingsTest.java b/tests/robotests/src/com/android/settings/TetherSettingsTest.java
index 99c112c..637ff8ad 100644
--- a/tests/robotests/src/com/android/settings/TetherSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/TetherSettingsTest.java
@@ -33,6 +33,7 @@
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.net.ConnectivityManager;
+import android.net.TetheringManager;
 import android.net.wifi.WifiManager;
 import android.os.UserHandle;
 import android.os.UserManager;
@@ -65,6 +66,8 @@
     private ConnectivityManager mConnectivityManager;
     @Mock
     private UserManager mUserManager;
+    @Mock
+    private TetheringManager mTetheringManager;
 
     @Before
     public void setUp() {
@@ -75,11 +78,13 @@
                 .when(mContext).getSystemService(Context.CONNECTIVITY_SERVICE);
         doReturn(mUserManager)
                 .when(mContext).getSystemService(Context.USER_SERVICE);
+        doReturn(mTetheringManager)
+                .when(mContext).getSystemService(Context.TETHERING_SERVICE);
 
         setupIsTetherAvailable(true);
 
-        when(mConnectivityManager.getTetherableUsbRegexs()).thenReturn(new String[0]);
-        when(mConnectivityManager.getTetherableBluetoothRegexs()).thenReturn(new String[0]);
+        when(mTetheringManager.getTetherableUsbRegexs()).thenReturn(new String[0]);
+        when(mTetheringManager.getTetherableBluetoothRegexs()).thenReturn(new String[0]);
     }
 
     @Test
@@ -109,7 +114,7 @@
 
     @Test
     public void testTetherNonIndexableKeys_usbNotAvailable_usbKeyReturned() {
-        when(mConnectivityManager.getTetherableUsbRegexs()).thenReturn(new String[0]);
+        when(mTetheringManager.getTetherableUsbRegexs()).thenReturn(new String[0]);
 
         final List<String> niks =
             TetherSettings.SEARCH_INDEX_DATA_PROVIDER.getNonIndexableKeys(mContext);
@@ -122,7 +127,7 @@
         FeatureFlagUtils.setEnabled(mContext, FeatureFlags.TETHER_ALL_IN_ONE, false);
         // We can ignore the condition of Utils.isMonkeyRunning()
         // In normal case, monkey and robotest should not execute at the same time
-        when(mConnectivityManager.getTetherableUsbRegexs()).thenReturn(new String[]{"dummyRegex"});
+        when(mTetheringManager.getTetherableUsbRegexs()).thenReturn(new String[]{"dummyRegex"});
 
         final List<String> niks =
             TetherSettings.SEARCH_INDEX_DATA_PROVIDER.getNonIndexableKeys(mContext);
@@ -132,7 +137,7 @@
 
     @Test
     public void testTetherNonIndexableKeys_bluetoothNotAvailable_bluetoothKeyReturned() {
-        when(mConnectivityManager.getTetherableBluetoothRegexs()).thenReturn(new String[0]);
+        when(mTetheringManager.getTetherableBluetoothRegexs()).thenReturn(new String[0]);
 
         final List<String> niks =
             TetherSettings.SEARCH_INDEX_DATA_PROVIDER.getNonIndexableKeys(mContext);
@@ -143,7 +148,7 @@
     @Test
     public void testTetherNonIndexableKeys_bluetoothAvailable_bluetoothKeyNotReturned() {
         FeatureFlagUtils.setEnabled(mContext, FeatureFlags.TETHER_ALL_IN_ONE, false);
-        when(mConnectivityManager.getTetherableBluetoothRegexs())
+        when(mTetheringManager.getTetherableBluetoothRegexs())
                 .thenReturn(new String[]{"dummyRegex"});
 
         final List<String> niks =
@@ -232,11 +237,11 @@
     }
 
     private void updateOnlyBluetoothState(TetherSettings tetherSettings) {
-        doReturn(mConnectivityManager).when(tetherSettings)
-            .getSystemService(Context.CONNECTIVITY_SERVICE);
-        when(mConnectivityManager.getTetherableIfaces()).thenReturn(new String[0]);
-        when(mConnectivityManager.getTetheredIfaces()).thenReturn(new String[0]);
-        when(mConnectivityManager.getTetheringErroredIfaces()).thenReturn(new String[0]);
+        doReturn(mTetheringManager).when(tetherSettings)
+            .getSystemService(Context.TETHERING_SERVICE);
+        when(mTetheringManager.getTetherableIfaces()).thenReturn(new String[0]);
+        when(mTetheringManager.getTetheredIfaces()).thenReturn(new String[0]);
+        when(mTetheringManager.getTetheringErroredIfaces()).thenReturn(new String[0]);
         doNothing().when(tetherSettings).updateUsbState(any(String[].class), any(String[].class),
                 any(String[].class));
         doNothing().when(tetherSettings).updateEthernetState(any(String[].class),
diff --git a/tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProviderImplTest.java b/tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProviderImplTest.java
index f539350..43fe0f6 100644
--- a/tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProviderImplTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProviderImplTest.java
@@ -39,7 +39,7 @@
 import android.content.pm.UserInfo;
 import android.content.res.Resources;
 import android.net.ConnectivityManager;
-import android.net.ProxyInfo;
+import android.net.VpnManager;
 import android.os.UserHandle;
 import android.os.UserManager;
 import android.provider.Settings;
@@ -84,6 +84,7 @@
     private @Mock PackageManager mPackageManager;
     private @Mock UserManager mUserManager;
     private @Mock ConnectivityManager mConnectivityManger;
+    private @Mock VpnManager mVpnManager;
     private Resources mResources;
 
     private EnterprisePrivacyFeatureProvider mProvider;
@@ -99,7 +100,7 @@
         mResources = RuntimeEnvironment.application.getResources();
 
         mProvider = new EnterprisePrivacyFeatureProviderImpl(mContext, mDevicePolicyManager,
-                mPackageManager, mUserManager, mConnectivityManger, mResources);
+                mPackageManager, mUserManager, mConnectivityManger, mVpnManager, mResources);
     }
 
     @Test
@@ -201,11 +202,10 @@
 
     @Test
     public void testIsAlwaysOnVpnSetInCurrentUser() {
-        when(mConnectivityManger.getAlwaysOnVpnPackageForUser(MY_USER_ID)).thenReturn(null);
+        when(mVpnManager.getAlwaysOnVpnPackageForUser(MY_USER_ID)).thenReturn(null);
         assertThat(mProvider.isAlwaysOnVpnSetInCurrentUser()).isFalse();
 
-        when(mConnectivityManger.getAlwaysOnVpnPackageForUser(MY_USER_ID))
-                .thenReturn(VPN_PACKAGE_ID);
+        when(mVpnManager.getAlwaysOnVpnPackageForUser(MY_USER_ID)).thenReturn(VPN_PACKAGE_ID);
         assertThat(mProvider.isAlwaysOnVpnSetInCurrentUser()).isTrue();
     }
 
@@ -215,26 +215,15 @@
 
         mProfiles.add(new UserInfo(MANAGED_PROFILE_USER_ID, "", "", UserInfo.FLAG_MANAGED_PROFILE));
 
-        when(mConnectivityManger.getAlwaysOnVpnPackageForUser(MANAGED_PROFILE_USER_ID))
-                .thenReturn(null);
+        when(mVpnManager.getAlwaysOnVpnPackageForUser(MANAGED_PROFILE_USER_ID)).thenReturn(null);
         assertThat(mProvider.isAlwaysOnVpnSetInManagedProfile()).isFalse();
 
-        when(mConnectivityManger.getAlwaysOnVpnPackageForUser(MANAGED_PROFILE_USER_ID))
+        when(mVpnManager.getAlwaysOnVpnPackageForUser(MANAGED_PROFILE_USER_ID))
                 .thenReturn(VPN_PACKAGE_ID);
         assertThat(mProvider.isAlwaysOnVpnSetInManagedProfile()).isTrue();
     }
 
     @Test
-    public void testIsGlobalHttpProxySet() {
-        when(mConnectivityManger.getGlobalProxy()).thenReturn(null);
-        assertThat(mProvider.isGlobalHttpProxySet()).isFalse();
-
-        when(mConnectivityManger.getGlobalProxy())
-            .thenReturn(ProxyInfo.buildDirectProxy("localhost", 123));
-        assertThat(mProvider.isGlobalHttpProxySet()).isTrue();
-    }
-
-    @Test
     public void testGetMaximumFailedPasswordsForWipeInCurrentUser() {
         when(mDevicePolicyManager.getDeviceOwnerComponentOnCallingUser()).thenReturn(null);
         when(mDevicePolicyManager.getProfileOwnerAsUser(MY_USER_ID)).thenReturn(null);
diff --git a/tests/robotests/src/com/android/settings/enterprise/GlobalHttpProxyPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/enterprise/GlobalHttpProxyPreferenceControllerTest.java
index 05d1c64..11676a2 100644
--- a/tests/robotests/src/com/android/settings/enterprise/GlobalHttpProxyPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/GlobalHttpProxyPreferenceControllerTest.java
@@ -21,11 +21,11 @@
 import static org.mockito.Mockito.when;
 
 import android.content.Context;
+import android.net.ConnectivityManager;
+import android.net.ProxyInfo;
 
 import androidx.preference.Preference;
 
-import com.android.settings.testutils.FakeFeatureFactory;
-
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -41,25 +41,23 @@
 
     @Mock(answer = Answers.RETURNS_DEEP_STUBS)
     private Context mContext;
-    private FakeFeatureFactory mFeatureFactory;
+    @Mock
+    private ConnectivityManager mCm;
 
     private GlobalHttpProxyPreferenceController mController;
 
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
-        mFeatureFactory = FakeFeatureFactory.setupForTest();
         mController = new GlobalHttpProxyPreferenceController(mContext);
     }
 
     @Test
     public void testIsAvailable() {
-        when(mFeatureFactory.enterprisePrivacyFeatureProvider.isGlobalHttpProxySet())
-                .thenReturn(false);
+        when(mCm.getGlobalProxy()).thenReturn(null);
         assertThat(mController.isAvailable()).isFalse();
 
-        when(mFeatureFactory.enterprisePrivacyFeatureProvider.isGlobalHttpProxySet())
-                .thenReturn(true);
+        when(mCm.getGlobalProxy()).thenReturn(ProxyInfo.buildDirectProxy("localhost", 123));
         assertThat(mController.isAvailable()).isTrue();
     }
 
diff --git a/tests/robotests/src/com/android/settings/network/BluetoothTetherPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/BluetoothTetherPreferenceControllerTest.java
index 3b1f008..d3a3129 100644
--- a/tests/robotests/src/com/android/settings/network/BluetoothTetherPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/BluetoothTetherPreferenceControllerTest.java
@@ -26,7 +26,6 @@
 
 import android.bluetooth.BluetoothAdapter;
 import android.content.Context;
-import android.net.ConnectivityManager;
 import android.net.TetheringManager;
 
 import androidx.preference.SwitchPreference;
@@ -44,7 +43,7 @@
 public class BluetoothTetherPreferenceControllerTest {
 
     @Mock
-    private ConnectivityManager mConnectivityManager;
+    private TetheringManager mTetheringManager;
     @Mock
     private TetherEnabler mTetherEnabler;
 
@@ -58,9 +57,8 @@
 
         mContext = spy(ApplicationProvider.getApplicationContext());
         mSwitchPreference = spy(SwitchPreference.class);
-        when(mContext.getSystemService(Context.CONNECTIVITY_SERVICE)).thenReturn(
-                mConnectivityManager);
-        when(mConnectivityManager.getTetherableBluetoothRegexs()).thenReturn(new String[] {""});
+        when(mContext.getSystemService(Context.TETHERING_SERVICE)).thenReturn(mTetheringManager);
+        when(mTetheringManager.getTetherableBluetoothRegexs()).thenReturn(new String[] {""});
         mController = new BluetoothTetherPreferenceController(mContext, "BLUETOOTH");
         mController.setTetherEnabler(mTetherEnabler);
         ReflectionHelpers.setField(mController, "mPreference", mSwitchPreference);
@@ -98,7 +96,7 @@
 
     @Test
     public void shouldShow_noBluetoothTetherable() {
-        when(mConnectivityManager.getTetherableBluetoothRegexs()).thenReturn(new String[0]);
+        when(mTetheringManager.getTetherableBluetoothRegexs()).thenReturn(new String[0]);
         assertThat(mController.isAvailable()).isFalse();
     }
 
diff --git a/tests/robotests/src/com/android/settings/network/EthernetTetherPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/EthernetTetherPreferenceControllerTest.java
index d2e53b8..b269b05 100644
--- a/tests/robotests/src/com/android/settings/network/EthernetTetherPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/EthernetTetherPreferenceControllerTest.java
@@ -25,7 +25,6 @@
 import static org.mockito.Mockito.when;
 
 import android.content.Context;
-import android.net.ConnectivityManager;
 import android.net.EthernetManager;
 import android.net.TetheringManager;
 
@@ -49,7 +48,7 @@
     public MockitoRule mocks = MockitoJUnit.rule();
 
     @Mock
-    private ConnectivityManager mConnectivityManager;
+    private TetheringManager mTetheringManager;
     @Mock
     private EthernetManager mEthernetManager;
     @Mock
@@ -64,9 +63,8 @@
     public void setUp() {
         mContext = spy(ApplicationProvider.getApplicationContext());
         mPreference = spy(SwitchPreference.class);
-        when(mContext.getSystemService(Context.CONNECTIVITY_SERVICE))
-                .thenReturn(mConnectivityManager);
-        when(mConnectivityManager.getTetherableIfaces()).thenReturn(new String[]{ETHERNET_REGEX});
+        when(mContext.getSystemService(Context.TETHERING_SERVICE)).thenReturn(mTetheringManager);
+        when(mTetheringManager.getTetherableIfaces()).thenReturn(new String[]{ETHERNET_REGEX});
         when(mContext.getSystemService(Context.ETHERNET_SERVICE)).thenReturn(mEthernetManager);
         mController = new EthernetTetherPreferenceController(mContext, "ethernet");
         mController.setTetherEnabler(mTetherEnabler);
@@ -105,7 +103,7 @@
 
     @Test
     public void shouldEnable_noTetherable() {
-        when(mConnectivityManager.getTetherableIfaces()).thenReturn(new String[0]);
+        when(mTetheringManager.getTetherableIfaces()).thenReturn(new String[0]);
         assertThat(mController.shouldEnable()).isFalse();
     }
 
diff --git a/tests/robotests/src/com/android/settings/network/TetherEnablerTest.java b/tests/robotests/src/com/android/settings/network/TetherEnablerTest.java
index 87806be..bb4b0c4 100644
--- a/tests/robotests/src/com/android/settings/network/TetherEnablerTest.java
+++ b/tests/robotests/src/com/android/settings/network/TetherEnablerTest.java
@@ -101,9 +101,9 @@
         when(context.getSystemService(Context.TETHERING_SERVICE)).thenReturn(mTetheringManager);
         when(context.getSystemService(Context.NETWORK_POLICY_SERVICE)).thenReturn(
                 mNetworkPolicyManager);
-        when(mConnectivityManager.getTetherableIfaces()).thenReturn(new String[0]);
-        when(mConnectivityManager.getTetheredIfaces()).thenReturn(new String[0]);
-        when(mConnectivityManager.getTetherableUsbRegexs()).thenReturn(new String[0]);
+        when(mTetheringManager.getTetherableIfaces()).thenReturn(new String[0]);
+        when(mTetheringManager.getTetheredIfaces()).thenReturn(new String[0]);
+        when(mTetheringManager.getTetherableUsbRegexs()).thenReturn(new String[0]);
         panReference.set(mBluetoothPan);
         mEnabler = spy(new TetherEnabler(context, mSwitchWidgetController, panReference));
         ReflectionHelpers.setField(mEnabler, "mBluetoothAdapter", mBluetoothAdapter);
@@ -111,8 +111,8 @@
 
     @Test
     public void lifecycle_onStart_setCheckedCorrectly() {
-        when(mConnectivityManager.getTetheredIfaces()).thenReturn(USB_TETHERED);
-        when(mConnectivityManager.getTetherableUsbRegexs()).thenReturn(USB_TETHERED);
+        when(mTetheringManager.getTetheredIfaces()).thenReturn(USB_TETHERED);
+        when(mTetheringManager.getTetherableUsbRegexs()).thenReturn(USB_TETHERED);
 
         mEnabler.onStart();
         assertThat(mSwitchBar.isChecked()).isTrue();
@@ -150,7 +150,7 @@
         mEnabler.onStart();
         mEnabler.startTethering(TetheringManager.TETHERING_WIFI);
 
-        when(mConnectivityManager.getTetheredIfaces()).thenReturn(new String[0]);
+        when(mTetheringManager.getTetheredIfaces()).thenReturn(new String[0]);
         mEnabler.mOnStartTetheringCallback.onTetheringFailed();
 
         assertThat(mSwitchBar.isChecked()).isFalse();
@@ -255,8 +255,8 @@
 
     @Test
     public void updateState_shouldEnableSwitchBarTethering() {
-        when(mConnectivityManager.getTetheredIfaces()).thenReturn(USB_TETHERED);
-        when(mConnectivityManager.getTetherableUsbRegexs()).thenReturn(USB_TETHERED);
+        when(mTetheringManager.getTetheredIfaces()).thenReturn(USB_TETHERED);
+        when(mTetheringManager.getTetherableUsbRegexs()).thenReturn(USB_TETHERED);
 
         mSwitchWidgetController.setListener(mEnabler);
         mSwitchWidgetController.startListening();
diff --git a/tests/robotests/src/com/android/settings/network/TetherPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/TetherPreferenceControllerTest.java
index 3958589..4824eb2 100644
--- a/tests/robotests/src/com/android/settings/network/TetherPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/TetherPreferenceControllerTest.java
@@ -33,6 +33,7 @@
 import android.content.IntentFilter;
 import android.database.ContentObserver;
 import android.net.ConnectivityManager;
+import android.net.TetheringManager;
 import android.provider.Settings;
 
 import androidx.preference.Preference;
@@ -56,7 +57,7 @@
     @Mock
     private Context mContext;
     @Mock
-    private ConnectivityManager mConnectivityManager;
+    private TetheringManager mTetheringManager;
     @Mock
     private BluetoothAdapter mBluetoothAdapter;
     @Mock
@@ -69,7 +70,7 @@
         MockitoAnnotations.initMocks(this);
         mController = spy(TetherPreferenceController.class);
         ReflectionHelpers.setField(mController, "mContext", mContext);
-        ReflectionHelpers.setField(mController, "mConnectivityManager", mConnectivityManager);
+        ReflectionHelpers.setField(mController, "mTetheringManager", mTetheringManager);
         ReflectionHelpers.setField(mController, "mBluetoothAdapter", mBluetoothAdapter);
         ReflectionHelpers.setField(mController, "mPreference", mPreference);
     }
@@ -106,16 +107,16 @@
     }
 
     @Test
-    public void updateSummary_noPreference_noInteractionWithConnectivityManager() {
+    public void updateSummary_noPreference_noInteractionWithTetheringManager() {
         ReflectionHelpers.setField(mController, "mPreference", null);
         mController.updateSummary();
-        verifyNoMoreInteractions(mConnectivityManager);
+        verifyNoMoreInteractions(mTetheringManager);
     }
 
     @Test
     public void updateSummary_wifiTethered_shouldShowHotspotMessage() {
-        when(mConnectivityManager.getTetheredIfaces()).thenReturn(new String[]{"123"});
-        when(mConnectivityManager.getTetherableWifiRegexs()).thenReturn(new String[]{"123"});
+        when(mTetheringManager.getTetheredIfaces()).thenReturn(new String[]{"123"});
+        when(mTetheringManager.getTetherableWifiRegexs()).thenReturn(new String[]{"123"});
 
         mController.updateSummary();
         verify(mPreference).setSummary(R.string.tether_settings_summary_hotspot_on_tether_off);
@@ -123,8 +124,8 @@
 
     @Test
     public void updateSummary_btThetherOn_shouldShowTetherMessage() {
-        when(mConnectivityManager.getTetheredIfaces()).thenReturn(new String[]{"123"});
-        when(mConnectivityManager.getTetherableBluetoothRegexs()).thenReturn(new String[]{"123"});
+        when(mTetheringManager.getTetheredIfaces()).thenReturn(new String[]{"123"});
+        when(mTetheringManager.getTetherableBluetoothRegexs()).thenReturn(new String[]{"123"});
 
         mController.updateSummary();
         verify(mPreference).setSummary(R.string.tether_settings_summary_hotspot_off_tether_on);
@@ -132,8 +133,8 @@
 
     @Test
     public void updateSummary_tetherOff_shouldShowTetherOffMessage() {
-        when(mConnectivityManager.getTetherableBluetoothRegexs()).thenReturn(new String[]{"123"});
-        when(mConnectivityManager.getTetherableWifiRegexs()).thenReturn(new String[]{"456"});
+        when(mTetheringManager.getTetherableBluetoothRegexs()).thenReturn(new String[]{"123"});
+        when(mTetheringManager.getTetherableWifiRegexs()).thenReturn(new String[]{"456"});
 
         mController.updateSummary();
         verify(mPreference).setSummary(R.string.switch_off_text);
@@ -141,9 +142,9 @@
 
     @Test
     public void updateSummary_wifiBtTetherOn_shouldShowHotspotAndTetherMessage() {
-        when(mConnectivityManager.getTetheredIfaces()).thenReturn(new String[]{"123", "456"});
-        when(mConnectivityManager.getTetherableWifiRegexs()).thenReturn(new String[]{"456"});
-        when(mConnectivityManager.getTetherableBluetoothRegexs()).thenReturn(new String[]{"23"});
+        when(mTetheringManager.getTetheredIfaces()).thenReturn(new String[]{"123", "456"});
+        when(mTetheringManager.getTetherableWifiRegexs()).thenReturn(new String[]{"456"});
+        when(mTetheringManager.getTetherableBluetoothRegexs()).thenReturn(new String[]{"23"});
 
         mController.updateSummary();
         verify(mPreference).setSummary(R.string.tether_settings_summary_hotspot_on_tether_on);
diff --git a/tests/robotests/src/com/android/settings/network/UsbTetherPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/UsbTetherPreferenceControllerTest.java
index 066084e..e02da90 100644
--- a/tests/robotests/src/com/android/settings/network/UsbTetherPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/UsbTetherPreferenceControllerTest.java
@@ -25,7 +25,6 @@
 import static org.mockito.Mockito.when;
 
 import android.content.Context;
-import android.net.ConnectivityManager;
 import android.net.TetheringManager;
 
 import androidx.preference.SwitchPreference;
@@ -43,7 +42,7 @@
 public class UsbTetherPreferenceControllerTest {
 
     @Mock
-    private ConnectivityManager mConnectivityManager;
+    private TetheringManager mTetheringManager;
     @Mock
     private TetherEnabler mTetherEnabler;
 
@@ -56,9 +55,8 @@
         MockitoAnnotations.initMocks(this);
 
         mContext = spy(ApplicationProvider.getApplicationContext());
-        when(mContext.getSystemService(Context.CONNECTIVITY_SERVICE)).thenReturn(
-                mConnectivityManager);
-        when(mConnectivityManager.getTetherableUsbRegexs()).thenReturn(new String[]{""});
+        when(mContext.getSystemService(Context.TETHERING_SERVICE)).thenReturn(mTetheringManager);
+        when(mTetheringManager.getTetherableUsbRegexs()).thenReturn(new String[]{""});
         mController = new UsbTetherPreferenceController(mContext, "USB");
         mController.setTetherEnabler(mTetherEnabler);
         mSwitchPreference = spy(SwitchPreference.class);
@@ -94,7 +92,7 @@
 
     @Test
     public void shouldShow_noTetherableUsb() {
-        when(mConnectivityManager.getTetherableUsbRegexs()).thenReturn(new String[0]);
+        when(mTetheringManager.getTetherableUsbRegexs()).thenReturn(new String[0]);
         assertThat(mController.shouldShow()).isFalse();
     }
 
diff --git a/tests/robotests/src/com/android/settings/network/WifiTetherDisablePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/WifiTetherDisablePreferenceControllerTest.java
index 1d2042c..a82a71f 100644
--- a/tests/robotests/src/com/android/settings/network/WifiTetherDisablePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/WifiTetherDisablePreferenceControllerTest.java
@@ -28,7 +28,7 @@
 import static org.mockito.Mockito.when;
 
 import android.content.Context;
-import android.net.ConnectivityManager;
+import android.net.TetheringManager;
 
 import androidx.preference.PreferenceScreen;
 import androidx.preference.SwitchPreference;
@@ -77,7 +77,7 @@
     }
 
     @Mock
-    private ConnectivityManager mConnectivityManager;
+    private TetheringManager mTetheringManager;
     @Mock
     private PreferenceScreen mPreferenceScreen;
     @Mock
@@ -100,9 +100,8 @@
 
         mContext = spy(ApplicationProvider.getApplicationContext());
         mPreference = spy(SwitchPreference.class);
-        when(mContext.getSystemService(Context.CONNECTIVITY_SERVICE)).thenReturn(
-                mConnectivityManager);
-        when(mConnectivityManager.getTetherableWifiRegexs()).thenReturn(new String[]{""});
+        when(mContext.getSystemService(Context.TETHERING_SERVICE)).thenReturn(mTetheringManager);
+        when(mTetheringManager.getTetherableWifiRegexs()).thenReturn(new String[]{""});
         mController = new WifiTetherDisablePreferenceController(mContext, WIFI_TETHER_DISABLE_KEY);
         mController.setTetherEnabler(mTetherEnabler);
         ReflectionHelpers.setField(mController, "mScreen", mPreferenceScreen);
@@ -112,7 +111,7 @@
 
     @Test
     public void shouldShow_noTetherableWifi() {
-        when(mConnectivityManager.getTetherableWifiRegexs()).thenReturn(new String[0]);
+        when(mTetheringManager.getTetherableWifiRegexs()).thenReturn(new String[0]);
         assertThat(mController.shouldShow()).isFalse();
     }
 
diff --git a/tests/robotests/src/com/android/settings/vpn2/VpnUtilsTest.java b/tests/robotests/src/com/android/settings/vpn2/VpnUtilsTest.java
index 7856b06..08a9242 100644
--- a/tests/robotests/src/com/android/settings/vpn2/VpnUtilsTest.java
+++ b/tests/robotests/src/com/android/settings/vpn2/VpnUtilsTest.java
@@ -21,7 +21,7 @@
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
-import android.net.ConnectivityManager;
+import android.net.VpnManager;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -31,11 +31,11 @@
 public final class VpnUtilsTest {
     @Test
     public void testIsAlwaysOnVpnSet() {
-        final ConnectivityManager cm = mock(ConnectivityManager.class);
-        when(cm.getAlwaysOnVpnPackageForUser(0)).thenReturn("com.example.vpn");
-        assertThat(VpnUtils.isAlwaysOnVpnSet(cm, 0)).isTrue();
+        final VpnManager vm = mock(VpnManager.class);
+        when(vm.getAlwaysOnVpnPackageForUser(0)).thenReturn("com.example.vpn");
+        assertThat(VpnUtils.isAlwaysOnVpnSet(vm, 0)).isTrue();
 
-        when(cm.getAlwaysOnVpnPackageForUser(0)).thenReturn(null);
-        assertThat(VpnUtils.isAlwaysOnVpnSet(cm, 0)).isFalse();
+        when(vm.getAlwaysOnVpnPackageForUser(0)).thenReturn(null);
+        assertThat(VpnUtils.isAlwaysOnVpnSet(vm, 0)).isFalse();
     }
 }
diff --git a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherApBandPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherApBandPreferenceControllerTest.java
index e639b67..d777a59 100644
--- a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherApBandPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherApBandPreferenceControllerTest.java
@@ -25,7 +25,7 @@
 import static org.mockito.Mockito.when;
 
 import android.content.Context;
-import android.net.ConnectivityManager;
+import android.net.TetheringManager;
 import android.net.wifi.SoftApConfiguration;
 import android.net.wifi.WifiManager;
 
@@ -57,7 +57,7 @@
 
     private Context mContext;
     @Mock
-    private ConnectivityManager mConnectivityManager;
+    private TetheringManager mTetheringManager;
     @Mock
     private WifiManager mWifiManager;
     @Mock
@@ -74,9 +74,8 @@
         mContext = spy(RuntimeEnvironment.application);
         mPreference = new ListPreference(RuntimeEnvironment.application);
         when(mContext.getSystemService(Context.WIFI_SERVICE)).thenReturn(mWifiManager);
-        when(mContext.getSystemService(Context.CONNECTIVITY_SERVICE))
-                .thenReturn(mConnectivityManager);
-        when(mConnectivityManager.getTetherableWifiRegexs()).thenReturn(new String[]{"1", "2"});
+        when(mContext.getSystemService(Context.TETHERING_SERVICE)).thenReturn(mTetheringManager);
+        when(mTetheringManager.getTetherableWifiRegexs()).thenReturn(new String[]{"1", "2"});
         when(mContext.getResources()).thenReturn(RuntimeEnvironment.application.getResources());
         when(mScreen.findPreference(anyString())).thenReturn(mPreference);
         when(mWifiManager.getSoftApConfiguration()).thenReturn(
diff --git a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherFooterPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherFooterPreferenceControllerTest.java
index b0ed862..25ad730 100644
--- a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherFooterPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherFooterPreferenceControllerTest.java
@@ -22,7 +22,7 @@
 import static org.mockito.Mockito.when;
 
 import android.content.Context;
-import android.net.ConnectivityManager;
+import android.net.TetheringManager;
 import android.net.wifi.WifiManager;
 
 import androidx.preference.PreferenceScreen;
@@ -43,7 +43,7 @@
     @Mock(answer = Answers.RETURNS_DEEP_STUBS)
     private Context mContext;
     @Mock
-    private ConnectivityManager mConnectivityManager;
+    private TetheringManager mTetheringManager;
     @Mock
     private WifiManager mWifiManager;
     @Mock
@@ -58,9 +58,8 @@
         MockitoAnnotations.initMocks(this);
 
         when(mContext.getSystemService(Context.WIFI_SERVICE)).thenReturn(mWifiManager);
-        when(mContext.getSystemService(Context.CONNECTIVITY_SERVICE))
-                .thenReturn(mConnectivityManager);
-        when(mConnectivityManager.getTetherableWifiRegexs()).thenReturn(new String[]{"1", "2"});
+        when(mContext.getSystemService(Context.TETHERING_SERVICE)).thenReturn(mTetheringManager);
+        when(mTetheringManager.getTetherableWifiRegexs()).thenReturn(new String[]{"1", "2"});
         mController = new WifiTetherFooterPreferenceController(mContext);
         when(mScreen.findPreference(anyString())).thenReturn(mPreference);
     }
diff --git a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherPasswordPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherPasswordPreferenceControllerTest.java
index 7835f7e..8f8477f 100644
--- a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherPasswordPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherPasswordPreferenceControllerTest.java
@@ -26,7 +26,7 @@
 
 import android.app.settings.SettingsEnums;
 import android.content.Context;
-import android.net.ConnectivityManager;
+import android.net.TetheringManager;
 import android.net.wifi.SoftApConfiguration;
 import android.net.wifi.WifiManager;
 
@@ -53,7 +53,7 @@
     @Mock(answer = Answers.RETURNS_DEEP_STUBS)
     private Context mContext;
     @Mock
-    private ConnectivityManager mConnectivityManager;
+    private TetheringManager mTetheringManager;
     @Mock
     private WifiManager mWifiManager;
     @Mock
@@ -77,9 +77,8 @@
 
         when(mContext.getSystemService(Context.WIFI_SERVICE)).thenReturn(mWifiManager);
         when(mWifiManager.getSoftApConfiguration()).thenReturn(mConfig);
-        when(mContext.getSystemService(Context.CONNECTIVITY_SERVICE))
-                .thenReturn(mConnectivityManager);
-        when(mConnectivityManager.getTetherableWifiRegexs()).thenReturn(new String[]{"1", "2"});
+        when(mContext.getSystemService(Context.TETHERING_SERVICE)).thenReturn(mTetheringManager);
+        when(mTetheringManager.getTetherableWifiRegexs()).thenReturn(new String[]{"1", "2"});
         when(mContext.getResources()).thenReturn(RuntimeEnvironment.application.getResources());
         when(mScreen.findPreference(anyString())).thenReturn(mPreference);
 
diff --git a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherPreferenceControllerTest.java
index b62f1ba..f1cdda3 100644
--- a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherPreferenceControllerTest.java
@@ -23,7 +23,7 @@
 import static org.mockito.Mockito.when;
 
 import android.content.Context;
-import android.net.ConnectivityManager;
+import android.net.TetheringManager;
 import android.net.wifi.SoftApConfiguration;
 import android.net.wifi.WifiManager;
 
@@ -56,7 +56,7 @@
 
     private Context mContext;
     @Mock
-    private ConnectivityManager mConnectivityManager;
+    private TetheringManager mTetheringManager;
     @Mock
     private WifiManager mWifiManager;
     @Mock
@@ -77,14 +77,13 @@
         mLifecycle = new Lifecycle(mLifecycleOwner);
         FakeFeatureFactory.setupForTest();
         mPreference = new MasterSwitchPreference(RuntimeEnvironment.application);
-        when(mContext.getSystemService(Context.CONNECTIVITY_SERVICE))
-                .thenReturn(mConnectivityManager);
+        when(mContext.getSystemService(Context.TETHERING_SERVICE)).thenReturn(mTetheringManager);
         when(mContext.getSystemService(Context.WIFI_SERVICE)).thenReturn(mWifiManager);
         when(mScreen.findPreference(anyString())).thenReturn(mPreference);
         mSoftApConfiguration = new SoftApConfiguration.Builder().setSsid(SSID).build();
         when(mWifiManager.getSoftApConfiguration()).thenReturn(mSoftApConfiguration);
 
-        when(mConnectivityManager.getTetherableWifiRegexs()).thenReturn(new String[]{"1", "2"});
+        when(mTetheringManager.getTetherableWifiRegexs()).thenReturn(new String[]{"1", "2"});
         mController = new WifiTetherPreferenceController(mContext, mLifecycle,
                 false /* initSoftApManager */);
         mController.displayPreference(mScreen);
@@ -92,7 +91,7 @@
 
     @Test
     public void isAvailable_noTetherRegex_shouldReturnFalse() {
-        when(mConnectivityManager.getTetherableWifiRegexs()).thenReturn(new String[]{});
+        when(mTetheringManager.getTetherableWifiRegexs()).thenReturn(new String[]{});
         mController = new WifiTetherPreferenceController(mContext, mLifecycle,
                 false /* initSoftApManager */);
 
diff --git a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSSIDPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSSIDPreferenceControllerTest.java
index a6a9dda..147cd64 100644
--- a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSSIDPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSSIDPreferenceControllerTest.java
@@ -26,7 +26,7 @@
 
 import android.app.settings.SettingsEnums;
 import android.content.Context;
-import android.net.ConnectivityManager;
+import android.net.TetheringManager;
 import android.net.wifi.SoftApConfiguration;
 import android.net.wifi.WifiManager;
 
@@ -49,7 +49,7 @@
     @Mock(answer = Answers.RETURNS_DEEP_STUBS)
     private Context mContext;
     @Mock
-    private ConnectivityManager mConnectivityManager;
+    private TetheringManager mTetheringManager;
     @Mock
     private WifiManager mWifiManager;
     @Mock
@@ -68,9 +68,8 @@
         mPreference = new WifiTetherSsidPreference(RuntimeEnvironment.application);
 
         when(mContext.getSystemService(Context.WIFI_SERVICE)).thenReturn(mWifiManager);
-        when(mContext.getSystemService(Context.CONNECTIVITY_SERVICE))
-                .thenReturn(mConnectivityManager);
-        when(mConnectivityManager.getTetherableWifiRegexs()).thenReturn(new String[]{"1", "2"});
+        when(mContext.getSystemService(Context.TETHERING_SERVICE)).thenReturn(mTetheringManager);
+        when(mTetheringManager.getTetherableWifiRegexs()).thenReturn(new String[]{"1", "2"});
         when(mContext.getResources()).thenReturn(RuntimeEnvironment.application.getResources());
         when(mScreen.findPreference(anyString())).thenReturn(mPreference);
         mController = new WifiTetherSSIDPreferenceController(mContext, mListener,
diff --git a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSecurityPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSecurityPreferenceControllerTest.java
index c7d0695..523bcac 100644
--- a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSecurityPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSecurityPreferenceControllerTest.java
@@ -7,7 +7,7 @@
 import static org.mockito.Mockito.when;
 
 import android.content.Context;
-import android.net.ConnectivityManager;
+import android.net.TetheringManager;
 import android.net.wifi.SoftApConfiguration;
 import android.net.wifi.WifiManager;
 
@@ -32,7 +32,7 @@
     private WifiTetherBasePreferenceController.OnTetherConfigUpdateListener mListener;
     private Context mContext;
     @Mock
-    private ConnectivityManager mConnectivityManager;
+    private TetheringManager mTetheringManager;
     @Mock
     private WifiManager mWifiManager;
     @Mock
@@ -51,9 +51,8 @@
 
         when(mContext.getSystemService(Context.WIFI_SERVICE)).thenReturn(mWifiManager);
         when(mWifiManager.getSoftApConfiguration()).thenReturn(mConfig);
-        when(mContext.getSystemService(Context.CONNECTIVITY_SERVICE))
-                .thenReturn(mConnectivityManager);
-        when(mConnectivityManager.getTetherableWifiRegexs()).thenReturn(new String[]{"1", "2"});
+        when(mContext.getSystemService(Context.TETHERING_SERVICE)).thenReturn(mTetheringManager);
+        when(mTetheringManager.getTetherableWifiRegexs()).thenReturn(new String[]{"1", "2"});
         when(mScreen.findPreference(anyString())).thenReturn(mPreference);
 
         mController = new WifiTetherSecurityPreferenceController(mContext, mListener);
diff --git a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSettingsTest.java b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSettingsTest.java
index e996b2d..7c1939d 100644
--- a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherSettingsTest.java
@@ -30,6 +30,7 @@
 import android.content.Context;
 import android.content.res.Resources;
 import android.net.ConnectivityManager;
+import android.net.TetheringManager;
 import android.os.Bundle;
 import android.os.UserHandle;
 import android.os.UserManager;
@@ -69,6 +70,8 @@
     private ConnectivityManager mConnectivityManager;
     @Mock
     private UserManager mUserManager;
+    @Mock
+    private TetheringManager mTetheringManager;
 
     @Before
     public void setUp() {
@@ -77,7 +80,8 @@
         MockitoAnnotations.initMocks(this);
         doReturn(mConnectivityManager)
                 .when(mContext).getSystemService(Context.CONNECTIVITY_SERVICE);
-        doReturn(WIFI_REGEXS).when(mConnectivityManager).getTetherableWifiRegexs();
+        doReturn(mTetheringManager).when(mContext).getSystemService(Context.TETHERING_SERVICE);
+        doReturn(WIFI_REGEXS).when(mTetheringManager).getTetherableWifiRegexs();
         doReturn(mUserManager).when(mContext).getSystemService(Context.USER_SERVICE);
 
         mWifiTetherSettings = new WifiTetherSettings();
diff --git a/tests/uitests/Android.bp b/tests/uitests/Android.bp
index 8a3e374..8636c81 100644
--- a/tests/uitests/Android.bp
+++ b/tests/uitests/Android.bp
@@ -12,6 +12,15 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+package {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "packages_apps_Settings_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["packages_apps_Settings_license"],
+}
+
 android_test {
     name: "SettingsUITests",
     platform_apis: true,
diff --git a/tests/unit/Android.bp b/tests/unit/Android.bp
index 7556cbe..b94e891 100644
--- a/tests/unit/Android.bp
+++ b/tests/unit/Android.bp
@@ -1,3 +1,12 @@
+package {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "packages_apps_Settings_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["packages_apps_Settings_license"],
+}
+
 android_test {
     name: "SettingsUnitTests",
 
diff --git a/tests/unit/InstrumentedEntitlementApp/Android.bp b/tests/unit/InstrumentedEntitlementApp/Android.bp
index dacd32a..1ec108a 100644
--- a/tests/unit/InstrumentedEntitlementApp/Android.bp
+++ b/tests/unit/InstrumentedEntitlementApp/Android.bp
@@ -12,6 +12,15 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+package {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "packages_apps_Settings_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["packages_apps_Settings_license"],
+}
+
 android_test {
     name: "InstrumentedEntitlementApp",
     srcs: ["src/**/*.java"],
diff --git a/tests/unit/src/com/android/settings/applications/specialaccess/notificationaccess/OWNERS b/tests/unit/src/com/android/settings/applications/specialaccess/notificationaccess/OWNERS
new file mode 100644
index 0000000..4338198
--- /dev/null
+++ b/tests/unit/src/com/android/settings/applications/specialaccess/notificationaccess/OWNERS
@@ -0,0 +1,4 @@
+# Default reviewers for this and subdirectories.
+beverlyt@google.com
+dsandler@android.com
+juliacr@google.com
\ No newline at end of file
diff --git a/tests/unit/src/com/android/settings/wifi/OWNERS b/tests/unit/src/com/android/settings/wifi/OWNERS
new file mode 100644
index 0000000..358c910
--- /dev/null
+++ b/tests/unit/src/com/android/settings/wifi/OWNERS
@@ -0,0 +1 @@
+include /src/com/android/settings/wifi/OWNERS