Settings: Make SIM toggle unchangable when not supported
Fixes: https://gitlab.com/LineageOS/issues/android/-/issues/8290 Change-Id: I2e566c24969708c31f607af2baad88b388bda74d
This commit is contained in:
parent
3df966cc65
commit
97c93a7017
1 changed files with 9 additions and 1 deletions
|
|
@ -69,6 +69,11 @@ private fun SimPreference(subInfo: SubscriptionInfo) {
|
|||
SubscriptionRepository(context).isSubscriptionEnabledFlow(subInfo.subscriptionId)
|
||||
}.collectAsStateWithLifecycle(initialValue = false)
|
||||
val phoneNumber = phoneNumber(subInfo)
|
||||
val canDisablePhysicalSubscription by remember {
|
||||
flow {
|
||||
emit(SubscriptionRepository(context).canDisablePhysicalSubscription())
|
||||
}
|
||||
}.collectAsStateWithLifecycle(initialValue = false)
|
||||
val isConvertedPsim by remember(subInfo) {
|
||||
flow {
|
||||
emit(SubscriptionUtil.isConvertedPsimSubscription(subInfo))
|
||||
|
|
@ -90,7 +95,10 @@ private fun SimPreference(subInfo: SubscriptionInfo) {
|
|||
}
|
||||
}
|
||||
override val icon = @Composable { SimIcon(subInfo.isEmbedded) }
|
||||
override val changeable = { isActivationChangeable && !isConvertedPsim }
|
||||
override val changeable = {
|
||||
(subInfo.isEmbedded || canDisablePhysicalSubscription)
|
||||
&& isActivationChangeable && !isConvertedPsim
|
||||
}
|
||||
override val checked = { checked.value }
|
||||
override val onCheckedChange: (Boolean) -> Unit = { newChecked ->
|
||||
coroutineScope.launch {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue