diff --git a/app/src/main/java/dev/bluehouse/enablevolte/Components.kt b/app/src/main/java/dev/bluehouse/enablevolte/Components.kt index e2c086e..b179c7d 100644 --- a/app/src/main/java/dev/bluehouse/enablevolte/Components.kt +++ b/app/src/main/java/dev/bluehouse/enablevolte/Components.kt @@ -166,18 +166,18 @@ fun UserAgentPropertyView(label: String, value: String?, onUpdate: ((String) -> Row(modifier = Modifier.align(Alignment.End)) { TextButton( onClick = { - onUpdate(typedText) openTextEditDialog = false }, ) { - Text(stringResource(R.string.confirm)) + Text(stringResource(R.string.dismiss)) } TextButton( onClick = { + onUpdate(typedText) openTextEditDialog = false }, ) { - Text(stringResource(R.string.dismiss)) + Text(stringResource(R.string.confirm)) } } } diff --git a/app/src/main/java/dev/bluehouse/enablevolte/Moder.kt b/app/src/main/java/dev/bluehouse/enablevolte/Moder.kt index 931407a..b21971f 100644 --- a/app/src/main/java/dev/bluehouse/enablevolte/Moder.kt +++ b/app/src/main/java/dev/bluehouse/enablevolte/Moder.kt @@ -241,13 +241,19 @@ class SubscriptionModer(val subscriptionId: Int) : Moder() { val isVoLteConfigEnabled: Boolean get() = this.getBooleanValue(CarrierConfigManager.KEY_CARRIER_VOLTE_AVAILABLE_BOOL) - val isVonrConfigEnabled: Boolean + val isVoNrConfigEnabled: Boolean get() = this.getBooleanValue(CarrierConfigManager.KEY_VONR_ENABLED_BOOL) && this.getBooleanValue(CarrierConfigManager.KEY_VONR_SETTING_VISIBILITY_BOOL) - val isCrosssimConfigEnabled: Boolean - get() = this.getBooleanValue(CarrierConfigManager.KEY_CARRIER_CROSS_SIM_IMS_AVAILABLE_BOOL) && - this.getBooleanValue(CarrierConfigManager.KEY_ENABLE_CROSS_SIM_CALLING_ON_OPPORTUNISTIC_DATA_BOOL) + val isCrossSIMConfigEnabled: Boolean + get() { + return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + this.getBooleanValue(CarrierConfigManager.KEY_CARRIER_CROSS_SIM_IMS_AVAILABLE_BOOL) && + this.getBooleanValue(CarrierConfigManager.KEY_ENABLE_CROSS_SIM_CALLING_ON_OPPORTUNISTIC_DATA_BOOL) + } else { + false + } + } val isVoWifiConfigEnabled: Boolean get() = this.getBooleanValue(CarrierConfigManager.KEY_CARRIER_WFC_IMS_AVAILABLE_BOOL) @@ -255,9 +261,12 @@ class SubscriptionModer(val subscriptionId: Int) : Moder() { val isVoWifiWhileRoamingEnabled: Boolean get() = this.getBooleanValue(CarrierConfigManager.KEY_CARRIER_DEFAULT_WFC_IMS_ROAMING_ENABLED_BOOL) - val showIMSinSIMinfo: Boolean + val showIMSinSIMInfo: Boolean get() = this.getBooleanValue(CarrierConfigManager.KEY_SHOW_IMS_REGISTRATION_STATUS_BOOL) + val allowAddingAPNs: Boolean + get() = this.getBooleanValue(CarrierConfigManager.KEY_ALLOW_ADDING_APNS_BOOL) + val showVoWifiMode: Boolean get() = this.getBooleanValue(CarrierConfigManager.KEY_EDITABLE_WFC_MODE_BOOL) diff --git a/app/src/main/java/dev/bluehouse/enablevolte/pages/Config.kt b/app/src/main/java/dev/bluehouse/enablevolte/pages/Config.kt index 86f9cdb..a8b8106 100644 --- a/app/src/main/java/dev/bluehouse/enablevolte/pages/Config.kt +++ b/app/src/main/java/dev/bluehouse/enablevolte/pages/Config.kt @@ -1,5 +1,6 @@ package dev.bluehouse.enablevolte.pages +import android.os.Build import android.telephony.CarrierConfigManager import android.widget.Toast import androidx.compose.foundation.layout.Column @@ -29,7 +30,6 @@ import dev.bluehouse.enablevolte.UserAgentPropertyView import dev.bluehouse.enablevolte.ValueType import dev.bluehouse.enablevolte.checkShizukuPermission import java.lang.IllegalStateException -import java.util.* @Composable fun Config(navController: NavController, subId: Int) { @@ -41,10 +41,11 @@ fun Config(navController: NavController, subId: Int) { var configurable by rememberSaveable { mutableStateOf(false) } var voLTEEnabled by rememberSaveable { mutableStateOf(false) } var voNREnabled by rememberSaveable { mutableStateOf(false) } - var crosssimEnabled by rememberSaveable { mutableStateOf(false) } + var crossSIMEnabled by rememberSaveable { mutableStateOf(false) } var voWiFiEnabled by rememberSaveable { mutableStateOf(false) } var voWiFiEnabledWhileRoaming by rememberSaveable { mutableStateOf(false) } - var showIMSinSIMinfo by rememberSaveable { mutableStateOf(false) } + var showIMSinSIMInfo by rememberSaveable { mutableStateOf(false) } + var allowAddingAPNs by rememberSaveable { mutableStateOf(false) } var showVoWifiMode by rememberSaveable { mutableStateOf(false) } var showVoWifiRoamingMode by rememberSaveable { mutableStateOf(false) } var showVoWifiInNetworkName by rememberSaveable { mutableStateOf(false) } @@ -61,11 +62,12 @@ fun Config(navController: NavController, subId: Int) { fun loadFlags() { voLTEEnabled = moder.isVoLteConfigEnabled - voNREnabled = moder.isVonrConfigEnabled - crosssimEnabled = moder.isCrosssimConfigEnabled + voNREnabled = moder.isVoNrConfigEnabled + crossSIMEnabled = moder.isCrossSIMConfigEnabled voWiFiEnabled = moder.isVoWifiConfigEnabled voWiFiEnabledWhileRoaming = moder.isVoWifiWhileRoamingEnabled - showIMSinSIMinfo = moder.showIMSinSIMinfo + showIMSinSIMInfo = moder.showIMSinSIMInfo + allowAddingAPNs = moder.allowAddingAPNs showVoWifiMode = moder.showVoWifiMode showVoWifiRoamingMode = moder.showVoWifiRoamingMode showVoWifiInNetworkName = (moder.showVoWifiInNetworkName == 1) @@ -129,16 +131,18 @@ fun Config(navController: NavController, subId: Int) { true } } - BooleanPropertyView(label = stringResource(R.string.enable_crosssim), toggled = crosssimEnabled) { - crosssimEnabled = if (crosssimEnabled) { - moder.updateCarrierConfig(CarrierConfigManager.KEY_CARRIER_CROSS_SIM_IMS_AVAILABLE_BOOL, false) - moder.updateCarrierConfig(CarrierConfigManager.KEY_ENABLE_CROSS_SIM_CALLING_ON_OPPORTUNISTIC_DATA_BOOL, false) - false - } else { - moder.updateCarrierConfig(CarrierConfigManager.KEY_CARRIER_CROSS_SIM_IMS_AVAILABLE_BOOL, true) - moder.updateCarrierConfig(CarrierConfigManager.KEY_ENABLE_CROSS_SIM_CALLING_ON_OPPORTUNISTIC_DATA_BOOL, true) - moder.restartIMSRegistration() - true + BooleanPropertyView(label = stringResource(R.string.enable_crosssim), toggled = crossSIMEnabled, enabled = Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + crossSIMEnabled = if (crossSIMEnabled) { + moder.updateCarrierConfig(CarrierConfigManager.KEY_CARRIER_CROSS_SIM_IMS_AVAILABLE_BOOL, false) + moder.updateCarrierConfig(CarrierConfigManager.KEY_ENABLE_CROSS_SIM_CALLING_ON_OPPORTUNISTIC_DATA_BOOL, false) + false + } else { + moder.updateCarrierConfig(CarrierConfigManager.KEY_CARRIER_CROSS_SIM_IMS_AVAILABLE_BOOL, true) + moder.updateCarrierConfig(CarrierConfigManager.KEY_ENABLE_CROSS_SIM_CALLING_ON_OPPORTUNISTIC_DATA_BOOL, true) + moder.restartIMSRegistration() + true + } } } BooleanPropertyView(label = stringResource(R.string.enable_vowifi), toggled = voWiFiEnabled) { @@ -184,6 +188,15 @@ fun Config(navController: NavController, subId: Int) { true } } + BooleanPropertyView(label = stringResource(R.string.allow_adding_apns), toggled = allowAddingAPNs) { + allowAddingAPNs = if (allowAddingAPNs) { + moder.updateCarrierConfig(CarrierConfigManager.KEY_ALLOW_ADDING_APNS_BOOL, false) + false + } else { + moder.updateCarrierConfig(CarrierConfigManager.KEY_ALLOW_ADDING_APNS_BOOL, true) + true + } + } HeaderText(text = stringResource(R.string.string_values)) UserAgentPropertyView(label = stringResource(R.string.user_agent), value = configuredUserAgent) { @@ -288,8 +301,8 @@ fun Config(navController: NavController, subId: Int) { true } } - BooleanPropertyView(label = stringResource(R.string.show_ims_status_in_sim_status), toggled = showIMSinSIMinfo) { - showIMSinSIMinfo = if (showIMSinSIMinfo) { + BooleanPropertyView(label = stringResource(R.string.show_ims_status_in_sim_status), toggled = showIMSinSIMInfo) { + showIMSinSIMInfo = if (showIMSinSIMInfo) { moder.updateCarrierConfig(CarrierConfigManager.KEY_SHOW_IMS_REGISTRATION_STATUS_BOOL, false) false } else { diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 5c72d9b..8099a47 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -21,6 +21,7 @@ 显示 VoWiFi漫游 选项 网络名中添加 \"Wi-Fi Calling\" 在 SIM 信息中显示 IMS 状态 + Allow adding APNs VoWiFi 显示 \"仅WiFi\" 模式 启用视频通话(VT) UT接口下启用补充业务 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ceef38f..f044591 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -22,6 +22,7 @@ Add \"Wi-Fi Calling\" to Network Name Show \"WiFi only\" mode for VoWiFi Enable Video Calling (VT) + Allow adding APNs Enable Supplementary Services over UT Enable Supplementary Services over CDMA SIM Detected