Merge "[Settings] eSIM transfer: MobileNetworkListFragment"
diff --git a/res/drawable/ic_sim_card_download.xml b/res/drawable/ic_sim_card_download.xml
new file mode 100644
index 0000000..1da4bf3
--- /dev/null
+++ b/res/drawable/ic_sim_card_download.xml
@@ -0,0 +1,27 @@
+<!--
+  Copyright (C) 2022 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.
+  -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+        android:width="24dp"
+        android:height="24dp"
+        android:viewportWidth="24"
+        android:viewportHeight="24"
+        android:tint="?android:attr/colorControlNormal"
+>
+    <path android:fillColor="@android:color/white"
+          android:pathData="M18,2h-8L4,8v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2V4C20,2.9 19.1,2 18,2zM18,4v16H6V8.83L10.83,4H18z"/>
+    <path android:fillColor="@android:color/white"
+          android:pathData="M16,13l-4,4l-4,-4l1.41,-1.41L11,13.17V9.02L13,9v4.17l1.59,-1.59L16,13z"/>
+</vector>
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 1bdac77..eb8f75b 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -10248,8 +10248,8 @@
     <string name="subscription_available">Available</string>
 
     <!-- Title of item shown at the bottom of the page listing multiple mobile service
-         subscriptions; tapping it leads to a UI to add more [CHAR LIMIT=40] -->
-    <string name="mobile_network_list_add_more">Add more</string>
+         subscriptions; tapping it leads to a UI to add more SIMs [CHAR LIMIT=40] -->
+    <string name="mobile_network_list_add_more">Add SIM</string>
     <!-- Summary for an item in the page listing multiple mobile service subscriptions, indicating
          that service is active and is tied to a physical SIM card [CHAR LIMIT=40] -->
     <string name="mobile_network_active_sim">Active / SIM</string>
diff --git a/res/xml/network_provider_sims_list.xml b/res/xml/network_provider_sims_list.xml
index 0f866f1..b21341e 100644
--- a/res/xml/network_provider_sims_list.xml
+++ b/res/xml/network_provider_sims_list.xml
@@ -21,20 +21,13 @@
 
     <PreferenceCategory
         android:key="provider_model_sim_category"
-        android:title="@string/sim_category_title"
+        android:title="@string/summary_placeholder"
+        android:layout="@layout/preference_category_no_label"
         android:order="20"
         settings:controller="com.android.settings.network.NetworkProviderSimsCategoryController"/>
 
-    <PreferenceCategory
-        android:key="provider_model_downloaded_sim_category"
-        android:title="@string/downloaded_sim_category_title"
-        android:order="25"
-        settings:controller=
-            "com.android.settings.network.NetworkProviderDownloadedSimsCategoryController"
-        settings:allowDividerAbove="true"/>
-
     <com.android.settingslib.RestrictedPreference
-        android:key="add_more"
+        android:key="add_sim"
         settings:isPreferenceVisible="false"
         settings:userRestriction="no_config_mobile_networks"
         settings:useAdminDisabledSummary="true"
diff --git a/src/com/android/settings/network/MobileNetworkListController.java b/src/com/android/settings/network/MobileNetworkListController.java
deleted file mode 100644
index fd40c8f..0000000
--- a/src/com/android/settings/network/MobileNetworkListController.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Copyright (C) 2019 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.network;
-
-import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
-
-import static androidx.lifecycle.Lifecycle.Event.ON_PAUSE;
-import static androidx.lifecycle.Lifecycle.Event.ON_RESUME;
-
-import android.content.Context;
-import android.content.Intent;
-import android.provider.Settings;
-import android.telephony.SubscriptionInfo;
-import android.telephony.SubscriptionManager;
-import android.util.ArrayMap;
-
-import androidx.lifecycle.Lifecycle;
-import androidx.lifecycle.LifecycleObserver;
-import androidx.lifecycle.OnLifecycleEvent;
-import androidx.preference.Preference;
-import androidx.preference.PreferenceScreen;
-
-import com.android.internal.annotations.VisibleForTesting;
-import com.android.settings.R;
-import com.android.settings.network.telephony.MobileNetworkUtils;
-import com.android.settingslib.core.AbstractPreferenceController;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * This populates the entries on a page which lists all available mobile subscriptions. Each entry
- * has the name of the subscription with some subtext giving additional detail, and clicking on the
- * entry brings you to a details page for that network.
- *
- * @deprecated This class will be removed in Android U, use
- * {@link NetworkProviderSimsCategoryController} and
- * {@link NetworkProviderDownloadedSimsCategoryController} instead.
- */
-@Deprecated
-public class MobileNetworkListController extends AbstractPreferenceController implements
-        LifecycleObserver, SubscriptionsChangeListener.SubscriptionsChangeListenerClient {
-    private static final String TAG = "MobileNetworkListCtlr";
-
-    @VisibleForTesting
-    static final String KEY_ADD_MORE = "add_more";
-
-    private SubscriptionManager mSubscriptionManager;
-    private SubscriptionsChangeListener mChangeListener;
-    private PreferenceScreen mPreferenceScreen;
-    private Map<Integer, Preference> mPreferences;
-
-    public MobileNetworkListController(Context context, Lifecycle lifecycle) {
-        super(context);
-        mSubscriptionManager = context.getSystemService(SubscriptionManager.class);
-        mChangeListener = new SubscriptionsChangeListener(context, this);
-        mPreferences = new ArrayMap<>();
-        lifecycle.addObserver(this);
-    }
-
-    @OnLifecycleEvent(ON_RESUME)
-    public void onResume() {
-        mChangeListener.start();
-        update();
-    }
-
-    @OnLifecycleEvent(ON_PAUSE)
-    public void onPause() {
-        mChangeListener.stop();
-    }
-
-    @Override
-    public void displayPreference(PreferenceScreen screen) {
-        super.displayPreference(screen);
-        mPreferenceScreen = screen;
-        mPreferenceScreen.findPreference(KEY_ADD_MORE).setVisible(
-                MobileNetworkUtils.showEuiccSettings(mContext));
-        update();
-    }
-
-    private void update() {
-        if (mPreferenceScreen == null) {
-            return;
-        }
-
-        // Since we may already have created some preferences previously, we first grab the list of
-        // those, then go through the current available subscriptions making sure they are all
-        // present in the screen, and finally remove any now-outdated ones.
-        final Map<Integer, Preference> existingPreferences = mPreferences;
-        mPreferences = new ArrayMap<>();
-
-        final List<SubscriptionInfo> subscriptions = SubscriptionUtil.getAvailableSubscriptions(
-                mContext);
-        for (SubscriptionInfo info : subscriptions) {
-            final int subId = info.getSubscriptionId();
-            Preference pref = existingPreferences.remove(subId);
-            if (pref == null) {
-                pref = new Preference(mPreferenceScreen.getContext());
-                mPreferenceScreen.addPreference(pref);
-            }
-            final CharSequence displayName = SubscriptionUtil.getUniqueSubscriptionDisplayName(
-                    info, mContext);
-            pref.setTitle(displayName);
-
-            if (info.isEmbedded()) {
-                if (mSubscriptionManager.isActiveSubscriptionId(subId)) {
-                    pref.setSummary(R.string.mobile_network_active_esim);
-                } else {
-                    pref.setSummary(R.string.mobile_network_inactive_esim);
-                }
-            } else {
-                if (mSubscriptionManager.isActiveSubscriptionId(subId)) {
-                    pref.setSummary(R.string.mobile_network_active_sim);
-                } else if (SubscriptionUtil.showToggleForPhysicalSim(mSubscriptionManager)) {
-                    pref.setSummary(mContext.getString(R.string.mobile_network_inactive_sim));
-                } else {
-                    pref.setSummary(mContext.getString(R.string.mobile_network_tap_to_activate,
-                            displayName));
-                }
-            }
-
-            pref.setOnPreferenceClickListener(clickedPref -> {
-                if (!info.isEmbedded() && !mSubscriptionManager.isActiveSubscriptionId(subId)
-                        && !SubscriptionUtil.showToggleForPhysicalSim(mSubscriptionManager)) {
-                    SubscriptionUtil.startToggleSubscriptionDialogActivity(mContext, subId, true);
-                } else {
-                    final Intent intent = new Intent(Settings.ACTION_NETWORK_OPERATOR_SETTINGS);
-                    intent.setPackage(SETTINGS_PACKAGE_NAME);
-                    intent.putExtra(Settings.EXTRA_SUB_ID, info.getSubscriptionId());
-                    mContext.startActivity(intent);
-                }
-                return true;
-            });
-            mPreferences.put(subId, pref);
-        }
-        for (Preference pref : existingPreferences.values()) {
-            mPreferenceScreen.removePreference(pref);
-        }
-    }
-
-    @Override
-    public boolean isAvailable() {
-        return true;
-    }
-
-    @Override
-    public String getPreferenceKey() {
-        return null;
-    }
-
-    @Override
-    public void onAirplaneModeChanged(boolean airplaneModeEnabled) {
-    }
-
-    @Override
-    public void onSubscriptionsChanged() {
-        update();
-    }
-}
diff --git a/src/com/android/settings/network/MobileNetworkListFragment.java b/src/com/android/settings/network/MobileNetworkListFragment.java
index c84e465..d7d241a 100644
--- a/src/com/android/settings/network/MobileNetworkListFragment.java
+++ b/src/com/android/settings/network/MobileNetworkListFragment.java
@@ -26,6 +26,7 @@
 
 import com.android.settings.R;
 import com.android.settings.dashboard.DashboardFragment;
+import com.android.settings.network.telephony.MobileNetworkUtils;
 import com.android.settings.search.BaseSearchIndexProvider;
 import com.android.settingslib.core.AbstractPreferenceController;
 import com.android.settingslib.search.SearchIndexable;
@@ -38,9 +39,7 @@
     private static final String LOG_TAG = "NetworkListFragment";
 
     static final String KEY_PREFERENCE_CATEGORY_SIM = "provider_model_sim_category";
-    @VisibleForTesting
-    static final String KEY_PREFERENCE_CATEGORY_DOWNLOADED_SIM =
-            "provider_model_downloaded_sim_category";
+    private static final String KEY_ADD_SIM = "add_sim";
 
     @Override
     public void onResume() {
@@ -50,6 +49,8 @@
         if (prefListView != null) {
             prefListView.setItemAnimator(null);
         }
+
+        findPreference(KEY_ADD_SIM).setVisible(MobileNetworkUtils.showEuiccSettings(getContext()));
     }
 
     @Override
@@ -79,10 +80,6 @@
                 new NetworkProviderSimsCategoryController(context, KEY_PREFERENCE_CATEGORY_SIM,
                         getSettingsLifecycle(), this);
         controllers.add(simCategoryPrefCtrl);
-        NetworkProviderDownloadedSimsCategoryController downloadedSimsCategoryCtrl =
-                new NetworkProviderDownloadedSimsCategoryController(context,
-                        KEY_PREFERENCE_CATEGORY_DOWNLOADED_SIM, getSettingsLifecycle(), this);
-        controllers.add(downloadedSimsCategoryCtrl);
 
         return controllers;
     }
diff --git a/src/com/android/settings/network/NetworkProviderDownloadedSimListController.java b/src/com/android/settings/network/NetworkProviderDownloadedSimListController.java
deleted file mode 100644
index 421a854..0000000
--- a/src/com/android/settings/network/NetworkProviderDownloadedSimListController.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * Copyright (C) 2021 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.network;
-
-import static androidx.lifecycle.Lifecycle.Event.ON_PAUSE;
-import static androidx.lifecycle.Lifecycle.Event.ON_RESUME;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.provider.Settings;
-import android.telephony.SubscriptionManager;
-import android.telephony.TelephonyManager;
-import android.util.ArrayMap;
-import android.util.Log;
-
-import androidx.annotation.VisibleForTesting;
-import androidx.lifecycle.LifecycleOwner;
-import androidx.lifecycle.OnLifecycleEvent;
-import androidx.preference.Preference;
-import androidx.preference.PreferenceCategory;
-import androidx.preference.PreferenceScreen;
-
-import com.android.settings.R;
-import com.android.settings.network.telephony.MobileNetworkUtils;
-import com.android.settingslib.core.AbstractPreferenceController;
-import com.android.settingslib.core.lifecycle.Lifecycle;
-import com.android.settingslib.core.lifecycle.LifecycleObserver;
-import com.android.settingslib.mobile.dataservice.DataServiceUtils;
-import com.android.settingslib.mobile.dataservice.MobileNetworkInfoEntity;
-import com.android.settingslib.mobile.dataservice.SubscriptionInfoEntity;
-import com.android.settingslib.mobile.dataservice.UiccInfoEntity;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-public class NetworkProviderDownloadedSimListController extends
-        AbstractPreferenceController implements
-        LifecycleObserver, MobileNetworkRepository.MobileNetworkCallback {
-    private static final String TAG = "NetworkProviderDownloadedSimListCtrl";
-    private static final String KEY_PREFERENCE_CATEGORY_DOWNLOADED_SIM =
-            "provider_model_downloaded_sim_category";
-    private static final String KEY_PREFERENCE_DOWNLOADED_SIM =
-            "provider_model_downloaded_sim_list";
-    private static final String KEY_ADD_MORE = "add_more";
-
-    private SubscriptionManager mSubscriptionManager;
-    private PreferenceCategory mPreferenceCategory;
-    private Map<Integer, Preference> mPreferences;
-    private LifecycleOwner mLifecycleOwner;
-    private MobileNetworkRepository mMobileNetworkRepository;
-    private List<SubscriptionInfoEntity> mSubInfoEntityList = new ArrayList<>();
-
-    public NetworkProviderDownloadedSimListController(Context context, Lifecycle lifecycle,
-            LifecycleOwner lifecycleOwner) {
-        super(context);
-        mSubscriptionManager = context.getSystemService(SubscriptionManager.class);
-        mPreferences = new ArrayMap<>();
-        mLifecycleOwner = lifecycleOwner;
-        mMobileNetworkRepository = MobileNetworkRepository.create(context, this);
-        lifecycle.addObserver(this);
-    }
-
-    @OnLifecycleEvent(ON_RESUME)
-    public void onResume() {
-        mMobileNetworkRepository.addRegister(mLifecycleOwner);
-        update();
-    }
-
-    @OnLifecycleEvent(ON_PAUSE)
-    public void onPause() {
-        mMobileNetworkRepository.removeRegister();
-    }
-
-    @Override
-    public void displayPreference(PreferenceScreen screen) {
-        super.displayPreference(screen);
-        mPreferenceCategory = screen.findPreference(KEY_PREFERENCE_CATEGORY_DOWNLOADED_SIM);
-        screen.findPreference(KEY_ADD_MORE).setVisible(
-                MobileNetworkUtils.showEuiccSettings(mContext));
-        update();
-    }
-
-    private void update() {
-        if (mPreferenceCategory == null) {
-            return;
-        }
-
-        final Map<Integer, Preference> existingPreferences = mPreferences;
-        mPreferences = new ArrayMap<>();
-
-        final List<SubscriptionInfoEntity> subscriptions = getAvailableDownloadedSubscriptions();
-        for (SubscriptionInfoEntity info : subscriptions) {
-            final int subId = Integer.parseInt(info.subId);
-            Preference pref = existingPreferences.remove(subId);
-            if (pref == null) {
-                pref = new Preference(mPreferenceCategory.getContext());
-                mPreferenceCategory.addPreference(pref);
-            }
-            final CharSequence displayName = info.uniqueName;
-            pref.setTitle(displayName);
-            pref.setSummary(getSummary(info));
-
-            pref.setOnPreferenceClickListener(clickedPref -> {
-                MobileNetworkUtils.launchMobileNetworkSettings(mContext, info);
-                return true;
-            });
-            mPreferences.put(subId, pref);
-        }
-        for (Preference pref : existingPreferences.values()) {
-            mPreferenceCategory.removePreference(pref);
-        }
-    }
-
-    public CharSequence getSummary(SubscriptionInfoEntity subInfo) {
-        if (subInfo.isActiveSubscriptionId) {
-            CharSequence config = subInfo.defaultSimConfig;
-            CharSequence summary = mContext.getResources().getString(
-                    R.string.sim_category_active_sim);
-            if (config == "") {
-                return summary;
-            } else {
-                final StringBuilder activeSim = new StringBuilder();
-                activeSim.append(summary).append(config);
-                return activeSim;
-            }
-        } else {
-            return mContext.getString(R.string.sim_category_inactive_sim);
-        }
-    }
-
-    @Override
-    public boolean isAvailable() {
-        if (!getAvailableDownloadedSubscriptions().isEmpty()) {
-            return true;
-        }
-        return false;
-    }
-
-    @Override
-    public String getPreferenceKey() {
-        return KEY_PREFERENCE_DOWNLOADED_SIM;
-    }
-
-    @VisibleForTesting
-    protected List<SubscriptionInfoEntity> getAvailableDownloadedSubscriptions() {
-        List<SubscriptionInfoEntity> subList = new ArrayList<>();
-        for (SubscriptionInfoEntity info : mSubInfoEntityList) {
-            if (info.isEmbedded) {
-                subList.add(info);
-            }
-        }
-        return subList;
-    }
-
-    @Override
-    public void updateState(Preference preference) {
-        super.updateState(preference);
-        refreshSummary(mPreferenceCategory);
-        update();
-    }
-
-    @Override
-    public void onAirplaneModeChanged(boolean airplaneModeEnabled) {
-    }
-
-    @Override
-    public void onAvailableSubInfoChanged(List<SubscriptionInfoEntity> subInfoEntityList) {
-        if (DataServiceUtils.shouldUpdateEntityList(mSubInfoEntityList, subInfoEntityList)) {
-            mSubInfoEntityList = subInfoEntityList;
-            mPreferenceCategory.setVisible(isAvailable());
-            update();
-        }
-    }
-
-    @Override
-    public void onActiveSubInfoChanged(List<SubscriptionInfoEntity> activeSubInfoList) {
-    }
-
-    @Override
-    public void onAllUiccInfoChanged(List<UiccInfoEntity> uiccInfoEntityList) {
-    }
-
-    @Override
-    public void onAllMobileNetworkInfoChanged(
-            List<MobileNetworkInfoEntity> mobileNetworkInfoEntityList) {
-    }
-}
diff --git a/src/com/android/settings/network/NetworkProviderDownloadedSimsCategoryController.java b/src/com/android/settings/network/NetworkProviderDownloadedSimsCategoryController.java
deleted file mode 100644
index eaa92e2..0000000
--- a/src/com/android/settings/network/NetworkProviderDownloadedSimsCategoryController.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package com.android.settings.network;
-
-import android.content.Context;
-import android.util.Log;
-
-import androidx.lifecycle.LifecycleOwner;
-import androidx.preference.Preference;
-import androidx.preference.PreferenceCategory;
-import androidx.preference.PreferenceScreen;
-
-import com.android.settings.R;
-import com.android.settings.widget.PreferenceCategoryController;
-import com.android.settingslib.core.lifecycle.Lifecycle;
-import com.android.settingslib.core.lifecycle.LifecycleObserver;
-
-public class NetworkProviderDownloadedSimsCategoryController extends
-        PreferenceCategoryController implements LifecycleObserver {
-
-    private static final String LOG_TAG = "NetworkProviderDownloadedSimsCategoryController";
-    private static final String KEY_PREFERENCE_CATEGORY_DOWNLOADED_SIM =
-            "provider_model_downloaded_sim_category";
-    private PreferenceCategory mPreferenceCategory;
-    private NetworkProviderDownloadedSimListController mNetworkProviderDownloadedSimListController;
-
-    public NetworkProviderDownloadedSimsCategoryController(Context context, String key,
-            Lifecycle lifecycle, LifecycleOwner lifecycleOwner) {
-        super(context, key);
-        mNetworkProviderDownloadedSimListController =
-                new NetworkProviderDownloadedSimListController(mContext, lifecycle, lifecycleOwner);
-    }
-
-    @Override
-    public int getAvailabilityStatus() {
-        if (mNetworkProviderDownloadedSimListController == null
-                || !mNetworkProviderDownloadedSimListController.isAvailable()) {
-            return CONDITIONALLY_UNAVAILABLE;
-        } else {
-            return AVAILABLE;
-        }
-    }
-
-    @Override
-    public void displayPreference(PreferenceScreen screen) {
-        super.displayPreference(screen);
-        mNetworkProviderDownloadedSimListController.displayPreference(screen);
-        mPreferenceCategory = screen.findPreference(
-                KEY_PREFERENCE_CATEGORY_DOWNLOADED_SIM);
-        if (mPreferenceCategory == null) {
-            Log.d(LOG_TAG, "displayPreference(), Can not find the category.");
-            return;
-        }
-        mPreferenceCategory.setVisible(isAvailable());
-    }
-
-    @Override
-    public void updateState(Preference preference) {
-        super.updateState(preference);
-        if (mPreferenceCategory == null) {
-            Log.d(LOG_TAG, "updateState(), Can not find the category.");
-            return;
-        }
-        int count = mPreferenceCategory.getPreferenceCount();
-        String title = mContext.getString(count > 1
-                ? R.string.downloaded_sims_category_title
-                : R.string.downloaded_sim_category_title);
-        mPreferenceCategory.setTitle(title);
-    }
-}
diff --git a/src/com/android/settings/network/NetworkProviderSimListController.java b/src/com/android/settings/network/NetworkProviderSimListController.java
index 66b2d92..0e4fec5 100644
--- a/src/com/android/settings/network/NetworkProviderSimListController.java
+++ b/src/com/android/settings/network/NetworkProviderSimListController.java
@@ -19,13 +19,9 @@
 import static androidx.lifecycle.Lifecycle.Event.ON_PAUSE;
 import static androidx.lifecycle.Lifecycle.Event.ON_RESUME;
 
-import android.content.BroadcastReceiver;
 import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.provider.Settings;
+import android.graphics.drawable.Drawable;
 import android.telephony.SubscriptionManager;
-import android.telephony.TelephonyManager;
 import android.util.ArrayMap;
 import android.util.Log;
 
@@ -38,6 +34,7 @@
 
 import com.android.settings.R;
 import com.android.settings.network.telephony.MobileNetworkUtils;
+import com.android.settingslib.RestrictedPreference;
 import com.android.settingslib.core.AbstractPreferenceController;
 import com.android.settingslib.core.lifecycle.Lifecycle;
 import com.android.settingslib.core.lifecycle.LifecycleObserver;
@@ -58,7 +55,7 @@
 
     private SubscriptionManager mSubscriptionManager;
     private PreferenceCategory mPreferenceCategory;
-    private Map<Integer, Preference> mPreferences;
+    private Map<Integer, RestrictedPreference> mPreferences;
     private LifecycleOwner mLifecycleOwner;
     private MobileNetworkRepository mMobileNetworkRepository;
     private List<SubscriptionInfoEntity> mSubInfoEntityList = new ArrayList<>();
@@ -96,25 +93,27 @@
             return;
         }
 
-        final Map<Integer, Preference> existingPreferences = mPreferences;
+        final Map<Integer, RestrictedPreference> existingPreferences = mPreferences;
         mPreferences = new ArrayMap<>();
 
         final List<SubscriptionInfoEntity> subscriptions = getAvailablePhysicalSubscriptions();
         for (SubscriptionInfoEntity info : subscriptions) {
             final int subId = Integer.parseInt(info.subId);
-            Preference pref = existingPreferences.remove(subId);
+            RestrictedPreference pref = existingPreferences.remove(subId);
             if (pref == null) {
-                pref = new Preference(mPreferenceCategory.getContext());
+                pref = new RestrictedPreference(mPreferenceCategory.getContext());
                 mPreferenceCategory.addPreference(pref);
             }
             final CharSequence displayName = info.uniqueName;
             pref.setTitle(displayName);
             boolean isActiveSubscriptionId = info.isActiveSubscriptionId;
             pref.setSummary(getSummary(info, displayName));
-
+            final Drawable drawable = mContext.getDrawable(
+                    info.isEmbedded ? R.drawable.ic_sim_card_download : R.drawable.ic_sim_card);
+            pref.setIcon(drawable);
             pref.setOnPreferenceClickListener(clickedPref -> {
-                if (!isActiveSubscriptionId && !SubscriptionUtil.showToggleForPhysicalSim(
-                        mSubscriptionManager)) {
+                if (!info.isEmbedded && !isActiveSubscriptionId
+                        && !SubscriptionUtil.showToggleForPhysicalSim(mSubscriptionManager)) {
                     SubscriptionUtil.startToggleSubscriptionDialogActivity(mContext, subId,
                             true);
                 } else {
@@ -124,7 +123,7 @@
             });
             mPreferences.put(subId, pref);
         }
-        for (Preference pref : existingPreferences.values()) {
+        for (RestrictedPreference pref : existingPreferences.values()) {
             mPreferenceCategory.removePreference(pref);
         }
     }
@@ -141,10 +140,13 @@
                 activeSim.append(summary).append(config);
                 return activeSim;
             }
-        } else if (SubscriptionUtil.showToggleForPhysicalSim(mSubscriptionManager)) {
-            return mContext.getString(R.string.sim_category_inactive_sim);
         } else {
-            return mContext.getString(R.string.mobile_network_tap_to_activate, displayName);
+            if (!subInfo.isEmbedded && !SubscriptionUtil.showToggleForPhysicalSim(
+                    mSubscriptionManager)) {
+                return mContext.getString(R.string.mobile_network_tap_to_activate, displayName);
+            } else {
+                return mContext.getString(R.string.sim_category_inactive_sim);
+            }
         }
     }
 
@@ -160,9 +162,7 @@
     protected List<SubscriptionInfoEntity> getAvailablePhysicalSubscriptions() {
         List<SubscriptionInfoEntity> subList = new ArrayList<>();
         for (SubscriptionInfoEntity info : mSubInfoEntityList) {
-            if (!info.isEmbedded) {
-                subList.add(info);
-            }
+            subList.add(info);
         }
         return subList;
     }
diff --git a/src/com/android/settings/network/NetworkProviderSimsCategoryController.java b/src/com/android/settings/network/NetworkProviderSimsCategoryController.java
index 3c93849..f983e62 100644
--- a/src/com/android/settings/network/NetworkProviderSimsCategoryController.java
+++ b/src/com/android/settings/network/NetworkProviderSimsCategoryController.java
@@ -64,18 +64,4 @@
         }
         mPreferenceCategory.setVisible(isAvailable());
     }
-
-    @Override
-    public void updateState(Preference preference) {
-        super.updateState(preference);
-        if (mPreferenceCategory == null) {
-            Log.d(LOG_TAG, "updateState(), Can not find the category.");
-            return;
-        }
-        int count = mPreferenceCategory.getPreferenceCount();
-        String title = mContext.getString(count > 1
-                ? R.string.provider_network_settings_title
-                : R.string.sim_category_title);
-        mPreferenceCategory.setTitle(title);
-    }
 }
diff --git a/tests/robotests/src/com/android/settings/network/MobileNetworkListControllerTest.java b/tests/robotests/src/com/android/settings/network/MobileNetworkListControllerTest.java
deleted file mode 100644
index 355dda8..0000000
--- a/tests/robotests/src/com/android/settings/network/MobileNetworkListControllerTest.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * Copyright (C) 2019 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.network;
-
-import static android.provider.Settings.EXTRA_SUB_ID;
-import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.clearInvocations;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import android.content.Context;
-import android.content.Intent;
-import android.provider.Settings;
-import android.telephony.SubscriptionInfo;
-import android.telephony.SubscriptionManager;
-import android.telephony.TelephonyManager;
-import android.telephony.euicc.EuiccManager;
-
-import androidx.lifecycle.Lifecycle;
-import androidx.preference.Preference;
-import androidx.preference.PreferenceScreen;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-
-import java.util.Arrays;
-
-@RunWith(RobolectricTestRunner.class)
-public class MobileNetworkListControllerTest {
-    @Mock
-    private TelephonyManager mTelephonyManager;
-    @Mock
-    private EuiccManager mEuiccManager;
-    @Mock
-    private SubscriptionManager mSubscriptionManager;
-
-    @Mock
-    private Lifecycle mLifecycle;
-
-    @Mock
-    private PreferenceScreen mPreferenceScreen;
-
-    private Context mContext;
-    private MobileNetworkListController mController;
-    private Preference mAddMorePreference;
-
-    @Before
-    public void setUp() {
-        MockitoAnnotations.initMocks(this);
-        mContext = spy(RuntimeEnvironment.application);
-        when(mContext.getSystemService(TelephonyManager.class)).thenReturn(mTelephonyManager);
-        when(mContext.getSystemService(EuiccManager.class)).thenReturn(mEuiccManager);
-        when(mContext.getSystemService(SubscriptionManager.class)).thenReturn(mSubscriptionManager);
-        Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.EUICC_PROVISIONED, 1);
-        when(mPreferenceScreen.getContext()).thenReturn(mContext);
-        mAddMorePreference = new Preference(mContext);
-        when(mPreferenceScreen.findPreference(MobileNetworkListController.KEY_ADD_MORE)).thenReturn(
-                mAddMorePreference);
-        mController = new MobileNetworkListController(mContext, mLifecycle);
-    }
-
-    @After
-    public void tearDown() {
-        SubscriptionUtil.setAvailableSubscriptionsForTesting(null);
-    }
-
-    @Test
-    @Ignore
-    public void displayPreference_noSubscriptions_noCrash() {
-        mController.displayPreference(mPreferenceScreen);
-        mController.onResume();
-    }
-
-    @Test
-    @Ignore
-    public void displayPreference_eSimNotSupported_addMoreLinkNotVisible() {
-        when(mEuiccManager.isEnabled()).thenReturn(false);
-        mController.displayPreference(mPreferenceScreen);
-        mController.onResume();
-        assertThat(mAddMorePreference.isVisible()).isFalse();
-    }
-
-    @Test
-    @Ignore
-    public void displayPreference_eSimSupported_addMoreLinkIsVisible() {
-        when(mEuiccManager.isEnabled()).thenReturn(true);
-        when(mTelephonyManager.getNetworkCountryIso()).thenReturn("");
-        mController.displayPreference(mPreferenceScreen);
-        mController.onResume();
-        assertThat(mAddMorePreference.isVisible()).isTrue();
-    }
-
-    @Test
-    @Ignore
-    public void displayPreference_twoSubscriptions_correctlySetup() {
-        final SubscriptionInfo sub1 = createMockSubscription(1, "sub1");
-        final SubscriptionInfo sub2 = createMockSubscription(2, "sub2");
-        doReturn(true).when(mSubscriptionManager).isActiveSubscriptionId(eq(1));
-        doReturn(true).when(mSubscriptionManager).isActiveSubscriptionId(eq(2));
-        SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(sub1, sub2));
-        mController.displayPreference(mPreferenceScreen);
-        mController.onResume();
-
-        // Check that the preferences get created with the correct titles.
-        final ArgumentCaptor<Preference> preferenceCaptor = ArgumentCaptor.forClass(
-                Preference.class);
-        verify(mPreferenceScreen, times(2)).addPreference(preferenceCaptor.capture());
-        final Preference pref1 = preferenceCaptor.getAllValues().get(0);
-        final Preference pref2 = preferenceCaptor.getAllValues().get(1);
-        assertThat(pref1.getTitle()).isEqualTo("sub1");
-        assertThat(pref2.getTitle()).isEqualTo("sub2");
-
-        // Check that the onclick listeners are setup to fire with the right subscription id.
-        final ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class);
-        doNothing().when(mContext).startActivity(intentCaptor.capture());
-        pref1.getOnPreferenceClickListener().onPreferenceClick(pref1);
-        pref2.getOnPreferenceClickListener().onPreferenceClick(pref2);
-        final Intent intent1 = intentCaptor.getAllValues().get(0);
-        final Intent intent2 = intentCaptor.getAllValues().get(1);
-        assertThat(intent1.getIntExtra(EXTRA_SUB_ID, INVALID_SUBSCRIPTION_ID)).isEqualTo(1);
-        assertThat(intent2.getIntExtra(EXTRA_SUB_ID, INVALID_SUBSCRIPTION_ID)).isEqualTo(2);
-    }
-
-    @Test
-    @Ignore
-    public void displayPreference_oneActiveESimOneInactivePSim_correctlySetup() {
-        final SubscriptionInfo sub1 = createMockSubscription(1, "sub1");
-        final SubscriptionInfo sub2 = createMockSubscription(2, "sub2");
-        when(sub1.isEmbedded()).thenReturn(true);
-        doReturn(true).when(mSubscriptionManager).isActiveSubscriptionId(eq(1));
-        doReturn(false).when(mSubscriptionManager).isActiveSubscriptionId(eq(2));
-        doReturn(false).when(mSubscriptionManager).canDisablePhysicalSubscription();
-
-        when(sub2.isEmbedded()).thenReturn(false);
-        SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(sub1, sub2));
-
-        mController.displayPreference(mPreferenceScreen);
-        mController.onResume();
-
-        // Check that the preferences get created with the correct summaries.
-        final ArgumentCaptor<Preference> preferenceCaptor = ArgumentCaptor.forClass(
-                Preference.class);
-        verify(mPreferenceScreen, times(2)).addPreference(preferenceCaptor.capture());
-        Preference pref1 = preferenceCaptor.getAllValues().get(0);
-        Preference pref2 = preferenceCaptor.getAllValues().get(1);
-        assertThat(pref1.getSummary()).isEqualTo("Active / Downloaded SIM");
-        assertThat(pref2.getSummary()).isEqualTo("Tap to activate sub2");
-
-        pref2.getOnPreferenceClickListener().onPreferenceClick(pref2);
-        verify(mSubscriptionManager).setSubscriptionEnabled(eq(2), eq(true));
-
-        // If disabling pSIM is allowed, summary of inactive pSIM should be different.
-        clearInvocations(mPreferenceScreen);
-        clearInvocations(mSubscriptionManager);
-        doReturn(true).when(mSubscriptionManager).canDisablePhysicalSubscription();
-        mController.onResume();
-        pref2 = preferenceCaptor.getAllValues().get(1);
-        assertThat(pref2.getSummary()).isEqualTo("Inactive / SIM");
-    }
-
-    @Test
-    @Ignore
-    public void onSubscriptionsChanged_twoSubscriptionsOneChangesName_preferenceUpdated() {
-        final SubscriptionInfo sub1 = createMockSubscription(1, "sub1");
-        final SubscriptionInfo sub2 = createMockSubscription(2, "sub2");
-        SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(sub1, sub2));
-        mController.displayPreference(mPreferenceScreen);
-        mController.onResume();
-        final ArgumentCaptor<Preference> preferenceCaptor = ArgumentCaptor.forClass(
-                Preference.class);
-        verify(mPreferenceScreen, times(2)).addPreference(preferenceCaptor.capture());
-
-        when(sub2.getDisplayName()).thenReturn("new name");
-        mController.onSubscriptionsChanged();
-        assertThat(preferenceCaptor.getAllValues().get(1).getTitle()).isEqualTo("new name");
-    }
-
-    @Test
-    @Ignore
-    public void onSubscriptionsChanged_startWithThreeSubsAndRemoveOne_correctPreferenceRemoved() {
-        final SubscriptionInfo sub1 = createMockSubscription(1, "sub1");
-        final SubscriptionInfo sub2 = createMockSubscription(2, "sub2");
-        final SubscriptionInfo sub3 = createMockSubscription(3, "sub3");
-        SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(sub1, sub2, sub3));
-        mController.displayPreference(mPreferenceScreen);
-        mController.onResume();
-        final ArgumentCaptor<Preference> preferenceCaptor = ArgumentCaptor.forClass(
-                Preference.class);
-        verify(mPreferenceScreen, times(3)).addPreference(preferenceCaptor.capture());
-
-        // remove sub2, and check that the second pref was removed from the screen
-        SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(sub1, sub3));
-        mController.onSubscriptionsChanged();
-        final ArgumentCaptor<Preference> removedPrefCaptor = ArgumentCaptor.forClass(
-                Preference.class);
-        verify(mPreferenceScreen).removePreference(removedPrefCaptor.capture());
-        assertThat(removedPrefCaptor.getValue().getTitle()).isEqualTo("sub2");
-    }
-
-    private SubscriptionInfo createMockSubscription(int id, String displayName) {
-        final SubscriptionInfo sub = mock(SubscriptionInfo.class);
-        when(sub.getSubscriptionId()).thenReturn(id);
-        when(sub.getDisplayName()).thenReturn(displayName);
-        return sub;
-    }
-}
diff --git a/tests/unit/src/com/android/settings/network/NetworkProviderDownloadedSimListControllerTest.java b/tests/unit/src/com/android/settings/network/NetworkProviderDownloadedSimListControllerTest.java
deleted file mode 100644
index 7dbef05..0000000
--- a/tests/unit/src/com/android/settings/network/NetworkProviderDownloadedSimListControllerTest.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * Copyright (C) 2021 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.network;
-
-import static androidx.lifecycle.Lifecycle.Event;
-
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-
-import android.content.Context;
-import android.os.Looper;
-import android.telephony.SubscriptionManager;
-import android.telephony.TelephonyManager;
-import android.text.TextUtils;
-
-import androidx.lifecycle.LifecycleOwner;
-import androidx.lifecycle.LifecycleRegistry;
-import androidx.preference.Preference;
-import androidx.preference.PreferenceCategory;
-import androidx.preference.PreferenceManager;
-import androidx.preference.PreferenceScreen;
-import androidx.test.annotation.UiThreadTest;
-import androidx.test.core.app.ApplicationProvider;
-import androidx.test.ext.junit.runners.AndroidJUnit4;
-
-import com.android.settings.R;
-import com.android.settings.testutils.ResourcesUtils;
-import com.android.settingslib.core.lifecycle.Lifecycle;
-import com.android.settingslib.mobile.dataservice.SubscriptionInfoEntity;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-import java.util.ArrayList;
-import java.util.List;
-
-@RunWith(AndroidJUnit4.class)
-public class NetworkProviderDownloadedSimListControllerTest {
-
-    private static final String SUB_ID_1 = "1";
-    private static final String DISPLAY_NAME_1 = "Sub 1";
-    private static final String SUB_MCC_1 = "123";
-    private static final String SUB_MNC_1 = "456";
-    private static final String SUB_COUNTRY_ISO_1 = "Sub 1";
-    private static final String KEY_PREFERENCE_DOWNLOADED_SIM =
-            "provider_model_downloaded_sim_list";
-    private static final String KEY_PREFERENCE_CATEGORY_DOWNLOADED_SIM =
-            "provider_model_downloaded_sim_category";
-    private static final String KEY_ADD_MORE = "add_more";
-
-    @Mock
-    private SubscriptionInfoEntity mSubInfo1;
-    @Mock
-    private Lifecycle mLifecycle;
-    @Mock
-    private LifecycleOwner mLifecycleOwner;
-
-    private LifecycleRegistry mLifecycleRegistry;
-    private MockNetworkProviderDownloadedSimListController mController;
-    private PreferenceManager mPreferenceManager;
-    private PreferenceCategory mPreferenceCategory;
-    private PreferenceScreen mPreferenceScreen;
-    private Preference mPreference;
-    private Preference mAddMorePreference;
-    private Context mContext;
-    private List<SubscriptionInfoEntity> mSubscriptionInfoEntityList = new ArrayList<>();
-
-    /**
-     * Mock the MockNetworkProviderDownloadedSimListController that allows one to set a
-     * default voice, SMS and mobile data subscription ID.
-     */
-    @SuppressWarnings("ClassCanBeStatic")
-    private class MockNetworkProviderDownloadedSimListController extends
-            com.android.settings.network.NetworkProviderDownloadedSimListController {
-        public MockNetworkProviderDownloadedSimListController(Context context,
-                Lifecycle lifecycle, LifecycleOwner lifecycleOwner) {
-            super(context, lifecycle, lifecycleOwner);
-        }
-
-        private List<SubscriptionInfoEntity> mSubscriptionInfoEntity;
-
-        @Override
-        protected List<SubscriptionInfoEntity> getAvailableDownloadedSubscriptions() {
-            return mSubscriptionInfoEntity;
-        }
-
-        public void setSubscriptionInfoList(List<SubscriptionInfoEntity> list) {
-            mSubscriptionInfoEntity = list;
-        }
-    }
-
-    @Before
-    public void setUp() {
-        MockitoAnnotations.initMocks(this);
-        mContext = spy(ApplicationProvider.getApplicationContext());
-
-        if (Looper.myLooper() == null) {
-            Looper.prepare();
-        }
-
-        mPreferenceManager = new PreferenceManager(mContext);
-        mPreferenceScreen = mPreferenceManager.createPreferenceScreen(mContext);
-        mPreference = new Preference(mContext);
-        mPreference.setKey(KEY_PREFERENCE_DOWNLOADED_SIM);
-        mPreferenceCategory = new PreferenceCategory(mContext);
-        mPreferenceCategory.setKey(KEY_PREFERENCE_CATEGORY_DOWNLOADED_SIM);
-        mController = new MockNetworkProviderDownloadedSimListController(mContext, mLifecycle,
-                mLifecycleOwner);
-        mAddMorePreference = new Preference(mContext);
-        mAddMorePreference.setKey(KEY_ADD_MORE);
-        mAddMorePreference.setVisible(true);
-        mLifecycleRegistry = new LifecycleRegistry(mLifecycleOwner);
-        when(mLifecycleOwner.getLifecycle()).thenReturn(mLifecycleRegistry);
-    }
-
-    private void displayPreferenceWithLifecycle() {
-        mLifecycleRegistry.addObserver(mController);
-        mPreferenceScreen.addPreference(mPreference);
-        mPreferenceScreen.addPreference(mPreferenceCategory);
-        mPreferenceScreen.addPreference(mAddMorePreference);
-        mController.displayPreference(mPreferenceScreen);
-        mLifecycleRegistry.handleLifecycleEvent(Event.ON_RESUME);
-    }
-
-    private SubscriptionInfoEntity setupSubscriptionInfoEntity(String subId, int slotId,
-            int carrierId, String displayName, String mcc, String mnc, String countryIso,
-            int cardId, CharSequence defaultSimConfig, boolean isValid, boolean isActive,
-            boolean isAvailable, boolean isDefaultCall, boolean isDefaultData,
-            boolean isDefaultSms) {
-        return new SubscriptionInfoEntity(subId, slotId, carrierId, displayName, displayName, 0,
-                mcc, mnc, countryIso, true, cardId, TelephonyManager.DEFAULT_PORT_INDEX, false,
-                null, SubscriptionManager.SUBSCRIPTION_TYPE_LOCAL_SIM, displayName, false,
-                "1234567890", true, defaultSimConfig.toString(), false, isValid, true, isActive,
-                isAvailable, isDefaultCall, isDefaultSms, isDefaultData, false, false);
-    }
-
-    private String setSummaryResId(String resName) {
-        return ResourcesUtils.getResourcesString(mContext, resName);
-    }
-
-    @Test
-    @UiThreadTest
-    public void getSummary_inactiveESim() {
-        mSubInfo1 = setupSubscriptionInfoEntity(SUB_ID_1, 1, 1, DISPLAY_NAME_1, SUB_MCC_1,
-                SUB_MNC_1, SUB_COUNTRY_ISO_1, 1, "", true, false, false, false, false, false);
-        mSubscriptionInfoEntityList.add(mSubInfo1);
-        mController.setSubscriptionInfoList(mSubscriptionInfoEntityList);
-
-        displayPreferenceWithLifecycle();
-        String summary = setSummaryResId("sim_category_inactive_sim");
-
-        assertTrue(TextUtils.equals(mController.getSummary(mSubInfo1), summary));
-    }
-
-    @Test
-    @UiThreadTest
-    public void getSummary_defaultCalls() {
-        mSubInfo1 = setupSubscriptionInfoEntity(SUB_ID_1, 1, 1, DISPLAY_NAME_1, SUB_MCC_1,
-                SUB_MNC_1, SUB_COUNTRY_ISO_1, 1,
-                mContext.getString(R.string.sim_category_default_active_sim,
-                        setSummaryResId("default_active_sim_calls")), true,
-                true, true, true, false, false);
-        mSubscriptionInfoEntityList.add(mSubInfo1);
-        mController.setSubscriptionInfoList(mSubscriptionInfoEntityList);
-
-        displayPreferenceWithLifecycle();
-        CharSequence defaultCall = mSubInfo1.defaultSimConfig;
-        final StringBuilder summary = new StringBuilder();
-        summary.append(setSummaryResId("sim_category_active_sim"))
-                .append(defaultCall);
-
-        assertTrue(TextUtils.equals(mController.getSummary(mSubInfo1), summary));
-    }
-
-    @Test
-    @UiThreadTest
-    public void getSummary_defaultCallsAndMobileData() {
-        final StringBuilder defaultConfig = new StringBuilder();
-        defaultConfig.append(setSummaryResId("default_active_sim_mobile_data"))
-                .append(", ")
-                .append(setSummaryResId("default_active_sim_calls"));
-        mSubInfo1 = setupSubscriptionInfoEntity(SUB_ID_1, 1, 1, DISPLAY_NAME_1, SUB_MCC_1,
-                SUB_MNC_1, SUB_COUNTRY_ISO_1, 1,
-                mContext.getString(R.string.sim_category_default_active_sim, defaultConfig), true,
-                true, true, true, true,
-                false);
-        mSubscriptionInfoEntityList.add(mSubInfo1);
-        mController.setSubscriptionInfoList(mSubscriptionInfoEntityList);
-
-        displayPreferenceWithLifecycle();
-        CharSequence defaultCall = mSubInfo1.defaultSimConfig;
-        final StringBuilder summary = new StringBuilder();
-        summary.append(setSummaryResId("sim_category_active_sim"))
-                .append(defaultCall);
-        assertTrue(TextUtils.equals(mController.getSummary(mSubInfo1), summary));
-    }
-}
diff --git a/tests/unit/src/com/android/settings/network/NetworkProviderDownloadedSimsCategoryControllerTest.java b/tests/unit/src/com/android/settings/network/NetworkProviderDownloadedSimsCategoryControllerTest.java
deleted file mode 100644
index 9e64b75..0000000
--- a/tests/unit/src/com/android/settings/network/NetworkProviderDownloadedSimsCategoryControllerTest.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright (C) 2020 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.network;
-
-import static com.android.settings.core.BasePreferenceController.CONDITIONALLY_UNAVAILABLE;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-
-import android.content.Context;
-import android.os.Looper;
-import android.telephony.SubscriptionInfo;
-
-import com.android.settings.testutils.ResourcesUtils;
-import com.android.settingslib.core.lifecycle.Lifecycle;
-
-import androidx.lifecycle.LifecycleOwner;
-import androidx.preference.Preference;
-import androidx.preference.PreferenceCategory;
-import androidx.preference.PreferenceManager;
-import androidx.preference.PreferenceScreen;
-import androidx.test.core.app.ApplicationProvider;
-import androidx.test.ext.junit.runners.AndroidJUnit4;
-
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-
-//TODO: Remove NetworkProviderDownloadedSimsCategoryControllerTest once it is removed in the
-// b/244769887.
-@RunWith(AndroidJUnit4.class)
-public class NetworkProviderDownloadedSimsCategoryControllerTest {
-
-    private static final String KEY_PREFERENCE_CATEGORY_DOWNLOADED_SIM =
-            "provider_model_downloaded_sim_category";
-    private static final String KEY_ADD_MORE = "add_more";
-    private static final String SUB_1 = "SUB_1";
-    private static final String SUB_2 = "SUB_2";
-    private static final int SUB_ID_1 = 1;
-    private static final int SUB_ID_2 = 2;
-
-    @Mock
-    private Lifecycle mLifecycle;
-    @Mock
-    private SubscriptionInfo mSubscriptionInfo1;
-    @Mock
-    private SubscriptionInfo mSubscriptionInfo2;
-
-    private Context mContext;
-    private NetworkProviderDownloadedSimsCategoryController mCategoryController;
-    private PreferenceCategory mPreferenceCategory;
-    private PreferenceManager mPreferenceManager;
-    private PreferenceScreen mPreferenceScreen;
-    private Preference mAddMorePreference;
-    private LifecycleOwner mLifecycleOwner;
-
-    @Before
-    public void setUp() throws Exception {
-        MockitoAnnotations.initMocks(this);
-
-        mContext = spy(ApplicationProvider.getApplicationContext());
-
-        if (Looper.myLooper() == null) {
-            Looper.prepare();
-        }
-
-        mLifecycleOwner = () -> mLifecycle;
-        mPreferenceManager = new PreferenceManager(mContext);
-        mPreferenceScreen = mPreferenceManager.createPreferenceScreen(mContext);
-        mPreferenceCategory = new PreferenceCategory(mContext);
-        mPreferenceCategory.setKey(KEY_PREFERENCE_CATEGORY_DOWNLOADED_SIM);
-        mAddMorePreference = new Preference(mContext);
-        mAddMorePreference.setKey(KEY_ADD_MORE);
-        mAddMorePreference.setVisible(true);
-        mPreferenceScreen.addPreference(mPreferenceCategory);
-        mPreferenceScreen.addPreference(mAddMorePreference);
-
-        mCategoryController = new NetworkProviderDownloadedSimsCategoryController(mContext,
-                KEY_PREFERENCE_CATEGORY_DOWNLOADED_SIM, mLifecycle, mLifecycleOwner);
-    }
-
-    @Ignore
-    @Test
-    public void getAvailabilityStatus_returnUnavailable() {
-        SubscriptionUtil.setAvailableSubscriptionsForTesting(new ArrayList<>());
-
-        assertThat(mCategoryController.getAvailabilityStatus()).isEqualTo(
-                CONDITIONALLY_UNAVAILABLE);
-    }
-
-    @Ignore
-    @Test
-    public void displayPreference_isVisible() {
-        setUpSubscriptionInfoForDownloadedSim(SUB_ID_1, SUB_1, mSubscriptionInfo1);
-        SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(mSubscriptionInfo1));
-        mCategoryController.displayPreference(mPreferenceScreen);
-
-        assertEquals(mPreferenceCategory.isVisible(), true);
-    }
-
-    @Ignore
-    @Test
-    public void updateState_setTitle_withTwoDownloadedSims_returnDownloadedSims() {
-        setUpSubscriptionInfoForDownloadedSim(SUB_ID_1, SUB_1, mSubscriptionInfo1);
-        setUpSubscriptionInfoForDownloadedSim(SUB_ID_2, SUB_2, mSubscriptionInfo2);
-        SubscriptionUtil.setAvailableSubscriptionsForTesting(
-                Arrays.asList(mSubscriptionInfo1, mSubscriptionInfo2));
-
-        mCategoryController.displayPreference(mPreferenceScreen);
-        mCategoryController.updateState(mPreferenceCategory);
-
-        assertThat(mPreferenceCategory.getPreferenceCount()).isEqualTo(2);
-        assertThat(mPreferenceCategory.getTitle()).isEqualTo(
-                ResourcesUtils.getResourcesString(mContext, "downloaded_sims_category_title"));
-    }
-
-    @Ignore
-    @Test
-    public void updateState_setTitle_withOneDownloadedSim_returnDownloadedSim() {
-        setUpSubscriptionInfoForDownloadedSim(SUB_ID_1, SUB_1, mSubscriptionInfo1);
-        SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(mSubscriptionInfo1));
-
-        mCategoryController.displayPreference(mPreferenceScreen);
-        mCategoryController.updateState(mPreferenceCategory);
-
-        assertThat(mPreferenceCategory.getPreferenceCount()).isEqualTo(1);
-        assertThat(mPreferenceCategory.getTitle()).isEqualTo(
-                ResourcesUtils.getResourcesString(mContext, "downloaded_sim_category_title"));
-    }
-
-    private void setUpSubscriptionInfoForDownloadedSim(int subId, String displayName,
-            SubscriptionInfo subscriptionInfo) {
-        when(subscriptionInfo.isEmbedded()).thenReturn(true);
-        when(subscriptionInfo.getSubscriptionId()).thenReturn(subId);
-        when(subscriptionInfo.getDisplayName()).thenReturn(displayName);
-    }
-}
diff --git a/tests/unit/src/com/android/settings/network/NetworkProviderSimListControllerTest.java b/tests/unit/src/com/android/settings/network/NetworkProviderSimListControllerTest.java
index 16995d5..1c4238a 100644
--- a/tests/unit/src/com/android/settings/network/NetworkProviderSimListControllerTest.java
+++ b/tests/unit/src/com/android/settings/network/NetworkProviderSimListControllerTest.java
@@ -28,6 +28,7 @@
 import static org.mockito.Mockito.when;
 
 import android.content.Context;
+import android.graphics.drawable.Drawable;
 import android.os.Looper;
 import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyManager;
@@ -45,6 +46,7 @@
 
 import com.android.settings.R;
 import com.android.settings.testutils.ResourcesUtils;
+import com.android.settingslib.RestrictedPreference;
 import com.android.settingslib.core.lifecycle.Lifecycle;
 import com.android.settingslib.mobile.dataservice.SubscriptionInfoEntity;
 
@@ -90,7 +92,7 @@
     private PreferenceManager mPreferenceManager;
     private PreferenceCategory mPreferenceCategory;
     private PreferenceScreen mPreferenceScreen;
-    private Preference mPreference;
+    private RestrictedPreference mPreference;
     private Context mContext;
     private List<SubscriptionInfoEntity> mSubscriptionInfoEntityList = new ArrayList<>();
 
@@ -130,7 +132,7 @@
 
         mPreferenceManager = new PreferenceManager(mContext);
         mPreferenceScreen = mPreferenceManager.createPreferenceScreen(mContext);
-        mPreference = new Preference(mContext);
+        mPreference = new RestrictedPreference(mContext);
         mPreference.setKey(KEY_PREFERENCE_SIM_LIST);
         mPreferenceCategory = new PreferenceCategory(mContext);
         mPreferenceCategory.setKey(KEY_PREFERENCE_CATEGORY_SIM);
@@ -171,10 +173,9 @@
     @UiThreadTest
     public void getSummary_tapToActivePSim() {
         mSubInfo1 = setupSubscriptionInfoEntity(SUB_ID_1, 1, 1, DISPLAY_NAME_1, SUB_MCC_1,
-                SUB_MNC_1, SUB_COUNTRY_ISO_1, 1, "", true, false, false, false, false);
+                SUB_MNC_1, SUB_COUNTRY_ISO_1, 1, "", true, false, true, false, false);
         mSubscriptionInfoEntityList.add(mSubInfo1);
         mController.setSubscriptionInfoList(mSubscriptionInfoEntityList);
-
         displayPreferenceWithLifecycle();
         String summary = setSummaryResId("mobile_network_tap_to_activate", DISPLAY_NAME_1);
 
@@ -185,7 +186,7 @@
     @UiThreadTest
     public void getSummary_inactivePSim() {
         mSubInfo1 = setupSubscriptionInfoEntity(SUB_ID_1, 1, 1, DISPLAY_NAME_1, SUB_MCC_1,
-                SUB_MNC_1, SUB_COUNTRY_ISO_1, 1, "", true, false, false, false, false);
+                SUB_MNC_1, SUB_COUNTRY_ISO_1, 1, "", true, false, true, false, false);
         doReturn(true).when(mSubscriptionManager).canDisablePhysicalSubscription();
         mSubscriptionInfoEntityList.add(mSubInfo1);
         mController.setSubscriptionInfoList(mSubscriptionInfoEntityList);
@@ -201,7 +202,7 @@
     public void getSummary_defaultCalls() {
         mSubInfo1 = setupSubscriptionInfoEntity(SUB_ID_1, 1, 1, DISPLAY_NAME_1, SUB_MCC_1,
                 SUB_MNC_1, SUB_COUNTRY_ISO_1, 1,
-                mContext.getString(R.string.sim_category_default_active_sim,
+                setSummaryResId("sim_category_default_active_sim",
                         setSummaryResId("default_active_sim_calls")), true, true, true, true,
                 false);
         mSubscriptionInfoEntityList.add(mSubInfo1);
@@ -225,7 +226,7 @@
                 .append(setSummaryResId("default_active_sim_sms"));
         mSubInfo1 = setupSubscriptionInfoEntity(SUB_ID_1, 1, 1, DISPLAY_NAME_1, SUB_MCC_1,
                 SUB_MNC_1, SUB_COUNTRY_ISO_1, 1,
-                mContext.getString(R.string.sim_category_default_active_sim, defaultConfig), true,
+                setSummaryResId("sim_category_default_active_sim", defaultConfig.toString()), true,
                 true, true, true, true);
         mSubscriptionInfoEntityList.add(mSubInfo1);
         mController.setSubscriptionInfoList(mSubscriptionInfoEntityList);