Check isConvertedPsimSubscription in new UI

Bug: 326896614
Test: manual test
Change-Id: I0d3c87a863f58a9e962fb87df5b8001be9edb767
diff --git a/src/com/android/settings/network/SubscriptionUtil.java b/src/com/android/settings/network/SubscriptionUtil.java
index f3eb519..682d154 100644
--- a/src/com/android/settings/network/SubscriptionUtil.java
+++ b/src/com/android/settings/network/SubscriptionUtil.java
@@ -919,15 +919,22 @@
                 SubscriptionManager.class);
         List<SubscriptionInfo> allSubInofs = subscriptionManager.getAllSubscriptionInfoList();
         for (SubscriptionInfo subInfo : allSubInofs) {
-            if (subInfo != null) {
-                if (com.android.internal.telephony.flags.Flags.supportPsimToEsimConversion()
-                        && subInfo.getSubscriptionId() == subId
-                        && !subInfo.isEmbedded()
-                        && subInfo.getTransferStatus() == TRANSFER_STATUS_CONVERTED) {
-                    return true;
-                }
+            if (subInfo != null && subInfo.getSubscriptionId() == subId
+                    && isConvertedPsimSubscription(subInfo)) {
+                return true;
             }
         }
         return false;
     }
+
+    /**
+     * Checks if the subscription is converted pSIM.
+     */
+    public static boolean isConvertedPsimSubscription(@NonNull SubscriptionInfo subInfo) {
+        Log.d(TAG, "isConvertedPsimSubscription: isEmbedded " + subInfo.isEmbedded());
+        Log.d(TAG, "isConvertedPsimSubscription: getTransferStatus " + subInfo.getTransferStatus());
+        return com.android.internal.telephony.flags.Flags.supportPsimToEsimConversion()
+                && !subInfo.isEmbedded()
+                && subInfo.getTransferStatus() == TRANSFER_STATUS_CONVERTED;
+    }
 }
diff --git a/src/com/android/settings/spa/network/SimsSection.kt b/src/com/android/settings/spa/network/SimsSection.kt
index df92b37..5f6810d 100644
--- a/src/com/android/settings/spa/network/SimsSection.kt
+++ b/src/com/android/settings/spa/network/SimsSection.kt
@@ -28,6 +28,7 @@
 import androidx.compose.material.icons.outlined.SimCardDownload
 import androidx.compose.runtime.Composable
 import androidx.compose.runtime.State
+import androidx.compose.runtime.getValue
 import androidx.compose.runtime.remember
 import androidx.compose.ui.platform.LocalContext
 import androidx.compose.ui.res.stringResource
@@ -44,6 +45,7 @@
 import com.android.settingslib.spaprivileged.model.enterprise.Restrictions
 import com.android.settingslib.spaprivileged.template.preference.RestrictedPreference
 import com.android.settingslib.spaprivileged.template.preference.RestrictedTwoTargetSwitchPreference
+import kotlinx.coroutines.flow.flow
 
 @Composable
 fun SimsSection(subscriptionInfoList: List<SubscriptionInfo>) {
@@ -63,11 +65,23 @@
         context.isSubscriptionEnabledFlow(subInfo.subscriptionId)
     }.collectAsStateWithLifecycle(initialValue = false)
     val phoneNumber = phoneNumber(subInfo)
+    val isConvertedPsim by remember(subInfo) {
+        flow {
+            emit(SubscriptionUtil.isConvertedPsimSubscription(subInfo))
+        }
+    }.collectAsStateWithLifecycle(initialValue = false)
     RestrictedTwoTargetSwitchPreference(
         model = object : SwitchPreferenceModel {
             override val title = subInfo.displayName.toString()
-            override val summary = { phoneNumber.value ?: "" }
+            override val summary = {
+                if (isConvertedPsim) {
+                    context.getString(R.string.sim_category_converted_sim)
+                } else {
+                    phoneNumber.value ?: ""
+                }
+            }
             override val icon = @Composable { SimIcon(subInfo.isEmbedded) }
+            override val changeable = { !isConvertedPsim }
             override val checked = { checked.value }
             override val onCheckedChange = { newChecked: Boolean ->
                 SubscriptionUtil.startToggleSubscriptionDialogActivity(
@@ -78,6 +92,7 @@
             }
         },
         restrictions = Restrictions(keys = listOf(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)),
+        primaryEnabled = { !isConvertedPsim },
     ) {
         MobileNetworkUtils.launchMobileNetworkSettings(context, subInfo)
     }