Fix PrimarySim show the same sim in the preference list

Bug: 327425969
Test: manual test, verify the UI
Change-Id: I0d3c2163a43a00ec0e4e627b34281e95cc611751
This commit is contained in:
songferngwang
2024-02-28 21:40:07 +00:00
parent 09603308d4
commit bb7360b148
2 changed files with 12 additions and 4 deletions

View File

@@ -219,8 +219,12 @@ class SimOnboardingService {
return renameMutableMap[subInfo.subscriptionId] ?: subInfo.displayName.toString() return renameMutableMap[subInfo.subscriptionId] ?: subInfo.displayName.toString()
} }
fun addCurrentItemForSelectedSim(){ fun addCurrentItemForSelectedSim() {
if (userSelectedSubInfoList.size < getActiveModemCount) {
userSelectedSubInfoList.addAll(activeSubInfoList) userSelectedSubInfoList.addAll(activeSubInfoList)
Log.d(TAG, "addCurrentItemForSelectedSim: userSelectedSubInfoList:" +
", $userSelectedSubInfoList")
}
} }
fun addItemForSelectedSim(selectedSubInfo: SubscriptionInfo) { fun addItemForSelectedSim(selectedSubInfo: SubscriptionInfo) {

View File

@@ -24,6 +24,7 @@ import android.os.Bundle
import android.util.Log import android.util.Log
import androidx.annotation.VisibleForTesting import androidx.annotation.VisibleForTesting
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import androidx.navigation.NavHostController import androidx.navigation.NavHostController
import androidx.navigation.NavType import androidx.navigation.NavType
@@ -101,10 +102,13 @@ fun PageImpl(onboardingService:SimOnboardingService,navHostController: NavHostCo
) { ) {
composable(route = SimOnboardingScreen.LabelSim.name) { composable(route = SimOnboardingScreen.LabelSim.name) {
val nextPage = val nextPage =
if (onboardingService.isMultipleEnabledProfilesSupported && onboardingService.isAllOfSlotAssigned) { if (onboardingService.isMultipleEnabledProfilesSupported
&& onboardingService.isAllOfSlotAssigned) {
SimOnboardingScreen.SelectSim.name SimOnboardingScreen.SelectSim.name
} else { } else {
LaunchedEffect(Unit) {
onboardingService.addCurrentItemForSelectedSim() onboardingService.addCurrentItemForSelectedSim()
}
SimOnboardingScreen.PrimarySim.name SimOnboardingScreen.PrimarySim.name
} }
SimOnboardingLabelSimImpl( SimOnboardingLabelSimImpl(