diff --git a/interfaces/innerkits/include/hril_types.h b/interfaces/innerkits/include/hril_types.h index b1dcdd1c..37c478a9 100644 --- a/interfaces/innerkits/include/hril_types.h +++ b/interfaces/innerkits/include/hril_types.h @@ -405,6 +405,8 @@ static constexpr uint32_t HRIL_NETWORKS_SELECT_MODE = 0; inline const int32_t HRIL_SYSPARA_SIZE = 128; inline constexpr const char *HRIL_DEFAULT_SLOT_COUNT = "1"; inline constexpr const char *HRIL_TEL_SIM_SLOT_COUNT = "const.telephony.slotCount"; +inline constexpr const char *HRIL_DEFAULT_VSIM_MODEM_COUNT = "0"; +inline constexpr const char *HRIL_VSIM_MODEM_COUNT_STR = "const.telephony.vsimModemCount"; /** Interface token */ inline const std::u16string HRIL_INTERFACE_TOKEN = u"ohos.telephony.hril"; diff --git a/services/hril/BUILD.gn b/services/hril/BUILD.gn index f37a890f..384d7b71 100644 --- a/services/hril/BUILD.gn +++ b/services/hril/BUILD.gn @@ -12,6 +12,7 @@ # limitations under the License. import("//build/ohos.gni") +import("../../../core_service/telephony_core_service.gni") RIL_ADAPTER = "../../" RIL_HRIL = "../../services/hril/src" @@ -45,6 +46,8 @@ ohos_shared_library("hril") { "LOG_DOMAIN = 0xD001F08", ] + defines += telephony_extra_defines + deps = [ "$RIL_ADAPTER/interfaces/innerkits:hril_innerkits" ] external_deps = [ diff --git a/services/hril/include/hril_manager.h b/services/hril/include/hril_manager.h index 1ea55814..c474b3cb 100644 --- a/services/hril/include/hril_manager.h +++ b/services/hril/include/hril_manager.h @@ -33,6 +33,9 @@ namespace OHOS { namespace Telephony { +inline const int32_t DUAL_SLOT_COUNT = 2; +inline const int32_t MAX_SLOT_COUNT = 3; + typedef enum : int32_t { RIL_REGISTER_IS_NONE = 0, RIL_REGISTER_IS_RUNNING, diff --git a/services/hril/src/hril_manager.cpp b/services/hril/src/hril_manager.cpp index e7d2c872..93576bfa 100644 --- a/services/hril/src/hril_manager.cpp +++ b/services/hril/src/hril_manager.cpp @@ -1025,7 +1025,16 @@ int32_t GetSimSlotCount() { char simSlotCount[HRIL_SYSPARA_SIZE] = { 0 }; GetParameter(HRIL_TEL_SIM_SLOT_COUNT, HRIL_DEFAULT_SLOT_COUNT, simSlotCount, HRIL_SYSPARA_SIZE); - return std::atoi(simSlotCount); + int32_t simSlotCountNumber = std::atoi(simSlotCount); +#ifdef OHOS_BUILD_ENABLE_TELEPHONY_VSIM + char vSimModemCount[HRIL_SYSPARA_SIZE] = { 0 }; + GetParameter(HRIL_VSIM_MODEM_COUNT_STR, HRIL_DEFAULT_VSIM_MODEM_COUNT, vSimModemCount, HRIL_SYSPARA_SIZE); + int32_t vSimModemCountNumber = std::atoi(vSimModemCount); + if (simSlotCountNumber == DUAL_SLOT_COUNT && vSimModemCountNumber == MAX_SLOT_COUNT) { + simSlotCountNumber = MAX_SLOT_COUNT; + } +#endif + return simSlotCountNumber; } static void HRilBootUpEventLoop()