Remove wrapper for ConnectionManager/IPackageManager

Bug: 76167422
Test: robotests
Change-Id: I5f051b0ce58b97a3cfd5d4bae469463dcd6d83ac
diff --git a/src/com/android/settings/applications/AppStateAppOpsBridge.java b/src/com/android/settings/applications/AppStateAppOpsBridge.java
index e0c19ff..1f843b9 100755
--- a/src/com/android/settings/applications/AppStateAppOpsBridge.java
+++ b/src/com/android/settings/applications/AppStateAppOpsBridge.java
@@ -19,6 +19,7 @@
 import android.app.AppOpsManager;
 import android.app.AppOpsManager.PackageOps;
 import android.content.Context;
+import android.content.pm.IPackageManager;
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
 import android.os.RemoteException;
@@ -31,7 +32,6 @@
 
 import com.android.settingslib.applications.ApplicationsState;
 import com.android.settingslib.applications.ApplicationsState.AppEntry;
-import com.android.settings.wrapper.IPackageManagerWrapper;
 
 import java.util.Arrays;
 import java.util.Collection;
@@ -47,7 +47,7 @@
 
     private static final String TAG = "AppStateAppOpsBridge";
 
-    private final IPackageManagerWrapper mIPackageManager;
+    private final IPackageManager mIPackageManager;
     private final UserManager mUserManager;
     private final List<UserHandle> mProfiles;
     private final AppOpsManager mAppOpsManager;
@@ -58,12 +58,12 @@
     public AppStateAppOpsBridge(Context context, ApplicationsState appState, Callback callback,
             int appOpsOpCode, String[] permissions) {
         this(context, appState, callback, appOpsOpCode, permissions,
-            new IPackageManagerWrapper(AppGlobals.getPackageManager()));
+                AppGlobals.getPackageManager());
     }
 
     @VisibleForTesting
     AppStateAppOpsBridge(Context context, ApplicationsState appState, Callback callback,
-            int appOpsOpCode, String[] permissions, IPackageManagerWrapper packageManager) {
+            int appOpsOpCode, String[] permissions, IPackageManager packageManager) {
         super(appState, callback);
         mContext = context;
         mIPackageManager = packageManager;
@@ -210,9 +210,10 @@
                 if (entriesForProfile == null) {
                     continue;
                 }
-                @SuppressWarnings("unchecked")
-                final List<PackageInfo> packageInfos = mIPackageManager
-                        .getPackagesHoldingPermissions(mPermissions, 0, profileId).getList();
+                @SuppressWarnings("unchecked") final List<PackageInfo> packageInfos =
+                        mIPackageManager
+                                .getPackagesHoldingPermissions(mPermissions, 0,
+                                        profileId).getList();
                 final int packageInfoCount = packageInfos != null ? packageInfos.size() : 0;
                 for (int i = 0; i < packageInfoCount; i++) {
                     final PackageInfo packageInfo = packageInfos.get(i);
diff --git a/src/com/android/settings/applications/AppWithAdminGrantedPermissionsCounter.java b/src/com/android/settings/applications/AppWithAdminGrantedPermissionsCounter.java
index 77cecd2..9bb7a4b 100644
--- a/src/com/android/settings/applications/AppWithAdminGrantedPermissionsCounter.java
+++ b/src/com/android/settings/applications/AppWithAdminGrantedPermissionsCounter.java
@@ -17,12 +17,12 @@
 import android.app.admin.DevicePolicyManager;
 import android.content.Context;
 import android.content.pm.ApplicationInfo;
+import android.content.pm.IPackageManager;
 import android.content.pm.PackageManager;
 import android.os.Build;
 import android.os.RemoteException;
 import android.os.UserHandle;
 
-import com.android.settings.wrapper.IPackageManagerWrapper;
 import com.android.settingslib.wrapper.PackageManagerWrapper;
 
 /**
@@ -32,11 +32,11 @@
 public abstract class AppWithAdminGrantedPermissionsCounter extends AppCounter {
 
     private final String[] mPermissions;
-    private final IPackageManagerWrapper mPackageManagerService;
+    private final IPackageManager mPackageManagerService;
     private final DevicePolicyManager mDevicePolicyManager;
 
     public AppWithAdminGrantedPermissionsCounter(Context context, String[] permissions,
-            PackageManagerWrapper packageManager, IPackageManagerWrapper packageManagerService,
+            PackageManagerWrapper packageManager, IPackageManager packageManagerService,
             DevicePolicyManager devicePolicyManager) {
         super(context, packageManager);
         mPermissions = permissions;
@@ -52,7 +52,7 @@
 
     public static boolean includeInCount(String[] permissions,
             DevicePolicyManager devicePolicyManager, PackageManagerWrapper packageManager,
-            IPackageManagerWrapper packageManagerService, ApplicationInfo info) {
+            IPackageManager packageManagerService, ApplicationInfo info) {
         if (info.targetSdkVersion >= Build.VERSION_CODES.M) {
             // The app uses run-time permissions. Check whether one or more of the permissions were
             // granted by enterprise policy.
diff --git a/src/com/android/settings/applications/AppWithAdminGrantedPermissionsLister.java b/src/com/android/settings/applications/AppWithAdminGrantedPermissionsLister.java
index 655758a..1308620 100644
--- a/src/com/android/settings/applications/AppWithAdminGrantedPermissionsLister.java
+++ b/src/com/android/settings/applications/AppWithAdminGrantedPermissionsLister.java
@@ -18,9 +18,9 @@
 
 import android.app.admin.DevicePolicyManager;
 import android.content.pm.ApplicationInfo;
+import android.content.pm.IPackageManager;
 import android.os.UserManager;
 
-import com.android.settings.wrapper.IPackageManagerWrapper;
 import com.android.settingslib.wrapper.PackageManagerWrapper;
 
 /**
@@ -29,11 +29,11 @@
  */
 public abstract class AppWithAdminGrantedPermissionsLister extends AppLister {
     private final String[] mPermissions;
-    private final IPackageManagerWrapper mPackageManagerService;
+    private final IPackageManager mPackageManagerService;
     private final DevicePolicyManager mDevicePolicyManager;
 
     public AppWithAdminGrantedPermissionsLister(String[] permissions,
-            PackageManagerWrapper packageManager, IPackageManagerWrapper packageManagerService,
+            PackageManagerWrapper packageManager, IPackageManager packageManagerService,
             DevicePolicyManager devicePolicyManager, UserManager userManager) {
         super(packageManager, userManager);
         mPermissions = permissions;
diff --git a/src/com/android/settings/applications/ApplicationFeatureProviderImpl.java b/src/com/android/settings/applications/ApplicationFeatureProviderImpl.java
index cd54f79..f592865 100644
--- a/src/com/android/settings/applications/ApplicationFeatureProviderImpl.java
+++ b/src/com/android/settings/applications/ApplicationFeatureProviderImpl.java
@@ -20,6 +20,7 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.ComponentInfo;
+import android.content.pm.IPackageManager;
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
 import android.content.pm.UserInfo;
@@ -27,7 +28,6 @@
 import android.os.UserManager;
 import android.util.ArraySet;
 
-import com.android.settings.wrapper.IPackageManagerWrapper;
 import com.android.settingslib.wrapper.PackageManagerWrapper;
 
 import java.util.ArrayList;
@@ -38,12 +38,12 @@
 
     private final Context mContext;
     private final PackageManagerWrapper mPm;
-    private final IPackageManagerWrapper mPms;
+    private final IPackageManager mPms;
     private final DevicePolicyManager mDpm;
     private final UserManager mUm;
 
     public ApplicationFeatureProviderImpl(Context context, PackageManagerWrapper pm,
-            IPackageManagerWrapper pms, DevicePolicyManager dpm) {
+            IPackageManager pms, DevicePolicyManager dpm) {
         mContext = context.getApplicationContext();
         mPm = pm;
         mPms = pms;
@@ -149,7 +149,7 @@
 
         CurrentUserAndManagedProfileAppWithAdminGrantedPermissionsCounter(Context context,
                 String[] permissions, PackageManagerWrapper packageManager,
-                IPackageManagerWrapper packageManagerService,
+                IPackageManager packageManagerService,
                 DevicePolicyManager devicePolicyManager, NumberOfAppsCallback callback) {
             super(context, permissions, packageManager, packageManagerService, devicePolicyManager);
             mCallback = callback;
@@ -181,7 +181,7 @@
         private ListOfAppsCallback mCallback;
 
         CurrentUserAppWithAdminGrantedPermissionsLister(String[] permissions,
-                PackageManagerWrapper packageManager, IPackageManagerWrapper packageManagerService,
+                PackageManagerWrapper packageManager, IPackageManager packageManagerService,
                 DevicePolicyManager devicePolicyManager, UserManager userManager,
                 ListOfAppsCallback callback) {
             super(permissions, packageManager, packageManagerService, devicePolicyManager,
diff --git a/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProviderImpl.java b/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProviderImpl.java
index 17d7f0d..2146598 100644
--- a/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProviderImpl.java
+++ b/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProviderImpl.java
@@ -23,6 +23,7 @@
 import android.content.pm.PackageManager;
 import android.content.pm.UserInfo;
 import android.content.res.Resources;
+import android.net.ConnectivityManager;
 import android.os.UserHandle;
 import android.os.UserManager;
 import android.provider.Settings;
@@ -32,7 +33,6 @@
 
 import com.android.settings.R;
 import com.android.settings.vpn2.VpnUtils;
-import com.android.settings.wrapper.ConnectivityManagerWrapper;
 import com.android.settingslib.wrapper.PackageManagerWrapper;
 
 import java.util.Date;
@@ -44,13 +44,13 @@
     private final DevicePolicyManager mDpm;
     private final PackageManagerWrapper mPm;
     private final UserManager mUm;
-    private final ConnectivityManagerWrapper mCm;
+    private final ConnectivityManager mCm;
     private final Resources mResources;
 
     private static final int MY_USER_ID = UserHandle.myUserId();
 
     public EnterprisePrivacyFeatureProviderImpl(Context context, DevicePolicyManager dpm,
-            PackageManagerWrapper pm, UserManager um, ConnectivityManagerWrapper cm,
+            PackageManagerWrapper pm, UserManager um, ConnectivityManager cm,
             Resources resources) {
         mContext = context.getApplicationContext();
         mDpm = dpm;
diff --git a/src/com/android/settings/overlay/FeatureFactoryImpl.java b/src/com/android/settings/overlay/FeatureFactoryImpl.java
index f0bbe2e..b652c66 100644
--- a/src/com/android/settings/overlay/FeatureFactoryImpl.java
+++ b/src/com/android/settings/overlay/FeatureFactoryImpl.java
@@ -51,8 +51,6 @@
 import com.android.settings.slices.SlicesFeatureProviderImpl;
 import com.android.settings.users.UserFeatureProvider;
 import com.android.settings.users.UserFeatureProviderImpl;
-import com.android.settings.wrapper.ConnectivityManagerWrapper;
-import com.android.settings.wrapper.IPackageManagerWrapper;
 import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
 import com.android.settingslib.wrapper.PackageManagerWrapper;
 
@@ -112,7 +110,7 @@
         if (mApplicationFeatureProvider == null) {
             mApplicationFeatureProvider = new ApplicationFeatureProviderImpl(context,
                     new PackageManagerWrapper(context.getPackageManager()),
-                    new IPackageManagerWrapper(AppGlobals.getPackageManager()),
+                    AppGlobals.getPackageManager(),
                     (DevicePolicyManager) context
                             .getSystemService(Context.DEVICE_POLICY_SERVICE));
         }
@@ -134,8 +132,7 @@
                     (DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE),
                     new PackageManagerWrapper(context.getPackageManager()),
                     UserManager.get(context),
-                    new ConnectivityManagerWrapper((ConnectivityManager) context
-                            .getSystemService(Context.CONNECTIVITY_SERVICE)),
+                    (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE),
                     context.getResources());
         }
         return mEnterprisePrivacyFeatureProvider;
diff --git a/src/com/android/settings/vpn2/VpnUtils.java b/src/com/android/settings/vpn2/VpnUtils.java
index 1aa4ada..4528180 100644
--- a/src/com/android/settings/vpn2/VpnUtils.java
+++ b/src/com/android/settings/vpn2/VpnUtils.java
@@ -27,7 +27,6 @@
 
 import com.android.internal.net.LegacyVpnInfo;
 import com.android.internal.net.VpnConfig;
-import com.android.settings.wrapper.ConnectivityManagerWrapper;
 
 /**
  * Utility functions for vpn.
@@ -89,7 +88,7 @@
                 ServiceManager.getService(Context.CONNECTIVITY_SERVICE));
     }
 
-    public static boolean isAlwaysOnVpnSet(ConnectivityManagerWrapper cm, final int userId) {
+    public static boolean isAlwaysOnVpnSet(ConnectivityManager cm, final int userId) {
         return cm.getAlwaysOnVpnPackageForUser(userId) != null;
     }
 
diff --git a/src/com/android/settings/wifi/WifiEnabler.java b/src/com/android/settings/wifi/WifiEnabler.java
index c5e79b2..cdb9292 100644
--- a/src/com/android/settings/wifi/WifiEnabler.java
+++ b/src/com/android/settings/wifi/WifiEnabler.java
@@ -34,11 +34,10 @@
 import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
 import com.android.settings.R;
 import com.android.settings.widget.SwitchWidgetController;
-import com.android.settings.wrapper.ConnectivityManagerWrapper;
-import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
 import com.android.settingslib.RestrictedLockUtils;
 import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
 import com.android.settingslib.WirelessUtils;
+import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
 
 import java.util.concurrent.atomic.AtomicBoolean;
 
@@ -46,7 +45,7 @@
 
     private final SwitchWidgetController mSwitchWidget;
     private final WifiManager mWifiManager;
-    private final ConnectivityManagerWrapper mConnectivityManager;
+    private final ConnectivityManager mConnectivityManager;
     private final MetricsFeatureProvider mMetricsFeatureProvider;
 
     private Context mContext;
@@ -81,20 +80,20 @@
 
     public WifiEnabler(Context context, SwitchWidgetController switchWidget,
         MetricsFeatureProvider metricsFeatureProvider) {
-        this(context, switchWidget, metricsFeatureProvider, new ConnectivityManagerWrapper(
-            (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE)));
+        this(context, switchWidget, metricsFeatureProvider,
+            (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE));
     }
 
     @VisibleForTesting
     WifiEnabler(Context context, SwitchWidgetController switchWidget,
             MetricsFeatureProvider metricsFeatureProvider,
-            ConnectivityManagerWrapper connectivityManagerWrapper) {
+            ConnectivityManager connectivityManager) {
         mContext = context;
         mSwitchWidget = switchWidget;
         mSwitchWidget.setListener(this);
         mMetricsFeatureProvider = metricsFeatureProvider;
         mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
-        mConnectivityManager = connectivityManagerWrapper;
+        mConnectivityManager = connectivityManager;
 
         mIntentFilter = new IntentFilter(WifiManager.WIFI_STATE_CHANGED_ACTION);
         // The order matters! We really should not depend on this. :(
diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java
index 5f29922..4f1c832 100644
--- a/src/com/android/settings/wifi/WifiSettings.java
+++ b/src/com/android/settings/wifi/WifiSettings.java
@@ -64,7 +64,6 @@
 import com.android.settings.widget.SummaryUpdater.OnSummaryChangeListener;
 import com.android.settings.widget.SwitchBarController;
 import com.android.settings.wifi.details.WifiNetworkDetailsFragment;
-import com.android.settings.wrapper.ConnectivityManagerWrapper;
 import com.android.settingslib.RestrictedLockUtils;
 import com.android.settingslib.wifi.AccessPoint;
 import com.android.settingslib.wifi.AccessPoint.AccessPointListener;
@@ -852,9 +851,7 @@
                     pref.getAccessPoint().saveWifiState(pref.getExtras());
                     if (mCaptivePortalNetworkCallback != null
                             && mCaptivePortalNetworkCallback.isCaptivePortal()) {
-                        ConnectivityManagerWrapper connectivityManagerWrapper =
-                                new ConnectivityManagerWrapper(mConnectivityManager);
-                        connectivityManagerWrapper.startCaptivePortalApp(
+                        mConnectivityManager.startCaptivePortalApp(
                                 mCaptivePortalNetworkCallback.getNetwork());
                     } else {
                         launchNetworkDetailsFragment(pref);
diff --git a/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java b/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
index e7f0fdd..2339e38 100644
--- a/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
+++ b/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
@@ -48,6 +48,7 @@
 import android.util.Log;
 import android.widget.ImageView;
 import android.widget.Toast;
+
 import com.android.internal.annotations.VisibleForTesting;
 import com.android.internal.logging.nano.MetricsProto;
 import com.android.settings.R;
@@ -60,7 +61,6 @@
 import com.android.settings.wifi.WifiDialog;
 import com.android.settings.wifi.WifiDialog.WifiDialogListener;
 import com.android.settings.wifi.WifiUtils;
-import com.android.settings.wrapper.ConnectivityManagerWrapper;
 import com.android.settingslib.core.AbstractPreferenceController;
 import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
 import com.android.settingslib.core.lifecycle.Lifecycle;
@@ -68,6 +68,7 @@
 import com.android.settingslib.core.lifecycle.events.OnPause;
 import com.android.settingslib.core.lifecycle.events.OnResume;
 import com.android.settingslib.wifi.AccessPoint;
+
 import java.net.Inet4Address;
 import java.net.Inet6Address;
 import java.net.InetAddress;
@@ -114,7 +115,6 @@
     static final String KEY_IPV6_ADDRESSES_PREF = "ipv6_addresses";
 
     private AccessPoint mAccessPoint;
-    private final ConnectivityManagerWrapper mConnectivityManagerWrapper;
     private final ConnectivityManager mConnectivityManager;
     private final Fragment mFragment;
     private final Handler mHandler;
@@ -152,10 +152,10 @@
             switch (intent.getAction()) {
                 case WifiManager.CONFIGURED_NETWORKS_CHANGED_ACTION:
                     if (!intent.getBooleanExtra(WifiManager.EXTRA_MULTIPLE_NETWORKS_CHANGED,
-                        false /* defaultValue */)) {
+                            false /* defaultValue */)) {
                         // only one network changed
                         WifiConfiguration wifiConfiguration = intent
-                            .getParcelableExtra(WifiManager.EXTRA_WIFI_CONFIGURATION);
+                                .getParcelableExtra(WifiManager.EXTRA_WIFI_CONFIGURATION);
                         if (mAccessPoint.matches(wifiConfiguration)) {
                             mWifiConfig = wifiConfiguration;
                         }
@@ -215,7 +215,7 @@
 
     public static WifiDetailPreferenceController newInstance(
             AccessPoint accessPoint,
-            ConnectivityManagerWrapper connectivityManagerWrapper,
+            ConnectivityManager connectivityManager,
             Context context,
             Fragment fragment,
             Handler handler,
@@ -223,14 +223,14 @@
             WifiManager wifiManager,
             MetricsFeatureProvider metricsFeatureProvider) {
         return new WifiDetailPreferenceController(
-                accessPoint, connectivityManagerWrapper, context, fragment, handler, lifecycle,
+                accessPoint, connectivityManager, context, fragment, handler, lifecycle,
                 wifiManager, metricsFeatureProvider, new IconInjector(context));
     }
 
     @VisibleForTesting
-    /* package */ WifiDetailPreferenceController(
+        /* package */ WifiDetailPreferenceController(
             AccessPoint accessPoint,
-            ConnectivityManagerWrapper connectivityManagerWrapper,
+            ConnectivityManager connectivityManager,
             Context context,
             Fragment fragment,
             Handler handler,
@@ -241,8 +241,7 @@
         super(context);
 
         mAccessPoint = accessPoint;
-        mConnectivityManager = connectivityManagerWrapper.getConnectivityManager();
-        mConnectivityManagerWrapper = connectivityManagerWrapper;
+        mConnectivityManager = connectivityManager;
         mFragment = fragment;
         mHandler = handler;
         mSignalStr = context.getResources().getStringArray(R.array.wifi_signal);
@@ -326,7 +325,7 @@
         mNetworkCapabilities = mConnectivityManager.getNetworkCapabilities(mNetwork);
         updateInfo();
         mContext.registerReceiver(mReceiver, mFilter);
-        mConnectivityManagerWrapper.registerNetworkCallback(mNetworkRequest, mNetworkCallback,
+        mConnectivityManager.registerNetworkCallback(mNetworkRequest, mNetworkCallback,
                 mHandler);
     }
 
@@ -486,7 +485,7 @@
     private static String ipv4PrefixLengthToSubnetMask(int prefixLength) {
         try {
             InetAddress all = InetAddress.getByAddress(
-                    new byte[]{(byte) 255, (byte) 255, (byte) 255, (byte) 255});
+                    new byte[] {(byte) 255, (byte) 255, (byte) 255, (byte) 255});
             return NetworkUtils.getNetworkPart(all, prefixLength).getHostAddress();
         } catch (UnknownHostException e) {
             return null;
@@ -538,7 +537,7 @@
     private void signIntoNetwork() {
         mMetricsFeatureProvider.action(
                 mFragment.getActivity(), MetricsProto.MetricsEvent.ACTION_WIFI_SIGNIN);
-        mConnectivityManagerWrapper.startCaptivePortalApp(mNetwork);
+        mConnectivityManager.startCaptivePortalApp(mNetwork);
     }
 
     @Override
diff --git a/src/com/android/settings/wifi/details/WifiNetworkDetailsFragment.java b/src/com/android/settings/wifi/details/WifiNetworkDetailsFragment.java
index b2e56b9..3438035 100644
--- a/src/com/android/settings/wifi/details/WifiNetworkDetailsFragment.java
+++ b/src/com/android/settings/wifi/details/WifiNetworkDetailsFragment.java
@@ -20,13 +20,10 @@
 import android.app.Dialog;
 import android.content.Context;
 import android.net.ConnectivityManager;
-import android.net.NetworkPolicyManager;
-import android.net.wifi.WifiConfiguration;
 import android.net.wifi.WifiManager;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Looper;
-import android.support.v7.preference.DropDownPreference;
 import android.view.Menu;
 import android.view.MenuInflater;
 import android.view.MenuItem;
@@ -37,13 +34,11 @@
 import com.android.settings.dashboard.DashboardFragment;
 import com.android.settings.wifi.WifiConfigUiBase;
 import com.android.settings.wifi.WifiDialog;
-import com.android.settings.wrapper.ConnectivityManagerWrapper;
 import com.android.settingslib.RestrictedLockUtils;
 import com.android.settingslib.core.AbstractPreferenceController;
 import com.android.settingslib.wifi.AccessPoint;
 
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
 
 /**
@@ -126,10 +121,10 @@
     @Override
     protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
         final List<AbstractPreferenceController> controllers = new ArrayList<>();
-        ConnectivityManager cm = context.getSystemService(ConnectivityManager.class);
+        final ConnectivityManager cm = context.getSystemService(ConnectivityManager.class);
         mWifiDetailPreferenceController = WifiDetailPreferenceController.newInstance(
                 mAccessPoint,
-                new ConnectivityManagerWrapper(cm),
+                cm,
                 context,
                 this,
                 new Handler(Looper.getMainLooper()),  // UI thread.
diff --git a/src/com/android/settings/wrapper/ConnectivityManagerWrapper.java b/src/com/android/settings/wrapper/ConnectivityManagerWrapper.java
deleted file mode 100644
index c80a97b..0000000
--- a/src/com/android/settings/wrapper/ConnectivityManagerWrapper.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.wrapper;
-
-import android.net.ConnectivityManager;
-import android.net.ConnectivityManager.NetworkCallback;
-import android.net.Network;
-import android.net.NetworkRequest;
-import android.os.Handler;
-import android.net.ProxyInfo;
-
-/**
- * This class replicates a subset of the android.net.ConnectivityManager (CM). The class
- * exists so that we can use a thin wrapper around the CM in production code and a mock in tests.
- * We cannot directly mock or shadow the CM, because some of the methods we rely on are marked as
- * hidden and are thus invisible to Robolectric.
- */
-public class ConnectivityManagerWrapper {
-
-    private final ConnectivityManager mCm;
-
-    public ConnectivityManagerWrapper(ConnectivityManager cm) {
-        mCm = cm;
-    }
-
-    /**
-     * Returns the real ConnectivityManager object wrapped by this wrapper.
-     */
-    public ConnectivityManager getConnectivityManager() {
-        return mCm;
-    }
-
-    /**
-     * Calls {@code ConnectivityManager.getAlwaysOnVpnPackageForUser()}.
-     *
-     * @see android.net.ConnectivityManager#getAlwaysOnVpnPackageForUser
-     */
-    public String getAlwaysOnVpnPackageForUser(int userId) {
-        return mCm.getAlwaysOnVpnPackageForUser(userId);
-    }
-
-    /**
-     * Calls {@code ConnectivityManager.getGlobalProxy()}.
-     *
-     * @see android.net.ConnectivityManager#getGlobalProxy
-     */
-    public ProxyInfo getGlobalProxy() {
-        return mCm.getGlobalProxy();
-    }
-
-    /**
-     * Calls {@code ConnectivityManager.registerNetworkCallback()}.
-     *
-     * This is part of the ConnectivityManager public API in SDK 26 or above, but is not yet visible
-     * to the robolectric tests, which currently build with SDK 23.
-     * TODO: delete this once the robolectric tests build with SDK 26 or above.
-     *
-     * @see android.net.ConnectivityManager#registerNetworkCallback(NetworkRequest,NetworkCallback,Handler)
-     */
-    public void registerNetworkCallback(NetworkRequest request, NetworkCallback callback,
-            Handler handler) {
-        mCm.registerNetworkCallback(request, callback, handler);
-    }
-
-    /**
-     * Calls {@code ConnectivityManager.startCaptivePortalApp()}.
-     *
-     * This is part of the ConnectivityManager public API in SDK 26 or above, but is not yet visible
-     * to the robolectric tests, which currently build with SDK 23.
-     * TODO: delete this once the robolectric tests build with SDK 26 or above.
-     *
-     * @see android.net.ConnectivityManager#startCaptivePortalApp(Network)
-     */
-    public void startCaptivePortalApp(Network network) {
-        mCm.startCaptivePortalApp(network);
-    }
-
-    /**
-     * {@link ConnectivityManager#stopTethering}
-     */
-    public void stopTethering(int type) {
-        mCm.stopTethering(type);
-    }
-}
diff --git a/src/com/android/settings/wrapper/IPackageManagerWrapper.java b/src/com/android/settings/wrapper/IPackageManagerWrapper.java
deleted file mode 100644
index 9bb2df7..0000000
--- a/src/com/android/settings/wrapper/IPackageManagerWrapper.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.wrapper;
-
-import android.content.Intent;
-import android.content.pm.IPackageManager;
-import android.content.pm.PackageInfo;
-import android.content.pm.ParceledListSlice;
-import android.content.pm.ResolveInfo;
-import android.os.RemoteException;
-
-/**
- * This class replicates a subset of the android.content.pm.IPackageManager (PMS). The class
- * exists so that we can use a thin wrapper around the PMS in production code and a mock in tests.
- * We cannot directly mock or shadow the PMS, because some of the methods we rely on are newer than
- * the API version supported by Robolectric.
- */
-public class IPackageManagerWrapper {
-
-    private final IPackageManager mPms;
-
-    public IPackageManagerWrapper(IPackageManager pms) {
-        mPms = pms;
-    }
-
-    /**
-     * Calls {@code IPackageManager.checkUidPermission()}.
-     *
-     * @see android.content.pm.IPackageManager#checkUidPermission
-     */
-    public int checkUidPermission(String permName, int uid) throws RemoteException {
-        return mPms.checkUidPermission(permName, uid);
-    }
-
-    /**
-     * Calls {@code IPackageManager.findPersistentPreferredActivity()}.
-     *
-     * @see android.content.pm.IPackageManager#findPersistentPreferredActivity
-     */
-    public ResolveInfo findPersistentPreferredActivity(Intent intent, int userId)
-            throws RemoteException {
-        return mPms.findPersistentPreferredActivity(intent, userId);
-    }
-
-    /**
-     * Calls {@code IPackageManager.getPackageInfo()}.
-     *
-     * @see android.content.pm.IPackageManager#getPackageInfo
-     */
-    public PackageInfo getPackageInfo(String packageName, int flags, int userId)
-            throws RemoteException {
-        return mPms.getPackageInfo(packageName, flags, userId);
-    }
-
-    /**
-     * Calls {@code IPackageManager.getAppOpPermissionPackages()}.
-     *
-     * @see android.content.pm.IPackageManager#getAppOpPermissionPackages
-     */
-    public String[] getAppOpPermissionPackages(String permissionName) throws RemoteException {
-        return mPms.getAppOpPermissionPackages(permissionName);
-    }
-
-    /**
-     * Calls {@code IPackageManager.isPackageAvailable()}.
-     *
-     * @see android.content.pm.IPackageManager#isPackageAvailable
-     */
-    public boolean isPackageAvailable(String packageName, int userId) throws RemoteException {
-        return mPms.isPackageAvailable(packageName, userId);
-    }
-
-    /**
-     * Calls {@code IPackageManager.getPackagesHoldingPermissions()}.
-     *
-     * @see android.content.pm.IPackageManager#getPackagesHoldingPermissions
-     */
-    public ParceledListSlice<PackageInfo> getPackagesHoldingPermissions(
-        String[] permissions, int flags, int userId) throws RemoteException {
-        return mPms.getPackagesHoldingPermissions(permissions, flags, userId);
-    }
-
-}
diff --git a/tests/robotests/src/com/android/settings/applications/AppStateAppOpsBridgeTest.java b/tests/robotests/src/com/android/settings/applications/AppStateAppOpsBridgeTest.java
index 2df0117..a4eeacd 100644
--- a/tests/robotests/src/com/android/settings/applications/AppStateAppOpsBridgeTest.java
+++ b/tests/robotests/src/com/android/settings/applications/AppStateAppOpsBridgeTest.java
@@ -23,11 +23,11 @@
 import android.Manifest;
 import android.app.AppOpsManager;
 import android.content.Context;
+import android.content.pm.IPackageManager;
 import android.os.RemoteException;
 import android.os.UserManager;
 
 import com.android.settings.testutils.SettingsRobolectricTestRunner;
-import com.android.settings.wrapper.IPackageManagerWrapper;
 import com.android.settingslib.applications.ApplicationsState.AppEntry;
 
 import org.junit.Before;
@@ -41,7 +41,7 @@
 
     @Mock private Context mContext;
     @Mock private UserManager mUserManager;
-    @Mock private IPackageManagerWrapper mPackageManagerService;
+    @Mock private IPackageManager mPackageManagerService;
     @Mock private AppOpsManager mAppOpsManager;
 
     @Before
diff --git a/tests/robotests/src/com/android/settings/applications/AppWithAdminGrantedPermissionsCounterTest.java b/tests/robotests/src/com/android/settings/applications/AppWithAdminGrantedPermissionsCounterTest.java
index a0bae85..dcc6a1e 100644
--- a/tests/robotests/src/com/android/settings/applications/AppWithAdminGrantedPermissionsCounterTest.java
+++ b/tests/robotests/src/com/android/settings/applications/AppWithAdminGrantedPermissionsCounterTest.java
@@ -29,6 +29,7 @@
 import android.app.admin.DevicePolicyManager;
 import android.content.Context;
 import android.content.pm.ApplicationInfo;
+import android.content.pm.IPackageManager;
 import android.content.pm.PackageManager;
 import android.content.pm.UserInfo;
 import android.os.Build;
@@ -37,7 +38,6 @@
 import android.os.UserManager;
 
 import com.android.settings.testutils.SettingsRobolectricTestRunner;
-import com.android.settings.wrapper.IPackageManagerWrapper;
 import com.android.settingslib.wrapper.PackageManagerWrapper;
 
 import org.junit.Before;
@@ -81,7 +81,7 @@
     @Mock
     private PackageManagerWrapper mPackageManager;
     @Mock
-    private IPackageManagerWrapper mPackageManagerService;
+    private IPackageManager mPackageManagerService;
     @Mock
     private DevicePolicyManager mDevicePolicyManager;
 
diff --git a/tests/robotests/src/com/android/settings/applications/AppWithAdminGrantedPermissionsListerTest.java b/tests/robotests/src/com/android/settings/applications/AppWithAdminGrantedPermissionsListerTest.java
index 940fd4b..8365db2 100644
--- a/tests/robotests/src/com/android/settings/applications/AppWithAdminGrantedPermissionsListerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/AppWithAdminGrantedPermissionsListerTest.java
@@ -27,6 +27,7 @@
 import static org.mockito.Mockito.when;
 
 import android.app.admin.DevicePolicyManager;
+import android.content.pm.IPackageManager;
 import android.content.pm.PackageManager;
 import android.content.pm.UserInfo;
 import android.os.Build;
@@ -34,7 +35,6 @@
 import android.os.UserManager;
 
 import com.android.settings.testutils.SettingsRobolectricTestRunner;
-import com.android.settings.wrapper.IPackageManagerWrapper;
 import com.android.settingslib.wrapper.PackageManagerWrapper;
 
 import org.junit.Before;
@@ -78,7 +78,7 @@
     @Mock
     private PackageManagerWrapper mPackageManager;
     @Mock
-    private IPackageManagerWrapper mPackageManagerService;
+    private IPackageManager mPackageManagerService;
     @Mock
     private DevicePolicyManager mDevicePolicyManager;
 
diff --git a/tests/robotests/src/com/android/settings/applications/ApplicationFeatureProviderImplTest.java b/tests/robotests/src/com/android/settings/applications/ApplicationFeatureProviderImplTest.java
index 8afb798..a457ba2 100644
--- a/tests/robotests/src/com/android/settings/applications/ApplicationFeatureProviderImplTest.java
+++ b/tests/robotests/src/com/android/settings/applications/ApplicationFeatureProviderImplTest.java
@@ -24,6 +24,7 @@
 import android.content.Intent;
 import android.content.pm.ActivityInfo;
 import android.content.pm.ApplicationInfo;
+import android.content.pm.IPackageManager;
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
 import android.content.pm.UserInfo;
@@ -33,7 +34,6 @@
 
 import com.android.settings.testutils.ApplicationTestUtils;
 import com.android.settings.testutils.SettingsRobolectricTestRunner;
-import com.android.settings.wrapper.IPackageManagerWrapper;
 import com.android.settingslib.wrapper.PackageManagerWrapper;
 
 import org.junit.Before;
@@ -72,7 +72,7 @@
     @Mock
     private PackageManagerWrapper mPackageManager;
     @Mock
-    private IPackageManagerWrapper mPackageManagerService;
+    private IPackageManager mPackageManagerService;
     @Mock
     private DevicePolicyManager mDevicePolicyManager;
 
diff --git a/tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProviderImplTest.java b/tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProviderImplTest.java
index b71a35e..b4fc6d8 100644
--- a/tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProviderImplTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProviderImplTest.java
@@ -28,6 +28,7 @@
 import android.content.pm.PackageManager;
 import android.content.pm.UserInfo;
 import android.content.res.Resources;
+import android.net.ConnectivityManager;
 import android.net.ProxyInfo;
 import android.os.UserHandle;
 import android.os.UserManager;
@@ -36,7 +37,6 @@
 
 import com.android.settings.R;
 import com.android.settings.testutils.SettingsRobolectricTestRunner;
-import com.android.settings.wrapper.ConnectivityManagerWrapper;
 import com.android.settingslib.wrapper.PackageManagerWrapper;
 
 import org.junit.Before;
@@ -72,7 +72,7 @@
     private @Mock PackageManagerWrapper mPackageManagerWrapper;
     private @Mock PackageManager mPackageManager;
     private @Mock UserManager mUserManager;
-    private @Mock ConnectivityManagerWrapper mConnectivityManger;
+    private @Mock ConnectivityManager mConnectivityManger;
     private Resources mResources;
 
     private EnterprisePrivacyFeatureProvider mProvider;
diff --git a/tests/robotests/src/com/android/settings/vpn2/VpnUtilsTest.java b/tests/robotests/src/com/android/settings/vpn2/VpnUtilsTest.java
index f354c43..fd41c36 100644
--- a/tests/robotests/src/com/android/settings/vpn2/VpnUtilsTest.java
+++ b/tests/robotests/src/com/android/settings/vpn2/VpnUtilsTest.java
@@ -20,8 +20,9 @@
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
+import android.net.ConnectivityManager;
+
 import com.android.settings.testutils.SettingsRobolectricTestRunner;
-import com.android.settings.wrapper.ConnectivityManagerWrapper;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -30,7 +31,7 @@
 public final class VpnUtilsTest {
     @Test
     public void testIsAlwaysOnVpnSet() {
-        final ConnectivityManagerWrapper cm = mock(ConnectivityManagerWrapper.class);
+        final ConnectivityManager cm = mock(ConnectivityManager.class);
         when(cm.getAlwaysOnVpnPackageForUser(0)).thenReturn("com.example.vpn");
         assertThat(VpnUtils.isAlwaysOnVpnSet(cm, 0)).isTrue();
 
diff --git a/tests/robotests/src/com/android/settings/wifi/WifiEnablerTest.java b/tests/robotests/src/com/android/settings/wifi/WifiEnablerTest.java
index b7bc33e..66cbd30 100644
--- a/tests/robotests/src/com/android/settings/wifi/WifiEnablerTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/WifiEnablerTest.java
@@ -26,7 +26,6 @@
 
 import com.android.settings.testutils.SettingsRobolectricTestRunner;
 import com.android.settings.widget.SwitchWidgetController;
-import com.android.settings.wrapper.ConnectivityManagerWrapper;
 import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
 
 import org.junit.Before;
@@ -43,7 +42,7 @@
     @Mock
     private WifiManager mWifiManager;
     @Mock
-    private ConnectivityManagerWrapper mConnectivityManager;
+    private ConnectivityManager mConnectivityManager;
 
     private WifiEnabler mEnabler;
 
@@ -52,7 +51,7 @@
         MockitoAnnotations.initMocks(this);
         when(mContext.getSystemService(Context.WIFI_SERVICE)).thenReturn(mWifiManager);
         mEnabler = new WifiEnabler(mContext, mock(SwitchWidgetController.class),
-            mock(MetricsFeatureProvider.class), mConnectivityManager);
+                mock(MetricsFeatureProvider.class), mConnectivityManager);
     }
 
     @Test
diff --git a/tests/robotests/src/com/android/settings/wifi/details/WifiDetailPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/wifi/details/WifiDetailPreferenceControllerTest.java
index 9c20d18..d08f922 100644
--- a/tests/robotests/src/com/android/settings/wifi/details/WifiDetailPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/details/WifiDetailPreferenceControllerTest.java
@@ -51,7 +51,6 @@
 import android.net.wifi.WifiManager;
 import android.os.Handler;
 import android.provider.Settings;
-import android.support.v7.preference.Preference;
 import android.support.v7.preference.PreferenceCategory;
 import android.support.v7.preference.PreferenceScreen;
 import android.view.View;
@@ -70,7 +69,6 @@
 import com.android.settings.widget.ActionButtonPreferenceTest;
 import com.android.settings.widget.EntityHeaderController;
 import com.android.settings.wifi.WifiDetailPreference;
-import com.android.settings.wrapper.ConnectivityManagerWrapper;
 import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
 import com.android.settingslib.core.lifecycle.Lifecycle;
 import com.android.settingslib.wifi.AccessPoint;
@@ -91,7 +89,6 @@
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.util.Arrays;
-import java.util.List;
 import java.util.stream.Collectors;
 
 @RunWith(SettingsRobolectricTestRunner.class)
@@ -119,8 +116,6 @@
     @Mock
     private ConnectivityManager mockConnectivityManager;
     @Mock
-    private ConnectivityManagerWrapper mockConnectivityManagerWrapper;
-    @Mock
     private Network mockNetwork;
     @Mock
     private NetworkInfo mockNetworkInfo;
@@ -173,8 +168,6 @@
     private ArgumentCaptor<NetworkCallback> mCallbackCaptor;
     @Captor
     private ArgumentCaptor<View.OnClickListener> mForgetClickListener;
-    @Captor
-    private ArgumentCaptor<Preference> mIpv6AddressCaptor;
 
     private Context mContext;
     private Lifecycle mLifecycle;
@@ -245,12 +238,9 @@
         when(mockAccessPoint.getConfig()).thenReturn(mockWifiConfig);
         when(mockAccessPoint.getLevel()).thenReturn(LEVEL);
         when(mockAccessPoint.getSecurityString(false)).thenReturn(SECURITY);
-
-        when(mockConnectivityManagerWrapper.getConnectivityManager())
-                .thenReturn(mockConnectivityManager);
         when(mockConnectivityManager.getNetworkInfo(any(Network.class)))
                 .thenReturn(mockNetworkInfo);
-        doNothing().when(mockConnectivityManagerWrapper).registerNetworkCallback(
+        doNothing().when(mockConnectivityManager).registerNetworkCallback(
                 nullable(NetworkRequest.class), mCallbackCaptor.capture(), nullable(Handler.class));
         mockButtonsPref = ActionButtonPreferenceTest.createMock();
         when(mockButtonsPref.setButton1OnClickListener(mForgetClickListener.capture()))
@@ -281,7 +271,7 @@
     private WifiDetailPreferenceController newWifiDetailPreferenceController() {
         return new WifiDetailPreferenceController(
                 mockAccessPoint,
-                mockConnectivityManagerWrapper,
+                mockConnectivityManager,
                 mContext,
                 mockFragment,
                 null,  // Handler
@@ -362,7 +352,7 @@
     public void networkCallback_shouldBeRegisteredOnResume() {
         displayAndResume();
 
-        verify(mockConnectivityManagerWrapper, times(1)).registerNetworkCallback(
+        verify(mockConnectivityManager, times(1)).registerNetworkCallback(
                 nullable(NetworkRequest.class), mCallbackCaptor.capture(), nullable(Handler.class));
     }
 
@@ -779,8 +769,6 @@
 
         displayAndResume();
 
-        List<Preference> addrs = mIpv6AddressCaptor.getAllValues();
-
         String expectedAddresses = String.join("\n",
                 asString(Constants.IPV6_LINKLOCAL),
                 asString(Constants.IPV6_GLOBAL1),
@@ -826,7 +814,7 @@
         ArgumentCaptor<OnClickListener> captor = ArgumentCaptor.forClass(OnClickListener.class);
         verify(mockButtonsPref).setButton2OnClickListener(captor.capture());
         captor.getValue().onClick(null);
-        verify(mockConnectivityManagerWrapper).startCaptivePortalApp(mockNetwork);
+        verify(mockConnectivityManager).startCaptivePortalApp(mockNetwork);
         verify(mockMetricsFeatureProvider)
                 .action(mockActivity, MetricsProto.MetricsEvent.ACTION_WIFI_SIGNIN);
     }