Merge "Add talkback and fix touch area of phonebook sharing toggle" into main
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 8c6b84a..b956f67 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -4604,6 +4604,22 @@
         </activity>
 
         <activity
+            android:name="Settings$AudioStreamConfirmDialogActivity"
+            android:exported="true"
+            android:theme="@style/Transparent"
+            android:permission="android.permission.BLUETOOTH_CONNECT"
+            android:configChanges="orientation|keyboardHidden|screenSize">
+            <intent-filter android:priority="1">
+                <action android:name="android.settings.AUDIO_STREAM_DIALOG" />
+                <category android:name="android.intent.category.DEFAULT" />
+            </intent-filter>
+            <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
+                android:value="com.android.settings.connecteddevice.audiosharing.audiostreams.AudioStreamConfirmDialog" />
+            <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
+                android:value="true" />
+        </activity>
+
+        <activity
             android:name=".Settings$PreviouslyConnectedDeviceActivity"
             android:label="@string/connected_device_saved_title"
             android:exported="true"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index e73cf31..cbc1f95 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -11538,7 +11538,7 @@
     <!-- Button on the dual sim onboarding to go to next page. [CHAR LIMIT=30] -->
     <string name="sim_onboarding_next">Next</string>
     <!-- Text on the progressbar of dual sim onboarding for turning sim on. [CHAR LIMIT=30] -->
-    <string name="sim_onboarding_profressbar_turning_sim_on">Turning on <xliff:g id="carrier_name" example="Google Fi">%1$s</xliff:g>&#8230;</string>
+    <string name="sim_onboarding_progressbar_turning_sim_on">Turning on <xliff:g id="carrier_name" example="Google Fi">%1$s</xliff:g>&#8230;</string>
     <!-- Title of service provider name(SPN) at mobile network settings page. [CHAR LIMIT=30] -->
     <string name="mobile_network_spn_title">Mobile network</string>
     <!-- Title of phone number at mobile network settings page. [CHAR LIMIT=30] -->
diff --git a/res/xml/bluetooth_audio_streams_dialog.xml b/res/xml/bluetooth_audio_streams_dialog.xml
index afc5055..502e55a 100644
--- a/res/xml/bluetooth_audio_streams_dialog.xml
+++ b/res/xml/bluetooth_audio_streams_dialog.xml
@@ -78,14 +78,14 @@
                 android:layout_height="wrap_content"
                 android:layout_marginLeft="16dp"
                 android:layout_weight="1"
-                android:visibility="gone"/>
+                android:visibility="invisible"/>
             <Button
                 android:id="@+id/right_button"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_weight="1"
                 android:layout_marginRight="16dp"
-                android:visibility="gone"/>
+                android:visibility="invisible"/>
         </LinearLayout>
 
     </LinearLayout>
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index 3e48a9c..52f5e5b 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -399,6 +399,7 @@
     public static class StylusUsiDetailsActivity extends SettingsActivity { /* empty */ }
     public static class BluetoothBroadcastActivity extends SettingsActivity { /* empty */ }
     public static class BluetoothFindBroadcastsActivity extends SettingsActivity { /* empty */ }
+    public static class AudioStreamConfirmDialogActivity extends SettingsActivity { /* empty */ }
     public static class WifiCallingDisclaimerActivity extends SettingsActivity { /* empty */ }
     public static class MobileNetworkListActivity extends SettingsActivity {}
     public static class PowerMenuSettingsActivity extends SettingsActivity {}
diff --git a/src/com/android/settings/connecteddevice/audiosharing/audiostreams/AudioStreamConfirmDialog.java b/src/com/android/settings/connecteddevice/audiosharing/audiostreams/AudioStreamConfirmDialog.java
new file mode 100644
index 0000000..5981c9e
--- /dev/null
+++ b/src/com/android/settings/connecteddevice/audiosharing/audiostreams/AudioStreamConfirmDialog.java
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2024 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.connecteddevice.audiosharing.audiostreams;
+
+import android.app.Activity;
+import android.app.Dialog;
+import android.app.settings.SettingsEnums;
+import android.bluetooth.BluetoothLeBroadcastMetadata;
+import android.os.Bundle;
+import android.util.Log;
+
+import com.android.settings.R;
+import com.android.settings.bluetooth.Utils;
+import com.android.settings.connecteddevice.audiosharing.audiostreams.qrcode.QrCodeScanModeFragment;
+import com.android.settings.core.SubSettingLauncher;
+import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
+import com.android.settingslib.bluetooth.BluetoothLeBroadcastMetadataExt;
+
+import com.google.common.base.Strings;
+
+public class AudioStreamConfirmDialog extends InstrumentedDialogFragment {
+    public static final String KEY_BROADCAST_METADATA = "key_broadcast_metadata";
+    private static final String TAG = "AudioStreamConfirmDialog";
+    private Activity mActivity;
+    private String mBroadcastMetadataStr;
+    private BluetoothLeBroadcastMetadata mBroadcastMetadata;
+    private boolean mIsRequestValid = false;
+
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setShowsDialog(true);
+        mActivity = getActivity();
+        if (mActivity == null) {
+            Log.w(TAG, "onCreate() mActivity is null!");
+            return;
+        }
+        mBroadcastMetadataStr =
+                mActivity.getIntent().getStringExtra(QrCodeScanModeFragment.KEY_BROADCAST_METADATA);
+        if (Strings.isNullOrEmpty(mBroadcastMetadataStr)) {
+            Log.w(TAG, "onCreate() mBroadcastMetadataStr is null or empty!");
+            return;
+        }
+        mBroadcastMetadata =
+                BluetoothLeBroadcastMetadataExt.INSTANCE.convertToBroadcastMetadata(
+                        mBroadcastMetadataStr);
+        if (mBroadcastMetadata == null) {
+            Log.w(TAG, "onCreate() mBroadcastMetadata is null!");
+        } else {
+            // Warm up LE_AUDIO_BROADCAST_ASSISTANT service
+            Utils.getLocalBluetoothManager(mActivity);
+            mIsRequestValid = true;
+        }
+    }
+
+    @Override
+    public Dialog onCreateDialog(Bundle savedInstanceState) {
+        return mIsRequestValid ? getConfirmDialog() : getErrorDialog();
+    }
+
+    @Override
+    public int getMetricsCategory() {
+        // TODO(chelseahao): update metrics id
+        return 0;
+    }
+
+    private Dialog getConfirmDialog() {
+        return new AudioStreamsDialogFragment.DialogBuilder(mActivity)
+                .setTitle("Listen to audio stream")
+                .setSubTitle1(mBroadcastMetadata.getBroadcastName())
+                .setSubTitle2(
+                        "The audio stream will play on the active LE audio device. Use this device"
+                                + " to control the volume.")
+                .setLeftButtonText("Cancel")
+                .setLeftButtonOnClickListener(
+                        unused -> {
+                            dismiss();
+                            mActivity.finish();
+                        })
+                .setRightButtonText("Listen")
+                .setRightButtonOnClickListener(
+                        unused -> {
+                            launchAudioStreamsActivity();
+                            dismiss();
+                            mActivity.finish();
+                        })
+                .build();
+    }
+
+    private Dialog getErrorDialog() {
+        return new AudioStreamsDialogFragment.DialogBuilder(mActivity)
+                .setTitle("Can't listen to audio stream")
+                .setSubTitle1("Can't play this audio stream. Learn more")
+                .setRightButtonText("Close")
+                .setRightButtonOnClickListener(
+                        unused -> {
+                            dismiss();
+                            mActivity.finish();
+                        })
+                .build();
+    }
+
+    private void launchAudioStreamsActivity() {
+        Bundle bundle = new Bundle();
+        bundle.putString(KEY_BROADCAST_METADATA, mBroadcastMetadataStr);
+
+        new SubSettingLauncher(mActivity)
+                .setTitleRes(R.string.bluetooth_find_broadcast_title)
+                .setDestination(AudioStreamsDashboardFragment.class.getName())
+                .setArguments(bundle)
+                .setSourceMetricsCategory(SettingsEnums.PAGE_UNKNOWN)
+                .launch();
+    }
+}
diff --git a/src/com/android/settings/connecteddevice/audiosharing/audiostreams/AudioStreamsDashboardFragment.java b/src/com/android/settings/connecteddevice/audiosharing/audiostreams/AudioStreamsDashboardFragment.java
index b5c71b6..bddbb61 100644
--- a/src/com/android/settings/connecteddevice/audiosharing/audiostreams/AudioStreamsDashboardFragment.java
+++ b/src/com/android/settings/connecteddevice/audiosharing/audiostreams/AudioStreamsDashboardFragment.java
@@ -31,6 +31,8 @@
 import com.android.settingslib.bluetooth.BluetoothLeBroadcastMetadataExt;
 import com.android.settingslib.bluetooth.BluetoothUtils;
 
+import com.google.common.base.Strings;
+
 public class AudioStreamsDashboardFragment extends DashboardFragment {
     private static final String TAG = "AudioStreamsDashboardFrag";
     private static final boolean DEBUG = BluetoothUtils.D;
@@ -72,6 +74,21 @@
         use(AudioStreamsScanQrCodeController.class).setFragment(this);
         mAudioStreamsProgressCategoryController = use(AudioStreamsProgressCategoryController.class);
         mAudioStreamsProgressCategoryController.setFragment(this);
+
+        if (getArguments() != null) {
+            String broadcastMetadataStr =
+                    getArguments().getString(AudioStreamConfirmDialog.KEY_BROADCAST_METADATA);
+            if (!Strings.isNullOrEmpty(broadcastMetadataStr)) {
+                BluetoothLeBroadcastMetadata broadcastMetadata =
+                        BluetoothLeBroadcastMetadataExt.INSTANCE.convertToBroadcastMetadata(
+                                broadcastMetadataStr);
+                if (broadcastMetadata == null) {
+                    Log.w(TAG, "onAttach() broadcastMetadata is null!");
+                } else {
+                    mAudioStreamsProgressCategoryController.setSourceFromQrCode(broadcastMetadata);
+                }
+            }
+        }
     }
 
     @Override
diff --git a/src/com/android/settings/core/gateway/SettingsGateway.java b/src/com/android/settings/core/gateway/SettingsGateway.java
index 3433e12..b40b6bf 100644
--- a/src/com/android/settings/core/gateway/SettingsGateway.java
+++ b/src/com/android/settings/core/gateway/SettingsGateway.java
@@ -84,6 +84,7 @@
 import com.android.settings.connecteddevice.ConnectedDeviceDashboardFragment;
 import com.android.settings.connecteddevice.NfcAndPaymentFragment;
 import com.android.settings.connecteddevice.PreviouslyConnectedDeviceDashboardFragment;
+import com.android.settings.connecteddevice.audiosharing.audiostreams.AudioStreamConfirmDialog;
 import com.android.settings.connecteddevice.stylus.StylusUsiDetailsFragment;
 import com.android.settings.connecteddevice.usb.UsbDetailsFragment;
 import com.android.settings.datausage.DataSaverSummary;
@@ -349,6 +350,7 @@
             DataUsageList.class.getName(),
             ToggleBackupSettingFragment.class.getName(),
             PreviouslyConnectedDeviceDashboardFragment.class.getName(),
+            AudioStreamConfirmDialog.class.getName(),
             BatterySaverScheduleSettings.class.getName(),
             MobileNetworkListFragment.class.getName(),
             PowerMenuSettings.class.getName(),
diff --git a/src/com/android/settings/network/SimOnboardingService.kt b/src/com/android/settings/network/SimOnboardingService.kt
new file mode 100644
index 0000000..1b3994e
--- /dev/null
+++ b/src/com/android/settings/network/SimOnboardingService.kt
@@ -0,0 +1,126 @@
+/*
+ * Copyright (C) 2023 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 android.content.Context
+import android.telephony.SubscriptionInfo
+import android.telephony.SubscriptionManager
+import android.telephony.TelephonyManager
+import android.telephony.UiccCardInfo
+import android.telephony.UiccSlotInfo
+import android.util.Log
+import com.android.settingslib.utils.ThreadUtils
+
+
+private const val TAG = "SimOnboardingService"
+private const val INVALID = -1
+
+class SimOnboardingService {
+    var subscriptionManager:SubscriptionManager? = null
+    var telephonyManager:TelephonyManager? = null
+
+    var targetSubId: Int = INVALID
+    var targetSubInfo: SubscriptionInfo? = null
+    var availableSubInfoList: List<SubscriptionInfo> = listOf()
+    var activeSubInfoList: List<SubscriptionInfo> = listOf()
+    var slotInfoList: List<UiccSlotInfo> = listOf()
+    var uiccCardInfoList: List<UiccCardInfo> = listOf()
+    var selectedSubInfoList: MutableList<SubscriptionInfo> = mutableListOf()
+    var targetPrimarySimCalls: Int = -1
+    var targetPrimarySimTexts: Int = -1
+    var targetPrimarySimMobileData: Int = -1
+    var isMultipleEnabledProfilesSupported: Boolean = false
+        get() {
+            if (uiccCardInfoList.isEmpty()) {
+                Log.w(TAG, "UICC cards info list is empty.")
+                return false
+            }
+            return uiccCardInfoList.stream()
+                .anyMatch { cardInfo: UiccCardInfo -> cardInfo.isMultipleEnabledProfilesSupported }
+        }
+    var renameMutableMap : MutableMap<Int, String> = mutableMapOf()
+
+    fun isValid(): Boolean {
+        return targetSubId != INVALID
+            && targetSubInfo != null
+            && activeSubInfoList.isNotEmpty()
+            && slotInfoList.isNotEmpty()
+            && selectedSubInfoList.isNotEmpty()
+    }
+
+    fun clear() {
+        targetSubId = -1
+        targetSubInfo = null
+        availableSubInfoList = listOf()
+        activeSubInfoList = listOf()
+        slotInfoList = listOf()
+        uiccCardInfoList = listOf()
+        selectedSubInfoList = mutableListOf()
+        targetPrimarySimCalls = -1
+        targetPrimarySimTexts = -1
+        targetPrimarySimMobileData = -1
+        renameMutableMap.clear()
+    }
+
+    fun initData(inputTargetSubId:Int,context: Context) {
+        targetSubId = inputTargetSubId
+        subscriptionManager = context.getSystemService(SubscriptionManager::class.java)
+        telephonyManager = context.getSystemService(TelephonyManager::class.java)
+
+        ThreadUtils.postOnBackgroundThread {
+            activeSubInfoList = SubscriptionUtil.getActiveSubscriptions(subscriptionManager)
+            availableSubInfoList = SubscriptionUtil.getAvailableSubscriptions(context)
+            targetSubInfo = availableSubInfoList.find { subInfo -> subInfo.subscriptionId == targetSubId }
+            Log.d(
+                TAG, "targetSubId: $targetSubId" + ", targetSubInfo: $targetSubInfo" +
+                    ". activeSubInfoList: $activeSubInfoList"
+            )
+            slotInfoList = telephonyManager?.uiccSlotsInfo?.toList() ?: listOf()
+            Log.d(TAG, "slotInfoList: $slotInfoList.")
+            uiccCardInfoList = telephonyManager?.uiccCardsInfo!!
+            Log.d(TAG, "uiccCardInfoList: $uiccCardInfoList")
+
+            Log.d(TAG, "isMultipleEnabledProfilesSupported: $isMultipleEnabledProfilesSupported")
+        }
+    }
+
+    fun getSelectableSubscriptionInfo(): List<SubscriptionInfo> {
+        var list: MutableList<SubscriptionInfo> = mutableListOf()
+        list.addAll(activeSubInfoList)
+        if (!list.contains(targetSubInfo)) {
+            targetSubInfo?.let { list.add(it) }
+        }
+
+        Log.d(TAG, "list: $list")
+        return list.toList()
+    }
+
+    fun addItemForRenaming(subInfo: SubscriptionInfo, newName: String) {
+        if (subInfo.displayName == newName) {
+            return
+        }
+        renameMutableMap[subInfo.subscriptionId] = newName
+    }
+
+    fun getSubscriptionInfoDisplayName(subInfo: SubscriptionInfo): String {
+        return renameMutableMap[subInfo.subscriptionId] ?: subInfo.displayName.toString()
+    }
+
+    fun startActivatingSim(callback:() -> Unit){
+        // TODO: start to activate sim
+    }
+}
\ No newline at end of file
diff --git a/src/com/android/settings/network/SubscriptionUtil.java b/src/com/android/settings/network/SubscriptionUtil.java
index 1065e37..b6b433b 100644
--- a/src/com/android/settings/network/SubscriptionUtil.java
+++ b/src/com/android/settings/network/SubscriptionUtil.java
@@ -42,12 +42,14 @@
 import androidx.annotation.VisibleForTesting;
 
 import com.android.internal.telephony.MccTable;
-import com.android.internal.telephony.flags.Flags;
 import com.android.settings.R;
+import com.android.settings.flags.Flags;
 import com.android.settings.network.helper.SelectableSubscriptions;
 import com.android.settings.network.helper.SubscriptionAnnotation;
 import com.android.settings.network.telephony.DeleteEuiccSubscriptionDialogActivity;
 import com.android.settings.network.telephony.ToggleSubscriptionDialogActivity;
+import com.android.settings.spa.SpaActivity;
+import com.android.settings.spa.network.SimOnboardingPageProvider;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -543,6 +545,11 @@
             Log.i(TAG, "Unable to toggle subscription due to invalid subscription ID.");
             return;
         }
+        if (enable && Flags.isDualSimOnboardingEnabled()) {
+            String route = SimOnboardingPageProvider.INSTANCE.getRoute(subId);
+            SpaActivity.startSpaActivity(context, route);
+            return;
+        }
         context.startActivity(ToggleSubscriptionDialogActivity.getIntent(context, subId, enable));
     }
 
@@ -822,7 +829,7 @@
     private static boolean isEmbeddedSubscriptionVisible(@NonNull SubscriptionInfo subInfo) {
         if (subInfo.isEmbedded()
                 && (subInfo.getProfileClass() == PROFILE_CLASS_PROVISIONING
-                || (Flags.oemEnabledSatelliteFlag()
+                || (com.android.internal.telephony.flags.Flags.oemEnabledSatelliteFlag()
                 && subInfo.isOnlyNonTerrestrialNetwork()))) {
             return false;
         }
diff --git a/src/com/android/settings/network/apn/ApnEditPageProvider.kt b/src/com/android/settings/network/apn/ApnEditPageProvider.kt
index 924e311..79ce342 100644
--- a/src/com/android/settings/network/apn/ApnEditPageProvider.kt
+++ b/src/com/android/settings/network/apn/ApnEditPageProvider.kt
@@ -40,6 +40,10 @@
 import com.android.settings.R
 import com.android.settings.network.apn.ApnNetworkTypes.getNetworkTypeDisplayNames
 import com.android.settings.network.apn.ApnNetworkTypes.getNetworkTypeSelectedOptionsState
+import com.android.settings.network.apn.ApnTypes.APN_TYPES_OPTIONS
+import com.android.settings.network.apn.ApnTypes.APN_TYPE_MMS
+import com.android.settings.network.apn.ApnTypes.getApnTypeSelectedOptionsState
+import com.android.settings.network.apn.ApnTypes.updateApnType
 import com.android.settingslib.spa.framework.common.SettingsPageProvider
 import com.android.settingslib.spa.framework.compose.LocalNavController
 import com.android.settingslib.spa.framework.theme.SettingsDimension
@@ -100,6 +104,9 @@
     val networkTypeSelectedOptionsState = remember {
         getNetworkTypeSelectedOptionsState(apnData.networkType)
     }
+    var apnTypeSelectedOptionsState = remember {
+        getApnTypeSelectedOptionsState(apnData.apnType)
+    }
     val navController = LocalNavController.current
     var valid: String?
     RegularScaffold(
@@ -191,37 +198,50 @@
                 label = stringResource(R.string.apn_server),
                 enabled = apnData.serverEnabled
             ) { apnData = apnData.copy(server = it) }
-            SettingsOutlinedTextField(
-                value = apnData.mmsc,
-                label = stringResource(R.string.apn_mmsc),
-                errorMessage = validateMMSC(apnData.validEnabled, apnData.mmsc, context),
-                enabled = apnData.mmscEnabled
-            ) { apnData = apnData.copy(mmsc = it) }
-            SettingsOutlinedTextField(
-                value = apnData.mmsProxy,
-                label = stringResource(R.string.apn_mms_proxy),
-                enabled = apnData.mmsProxyEnabled
-            ) { apnData = apnData.copy(mmsProxy = it) }
-            SettingsOutlinedTextField(
-                value = apnData.mmsPort,
-                label = stringResource(R.string.apn_mms_port),
-                enabled = apnData.mmsPortEnabled
-            ) { apnData = apnData.copy(mmsPort = it) }
+            SettingsExposedDropdownMenuCheckBox(
+                label = stringResource(R.string.apn_type),
+                options = APN_TYPES_OPTIONS,
+                selectedOptionsState = apnTypeSelectedOptionsState,
+                enabled = apnData.apnTypeEnabled,
+                errorMessage = validateAPNType(
+                    apnData.validEnabled, apnData.apnType,
+                    apnData.customizedConfig.readOnlyApnTypes, context
+                )
+            ) {
+                val apnType = updateApnType(
+                    apnTypeSelectedOptionsState,
+                    apnData.customizedConfig.defaultApnTypes,
+                    apnData.customizedConfig.readOnlyApnTypes
+                )
+                apnTypeSelectedOptionsState = getApnTypeSelectedOptionsState(apnType)
+                apnData = apnData.copy(
+                    apnType = apnType
+                )
+            }
+            if (apnTypeSelectedOptionsState.contains(APN_TYPES_OPTIONS.indexOf(APN_TYPE_MMS))) {
+                SettingsOutlinedTextField(
+                    value = apnData.mmsc,
+                    label = stringResource(R.string.apn_mmsc),
+                    errorMessage = validateMMSC(apnData.validEnabled, apnData.mmsc, context),
+                    enabled = apnData.mmscEnabled
+                ) { apnData = apnData.copy(mmsc = it) }
+                SettingsOutlinedTextField(
+                    value = apnData.mmsProxy,
+                    label = stringResource(R.string.apn_mms_proxy),
+                    enabled = apnData.mmsProxyEnabled
+                ) { apnData = apnData.copy(mmsProxy = it) }
+                SettingsOutlinedTextField(
+                    value = apnData.mmsPort,
+                    label = stringResource(R.string.apn_mms_port),
+                    enabled = apnData.mmsPortEnabled
+                ) { apnData = apnData.copy(mmsPort = it) }
+            }
             SettingsExposedDropdownMenuBox(
                 label = stringResource(R.string.apn_auth_type),
                 options = authTypeOptions,
                 selectedOptionIndex = apnData.authType,
                 enabled = apnData.authTypeEnabled,
             ) { apnData = apnData.copy(authType = it) }
-            SettingsOutlinedTextField(
-                value = apnData.apnType,
-                label = stringResource(R.string.apn_type),
-                enabled = apnData.apnTypeEnabled,
-                errorMessage = validateAPNType(
-                    apnData.validEnabled, apnData.apnType,
-                    apnData.customizedConfig.readOnlyApnTypes, context
-                )
-            ) { apnData = apnData.copy(apnType = updateApnType(apnData.copy(apnType = it))) }
             SettingsExposedDropdownMenuBox(
                 label = stringResource(R.string.apn_protocol),
                 options = apnProtocolOptions,
@@ -234,6 +254,13 @@
                 selectedOptionIndex = apnData.apnRoaming,
                 enabled = apnData.apnRoamingEnabled
             ) { apnData = apnData.copy(apnRoaming = it) }
+            SettingsExposedDropdownMenuCheckBox(
+                label = stringResource(R.string.network_type),
+                options = getNetworkTypeDisplayNames(),
+                selectedOptionsState = networkTypeSelectedOptionsState,
+                emptyVal = stringResource(R.string.network_type_unspecified),
+                enabled = apnData.networkTypeEnabled
+            ) {}
             SwitchPreference(
                 object : SwitchPreferenceModel {
                     override val title = context.resources.getString(R.string.carrier_enabled)
@@ -244,13 +271,6 @@
                     }
                 }
             )
-            SettingsExposedDropdownMenuCheckBox(
-                label = stringResource(R.string.network_type),
-                options = getNetworkTypeDisplayNames(),
-                selectedOptionsState = networkTypeSelectedOptionsState,
-                emptyVal = stringResource(R.string.network_type_unspecified),
-                enabled = apnData.networkTypeEnabled
-            ) {}
         }
     }
 }
\ No newline at end of file
diff --git a/src/com/android/settings/network/apn/ApnStatus.kt b/src/com/android/settings/network/apn/ApnStatus.kt
index 6f39305..f9135fd 100644
--- a/src/com/android/settings/network/apn/ApnStatus.kt
+++ b/src/com/android/settings/network/apn/ApnStatus.kt
@@ -29,6 +29,12 @@
 import com.android.internal.util.ArrayUtils
 import com.android.settings.R
 import com.android.settings.network.apn.ApnNetworkTypes.getNetworkType
+import com.android.settings.network.apn.ApnTypes.APN_TYPES
+import com.android.settings.network.apn.ApnTypes.APN_TYPE_ALL
+import com.android.settings.network.apn.ApnTypes.APN_TYPE_EMERGENCY
+import com.android.settings.network.apn.ApnTypes.APN_TYPE_IA
+import com.android.settings.network.apn.ApnTypes.APN_TYPE_IMS
+import com.android.settings.network.apn.ApnTypes.APN_TYPE_MCX
 import java.util.Locale
 
 data class ApnData(
@@ -114,67 +120,6 @@
 )
 
 /**
- * APN types for data connections.  These are usage categories for an APN
- * entry.  One APN entry may support multiple APN types, eg, a single APN
- * may service regular internet traffic ("default") as well as MMS-specific
- * connections.<br></br>
- * APN_TYPE_ALL is a special type to indicate that this APN entry can
- * service all data connections.
- */
-const val APN_TYPE_ALL = "*"
-
-/** APN type for default data traffic  */
-const val APN_TYPE_DEFAULT = "default"
-
-/** APN type for MMS traffic  */
-const val APN_TYPE_MMS = "mms"
-
-/** APN type for SUPL assisted GPS  */
-const val APN_TYPE_SUPL = "supl"
-
-/** APN type for DUN traffic  */
-const val APN_TYPE_DUN = "dun"
-
-/** APN type for HiPri traffic  */
-const val APN_TYPE_HIPRI = "hipri"
-
-/** APN type for FOTA  */
-const val APN_TYPE_FOTA = "fota"
-
-/** APN type for IMS  */
-const val APN_TYPE_IMS = "ims"
-
-/** APN type for CBS  */
-const val APN_TYPE_CBS = "cbs"
-
-/** APN type for IA Initial Attach APN  */
-const val APN_TYPE_IA = "ia"
-
-/** APN type for Emergency PDN. This is not an IA apn, but is used
- * for access to carrier services in an emergency call situation.  */
-const val APN_TYPE_EMERGENCY = "emergency"
-
-/** APN type for Mission Critical Services  */
-const val APN_TYPE_MCX = "mcx"
-
-/** APN type for XCAP  */
-const val APN_TYPE_XCAP = "xcap"
-val APN_TYPES = arrayOf(
-    APN_TYPE_DEFAULT,
-    APN_TYPE_MMS,
-    APN_TYPE_SUPL,
-    APN_TYPE_DUN,
-    APN_TYPE_HIPRI,
-    APN_TYPE_FOTA,
-    APN_TYPE_IMS,
-    APN_TYPE_CBS,
-    APN_TYPE_IA,
-    APN_TYPE_EMERGENCY,
-    APN_TYPE_MCX,
-    APN_TYPE_XCAP
-)
-
-/**
  * Initialize ApnData according to the arguments.
  * @param arguments The data passed in when the user calls PageProvider.
  * @param uriInit The decoded user incoming uri data in Page.
@@ -483,25 +428,6 @@
 private fun normalizeApnType(apnType: String): String =
     apnType.trim().lowercase(Locale.getDefault())
 
-fun updateApnType(apnData: ApnData): String {
-    return if (apnData.apnType == "" && apnData.customizedConfig.defaultApnTypes.isNotEmpty())
-        getEditableApnType(apnData)
-    else
-        apnData.apnType
-}
-
-private fun getEditableApnType(apnData: ApnData): String {
-    val customizedConfig = apnData.customizedConfig
-    return customizedConfig.defaultApnTypes.filterNot { apnType ->
-        customizedConfig.readOnlyApnTypes.contains(apnType) || apnType in listOf(
-            APN_TYPE_IA,
-            APN_TYPE_EMERGENCY,
-            APN_TYPE_MCX,
-            APN_TYPE_IMS,
-        )
-    }.joinToString()
-}
-
 fun deleteApn(uri: Uri, context: Context) {
     val contentResolver = context.contentResolver
     contentResolver.delete(uri, null, null)
diff --git a/src/com/android/settings/network/apn/ApnTypes.kt b/src/com/android/settings/network/apn/ApnTypes.kt
new file mode 100644
index 0000000..d3dbe38
--- /dev/null
+++ b/src/com/android/settings/network/apn/ApnTypes.kt
@@ -0,0 +1,143 @@
+/*
+ * Copyright (C) 2024 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.apn
+
+import androidx.compose.runtime.mutableStateListOf
+import androidx.compose.runtime.snapshots.SnapshotStateList
+
+object ApnTypes {
+    /**
+     * APN types for data connections.  These are usage categories for an APN
+     * entry.  One APN entry may support multiple APN types, eg, a single APN
+     * may service regular internet traffic ("default") as well as MMS-specific
+     * connections.<br></br>
+     * APN_TYPE_ALL is a special type to indicate that this APN entry can
+     * service all data connections.
+     */
+    const val APN_TYPE_ALL = "*"
+
+    /** APN type for default data traffic  */
+    const val APN_TYPE_DEFAULT = "default"
+
+    /** APN type for MMS traffic  */
+    const val APN_TYPE_MMS = "mms"
+
+    /** APN type for SUPL assisted GPS  */
+    const val APN_TYPE_SUPL = "supl"
+
+    /** APN type for DUN traffic  */
+    const val APN_TYPE_DUN = "dun"
+
+    /** APN type for HiPri traffic  */
+    const val APN_TYPE_HIPRI = "hipri"
+
+    /** APN type for FOTA  */
+    const val APN_TYPE_FOTA = "fota"
+
+    /** APN type for IMS  */
+    const val APN_TYPE_IMS = "ims"
+
+    /** APN type for CBS  */
+    const val APN_TYPE_CBS = "cbs"
+
+    /** APN type for IA Initial Attach APN  */
+    const val APN_TYPE_IA = "ia"
+
+    /** APN type for Emergency PDN. This is not an IA apn, but is used
+     * for access to carrier services in an emergency call situation.  */
+    const val APN_TYPE_EMERGENCY = "emergency"
+
+    /** APN type for Mission Critical Services  */
+    const val APN_TYPE_MCX = "mcx"
+
+    /** APN type for XCAP  */
+    const val APN_TYPE_XCAP = "xcap"
+
+    /** APN type for VSIM  */
+    const val APN_TYPE_VSIM = "vsim"
+
+    /** APN type for BIP  */
+    const val APN_TYPE_BIP = "bip"
+
+    /** APN type for ENTERPRISE  */
+    const val APN_TYPE_ENTERPRISE = "enterprise"
+
+    val APN_TYPES = arrayOf(
+        APN_TYPE_DEFAULT,
+        APN_TYPE_MMS,
+        APN_TYPE_SUPL,
+        APN_TYPE_DUN,
+        APN_TYPE_HIPRI,
+        APN_TYPE_FOTA,
+        APN_TYPE_IMS,
+        APN_TYPE_CBS,
+        APN_TYPE_IA,
+        APN_TYPE_EMERGENCY,
+        APN_TYPE_MCX,
+        APN_TYPE_XCAP,
+        APN_TYPE_VSIM,
+        APN_TYPE_BIP,
+        APN_TYPE_ENTERPRISE
+    )
+
+    val APN_TYPES_OPTIONS = listOf(APN_TYPE_ALL) + APN_TYPES
+
+    fun getApnTypeSelectedOptionsState(apnType: String): SnapshotStateList<Int> {
+        val apnTypeSelectedOptionsState = mutableStateListOf<Int>()
+        if (apnType.contains(APN_TYPE_ALL))
+            APN_TYPES_OPTIONS.forEachIndexed { index, _ ->
+                apnTypeSelectedOptionsState.add(index)
+            }
+        else {
+            APN_TYPES_OPTIONS.forEachIndexed { index, type ->
+                if (apnType.contains(type)) {
+                    apnTypeSelectedOptionsState.add(index)
+                }
+            }
+            if (apnTypeSelectedOptionsState.size == APN_TYPES.size)
+                apnTypeSelectedOptionsState.add(APN_TYPES_OPTIONS.indexOf(APN_TYPE_ALL))
+        }
+        return apnTypeSelectedOptionsState
+    }
+
+    fun updateApnType(
+        apnTypeSelectedOptionsState: SnapshotStateList<Int>,
+        defaultApnTypes: List<String>,
+        readOnlyApnTypes: List<String>
+    ): String {
+        val apnType = apnTypeSelectedOptionsState.joinToString { APN_TYPES_OPTIONS[it] }
+        if (apnType.contains(APN_TYPE_ALL)) return APN_TYPE_ALL
+        return if (apnType == "" && defaultApnTypes.isNotEmpty())
+            getEditableApnType(defaultApnTypes, readOnlyApnTypes)
+        else
+            apnType
+    }
+
+    private fun getEditableApnType(
+        defaultApnTypes: List<String>,
+        readOnlyApnTypes: List<String>
+    ): String {
+        return defaultApnTypes.filterNot { apnType ->
+            readOnlyApnTypes.contains(apnType) || apnType in listOf(
+                APN_TYPE_IA,
+                APN_TYPE_EMERGENCY,
+                APN_TYPE_MCX,
+                APN_TYPE_IMS,
+            )
+        }.joinToString()
+    }
+}
\ No newline at end of file
diff --git a/src/com/android/settings/spa/SettingsSpaEnvironment.kt b/src/com/android/settings/spa/SettingsSpaEnvironment.kt
index a6cf5cc..d94e861 100644
--- a/src/com/android/settings/spa/SettingsSpaEnvironment.kt
+++ b/src/com/android/settings/spa/SettingsSpaEnvironment.kt
@@ -47,6 +47,7 @@
 import com.android.settings.spa.development.compat.PlatformCompatAppListPageProvider
 import com.android.settings.spa.home.HomePageProvider
 import com.android.settings.spa.network.NetworkAndInternetPageProvider
+import com.android.settings.spa.network.SimOnboardingPageProvider
 import com.android.settings.spa.notification.AppListNotificationsPageProvider
 import com.android.settings.spa.notification.NotificationMainPageProvider
 import com.android.settings.spa.system.AppLanguagesPageProvider
@@ -114,6 +115,7 @@
         StorageAppListPageProvider.Apps,
         StorageAppListPageProvider.Games,
         ApnEditPageProvider,
+        SimOnboardingPageProvider,
     )
 
     override val logger = if (FeatureFlagUtils.isEnabled(
diff --git a/src/com/android/settings/spa/network/SimOnboardingLabelSim.kt b/src/com/android/settings/spa/network/SimOnboardingLabelSim.kt
new file mode 100644
index 0000000..4cb04b6
--- /dev/null
+++ b/src/com/android/settings/spa/network/SimOnboardingLabelSim.kt
@@ -0,0 +1,113 @@
+/*
+ * Copyright (C) 2024 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.spa.network
+
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.padding
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.outlined.SignalCellularAlt
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.platform.LocalContext
+import androidx.compose.ui.res.stringResource
+import com.android.settings.R
+import com.android.settings.network.SimOnboardingService
+import com.android.settings.network.SubscriptionUtil
+import com.android.settingslib.spa.framework.theme.SettingsDimension
+import com.android.settingslib.spa.widget.dialog.AlertDialogButton
+import com.android.settingslib.spa.widget.dialog.rememberAlertDialogPresenter
+import com.android.settingslib.spa.widget.editor.SettingsOutlinedTextField
+
+import com.android.settingslib.spa.widget.preference.Preference
+import com.android.settingslib.spa.widget.preference.PreferenceModel
+import com.android.settingslib.spa.widget.scaffold.BottomAppBarButton
+import com.android.settingslib.spa.widget.scaffold.SuwScaffold
+import com.android.settingslib.spa.widget.ui.SettingsBody
+
+/**
+ * the sim onboarding label compose
+ */
+@Composable
+fun SimOnboardingLabelSimImpl(
+    nextAction: () -> Unit,
+    cancelAction: () -> Unit,
+    onboardingService: SimOnboardingService
+) {
+    SuwScaffold(
+        imageVector = Icons.Outlined.SignalCellularAlt,
+        title = stringResource(R.string.sim_onboarding_label_sim_title),
+        actionButton = BottomAppBarButton(
+            stringResource(R.string.sim_onboarding_next),
+            nextAction
+        ),
+        dismissButton = BottomAppBarButton(
+            stringResource(R.string.cancel),
+            cancelAction
+        ),
+    ) {
+        labelSimBody(onboardingService)
+    }
+}
+
+@Composable
+private fun labelSimBody(onboardingService: SimOnboardingService) {
+    Column(Modifier.padding(SettingsDimension.itemPadding)) {
+        SettingsBody(stringResource(R.string.sim_onboarding_label_sim_msg))
+    }
+
+    for (subInfo in onboardingService.getSelectableSubscriptionInfo()) {
+        var titleSimName by remember {
+            mutableStateOf(
+                onboardingService.getSubscriptionInfoDisplayName(subInfo)
+            )
+        }
+        var summaryNumber = subInfo.number
+            // TODO using the SubscriptionUtil.getFormattedPhoneNumber
+        val alertDialogPresenter = rememberAlertDialogPresenter(
+            confirmButton = AlertDialogButton(
+                stringResource(R.string.mobile_network_sim_name_rename)
+            ) {
+                onboardingService.addItemForRenaming(subInfo, titleSimName)
+            },
+            dismissButton = AlertDialogButton(stringResource(R.string.cancel)) {
+                titleSimName = onboardingService.getSubscriptionInfoDisplayName(subInfo)
+            },
+            title = stringResource(R.string.sim_onboarding_label_sim_dialog_title),
+            text = {
+                Text(summaryNumber)
+                SettingsOutlinedTextField(
+                    value = titleSimName,
+                    label = stringResource(R.string.sim_onboarding_label_sim_dialog_label),
+                    enabled = true
+                ) {
+                    titleSimName = it
+                }
+            },
+        )
+        Preference(object : PreferenceModel {
+            override val title = titleSimName
+            override val summary: () -> String
+                get() = { summaryNumber }
+            override val onClick = alertDialogPresenter::open
+        })
+    }
+}
\ No newline at end of file
diff --git a/src/com/android/settings/spa/network/SimOnboardingPageProvider.kt b/src/com/android/settings/spa/network/SimOnboardingPageProvider.kt
new file mode 100644
index 0000000..e46dc2e
--- /dev/null
+++ b/src/com/android/settings/spa/network/SimOnboardingPageProvider.kt
@@ -0,0 +1,135 @@
+/*
+ * Copyright (C) 2023 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.spa.network
+
+
+import android.app.Activity
+import android.content.Context
+import android.content.ContextWrapper
+import android.os.Bundle
+import androidx.annotation.VisibleForTesting
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.platform.LocalContext
+import androidx.navigation.NavHostController
+import androidx.navigation.NavType
+import androidx.navigation.compose.NavHost
+import androidx.navigation.compose.composable
+import androidx.navigation.compose.rememberNavController
+import androidx.navigation.navArgument
+import com.android.settings.R
+import com.android.settings.network.SimOnboardingService
+import com.android.settingslib.spa.framework.common.SettingsEntryBuilder
+import com.android.settingslib.spa.framework.common.SettingsPageProvider
+import com.android.settingslib.spa.framework.common.createSettingsPage
+import com.android.settingslib.spa.framework.compose.navigator
+
+import com.android.settingslib.spa.widget.preference.Preference
+import com.android.settingslib.spa.widget.preference.PreferenceModel
+
+const val SUB_ID = "subId"
+
+enum class SimOnboardingScreen(val stringResId: Int) {
+    LabelSim(R.string.sim_onboarding_label_sim_title),
+    SelectSim(R.string.sim_onboarding_select_sim_title),
+    PrimarySim(R.string.sim_onboarding_primary_sim_title)
+}
+
+/**
+ * Showing the sim onboarding which is the process flow of sim switching on.
+ */
+object SimOnboardingPageProvider : SettingsPageProvider {
+    override val name = "SimOnboardingPageProvider"
+    override val parameter = listOf(
+        navArgument(SUB_ID) { type = NavType.IntType },
+    )
+
+    private val owner = createSettingsPage()
+    @VisibleForTesting
+    var onboardingService: SimOnboardingService = SimOnboardingService()
+
+    fun buildInjectEntry() = SettingsEntryBuilder.createInject(owner = owner)
+        .setUiLayoutFn {
+            // never using
+            Preference(object : PreferenceModel {
+                override val title = name
+                override val onClick = navigator(getRoute(-1))
+            })
+        }
+
+    @Composable
+    override fun Page(arguments: Bundle?) {
+        initServiceData(arguments!!.getInt(SUB_ID))
+        PageImpl(onboardingService,rememberNavController())
+    }
+
+    fun getRoute(
+        subId: Int
+    ): String = "${name}/$subId"
+
+    @Composable
+    fun initServiceData(targetSubId: Int) {
+        onboardingService.initData(targetSubId, LocalContext.current)
+    }
+}
+
+private fun Context.getActivity(): Activity? = when (this) {
+    is Activity -> this
+    is ContextWrapper -> baseContext.getActivity()
+    else -> null
+}
+
+@Composable
+fun PageImpl(onboardingService:SimOnboardingService,navHostController: NavHostController) {
+    val context = LocalContext.current
+    var previousPageOfOnboarding: () -> Unit = { context.getActivity()?.finish() }
+
+    NavHost(
+        navController = navHostController,
+        startDestination = SimOnboardingScreen.LabelSim.name
+    ) {
+        composable(route = SimOnboardingScreen.LabelSim.name) {
+            val nextPage =
+                // Adding more conditions
+                if (onboardingService.isMultipleEnabledProfilesSupported) {
+                    SimOnboardingScreen.SelectSim.name
+                } else {
+                    SimOnboardingScreen.PrimarySim.name
+                }
+            SimOnboardingLabelSimImpl(
+                nextAction = { navHostController.navigate(nextPage) },
+                cancelAction = previousPageOfOnboarding,
+                onboardingService = onboardingService
+            )
+        }
+        composable(route = SimOnboardingScreen.PrimarySim.name) {
+            SimOnboardingPrimarySimImpl(
+                nextAction = {
+                    //go back and activate sim
+                },
+                cancelAction = previousPageOfOnboarding,
+                onboardingService = onboardingService
+            )
+        }
+        composable(route = SimOnboardingScreen.SelectSim.name) {
+            SimOnboardingSelectSimImpl(
+                nextAction = { navHostController.navigate(SimOnboardingScreen.PrimarySim.name) },
+                cancelAction = previousPageOfOnboarding,
+                onboardingService = onboardingService
+            )
+        }
+    }
+}
\ No newline at end of file
diff --git a/src/com/android/settings/spa/network/SimOnboardingPrimarySim.kt b/src/com/android/settings/spa/network/SimOnboardingPrimarySim.kt
new file mode 100644
index 0000000..7704f84
--- /dev/null
+++ b/src/com/android/settings/spa/network/SimOnboardingPrimarySim.kt
@@ -0,0 +1,160 @@
+/*
+ * Copyright (C) 2024 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.spa.network
+
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.padding
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.automirrored.outlined.Message
+import androidx.compose.material.icons.outlined.DataUsage
+import androidx.compose.material.icons.outlined.SignalCellularAlt
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.MutableIntState
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableIntStateOf
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.saveable.rememberSaveable
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.graphics.vector.ImageVector
+import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.res.vectorResource
+import com.android.settings.R
+import com.android.settings.network.SimOnboardingService
+import com.android.settingslib.spa.framework.theme.SettingsDimension
+import com.android.settingslib.spa.widget.preference.ListPreference
+import com.android.settingslib.spa.widget.preference.ListPreferenceModel
+import com.android.settingslib.spa.widget.preference.ListPreferenceOption
+import com.android.settingslib.spa.widget.preference.SwitchPreference
+import com.android.settingslib.spa.widget.preference.SwitchPreferenceModel
+import com.android.settingslib.spa.widget.scaffold.BottomAppBarButton
+import com.android.settingslib.spa.widget.scaffold.SuwScaffold
+import com.android.settingslib.spa.widget.ui.SettingsBody
+import com.android.settingslib.spa.widget.ui.SettingsIcon
+
+/**
+ * the sim onboarding primary sim compose
+ */
+@Composable
+fun SimOnboardingPrimarySimImpl(
+    nextAction: () -> Unit,
+    cancelAction: () -> Unit,
+    onboardingService: SimOnboardingService
+) {
+    SuwScaffold(
+        imageVector = Icons.Outlined.SignalCellularAlt,
+        title = stringResource(id = R.string.sim_onboarding_primary_sim_title),
+        actionButton = BottomAppBarButton(
+            stringResource(id = R.string.done),
+            nextAction
+        ),
+        dismissButton = BottomAppBarButton(
+            stringResource(id = R.string.cancel),
+            cancelAction
+        ),
+    ) {
+        primarySimBody(onboardingService)
+    }
+}
+
+@Composable
+private fun primarySimBody(onboardingService: SimOnboardingService) {
+    //TODO: Load the status from the frameworks
+    var callsSelectedId = rememberSaveable { mutableIntStateOf(1) }
+    var textsSelectedId = rememberSaveable { mutableIntStateOf(1) }
+    var mobileDataSelectedId = rememberSaveable { mutableIntStateOf(1) }
+    var automaticDataChecked by rememberSaveable { mutableStateOf(true) }
+
+    Column(Modifier.padding(SettingsDimension.itemPadding)) {
+        SettingsBody(stringResource(id = R.string.sim_onboarding_primary_sim_msg))
+    }
+    var selectableSubscriptionInfo = onboardingService.getSelectableSubscriptionInfo()
+    var list = listOf(ListPreferenceOption(id = -1, text = "Loading"))
+    if (selectableSubscriptionInfo.size >= 2) {
+        list = listOf(
+            ListPreferenceOption(
+                id = selectableSubscriptionInfo[0].subscriptionId,
+                text = "${selectableSubscriptionInfo[0].displayName}"
+            ),
+            ListPreferenceOption(
+                id = selectableSubscriptionInfo[1].subscriptionId,
+                text = "${selectableSubscriptionInfo[1].displayName}"
+            ),
+            ListPreferenceOption(
+                id = -1,
+                text = stringResource(id = R.string.sim_calls_ask_first_prefs_title)
+            ),
+        )
+    } else {
+        // set all of primary sim items' enable as false and showing that sim.
+    }
+    createPrimarySimListPreference(
+        stringResource(id = R.string.primary_sim_calls_title),
+        list,
+        callsSelectedId,
+        ImageVector.vectorResource(R.drawable.ic_phone),
+        true
+    )
+    createPrimarySimListPreference(
+        stringResource(id = R.string.primary_sim_texts_title),
+        list,
+        textsSelectedId,
+        Icons.AutoMirrored.Outlined.Message,
+        true
+    )
+    createPrimarySimListPreference(
+        stringResource(id = R.string.mobile_data_settings_title),
+        list,
+        mobileDataSelectedId,
+        Icons.Outlined.DataUsage,
+        true
+    )
+
+    val autoDataTitle = stringResource(id = R.string.primary_sim_automatic_data_title)
+    val autoDataSummary = stringResource(id = R.string.primary_sim_automatic_data_msg)
+    SwitchPreference(remember {
+        object : SwitchPreferenceModel {
+            override val title = autoDataTitle
+            override val summary = { autoDataSummary }
+            override val checked = { automaticDataChecked }
+            override val onCheckedChange =
+                { newChecked: Boolean -> automaticDataChecked = newChecked }
+        }
+    })
+}
+
+@Composable
+fun createPrimarySimListPreference(
+    title: String,
+    list: List<ListPreferenceOption>,
+    selectedId: MutableIntState,
+    icon: ImageVector,
+    enable: Boolean
+) = ListPreference(remember {
+    object : ListPreferenceModel {
+        override val title = title
+        override val options = list
+        override val selectedId = selectedId
+        override val onIdSelected: (id: Int) -> Unit = { selectedId.intValue = it }
+        override val icon = @Composable {
+            SettingsIcon(icon)
+        }
+        override val enabled: () -> Boolean
+            get() = { enable }
+    }
+})
\ No newline at end of file
diff --git a/src/com/android/settings/spa/network/SimOnboardingSelectSim.kt b/src/com/android/settings/spa/network/SimOnboardingSelectSim.kt
new file mode 100644
index 0000000..1955d13
--- /dev/null
+++ b/src/com/android/settings/spa/network/SimOnboardingSelectSim.kt
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2024 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.spa.network
+
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.padding
+import androidx.compose.material.icons.Icons
+import androidx.compose.material.icons.outlined.SignalCellularAlt
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.saveable.rememberSaveable
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.res.stringResource
+import com.android.settings.R
+import com.android.settings.network.SimOnboardingService
+import com.android.settingslib.spa.framework.theme.SettingsDimension
+import com.android.settingslib.spa.widget.preference.CheckboxPreference
+import com.android.settingslib.spa.widget.preference.CheckboxPreferenceModel
+
+import com.android.settingslib.spa.widget.scaffold.BottomAppBarButton
+import com.android.settingslib.spa.widget.scaffold.SuwScaffold
+import com.android.settingslib.spa.widget.ui.SettingsBody
+
+/**
+ * the sim onboarding select sim compose
+ */
+@Composable
+fun SimOnboardingSelectSimImpl(
+    nextAction: () -> Unit,
+    cancelAction: () -> Unit,
+    onboardingService: SimOnboardingService
+) {
+    SuwScaffold(
+        imageVector = Icons.Outlined.SignalCellularAlt,
+        title = stringResource(id = R.string.sim_onboarding_select_sim_title),
+        actionButton = BottomAppBarButton(
+            stringResource(id = R.string.sim_onboarding_next),
+            nextAction
+        ),
+        dismissButton = BottomAppBarButton(
+            stringResource(id = R.string.cancel),
+            cancelAction
+        ),
+    ) {
+        selectSimBody(onboardingService)
+    }
+}
+
+@Composable
+private fun selectSimBody(onboardingService: SimOnboardingService) {
+    Column(Modifier.padding(SettingsDimension.itemPadding)) {
+        SettingsBody(stringResource(id = R.string.sim_onboarding_select_sim_msg))
+    }
+    for (subInfo in onboardingService.getSelectableSubscriptionInfo()) {
+        var title = onboardingService.getSubscriptionInfoDisplayName(subInfo)
+        var summaryNumber =
+            subInfo.number // TODO using the SubscriptionUtil.getFormattedPhoneNumber
+        var changeable = subInfo.isActive
+        var checked by rememberSaveable { mutableStateOf(!subInfo.isActive) }
+
+        CheckboxPreference(remember {
+            object : CheckboxPreferenceModel {
+                override val title = title
+                override val summary: () -> String
+                    get() = { summaryNumber }
+                override val checked = { checked }
+                override val changeable = { changeable }
+                override val onCheckedChange = { newChecked: Boolean -> checked = newChecked }
+            }
+        })
+    }
+}
\ No newline at end of file
diff --git a/tests/spa_unit/src/com/android/settings/network/apn/ApnEditPageProviderTest.kt b/tests/spa_unit/src/com/android/settings/network/apn/ApnEditPageProviderTest.kt
index 20d67fc..03fddb5 100644
--- a/tests/spa_unit/src/com/android/settings/network/apn/ApnEditPageProviderTest.kt
+++ b/tests/spa_unit/src/com/android/settings/network/apn/ApnEditPageProviderTest.kt
@@ -50,9 +50,9 @@
 
     private val context: Context = ApplicationProvider.getApplicationContext()
     private val apnName = "apn_name"
-    private val mmsc = "mmsc"
-    private val mmsProxy = "mms_proxy"
-    private val apnType = "apn_type"
+    private val proxy = "proxy"
+    private val port = "port"
+    private val apnType = context.resources.getString(R.string.apn_type)
     private val apnRoaming = "IPv4"
     private val apnEnable = context.resources.getString(R.string.carrier_enabled)
     private val apnProtocolOptions =
@@ -61,8 +61,8 @@
     private val passwordTitle = context.resources.getString(R.string.apn_password)
     private val apnInit = ApnData(
         name = apnName,
-        mmsc = mmsc,
-        mmsProxy = mmsProxy,
+        proxy = proxy,
+        port = port,
         apnType = apnType,
         apnRoaming = apnProtocolOptions.indexOf(apnRoaming),
         apnEnable = true
@@ -94,23 +94,23 @@
     }
 
     @Test
-    fun mmsc_displayed() {
+    fun proxy_displayed() {
         composeTestRule.setContent {
             ApnPage(apnInit, remember { apnData }, uri)
         }
         composeTestRule.onRoot().onChild().onChildAt(0)
-            .performScrollToNode(hasText(mmsc, true))
-        composeTestRule.onNodeWithText(mmsc, true).assertIsDisplayed()
+            .performScrollToNode(hasText(proxy, true))
+        composeTestRule.onNodeWithText(proxy, true).assertIsDisplayed()
     }
 
     @Test
-    fun mms_proxy_displayed() {
+    fun port_displayed() {
         composeTestRule.setContent {
             ApnPage(apnInit, remember { apnData }, uri)
         }
         composeTestRule.onRoot().onChild().onChildAt(0)
-            .performScrollToNode(hasText(mmsProxy, true))
-        composeTestRule.onNodeWithText(mmsProxy, true).assertIsDisplayed()
+            .performScrollToNode(hasText(port, true))
+        composeTestRule.onNodeWithText(port, true).assertIsDisplayed()
     }
 
     @Test
diff --git a/tests/spa_unit/src/com/android/settings/spa/network/SimOnboardingLabelSimTest.kt b/tests/spa_unit/src/com/android/settings/spa/network/SimOnboardingLabelSimTest.kt
new file mode 100644
index 0000000..dace5e9
--- /dev/null
+++ b/tests/spa_unit/src/com/android/settings/spa/network/SimOnboardingLabelSimTest.kt
@@ -0,0 +1,197 @@
+/*
+ * Copyright (C) 2024 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.spa.network
+
+import android.content.Context
+import android.telephony.SubscriptionInfo
+import androidx.compose.ui.test.assertIsDisplayed
+import androidx.compose.ui.test.junit4.createComposeRule
+import androidx.compose.ui.test.onNodeWithText
+import androidx.compose.ui.test.performClick
+import androidx.test.core.app.ApplicationProvider
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import com.android.settings.R
+import com.android.settings.network.SimOnboardingService
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.mockito.kotlin.doReturn
+import org.mockito.kotlin.mock
+import org.mockito.kotlin.stub
+import org.mockito.kotlin.verify
+
+@RunWith(AndroidJUnit4::class)
+class SimOnboardingLabelSimTest {
+    @get:Rule
+    val composeTestRule = createComposeRule()
+
+    private val context: Context = ApplicationProvider.getApplicationContext()
+    private var mockSimOnboardingService = mock<SimOnboardingService> {
+        on { targetSubId }.doReturn(-1)
+        on { targetSubInfo }.doReturn(null)
+        on { availableSubInfoList }.doReturn(listOf())
+        on { activeSubInfoList }.doReturn(listOf())
+        on { slotInfoList }.doReturn(listOf())
+        on { uiccCardInfoList }.doReturn(listOf())
+        on { selectedSubInfoList }.doReturn(mutableListOf())
+
+        on { targetPrimarySimCalls }.doReturn(PRIMARY_SIM_ASK_EVERY_TIME)
+        on { targetPrimarySimTexts }.doReturn(PRIMARY_SIM_ASK_EVERY_TIME)
+        on { targetPrimarySimMobileData }.doReturn(PRIMARY_SIM_ASK_EVERY_TIME)
+    }
+
+    private val nextAction: () -> Unit = mock()
+    private val cancelAction: () -> Unit = mock()
+
+    @Test
+    fun simOnboardingLabelSimImpl_showTitle() {
+        composeTestRule.setContent {
+            SimOnboardingLabelSimImpl(nextAction, cancelAction, mockSimOnboardingService)
+        }
+
+        composeTestRule.onNodeWithText(context.getString(R.string.sim_onboarding_label_sim_title))
+            .assertIsDisplayed()
+    }
+
+    @Test
+    fun simOnboardingLabelSimImpl_showSubTitle() {
+        composeTestRule.setContent {
+            SimOnboardingLabelSimImpl(nextAction, cancelAction, mockSimOnboardingService)
+        }
+
+        composeTestRule.onNodeWithText(context.getString(R.string.sim_onboarding_label_sim_msg))
+            .assertIsDisplayed()
+    }
+
+    @Test
+    fun simOnboardingLabelSimImpl_clickNextAction_verifyNextAction() {
+        composeTestRule.setContent {
+            SimOnboardingLabelSimImpl(nextAction, cancelAction, mockSimOnboardingService)
+        }
+
+        composeTestRule.onNodeWithText(context.getString(R.string.sim_onboarding_next))
+            .performClick()
+
+        verify(nextAction)
+    }
+
+    @Test
+    fun simOnboardingLabelSimImpl_clickCancelAction_verifyCancelAction() {
+        composeTestRule.setContent {
+            SimOnboardingLabelSimImpl(nextAction, cancelAction, mockSimOnboardingService)
+        }
+
+        composeTestRule.onNodeWithText(context.getString(R.string.cancel))
+            .performClick()
+
+        verify(cancelAction)
+    }
+
+    @Test
+    fun simOnboardingLabelSimImpl_showItem_show3Items() {
+        mockSimOnboardingService.stub {
+            on { targetSubId }.doReturn(SUB_ID_1)
+            on { targetSubInfo }.doReturn(SUB_INFO_1)
+            on { availableSubInfoList }.doReturn(listOf(SUB_INFO_1, SUB_INFO_2, SUB_INFO_3))
+            on { activeSubInfoList }.doReturn(listOf(SUB_INFO_2, SUB_INFO_3))
+            on { getSelectableSubscriptionInfo() }.doReturn(
+                listOf(
+                    SUB_INFO_1,
+                    SUB_INFO_2,
+                    SUB_INFO_3
+                )
+            )
+            on { getSubscriptionInfoDisplayName(SUB_INFO_1) }.doReturn(DISPLAY_NAME_1)
+            on { getSubscriptionInfoDisplayName(SUB_INFO_2) }.doReturn(DISPLAY_NAME_2)
+            on { getSubscriptionInfoDisplayName(SUB_INFO_3) }.doReturn(DISPLAY_NAME_3)
+        }
+
+        composeTestRule.setContent {
+            SimOnboardingLabelSimImpl(nextAction, cancelAction, mockSimOnboardingService)
+        }
+
+        composeTestRule.onNodeWithText(DISPLAY_NAME_1).assertIsDisplayed()
+        composeTestRule.onNodeWithText(NUMBER_1).assertIsDisplayed()
+        composeTestRule.onNodeWithText(DISPLAY_NAME_2).assertIsDisplayed()
+        composeTestRule.onNodeWithText(NUMBER_2).assertIsDisplayed()
+        composeTestRule.onNodeWithText(DISPLAY_NAME_3).assertIsDisplayed()
+        composeTestRule.onNodeWithText(NUMBER_3).assertIsDisplayed()
+    }
+
+    @Test
+    fun simOnboardingLabelSimImpl_showDialog_checkTitle() {
+        mockSimOnboardingService.stub {
+            on { targetSubId }.doReturn(SUB_ID_1)
+            on { targetSubInfo }.doReturn(SUB_INFO_1)
+            on { availableSubInfoList }.doReturn(listOf(SUB_INFO_1, SUB_INFO_2, SUB_INFO_3))
+            on { activeSubInfoList }.doReturn(listOf(SUB_INFO_2, SUB_INFO_3))
+            on { getSelectableSubscriptionInfo() }.doReturn(
+                listOf(
+                    SUB_INFO_1,
+                    SUB_INFO_2,
+                    SUB_INFO_3
+                )
+            )
+            on { getSubscriptionInfoDisplayName(SUB_INFO_1) }.doReturn(DISPLAY_NAME_1)
+            on { getSubscriptionInfoDisplayName(SUB_INFO_2) }.doReturn(DISPLAY_NAME_2)
+            on { getSubscriptionInfoDisplayName(SUB_INFO_3) }.doReturn(DISPLAY_NAME_3)
+        }
+
+        composeTestRule.setContent {
+            SimOnboardingLabelSimImpl(nextAction, cancelAction, mockSimOnboardingService)
+        }
+
+
+        composeTestRule.onNodeWithText(DISPLAY_NAME_1).performClick()
+
+        composeTestRule.onNodeWithText(
+            context.getString(R.string.sim_onboarding_label_sim_dialog_title)
+        )
+            .assertIsDisplayed()
+    }
+
+    private companion object {
+        const val SUB_ID_1 = 1
+        const val SUB_ID_2 = 2
+        const val SUB_ID_3 = 3
+        const val DISPLAY_NAME_1 = "Sub 1"
+        const val DISPLAY_NAME_2 = "Sub 2"
+        const val DISPLAY_NAME_3 = "Sub 3"
+        const val NUMBER_1 = "000000001"
+        const val NUMBER_2 = "000000002"
+        const val NUMBER_3 = "000000003"
+        const val PRIMARY_SIM_ASK_EVERY_TIME = -1
+
+        val SUB_INFO_1: SubscriptionInfo = SubscriptionInfo.Builder().apply {
+            setId(SUB_ID_1)
+            setDisplayName(DISPLAY_NAME_1)
+            setNumber(NUMBER_1)
+        }.build()
+
+        val SUB_INFO_2: SubscriptionInfo = SubscriptionInfo.Builder().apply {
+            setId(SUB_ID_2)
+            setDisplayName(DISPLAY_NAME_2)
+            setNumber(NUMBER_2)
+        }.build()
+
+        val SUB_INFO_3: SubscriptionInfo = SubscriptionInfo.Builder().apply {
+            setId(SUB_ID_3)
+            setDisplayName(DISPLAY_NAME_3)
+            setNumber(NUMBER_3)
+        }.build()
+    }
+}
diff --git a/tests/spa_unit/src/com/android/settings/spa/network/SimOnboardingPageProviderTest.kt b/tests/spa_unit/src/com/android/settings/spa/network/SimOnboardingPageProviderTest.kt
new file mode 100644
index 0000000..35f1968
--- /dev/null
+++ b/tests/spa_unit/src/com/android/settings/spa/network/SimOnboardingPageProviderTest.kt
@@ -0,0 +1,126 @@
+/*
+ * Copyright (C) 2024 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.spa.network
+
+import android.content.Context
+import androidx.compose.ui.test.assertIsDisplayed
+import androidx.compose.ui.test.junit4.createComposeRule
+import androidx.compose.ui.test.onNodeWithText
+import androidx.compose.ui.test.performClick
+import androidx.navigation.compose.rememberNavController
+import androidx.test.core.app.ApplicationProvider
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import com.android.settings.R
+import com.android.settings.network.SimOnboardingService
+import com.google.common.truth.Truth.assertThat
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.mockito.kotlin.doReturn
+import org.mockito.kotlin.mock
+import org.mockito.kotlin.stub
+
+@RunWith(AndroidJUnit4::class)
+class SimOnboardingPageProviderTest {
+    @get:Rule
+    val composeTestRule = createComposeRule()
+
+    private val context: Context = ApplicationProvider.getApplicationContext()
+    private var mockSimOnboardingService = mock<SimOnboardingService> {
+        on { targetSubId }.doReturn(SUB_ID)
+        on { targetSubInfo }.doReturn(null)
+        on { availableSubInfoList }.doReturn(listOf())
+        on { activeSubInfoList }.doReturn(listOf())
+        on { slotInfoList }.doReturn(listOf())
+        on { uiccCardInfoList }.doReturn(listOf())
+        on { selectedSubInfoList }.doReturn(mutableListOf())
+
+        on { targetPrimarySimCalls }.doReturn(PRIMARY_SIM_ASK_EVERY_TIME)
+        on { targetPrimarySimTexts }.doReturn(PRIMARY_SIM_ASK_EVERY_TIME)
+        on { targetPrimarySimMobileData }.doReturn(PRIMARY_SIM_ASK_EVERY_TIME)
+    }
+
+    @Test
+    fun simOnboardingPageProvider_name() {
+        assertThat(SimOnboardingPageProvider.name).isEqualTo("SimOnboardingPageProvider")
+    }
+
+    @Test
+    fun simOnboardingPage_labelSim() {
+        composeTestRule.setContent {
+            val navHostController = rememberNavController()
+            PageImpl(mockSimOnboardingService, navHostController)
+        }
+
+        composeTestRule.onNodeWithText(context.getString(R.string.sim_onboarding_label_sim_title))
+            .assertIsDisplayed()
+    }
+
+    @Test
+    fun simOnboardingPage_nextAction_fromLabelSimToPrimarySim() {
+        mockSimOnboardingService.stub {
+            on { isMultipleEnabledProfilesSupported }.thenReturn(false)
+        }
+        composeTestRule.setContent {
+            val navHostController = rememberNavController()
+            PageImpl(mockSimOnboardingService, navHostController)
+        }
+
+        composeTestRule.onNodeWithText(context.getString(R.string.sim_onboarding_next))
+            .performClick()
+
+        composeTestRule.onNodeWithText(context.getString(R.string.sim_onboarding_primary_sim_title))
+            .assertIsDisplayed()
+    }
+
+    @Test
+    fun simOnboardingPage_nextAction_fromLabelSimToSelectSim() {
+        mockSimOnboardingService.stub {
+            on { isMultipleEnabledProfilesSupported }.thenReturn(true)
+        }
+
+        composeTestRule.setContent {
+            val navHostController = rememberNavController()
+            PageImpl(mockSimOnboardingService, navHostController)
+        }
+
+        composeTestRule.onNodeWithText(context.getString(R.string.sim_onboarding_next))
+            .performClick()
+
+        composeTestRule.onNodeWithText(context.getString(R.string.sim_onboarding_select_sim_title))
+            .assertIsDisplayed()
+    }
+
+    @Test
+    fun simOnboardingPage_nextAction_fromSelectSimToPrimarySim() {
+        composeTestRule.setContent {
+            val navHostController = rememberNavController()
+            PageImpl(mockSimOnboardingService, navHostController)
+        }
+
+        composeTestRule.onNodeWithText(context.getString(R.string.sim_onboarding_next))
+            .performClick()
+
+        composeTestRule.onNodeWithText(context.getString(R.string.sim_onboarding_primary_sim_title))
+            .assertIsDisplayed()
+    }
+
+    private companion object {
+        const val SUB_ID = 1
+        const val PRIMARY_SIM_ASK_EVERY_TIME = -1
+    }
+}
diff --git a/tests/spa_unit/src/com/android/settings/spa/network/SimOnboardingPrimarySimTest.kt b/tests/spa_unit/src/com/android/settings/spa/network/SimOnboardingPrimarySimTest.kt
new file mode 100644
index 0000000..9cb8909
--- /dev/null
+++ b/tests/spa_unit/src/com/android/settings/spa/network/SimOnboardingPrimarySimTest.kt
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2024 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.spa.network
+
+import android.content.Context
+import android.telephony.SubscriptionInfo
+import androidx.compose.ui.test.assertIsDisplayed
+import androidx.compose.ui.test.junit4.createComposeRule
+import androidx.compose.ui.test.onNodeWithText
+import androidx.compose.ui.test.performClick
+import androidx.test.core.app.ApplicationProvider
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import com.android.settings.R
+import com.android.settings.network.SimOnboardingService
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.mockito.kotlin.doReturn
+import org.mockito.kotlin.mock
+import org.mockito.kotlin.stub
+import org.mockito.kotlin.verify
+
+
+@RunWith(AndroidJUnit4::class)
+class SimOnboardingPrimarySimTest {
+    @get:Rule
+    val composeTestRule = createComposeRule()
+
+    private val context: Context = ApplicationProvider.getApplicationContext()
+    private var mockSimOnboardingService = mock<SimOnboardingService> {
+        on { targetSubId }.doReturn(-1)
+        on { targetSubInfo }.doReturn(null)
+        on { availableSubInfoList }.doReturn(listOf())
+        on { activeSubInfoList }.doReturn(listOf())
+        on { slotInfoList }.doReturn(listOf())
+        on { uiccCardInfoList }.doReturn(listOf())
+        on { selectedSubInfoList }.doReturn(mutableListOf())
+
+        on { targetPrimarySimCalls }.doReturn(PRIMARY_SIM_ASK_EVERY_TIME)
+        on { targetPrimarySimTexts }.doReturn(PRIMARY_SIM_ASK_EVERY_TIME)
+        on { targetPrimarySimMobileData }.doReturn(PRIMARY_SIM_ASK_EVERY_TIME)
+    }
+
+    private val nextAction: () -> Unit = mock()
+    private val cancelAction: () -> Unit = mock()
+
+    @Test
+    fun simOnboardingPrimarySimImpl_showTitle() {
+        composeTestRule.setContent {
+            SimOnboardingPrimarySimImpl(nextAction, cancelAction, mockSimOnboardingService)
+        }
+
+        composeTestRule.onNodeWithText(context.getString(R.string.sim_onboarding_primary_sim_title))
+            .assertIsDisplayed()
+    }
+
+    @Test
+    fun simOnboardingPrimarySimImpl_showSubTitle() {
+        composeTestRule.setContent {
+            SimOnboardingPrimarySimImpl(nextAction, cancelAction, mockSimOnboardingService)
+        }
+
+        composeTestRule.onNodeWithText(context.getString(R.string.sim_onboarding_primary_sim_msg))
+            .assertIsDisplayed()
+    }
+
+    @Test
+    fun simOnboardingPrimarySimImpl_clickCancelAction_verifyCancelAction() {
+        composeTestRule.setContent {
+            SimOnboardingPrimarySimImpl(nextAction, cancelAction, mockSimOnboardingService)
+        }
+
+        composeTestRule.onNodeWithText(context.getString(R.string.cancel))
+            .performClick()
+
+        verify(cancelAction)
+    }
+
+    private companion object {
+        const val SUB_ID_1 = 1
+        const val SUB_ID_2 = 2
+        const val SUB_ID_3 = 3
+        const val DISPLAY_NAME_1 = "Sub 1"
+        const val DISPLAY_NAME_2 = "Sub 2"
+        const val DISPLAY_NAME_3 = "Sub 3"
+        const val NUMBER_1 = "000000001"
+        const val NUMBER_2 = "000000002"
+        const val NUMBER_3 = "000000003"
+        const val PRIMARY_SIM_ASK_EVERY_TIME = -1
+
+        val SUB_INFO_1: SubscriptionInfo = SubscriptionInfo.Builder().apply {
+            setId(SUB_ID_1)
+            setDisplayName(DISPLAY_NAME_1)
+            setNumber(NUMBER_1)
+        }.build()
+
+        val SUB_INFO_2: SubscriptionInfo = SubscriptionInfo.Builder().apply {
+            setId(SUB_ID_2)
+            setDisplayName(DISPLAY_NAME_2)
+            setNumber(NUMBER_2)
+        }.build()
+
+        val SUB_INFO_3: SubscriptionInfo = SubscriptionInfo.Builder().apply {
+            setId(SUB_ID_3)
+            setDisplayName(DISPLAY_NAME_3)
+            setNumber(NUMBER_3)
+        }.build()
+    }
+}
diff --git a/tests/spa_unit/src/com/android/settings/spa/network/SimOnboardingSelectSimTest.kt b/tests/spa_unit/src/com/android/settings/spa/network/SimOnboardingSelectSimTest.kt
new file mode 100644
index 0000000..5d7465f
--- /dev/null
+++ b/tests/spa_unit/src/com/android/settings/spa/network/SimOnboardingSelectSimTest.kt
@@ -0,0 +1,165 @@
+/*
+ * Copyright (C) 2024 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.spa.network
+
+import android.content.Context
+import android.telephony.SubscriptionInfo
+import androidx.compose.ui.test.assertIsDisplayed
+import androidx.compose.ui.test.junit4.createComposeRule
+import androidx.compose.ui.test.onNodeWithText
+import androidx.compose.ui.test.performClick
+import androidx.test.core.app.ApplicationProvider
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import com.android.settings.R
+import com.android.settings.network.SimOnboardingService
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.mockito.kotlin.doReturn
+import org.mockito.kotlin.mock
+import org.mockito.kotlin.stub
+import org.mockito.kotlin.verify
+
+@RunWith(AndroidJUnit4::class)
+class SimOnboardingSelectSimTest {
+    @get:Rule
+    val composeTestRule = createComposeRule()
+
+    private val context: Context = ApplicationProvider.getApplicationContext()
+    private var mockSimOnboardingService = mock<SimOnboardingService> {
+        on { targetSubId }.doReturn(-1)
+        on { targetSubInfo }.doReturn(null)
+        on { availableSubInfoList }.doReturn(listOf())
+        on { activeSubInfoList }.doReturn(listOf())
+        on { slotInfoList }.doReturn(listOf())
+        on { uiccCardInfoList }.doReturn(listOf())
+        on { selectedSubInfoList }.doReturn(mutableListOf())
+
+        on { targetPrimarySimCalls }.doReturn(PRIMARY_SIM_ASK_EVERY_TIME)
+        on { targetPrimarySimTexts }.doReturn(PRIMARY_SIM_ASK_EVERY_TIME)
+        on { targetPrimarySimMobileData }.doReturn(PRIMARY_SIM_ASK_EVERY_TIME)
+    }
+
+    private val nextAction: () -> Unit = mock()
+    private val cancelAction: () -> Unit = mock()
+
+    @Test
+    fun simOnboardingSelectSimImpl_showTitle() {
+        composeTestRule.setContent {
+            SimOnboardingSelectSimImpl(nextAction, cancelAction, mockSimOnboardingService)
+        }
+
+        composeTestRule.onNodeWithText(context.getString(R.string.sim_onboarding_select_sim_title))
+            .assertIsDisplayed()
+    }
+
+    @Test
+    fun simOnboardingSelectSimImpl_showSubTitle() {
+        composeTestRule.setContent {
+            SimOnboardingSelectSimImpl(nextAction, cancelAction, mockSimOnboardingService)
+        }
+
+        composeTestRule.onNodeWithText(context.getString(R.string.sim_onboarding_select_sim_msg))
+            .assertIsDisplayed()
+    }
+
+    @Test
+    fun simOnboardingSelectSimImpl_clickNextAction_verifyNextAction() {
+        composeTestRule.setContent {
+            SimOnboardingSelectSimImpl(nextAction, cancelAction, mockSimOnboardingService)
+        }
+
+        composeTestRule.onNodeWithText(context.getString(R.string.sim_onboarding_next))
+            .performClick()
+
+        verify(nextAction)
+    }
+
+    @Test
+    fun simOnboardingSelectSimImpl_clickCancelAction_verifyCancelAction() {
+        composeTestRule.setContent {
+            SimOnboardingSelectSimImpl(nextAction, cancelAction, mockSimOnboardingService)
+        }
+
+        composeTestRule.onNodeWithText(context.getString(R.string.cancel))
+            .performClick()
+
+        verify(cancelAction)
+    }
+
+    @Test
+    fun simOnboardingSelectSimImpl_showItem_show3Items() {
+        mockSimOnboardingService.stub {
+            on { targetSubId }.doReturn(SUB_ID_1)
+            on { targetSubInfo }.doReturn(SUB_INFO_1)
+            on { availableSubInfoList }.doReturn(listOf(SUB_INFO_1, SUB_INFO_2, SUB_INFO_3))
+            on { activeSubInfoList }.doReturn(listOf(SUB_INFO_2, SUB_INFO_3))
+            on { getSelectableSubscriptionInfo() }.doReturn(
+                listOf(
+                    SUB_INFO_1,
+                    SUB_INFO_2,
+                    SUB_INFO_3
+                )
+            )
+            on { getSubscriptionInfoDisplayName(SUB_INFO_1) }.doReturn(DISPLAY_NAME_1)
+            on { getSubscriptionInfoDisplayName(SUB_INFO_2) }.doReturn(DISPLAY_NAME_2)
+            on { getSubscriptionInfoDisplayName(SUB_INFO_3) }.doReturn(DISPLAY_NAME_3)
+        }
+
+        composeTestRule.setContent {
+            SimOnboardingSelectSimImpl(nextAction, cancelAction, mockSimOnboardingService)
+        }
+
+        composeTestRule.onNodeWithText(DISPLAY_NAME_1).assertIsDisplayed()
+        composeTestRule.onNodeWithText(NUMBER_1).assertIsDisplayed()
+        composeTestRule.onNodeWithText(DISPLAY_NAME_2).assertIsDisplayed()
+        composeTestRule.onNodeWithText(NUMBER_2).assertIsDisplayed()
+        composeTestRule.onNodeWithText(DISPLAY_NAME_3).assertIsDisplayed()
+        composeTestRule.onNodeWithText(NUMBER_3).assertIsDisplayed()
+    }
+
+    private companion object {
+        const val SUB_ID_1 = 1
+        const val SUB_ID_2 = 2
+        const val SUB_ID_3 = 3
+        const val DISPLAY_NAME_1 = "Sub 1"
+        const val DISPLAY_NAME_2 = "Sub 2"
+        const val DISPLAY_NAME_3 = "Sub 3"
+        const val NUMBER_1 = "000000001"
+        const val NUMBER_2 = "000000002"
+        const val NUMBER_3 = "000000003"
+        const val PRIMARY_SIM_ASK_EVERY_TIME = -1
+
+        val SUB_INFO_1: SubscriptionInfo = SubscriptionInfo.Builder().apply {
+            setId(SUB_ID_1)
+            setDisplayName(DISPLAY_NAME_1)
+            setNumber(NUMBER_1)
+        }.build()
+
+        val SUB_INFO_2: SubscriptionInfo = SubscriptionInfo.Builder().apply {
+            setId(SUB_ID_2)
+            setDisplayName(DISPLAY_NAME_2)
+            setNumber(NUMBER_2)
+        }.build()
+
+        val SUB_INFO_3: SubscriptionInfo = SubscriptionInfo.Builder().apply {
+            setId(SUB_ID_3)
+            setDisplayName(DISPLAY_NAME_3)
+            setNumber(NUMBER_3)
+        }.build()
+    }
+}