Merge "The pages of sim onboarding flow is wrong." into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
b462f9fa11
@@ -401,6 +401,11 @@ class SimOnboardingActivity : SpaBaseDialogActivity() {
|
|||||||
Log.d(TAG, "startSimSwitching:")
|
Log.d(TAG, "startSimSwitching:")
|
||||||
|
|
||||||
var targetSubInfo = onboardingService.targetSubInfo
|
var targetSubInfo = onboardingService.targetSubInfo
|
||||||
|
if(onboardingService.doesTargetSimActive) {
|
||||||
|
Log.d(TAG, "target subInfo is already active")
|
||||||
|
callbackListener(CallbackType.CALLBACK_SETUP_NAME)
|
||||||
|
return
|
||||||
|
}
|
||||||
targetSubInfo?.let {
|
targetSubInfo?.let {
|
||||||
var removedSubInfo = onboardingService.getRemovedSim()
|
var removedSubInfo = onboardingService.getRemovedSim()
|
||||||
if (targetSubInfo.isEmbedded) {
|
if (targetSubInfo.isEmbedded) {
|
||||||
|
@@ -16,6 +16,9 @@
|
|||||||
|
|
||||||
package com.android.settings.network
|
package com.android.settings.network
|
||||||
|
|
||||||
|
import android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID
|
||||||
|
import android.telephony.SubscriptionManager.INVALID_SIM_SLOT_INDEX
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.telephony.SubscriptionInfo
|
import android.telephony.SubscriptionInfo
|
||||||
import android.telephony.SubscriptionManager
|
import android.telephony.SubscriptionManager
|
||||||
@@ -40,26 +43,26 @@ class SimOnboardingService {
|
|||||||
var subscriptionManager:SubscriptionManager? = null
|
var subscriptionManager:SubscriptionManager? = null
|
||||||
var telephonyManager:TelephonyManager? = null
|
var telephonyManager:TelephonyManager? = null
|
||||||
|
|
||||||
var targetSubId: Int = INVALID
|
var targetSubId: Int = INVALID_SUBSCRIPTION_ID
|
||||||
var targetSubInfo: SubscriptionInfo? = null
|
var targetSubInfo: SubscriptionInfo? = null
|
||||||
var availableSubInfoList: List<SubscriptionInfo> = listOf()
|
var availableSubInfoList: List<SubscriptionInfo> = listOf()
|
||||||
var activeSubInfoList: List<SubscriptionInfo> = listOf()
|
var activeSubInfoList: List<SubscriptionInfo> = listOf()
|
||||||
var slotInfoList: List<UiccSlotInfo> = listOf()
|
var slotInfoList: List<UiccSlotInfo> = listOf()
|
||||||
var uiccCardInfoList: List<UiccCardInfo> = listOf()
|
var uiccCardInfoList: List<UiccCardInfo> = listOf()
|
||||||
var targetPrimarySimCalls: Int = SubscriptionManager.INVALID_SUBSCRIPTION_ID
|
var targetPrimarySimCalls: Int = INVALID_SUBSCRIPTION_ID
|
||||||
var targetPrimarySimTexts: Int = SubscriptionManager.INVALID_SUBSCRIPTION_ID
|
var targetPrimarySimTexts: Int = INVALID_SUBSCRIPTION_ID
|
||||||
var targetPrimarySimMobileData: Int = SubscriptionManager.INVALID_SUBSCRIPTION_ID
|
var targetPrimarySimMobileData: Int = INVALID_SUBSCRIPTION_ID
|
||||||
val targetPrimarySimAutoDataSwitch = MutableStateFlow(false)
|
val targetPrimarySimAutoDataSwitch = MutableStateFlow(false)
|
||||||
var targetNonDds: Int = SubscriptionManager.INVALID_SUBSCRIPTION_ID
|
var targetNonDds: Int = INVALID_SUBSCRIPTION_ID
|
||||||
get() {
|
get() {
|
||||||
if(targetPrimarySimMobileData == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
|
if(targetPrimarySimMobileData == INVALID_SUBSCRIPTION_ID) {
|
||||||
Log.w(TAG, "No DDS")
|
Log.w(TAG, "No DDS")
|
||||||
return SubscriptionManager.INVALID_SUBSCRIPTION_ID
|
return INVALID_SUBSCRIPTION_ID
|
||||||
}
|
}
|
||||||
return userSelectedSubInfoList
|
return userSelectedSubInfoList
|
||||||
.filter { info -> info.subscriptionId != targetPrimarySimMobileData }
|
.filter { info -> info.subscriptionId != targetPrimarySimMobileData }
|
||||||
.map { it.subscriptionId }
|
.map { it.subscriptionId }
|
||||||
.firstOrNull() ?: SubscriptionManager.INVALID_SUBSCRIPTION_ID
|
.firstOrNull() ?: INVALID_SUBSCRIPTION_ID
|
||||||
}
|
}
|
||||||
var callback: (CallbackType) -> Unit = {}
|
var callback: (CallbackType) -> Unit = {}
|
||||||
|
|
||||||
@@ -84,6 +87,11 @@ class SimOnboardingService {
|
|||||||
activeSubInfoList.stream().anyMatch { it.isEmbedded }
|
activeSubInfoList.stream().anyMatch { it.isEmbedded }
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
var doesTargetSimActive = false
|
||||||
|
get() {
|
||||||
|
return targetSubInfo?.getSimSlotIndex() ?: INVALID_SIM_SLOT_INDEX >= 0
|
||||||
|
}
|
||||||
|
|
||||||
var doesTargetSimHaveEsimOperation = false
|
var doesTargetSimHaveEsimOperation = false
|
||||||
get() {
|
get() {
|
||||||
return targetSubInfo?.isEmbedded ?: false
|
return targetSubInfo?.isEmbedded ?: false
|
||||||
@@ -95,7 +103,7 @@ class SimOnboardingService {
|
|||||||
}
|
}
|
||||||
var getActiveModemCount = 0
|
var getActiveModemCount = 0
|
||||||
get() {
|
get() {
|
||||||
return telephonyManager?.getActiveModemCount() ?: 0
|
return (telephonyManager?.getActiveModemCount() ?: 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
var renameMutableMap : MutableMap<Int, String> = mutableMapOf()
|
var renameMutableMap : MutableMap<Int, String> = mutableMapOf()
|
||||||
@@ -103,16 +111,18 @@ class SimOnboardingService {
|
|||||||
|
|
||||||
var isSimSelectionFinished = false
|
var isSimSelectionFinished = false
|
||||||
get() {
|
get() {
|
||||||
return getActiveModemCount != 0 && userSelectedSubInfoList.size == getActiveModemCount
|
val activeModem = getActiveModemCount
|
||||||
|
return activeModem != 0 && userSelectedSubInfoList.size == activeModem
|
||||||
}
|
}
|
||||||
|
|
||||||
var isAllOfSlotAssigned = false
|
var isAllOfSlotAssigned = false
|
||||||
get() {
|
get() {
|
||||||
if(getActiveModemCount == 0){
|
val activeModem = getActiveModemCount
|
||||||
|
if(activeModem == 0){
|
||||||
Log.e(TAG, "isAllOfSlotAssigned: getActiveModemCount is 0")
|
Log.e(TAG, "isAllOfSlotAssigned: getActiveModemCount is 0")
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return getActiveModemCount != 0 && activeSubInfoList.size == getActiveModemCount
|
return getActiveModemCount != 0 && activeSubInfoList.size == activeModem
|
||||||
}
|
}
|
||||||
var isMultiSimEnabled = false
|
var isMultiSimEnabled = false
|
||||||
get() {
|
get() {
|
||||||
@@ -129,7 +139,7 @@ class SimOnboardingService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun isValid(): Boolean {
|
fun isValid(): Boolean {
|
||||||
return targetSubId != INVALID
|
return targetSubId != INVALID_SUBSCRIPTION_ID
|
||||||
&& targetSubInfo != null
|
&& targetSubInfo != null
|
||||||
&& activeSubInfoList.isNotEmpty()
|
&& activeSubInfoList.isNotEmpty()
|
||||||
&& slotInfoList.isNotEmpty()
|
&& slotInfoList.isNotEmpty()
|
||||||
@@ -156,14 +166,15 @@ class SimOnboardingService {
|
|||||||
fun initData(inputTargetSubId: Int,
|
fun initData(inputTargetSubId: Int,
|
||||||
context: Context,
|
context: Context,
|
||||||
callback: (CallbackType) -> Unit) {
|
callback: (CallbackType) -> Unit) {
|
||||||
|
clear()
|
||||||
this.callback = callback
|
this.callback = callback
|
||||||
targetSubId = inputTargetSubId
|
targetSubId = inputTargetSubId
|
||||||
subscriptionManager = context.getSystemService(SubscriptionManager::class.java)
|
subscriptionManager = context.getSystemService(SubscriptionManager::class.java)
|
||||||
telephonyManager = context.getSystemService(TelephonyManager::class.java)
|
telephonyManager = context.getSystemService(TelephonyManager::class.java)
|
||||||
|
activeSubInfoList = SubscriptionUtil.getActiveSubscriptions(subscriptionManager)
|
||||||
Log.d(
|
Log.d(
|
||||||
TAG, "startInit: targetSubId:$targetSubId, activeSubInfoList: $activeSubInfoList"
|
TAG, "startInit: targetSubId:$targetSubId, activeSubInfoList: $activeSubInfoList"
|
||||||
)
|
)
|
||||||
activeSubInfoList = SubscriptionUtil.getActiveSubscriptions(subscriptionManager)
|
|
||||||
|
|
||||||
ThreadUtils.postOnBackgroundThread {
|
ThreadUtils.postOnBackgroundThread {
|
||||||
availableSubInfoList = SubscriptionUtil.getAvailableSubscriptions(context)
|
availableSubInfoList = SubscriptionUtil.getAvailableSubscriptions(context)
|
||||||
@@ -242,15 +253,20 @@ class SimOnboardingService {
|
|||||||
|
|
||||||
fun addCurrentItemForSelectedSim() {
|
fun addCurrentItemForSelectedSim() {
|
||||||
if (userSelectedSubInfoList.size < getActiveModemCount) {
|
if (userSelectedSubInfoList.size < getActiveModemCount) {
|
||||||
userSelectedSubInfoList.addAll(activeSubInfoList)
|
userSelectedSubInfoList.addAll(
|
||||||
Log.d(TAG, "addCurrentItemForSelectedSim: userSelectedSubInfoList:" +
|
activeSubInfoList.filter { !userSelectedSubInfoList.contains(it) }
|
||||||
", $userSelectedSubInfoList")
|
)
|
||||||
|
Log.d(TAG,
|
||||||
|
"addCurrentItemForSelectedSim: userSelectedSubInfoList: $userSelectedSubInfoList"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addItemForSelectedSim(selectedSubInfo: SubscriptionInfo) {
|
fun addItemForSelectedSim(selectedSubInfo: SubscriptionInfo) {
|
||||||
|
if (!userSelectedSubInfoList.contains(selectedSubInfo)) {
|
||||||
userSelectedSubInfoList.add(selectedSubInfo)
|
userSelectedSubInfoList.add(selectedSubInfo)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun removeItemForSelectedSim(selectedSubInfo: SubscriptionInfo) {
|
fun removeItemForSelectedSim(selectedSubInfo: SubscriptionInfo) {
|
||||||
if (userSelectedSubInfoList.contains(selectedSubInfo)) {
|
if (userSelectedSubInfoList.contains(selectedSubInfo)) {
|
||||||
@@ -370,7 +386,6 @@ class SimOnboardingService {
|
|||||||
|
|
||||||
companion object{
|
companion object{
|
||||||
private const val TAG = "SimOnboardingService"
|
private const val TAG = "SimOnboardingService"
|
||||||
private const val INVALID = SubscriptionManager.INVALID_SUBSCRIPTION_ID
|
|
||||||
const val NUM_OF_SIMS_FOR_DSDS = 2
|
const val NUM_OF_SIMS_FOR_DSDS = 2
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -107,7 +107,8 @@ fun PageImpl(onboardingService:SimOnboardingService,navHostController: NavHostCo
|
|||||||
composable(route = SimOnboardingScreen.LabelSim.name) {
|
composable(route = SimOnboardingScreen.LabelSim.name) {
|
||||||
val nextPage =
|
val nextPage =
|
||||||
if (onboardingService.isMultipleEnabledProfilesSupported
|
if (onboardingService.isMultipleEnabledProfilesSupported
|
||||||
&& onboardingService.isAllOfSlotAssigned) {
|
&& onboardingService.isAllOfSlotAssigned
|
||||||
|
&& !onboardingService.doesTargetSimActive) {
|
||||||
SimOnboardingScreen.SelectSim.name
|
SimOnboardingScreen.SelectSim.name
|
||||||
} else {
|
} else {
|
||||||
LaunchedEffect(Unit) {
|
LaunchedEffect(Unit) {
|
||||||
|
@@ -91,6 +91,7 @@ class SimOnboardingPageProviderTest {
|
|||||||
mockSimOnboardingService.stub {
|
mockSimOnboardingService.stub {
|
||||||
on { isMultipleEnabledProfilesSupported }.thenReturn(true)
|
on { isMultipleEnabledProfilesSupported }.thenReturn(true)
|
||||||
on { isAllOfSlotAssigned }.thenReturn(true)
|
on { isAllOfSlotAssigned }.thenReturn(true)
|
||||||
|
on { doesTargetSimActive }.thenReturn(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
composeTestRule.setContent {
|
composeTestRule.setContent {
|
||||||
|
Reference in New Issue
Block a user