diff --git a/src/com/android/settings/wifi/WifiConfigController2.java b/src/com/android/settings/wifi/WifiConfigController2.java
index 9e96be9..e55ea16 100644
--- a/src/com/android/settings/wifi/WifiConfigController2.java
+++ b/src/com/android/settings/wifi/WifiConfigController2.java
@@ -42,6 +42,7 @@
 import android.text.SpannableString;
 import android.text.TextUtils;
 import android.text.TextWatcher;
+import android.util.ArrayMap;
 import android.util.Log;
 import android.view.KeyEvent;
 import android.view.View;
@@ -1495,13 +1496,20 @@
         }
 
         // Shows display name of each active subscription.
-        final ArrayList<CharSequence> displayNames = new ArrayList<>();
+        ArrayMap<Integer, CharSequence> displayNames = new ArrayMap<>();
+        int defaultDataSubscriptionId = SubscriptionManager.getDefaultDataSubscriptionId();
         for (SubscriptionInfo activeSubInfo : mActiveSubscriptionInfos) {
-            displayNames.add(
+            // If multiple SIMs have the same carrier id, only the first or default data SIM is
+            // displayed.
+            if (displayNames.containsKey(activeSubInfo.getCarrierId())
+                    && defaultDataSubscriptionId != activeSubInfo.getSubscriptionId()) {
+                continue;
+            }
+            displayNames.put(activeSubInfo.getCarrierId(),
                     SubscriptionUtil.getUniqueSubscriptionDisplayName(activeSubInfo, mContext));
         }
         mEapSimSpinner.setAdapter(
-                getSpinnerAdapter(displayNames.toArray(new String[displayNames.size()])));
+                getSpinnerAdapter(displayNames.values().toArray(new String[displayNames.size()])));
         mEapSimSpinner.setSelection(0 /* position */);
         if (displayNames.size() == 1) {
             mEapSimSpinner.setEnabled(false);
diff --git a/tests/robotests/src/com/android/settings/wifi/WifiConfigController2Test.java b/tests/robotests/src/com/android/settings/wifi/WifiConfigController2Test.java
index 5d568fe..9139a28 100644
--- a/tests/robotests/src/com/android/settings/wifi/WifiConfigController2Test.java
+++ b/tests/robotests/src/com/android/settings/wifi/WifiConfigController2Test.java
@@ -16,6 +16,8 @@
 
 package com.android.settings.wifi;
 
+import static com.android.settings.wifi.WifiConfigController2.WIFI_EAP_METHOD_SIM;
+
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.mockito.ArgumentMatchers.anyInt;
@@ -86,6 +88,8 @@
     private AndroidKeystoreAliasLoader mAndroidKeystoreAliasLoader;
     @Mock
     private WifiManager mWifiManager;
+    @Mock
+    Spinner mEapMethodSimSpinner;
     private View mView;
     private Spinner mHiddenSettingsSpinner;
     private Spinner mEapCaCertSpinner;
@@ -141,6 +145,7 @@
                 mContext.getString(R.string.wifi_do_not_provide_eap_user_cert);
         ipSettingsSpinner.setSelection(DHCP);
         mShadowSubscriptionManager = shadowOf(mContext.getSystemService(SubscriptionManager.class));
+        when(mEapMethodSimSpinner.getSelectedItemPosition()).thenReturn(WIFI_EAP_METHOD_SIM);
 
         mController = new TestWifiConfigController2(mConfigUiBase, mView, mWifiEntry,
                 WifiConfigUiBase2.MODE_CONNECT);
@@ -813,10 +818,7 @@
         when(mWifiEntry.getSecurity()).thenReturn(WifiEntry.SECURITY_EAP);
         mController = new TestWifiConfigController2(mConfigUiBase, mView, mWifiEntry,
                 WifiConfigUiBase2.MODE_CONNECT);
-        final Spinner eapMethodSpinner = mock(Spinner.class);
-        when(eapMethodSpinner.getSelectedItemPosition()).thenReturn(
-                WifiConfigController2.WIFI_EAP_METHOD_SIM);
-        mController.mEapMethodSpinner = eapMethodSpinner;
+        mController.mEapMethodSpinner = mEapMethodSimSpinner;
 
         mController.loadSims();
 
@@ -837,10 +839,7 @@
         mShadowSubscriptionManager.setActiveSubscriptionInfoList(Arrays.asList(subscriptionInfo));
         mController = new TestWifiConfigController2(mConfigUiBase, mView, mWifiEntry,
                 WifiConfigUiBase2.MODE_CONNECT);
-        final Spinner eapMethodSpinner = mock(Spinner.class);
-        when(eapMethodSpinner.getSelectedItemPosition()).thenReturn(
-                WifiConfigController2.WIFI_EAP_METHOD_SIM);
-        mController.mEapMethodSpinner = eapMethodSpinner;
+        mController.mEapMethodSpinner = mEapMethodSimSpinner;
 
         mController.loadSims();
 
@@ -849,6 +848,48 @@
     }
 
     @Test
+    public void loadSims_twoSimsWithDifferentCarrierId_showTwoSims() {
+        SubscriptionInfo sub1 = createMockSubscription(1, "sub1", 8888);
+        SubscriptionInfo sub2 = createMockSubscription(2, "sub2", 9999);
+        SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(sub1, sub2));
+        mShadowSubscriptionManager.setActiveSubscriptionInfoList(Arrays.asList(sub1, sub2));
+        when(mWifiEntry.getSecurity()).thenReturn(WifiEntry.SECURITY_EAP);
+        mController = new TestWifiConfigController2(mConfigUiBase, mView, mWifiEntry,
+                WifiConfigUiBase2.MODE_CONNECT);
+        mController.mEapMethodSpinner = mEapMethodSimSpinner;
+        ShadowSubscriptionManager.setDefaultDataSubscriptionId(1);
+
+        mController.loadSims();
+
+        assertThat(mController.mEapSimSpinner.getAdapter().getCount()).isEqualTo(2);
+    }
+
+    @Test
+    public void loadSims_twoSimsWithSameCarrierId_showOneDefaultDataSim() {
+        SubscriptionInfo sub1 = createMockSubscription(1, "sub1", 9999);
+        SubscriptionInfo sub2 = createMockSubscription(2, "sub2", 9999);
+        SubscriptionUtil.setAvailableSubscriptionsForTesting(Arrays.asList(sub1, sub2));
+        mShadowSubscriptionManager.setActiveSubscriptionInfoList(Arrays.asList(sub1, sub2));
+        when(mWifiEntry.getSecurity()).thenReturn(WifiEntry.SECURITY_EAP);
+        mController = new TestWifiConfigController2(mConfigUiBase, mView, mWifiEntry,
+                WifiConfigUiBase2.MODE_CONNECT);
+        mController.mEapMethodSpinner = mEapMethodSimSpinner;
+        ShadowSubscriptionManager.setDefaultDataSubscriptionId(1);
+
+        mController.loadSims();
+
+        assertThat(mController.mEapSimSpinner.getAdapter().getCount()).isEqualTo(1);
+        assertThat(mController.mEapSimSpinner.getSelectedItem().toString()).isEqualTo("sub1");
+
+        ShadowSubscriptionManager.setDefaultDataSubscriptionId(2);
+
+        mController.loadSims();
+
+        assertThat(mController.mEapSimSpinner.getAdapter().getCount()).isEqualTo(1);
+        assertThat(mController.mEapSimSpinner.getSelectedItem().toString()).isEqualTo("sub2");
+    }
+
+    @Test
     public void loadCaCertificateValue_shouldPersistentAsDefault() {
         setUpModifyingSavedCertificateConfigController(null, null);
 
@@ -940,4 +981,12 @@
         //  certificates are covered by mController.onItemSelected after showSecurityFields end.
         mController.mEapMethodSpinner.setSelection(Eap.TLS);
     }
+
+    private SubscriptionInfo createMockSubscription(int subId, String displayName, int carrierId) {
+        SubscriptionInfo sub = mock(SubscriptionInfo.class);
+        when(sub.getSubscriptionId()).thenReturn(subId);
+        when(sub.getDisplayName()).thenReturn(displayName);
+        when(sub.getCarrierId()).thenReturn(carrierId);
+        return sub;
+    }
 }
