[Provider Model] Internal cleanup - remove Provider Model flag and deprecated legacy UI

Test: atest NetworkProviderCallsSmsFragmentTest, SubscriptionsPreferenceControllerTest
Bug: 197066557
Change-Id: I55e0fa2ca7317cd8c9d1bce7c229b8344f43cc92
diff --git a/res/xml/network_and_internet.xml b/res/xml/network_and_internet.xml
index 7b6b67c..d842aad 100644
--- a/res/xml/network_and_internet.xml
+++ b/res/xml/network_and_internet.xml
@@ -13,7 +13,8 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-
+<!-- @deprecated This class will be removed in Android U, use {@link network_provider_internet.xml}
+     instead.-->
 <PreferenceScreen
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:settings="http://schemas.android.com/apk/res-auto"
diff --git a/src/com/android/settings/network/MobileNetworkSummaryController.java b/src/com/android/settings/network/MobileNetworkSummaryController.java
index 8530dbe..94d1ff5 100644
--- a/src/com/android/settings/network/MobileNetworkSummaryController.java
+++ b/src/com/android/settings/network/MobileNetworkSummaryController.java
@@ -126,22 +126,13 @@
             }
             return mContext.getString(R.string.mobile_network_tap_to_activate, displayName);
         } else {
-            if (com.android.settings.Utils.isProviderModelEnabled(mContext)) {
-                return getSummaryForProviderModel(subs);
-            }
-            final int count = subs.size();
-            return mContext.getResources().getQuantityString(R.plurals.mobile_network_summary_count,
-                    count, count);
+            return subs.stream()
+                    .mapToInt(SubscriptionAnnotation::getSubscriptionId)
+                    .mapToObj(subId -> mStatusCache.getDisplayName(subId))
+                    .collect(Collectors.joining(", "));
         }
     }
 
-    private CharSequence getSummaryForProviderModel(List<SubscriptionAnnotation> subs) {
-        return subs.stream()
-                .mapToInt(SubscriptionAnnotation::getSubscriptionId)
-                .mapToObj(subId -> mStatusCache.getDisplayName(subId))
-                .collect(Collectors.joining(", "));
-    }
-
     private void logPreferenceClick(Preference preference) {
         mMetricsFeatureProvider.logClickedPreference(preference,
                 preference.getExtras().getInt(DashboardFragment.CATEGORY));
diff --git a/src/com/android/settings/network/MultiNetworkHeaderController.java b/src/com/android/settings/network/MultiNetworkHeaderController.java
index 1143546..2be4d62 100644
--- a/src/com/android/settings/network/MultiNetworkHeaderController.java
+++ b/src/com/android/settings/network/MultiNetworkHeaderController.java
@@ -32,9 +32,9 @@
  * are two or more active mobile subscriptions. It shows an overview of available network
  * connections with an entry for wifi (if connected) and an entry for each subscription.
  *
- * TODO(tomhsu) when provider model is completed, this class will be replaced
- * by {@link NetworkMobileProviderController}
+ * @deprecated This class will be removed in Android U, there is no networks header anymore.
  */
+@Deprecated
 public class MultiNetworkHeaderController extends BasePreferenceController implements
         WifiConnectionPreferenceController.UpdateListener,
         SubscriptionsPreferenceController.UpdateListener {
diff --git a/src/com/android/settings/network/NetworkProviderCallsSmsFragment.java b/src/com/android/settings/network/NetworkProviderCallsSmsFragment.java
index fcb8345..aad9b10 100644
--- a/src/com/android/settings/network/NetworkProviderCallsSmsFragment.java
+++ b/src/com/android/settings/network/NetworkProviderCallsSmsFragment.java
@@ -100,8 +100,7 @@
 
                 @Override
                 protected boolean isPageSearchEnabled(Context context) {
-                    return Utils.isProviderModelEnabled(context) &&
-                            context.getSystemService(UserManager.class).isAdminUser();
+                    return context.getSystemService(UserManager.class).isAdminUser();
                 }
             };
 }
diff --git a/src/com/android/settings/network/SubscriptionsPreferenceController.java b/src/com/android/settings/network/SubscriptionsPreferenceController.java
index bfe5938..b872680 100644
--- a/src/com/android/settings/network/SubscriptionsPreferenceController.java
+++ b/src/com/android/settings/network/SubscriptionsPreferenceController.java
@@ -74,15 +74,8 @@
 import java.util.Set;
 
 /**
- * If the provider model is not enabled, this controller manages a set of Preferences it places into
- * a PreferenceGroup owned by some parent
- * controller class - one for each available subscription. This controller is only considered
- * available if there are 2 or more subscriptions.
- *
- * If the provider model is enabled, this controller manages preference with data subscription
- * information and make its state display on preference.
- * TODO this class will clean up the multiple subscriptions functionality after the provider
- * model is released.
+ * This controller manages preference with data subscription information and make its state
+ * display on preference.
  */
 public class SubscriptionsPreferenceController extends AbstractPreferenceController implements
         LifecycleObserver, SubscriptionsChangeListener.SubscriptionsChangeListenerClient,
@@ -228,14 +221,6 @@
             return;
         }
 
-        if (mSubsPrefCtrlInjector.isProviderModelEnabled(mContext)) {
-            updateForProvider();
-        } else {
-            updateForBase();
-        }
-    }
-
-    private void updateForProvider() {
         SubscriptionInfo subInfo = mSubscriptionManager.getDefaultDataSubscriptionInfo();
         if (subInfo == null) {
             mPreferenceGroup.removeAll();
@@ -349,50 +334,6 @@
         mSubsGearPref.setSummary("");
     }
 
-    private void updateForBase() {
-        final Map<Integer, Preference> existingPrefs = mSubscriptionPreferences;
-        mSubscriptionPreferences = new ArrayMap<>();
-
-        int order = mStartOrder;
-        final Set<Integer> activeSubIds = new ArraySet<>();
-        final int dataDefaultSubId = mSubsPrefCtrlInjector.getDefaultDataSubscriptionId();
-        for (SubscriptionInfo info :
-                SubscriptionUtil.getActiveSubscriptions(mSubscriptionManager)) {
-            final int subId = info.getSubscriptionId();
-            // Avoid from showing subscription(SIM)s which has been marked as hidden
-            // For example, only one subscription will be shown when there're multiple
-            // subscriptions with same group UUID.
-            if (!mSubsPrefCtrlInjector.canSubscriptionBeDisplayed(mContext, subId)) {
-                continue;
-            }
-            activeSubIds.add(subId);
-            Preference pref = existingPrefs.remove(subId);
-            if (pref == null) {
-                pref = new Preference(mPreferenceGroup.getContext());
-                mPreferenceGroup.addPreference(pref);
-            }
-            pref.setTitle(SubscriptionUtil.getUniqueSubscriptionDisplayName(info, mContext));
-            final boolean isDefaultForData = (subId == dataDefaultSubId);
-            pref.setSummary(getSummary(subId, isDefaultForData));
-            setIcon(pref, subId, isDefaultForData);
-            pref.setOrder(order++);
-
-            pref.setOnPreferenceClickListener(clickedPref -> {
-                startMobileNetworkActivity(mContext, subId);
-                return true;
-            });
-
-            mSubscriptionPreferences.put(subId, pref);
-        }
-        mSignalStrengthListener.updateSubscriptionIds(activeSubIds);
-
-        // Remove any old preferences that no longer map to a subscription.
-        for (Preference pref : existingPrefs.values()) {
-            mPreferenceGroup.removePreference(pref);
-        }
-        mUpdateListener.onChildrenUpdated();
-    }
-
     private static void startMobileNetworkActivity(Context context, int subId) {
         final Intent intent = new Intent(context, MobileNetworkActivity.class);
         intent.putExtra(Settings.EXTRA_SUB_ID, subId);
@@ -472,8 +413,7 @@
     }
 
     /**
-     * @return true if there are at least 2 available subscriptions,
-     * or if there is at least 1 available subscription for provider model.
+     * @return true if there is at least 1 available subscription.
      */
     @Override
     public boolean isAvailable() {
@@ -492,7 +432,7 @@
                 .filter(subInfo ->
                         mSubsPrefCtrlInjector.canSubscriptionBeDisplayed(mContext,
                                 subInfo.getSubscriptionId()))
-                .count() >= (mSubsPrefCtrlInjector.isProviderModelEnabled(mContext) ? 1 : 2);
+                .count() >= 1;
     }
 
     @Override
@@ -537,12 +477,6 @@
         update();
     }
 
-    @VisibleForTesting
-    boolean canSubscriptionBeDisplayed(Context context, int subId) {
-        return (SubscriptionUtil.getAvailableSubscription(context,
-                ProxySubscriptionManager.getInstance(context), subId) != null);
-    }
-
     public void setWifiPickerTrackerHelper(WifiPickerTrackerHelper helper) {
         mWifiPickerTrackerHelper = helper;
     }
@@ -603,13 +537,6 @@
         }
 
         /**
-         * Confirms the flag of Provider Model switch is turned on or not.
-         */
-        public boolean isProviderModelEnabled(Context context) {
-            return Utils.isProviderModelEnabled(context);
-        }
-
-        /**
          * Gets config for carrier customization.
          */
         public Config getConfig(Context context) {
diff --git a/tests/unit/src/com/android/settings/network/NetworkProviderCallsSmsFragmentTest.java b/tests/unit/src/com/android/settings/network/NetworkProviderCallsSmsFragmentTest.java
index 8327d22..d00e2dd 100644
--- a/tests/unit/src/com/android/settings/network/NetworkProviderCallsSmsFragmentTest.java
+++ b/tests/unit/src/com/android/settings/network/NetworkProviderCallsSmsFragmentTest.java
@@ -20,30 +20,24 @@
 
 import static org.mockito.Mockito.spy;
 
-import android.app.Instrumentation;
 import android.content.Context;
 import android.os.Looper;
-import android.provider.SearchIndexableResource;
-import android.util.FeatureFlagUtils;
 
 import androidx.test.annotation.UiThreadTest;
 import androidx.test.core.app.ApplicationProvider;
 import androidx.test.ext.junit.runners.AndroidJUnit4;
-import androidx.test.platform.app.InstrumentationRegistry;
 
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.MockitoAnnotations;
 
-import java.util.ArrayList;
 import java.util.List;
 
 @RunWith(AndroidJUnit4.class)
 public class NetworkProviderCallsSmsFragmentTest {
 
     private Context mContext;
-    private NetworkProviderCallsSmsFragment mNetworkProviderCallsSmsFragment;
     private List<String> mPreferenceKeyList;
 
     @Before
@@ -55,14 +49,11 @@
         if (Looper.myLooper() == null) {
             Looper.prepare();
         }
-
-        mNetworkProviderCallsSmsFragment = new NetworkProviderCallsSmsFragment();
     }
 
     @Test
     @UiThreadTest
-    public void isPageSearchEnabled_providerModelEnable_shouldIncludeFragmentXml() {
-        FeatureFlagUtils.setEnabled(mContext, FeatureFlagUtils.SETTINGS_PROVIDER_MODEL, true);
+    public void isPageSearchEnabled_shouldIncludeFragmentXml() {
         mPreferenceKeyList =
                 NetworkProviderCallsSmsFragment.SEARCH_INDEX_DATA_PROVIDER
                         .getNonIndexableKeys(mContext);
@@ -71,17 +62,4 @@
         assertThat(mPreferenceKeyList).doesNotContain(
                 NetworkProviderCallsSmsFragment.KEY_PREFERENCE_SMS);
     }
-
-    @Test
-    @UiThreadTest
-    public void isPageSearchEnabled_providerModelDisable_shouldNotIncludeFragmentXml() {
-        FeatureFlagUtils.setEnabled(mContext, FeatureFlagUtils.SETTINGS_PROVIDER_MODEL, false);
-        mPreferenceKeyList =
-                NetworkProviderCallsSmsFragment.SEARCH_INDEX_DATA_PROVIDER
-                        .getNonIndexableKeys(mContext);
-        assertThat(mPreferenceKeyList).contains(NetworkProviderCallsSmsFragment
-                .KEY_PREFERENCE_CALLS);
-        assertThat(mPreferenceKeyList).contains(NetworkProviderCallsSmsFragment
-                .KEY_PREFERENCE_SMS);
-    }
 }
diff --git a/tests/unit/src/com/android/settings/network/SubscriptionsPreferenceControllerTest.java b/tests/unit/src/com/android/settings/network/SubscriptionsPreferenceControllerTest.java
index 7cffb76..8b03352 100644
--- a/tests/unit/src/com/android/settings/network/SubscriptionsPreferenceControllerTest.java
+++ b/tests/unit/src/com/android/settings/network/SubscriptionsPreferenceControllerTest.java
@@ -146,7 +146,6 @@
         mUpdateListener = () -> mOnChildUpdatedCount++;
 
         sInjector = spy(new SubsPrefCtrlInjector());
-        initializeMethod(true, 1, 1, 1, false, false);
         mController =  new FakeSubscriptionsPreferenceController(mContext, mLifecycle,
                 mUpdateListener, KEY, 5);
         Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, 0);
@@ -158,30 +157,14 @@
     }
 
     @Test
-    public void isAvailable_oneSubscription_availableFalse() {
-        setupMockSubscriptions(1);
-
-        assertThat(mController.isAvailable()).isFalse();
-    }
-
-    @Test
     public void isAvailable_oneSubAndProviderOn_availableTrue() {
-        doReturn(true).when(sInjector).isProviderModelEnabled(mContext);
         setupMockSubscriptions(1);
 
         assertThat(mController.isAvailable()).isTrue();
     }
 
     @Test
-    public void isAvailable_twoSubscriptions_availableTrue() {
-        setupMockSubscriptions(2);
-
-        assertThat(mController.isAvailable()).isTrue();
-    }
-
-    @Test
     public void isAvailable_fiveSubscriptions_availableTrue() {
-        doReturn(true).when(sInjector).canSubscriptionBeDisplayed(mContext, 0);
         setupMockSubscriptions(5);
 
         assertThat(mController.isAvailable()).isTrue();
@@ -200,203 +183,8 @@
 
     @Test
     @UiThreadTest
-    public void onAirplaneModeChanged_airplaneModeTurnedOn_eventFired() {
-        setupMockSubscriptions(2);
-
-        mController.onResume();
-        mController.displayPreference(mPreferenceScreen);
-
-        assertThat(mController.isAvailable()).isTrue();
-
-        final int updateCountBeforeModeChange = mOnChildUpdatedCount;
-        Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, 1);
-
-        mController.onAirplaneModeChanged(true);
-
-        assertThat(mController.isAvailable()).isFalse();
-        assertThat(mOnChildUpdatedCount).isEqualTo(updateCountBeforeModeChange + 1);
-    }
-
-    @Test
-    @UiThreadTest
-    public void onAirplaneModeChanged_airplaneModeTurnedOff_eventFired() {
-        Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, 1);
-        setupMockSubscriptions(2);
-
-        mController.onResume();
-        mController.displayPreference(mPreferenceScreen);
-        assertThat(mController.isAvailable()).isFalse();
-
-        final int updateCountBeforeModeChange = mOnChildUpdatedCount;
-        Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, 0);
-
-        mController.onAirplaneModeChanged(true);
-
-        assertThat(mController.isAvailable()).isTrue();
-        assertThat(mOnChildUpdatedCount).isEqualTo(updateCountBeforeModeChange + 1);
-    }
-
-    @Test
-    @UiThreadTest
-    public void onSubscriptionsChanged_countBecameTwo_eventFired() {
-        final List<SubscriptionInfo> subs = setupMockSubscriptions(2);
-        SubscriptionUtil.setActiveSubscriptionsForTesting(subs.subList(0, 1));
-
-        mController.onResume();
-        mController.displayPreference(mPreferenceScreen);
-
-        assertThat(mController.isAvailable()).isFalse();
-
-        final int updateCountBeforeSubscriptionChange = mOnChildUpdatedCount;
-        SubscriptionUtil.setActiveSubscriptionsForTesting(subs);
-
-        mController.onSubscriptionsChanged();
-
-        assertThat(mController.isAvailable()).isTrue();
-        assertThat(mOnChildUpdatedCount).isEqualTo(updateCountBeforeSubscriptionChange + 1);
-    }
-
-    @Test
-    @UiThreadTest
-    public void onSubscriptionsChanged_countBecameOne_eventFiredAndPrefsRemoved() {
-        final List<SubscriptionInfo> subs = setupMockSubscriptions(2);
-
-        mController.onResume();
-        mController.displayPreference(mPreferenceScreen);
-
-        assertThat(mController.isAvailable()).isTrue();
-        assertThat(mPreferenceCategory.getPreferenceCount()).isEqualTo(2);
-
-        final int updateCountBeforeSubscriptionChange = mOnChildUpdatedCount;
-        SubscriptionUtil.setActiveSubscriptionsForTesting(subs.subList(0, 1));
-
-        mController.onSubscriptionsChanged();
-
-        assertThat(mController.isAvailable()).isFalse();
-        assertThat(mOnChildUpdatedCount).isEqualTo(updateCountBeforeSubscriptionChange + 1);
-        assertThat(mPreferenceCategory.getPreferenceCount()).isEqualTo(0);
-    }
-
-    @Test
-    @UiThreadTest
-    public void onSubscriptionsChanged_subscriptionReplaced_preferencesChanged() {
-        final List<SubscriptionInfo> subs = setupMockSubscriptions(3);
-        doReturn(subs).when(mSubscriptionManager).getAvailableSubscriptionInfoList();
-
-        // Start out with only sub1 and sub2.
-        SubscriptionUtil.setActiveSubscriptionsForTesting(subs.subList(0, 2));
-        mController.onResume();
-        mController.displayPreference(mPreferenceScreen);
-
-        assertThat(mPreferenceCategory.getPreferenceCount()).isEqualTo(2);
-        assertThat(mPreferenceCategory.getPreference(0).getTitle()).isEqualTo("sub2");
-        assertThat(mPreferenceCategory.getPreference(1).getTitle()).isEqualTo("sub1");
-
-        // Now replace sub2 with sub3, and make sure the old preference was removed and the new
-        // preference was added.
-        final int updateCountBeforeSubscriptionChange = mOnChildUpdatedCount;
-        SubscriptionUtil.setActiveSubscriptionsForTesting(Arrays.asList(subs.get(0), subs.get(2)));
-        mController.onSubscriptionsChanged();
-
-        assertThat(mController.isAvailable()).isTrue();
-        assertThat(mOnChildUpdatedCount).isEqualTo(updateCountBeforeSubscriptionChange + 1);
-        assertThat(mPreferenceCategory.getPreferenceCount()).isEqualTo(2);
-        assertThat(mPreferenceCategory.getPreference(0).getTitle()).isEqualTo("sub3");
-        assertThat(mPreferenceCategory.getPreference(1).getTitle()).isEqualTo("sub1");
-    }
-
-    @Test
-    public void getSummary_twoSubsOneDefaultForEverythingDataActive() {
-        setupMockSubscriptions(2);
-
-        doReturn(11).when(sInjector).getDefaultSmsSubscriptionId();
-        doReturn(11).when(sInjector).getDefaultVoiceSubscriptionId();
-        when(mTelephonyManager.isDataEnabled()).thenReturn(true);
-        doReturn(true).when(sInjector).isActiveCellularNetwork(mContext);
-
-        assertThat(mController.getSummary(11, true)).isEqualTo(
-                ResourcesUtils.getResourcesString(mContext, "default_for_calls_and_sms")
-                        + System.lineSeparator()
-                        + ResourcesUtils.getResourcesString(mContext, "mobile_data_active"));
-
-        assertThat(mController.getSummary(22, false)).isEqualTo(
-                ResourcesUtils.getResourcesString(mContext, "subscription_available"));
-    }
-
-    @Test
-    public void getSummary_twoSubsOneDefaultForEverythingDataNotActive() {
-        setupMockSubscriptions(2, 1, true);
-
-        doReturn(1).when(sInjector).getDefaultSmsSubscriptionId();
-        doReturn(1).when(sInjector).getDefaultVoiceSubscriptionId();
-
-        assertThat(mController.getSummary(1, true)).isEqualTo(
-                ResourcesUtils.getResourcesString(mContext, "default_for_calls_and_sms")
-                        + System.lineSeparator()
-                        + ResourcesUtils.getResourcesString(mContext, "default_for_mobile_data"));
-
-        assertThat(mController.getSummary(2, false)).isEqualTo(
-                ResourcesUtils.getResourcesString(mContext, "subscription_available"));
-    }
-
-    @Test
-    public void getSummary_twoSubsOneDefaultForEverythingDataDisabled() {
-        setupMockSubscriptions(2);
-
-        doReturn(1).when(sInjector).getDefaultSmsSubscriptionId();
-        doReturn(1).when(sInjector).getDefaultVoiceSubscriptionId();
-
-        assertThat(mController.getSummary(1, true)).isEqualTo(
-                ResourcesUtils.getResourcesString(mContext, "default_for_calls_and_sms")
-                        + System.lineSeparator()
-                        + ResourcesUtils.getResourcesString(mContext, "mobile_data_off"));
-
-        assertThat(mController.getSummary(2, false)).isEqualTo(
-                ResourcesUtils.getResourcesString(mContext, "subscription_available"));
-    }
-
-    @Test
-    public void getSummary_twoSubsOneForCallsAndDataOneForSms() {
-        setupMockSubscriptions(2, 1, true);
-
-        doReturn(2).when(sInjector).getDefaultSmsSubscriptionId();
-        doReturn(1).when(sInjector).getDefaultVoiceSubscriptionId();
-
-        assertThat(mController.getSummary(1, true)).isEqualTo(
-                ResourcesUtils.getResourcesString(mContext, "default_for_calls")
-                        + System.lineSeparator()
-                        + ResourcesUtils.getResourcesString(mContext, "default_for_mobile_data"));
-
-        assertThat(mController.getSummary(2, false)).isEqualTo(
-                ResourcesUtils.getResourcesString(mContext, "default_for_sms"));
-    }
-
-    @Test
-    @UiThreadTest
-    public void setIcon_greatSignal_correctLevels() {
-        final List<SubscriptionInfo> subs = setupMockSubscriptions(2, 1, true);
-        setMockSubSignalStrength(subs, 0, SIGNAL_STRENGTH_GREAT);
-        setMockSubSignalStrength(subs, 1, SIGNAL_STRENGTH_GREAT);
-        final Preference pref = new Preference(mContext);
-        final Drawable greatDrawWithoutCutOff = mock(Drawable.class);
-        doReturn(greatDrawWithoutCutOff).when(sInjector)
-                .getIcon(any(), anyInt(), anyInt(), anyBoolean());
-
-        mController.setIcon(pref, 1, true /* isDefaultForData */);
-        assertThat(pref.getIcon()).isEqualTo(greatDrawWithoutCutOff);
-
-        final Drawable greatDrawWithCutOff = mock(Drawable.class);
-        doReturn(greatDrawWithCutOff).when(sInjector)
-                .getIcon(any(), anyInt(), anyInt(), anyBoolean());
-        mController.setIcon(pref, 2, false /* isDefaultForData */);
-        assertThat(pref.getIcon()).isEqualTo(greatDrawWithCutOff);
-    }
-
-    @Test
-    @UiThreadTest
     public void displayPreference_providerAndHasSim_showPreference() {
         final List<SubscriptionInfo> sub = setupMockSubscriptions(1);
-        doReturn(true).when(sInjector).isProviderModelEnabled(mContext);
         doReturn(sub.get(0)).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();
         doReturn(sub).when(mSubscriptionManager).getAvailableSubscriptionInfoList();
 
@@ -411,7 +199,6 @@
     @UiThreadTest
     public void displayPreference_providerAndHasMultiSim_showDataSubPreference() {
         final List<SubscriptionInfo> sub = setupMockSubscriptions(2);
-        doReturn(true).when(sInjector).isProviderModelEnabled(mContext);
         doReturn(sub.get(0)).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();
         doReturn(sub).when(mSubscriptionManager).getAvailableSubscriptionInfoList();
 
@@ -429,7 +216,6 @@
                 Html.fromHtml("Connected / 5G", Html.FROM_HTML_MODE_LEGACY);
         final String networkType = "5G";
         final List<SubscriptionInfo> sub = setupMockSubscriptions(2);
-        doReturn(true).when(sInjector).isProviderModelEnabled(mContext);
         doReturn(sub.get(0)).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();
         setupGetIconConditions(sub.get(0).getSubscriptionId(), true, true,
                 true, ServiceState.STATE_IN_SERVICE);
@@ -450,7 +236,6 @@
                 Html.fromHtml("Connected / W+", Html.FROM_HTML_MODE_LEGACY);
         final String networkType = "W+";
         final List<SubscriptionInfo> sub = setupMockSubscriptions(2);
-        doReturn(true).when(sInjector).isProviderModelEnabled(mContext);
         doReturn(sub.get(0)).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();
         setupGetIconConditions(sub.get(0).getSubscriptionId(), false, true,
                 true, ServiceState.STATE_IN_SERVICE);
@@ -475,7 +260,6 @@
                 Html.fromHtml(dataOffSummary, Html.FROM_HTML_MODE_LEGACY);
         final String networkType = "5G";
         final List<SubscriptionInfo> sub = setupMockSubscriptions(2);
-        doReturn(true).when(sInjector).isProviderModelEnabled(mContext);
         doReturn(sub.get(0)).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();
         setupGetIconConditions(sub.get(0).getSubscriptionId(), false, false,
                 true, ServiceState.STATE_IN_SERVICE);
@@ -495,7 +279,6 @@
         final CharSequence expectedSummary = Html.fromHtml("5G", Html.FROM_HTML_MODE_LEGACY);
         final String networkType = "5G";
         final List<SubscriptionInfo> sub = setupMockSubscriptions(2);
-        doReturn(true).when(sInjector).isProviderModelEnabled(mContext);
         doReturn(sub.get(0)).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();
         setupGetIconConditions(sub.get(0).getSubscriptionId(), false, true,
                 true, ServiceState.STATE_IN_SERVICE);
@@ -512,7 +295,6 @@
     @Test
     @UiThreadTest
     public void displayPreference_providerAndNoSim_noPreference() {
-        doReturn(true).when(sInjector).isProviderModelEnabled(mContext);
         doReturn(null).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();
 
         mController.onResume();
@@ -531,7 +313,6 @@
         final TelephonyDisplayInfo telephonyDisplayInfo =
                 new TelephonyDisplayInfo(TelephonyManager.NETWORK_TYPE_UNKNOWN,
                         TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE);
-        doReturn(true).when(sInjector).isProviderModelEnabled(mContext);
         doReturn(sub.get(0)).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();
         setupGetIconConditions(sub.get(0).getSubscriptionId(), true, true,
                 true, ServiceState.STATE_IN_SERVICE);
@@ -557,7 +338,6 @@
         final TelephonyDisplayInfo telephonyDisplayInfo =
                 new TelephonyDisplayInfo(TelephonyManager.NETWORK_TYPE_UNKNOWN,
                         TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE);
-        doReturn(true).when(sInjector).isProviderModelEnabled(mContext);
         doReturn(sub.get(0)).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();
         setupGetIconConditions(sub.get(0).getSubscriptionId(), false, true,
                 true, ServiceState.STATE_IN_SERVICE);
@@ -584,7 +364,6 @@
         final TelephonyDisplayInfo telephonyDisplayInfo =
                 new TelephonyDisplayInfo(TelephonyManager.NETWORK_TYPE_UNKNOWN,
                         TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE);
-        doReturn(true).when(sInjector).isProviderModelEnabled(mContext);
         doReturn(sub.get(0)).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();
         setupGetIconConditions(sub.get(0).getSubscriptionId(), false, true,
                 false, ServiceState.STATE_OUT_OF_SERVICE);
@@ -603,7 +382,6 @@
     @UiThreadTest
     public void onAirplaneModeChanged_providerAndHasSim_noPreference() {
         setupMockSubscriptions(1);
-        doReturn(true).when(sInjector).isProviderModelEnabled(mContext);
         mController.onResume();
         mController.displayPreference(mPreferenceScreen);
         Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, 1);
@@ -618,7 +396,6 @@
     @UiThreadTest
     public void dataSubscriptionChanged_providerAndHasMultiSim_showSubId1Preference() {
         final List<SubscriptionInfo> sub = setupMockSubscriptions(2);
-        doReturn(true).when(sInjector).isProviderModelEnabled(mContext);
         doReturn(sub.get(0)).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();
         doReturn(sub).when(mSubscriptionManager).getAvailableSubscriptionInfoList();
         Intent intent = new Intent(TelephonyManager.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED);
@@ -637,7 +414,6 @@
     public void dataSubscriptionChanged_providerAndHasMultiSim_showSubId2Preference() {
         final List<SubscriptionInfo> sub = setupMockSubscriptions(2);
         final int subId = sub.get(0).getSubscriptionId();
-        doReturn(true).when(sInjector).isProviderModelEnabled(mContext);
         doReturn(sub.get(0)).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();
         doReturn(sub).when(mSubscriptionManager).getAvailableSubscriptionInfoList();
         Intent intent = new Intent(TelephonyManager.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED);
@@ -662,7 +438,6 @@
     @UiThreadTest
     public void getIcon_cellularIsActive_iconColorIsAccentDefaultColor() {
         final List<SubscriptionInfo> sub = setupMockSubscriptions(1);
-        doReturn(true).when(sInjector).isProviderModelEnabled(mContext);
         doReturn(sub.get(0)).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();
         Drawable icon = mock(Drawable.class);
         when(mTelephonyManager.isDataEnabled()).thenReturn(true);
@@ -681,7 +456,6 @@
     public void getIcon_dataStateConnectedAndMobileDataOn_iconIsSignalIcon() {
         final List<SubscriptionInfo> subs = setupMockSubscriptions(1);
         final int subId = subs.get(0).getSubscriptionId();
-        doReturn(true).when(sInjector).isProviderModelEnabled(mContext);
         doReturn(subs.get(0)).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();
         Drawable icon = mock(Drawable.class);
         when(mTelephonyManager.isDataEnabled()).thenReturn(true);
@@ -700,7 +474,6 @@
     public void getIcon_voiceInServiceAndMobileDataOff_iconIsSignalIcon() {
         final List<SubscriptionInfo> subs = setupMockSubscriptions(1);
         final int subId = subs.get(0).getSubscriptionId();
-        doReturn(true).when(sInjector).isProviderModelEnabled(mContext);
         doReturn(subs.get(0)).when(mSubscriptionManager).getDefaultDataSubscriptionInfo();
         Drawable icon = mock(Drawable.class);
         when(mTelephonyManager.isDataEnabled()).thenReturn(false);
@@ -807,40 +580,6 @@
         return infos;
     }
 
-    /**
-     * Helper method to set the signal strength returned for a mock subscription
-     * @param subs The list of subscriptions
-     * @param index The index in of the subscription in |subs| to change
-     * @param level The signal strength level to return for the subscription. Pass -1 to force
-     *              return of a null SignalStrength object for the subscription.
-     */
-    private void setMockSubSignalStrength(List<SubscriptionInfo> subs, int index, int level) {
-        final int subId =  subs.get(index).getSubscriptionId();
-        doReturn(mTelephonyManagerForSub).when(mTelephonyManager).createForSubscriptionId(subId);
-        if (level == -1) {
-            when(mTelephonyManagerForSub.getSignalStrength()).thenReturn(null);
-        } else {
-            final SignalStrength signalStrength = mock(SignalStrength.class);
-            doReturn(signalStrength).when(mTelephonyManagerForSub).getSignalStrength();
-            when(signalStrength.getLevel()).thenReturn(level);
-        }
-    }
-
-    private void initializeMethod(boolean isSubscriptionCanBeDisplayed,
-            int defaultSmsSubscriptionId, int defaultVoiceSubscriptionId,
-            int defaultDataSubscriptionId, boolean isActiveCellularNetwork,
-            boolean isProviderModelEnabled) {
-        doReturn(isSubscriptionCanBeDisplayed)
-                .when(sInjector).canSubscriptionBeDisplayed(mContext, eq(anyInt()));
-        doReturn(defaultSmsSubscriptionId).when(sInjector).getDefaultSmsSubscriptionId();
-        doReturn(defaultVoiceSubscriptionId).when(sInjector).getDefaultVoiceSubscriptionId();
-        doReturn(defaultDataSubscriptionId).when(sInjector).getDefaultDataSubscriptionId();
-        doReturn(isActiveCellularNetwork).when(sInjector).isActiveCellularNetwork(mContext);
-        doReturn(isProviderModelEnabled).when(sInjector).isProviderModelEnabled(mContext);
-        doReturn(mock(Drawable.class))
-                .when(sInjector).getIcon(any(), anyInt(), anyInt(), eq(false));
-    }
-
     private static class FakeSubscriptionsPreferenceController
             extends SubscriptionsPreferenceController {