From 65a90724c1be65b6a65b3fb1fdf2fa78bbb1344f Mon Sep 17 00:00:00 2001 From: wangxingboo Date: Sat, 12 Oct 2024 14:31:53 +0800 Subject: [PATCH] fix codex Signed-off-by: wangxingboo --- interfaces/innerkits/include/telephony_types.h | 2 +- services/sim/src/esim_file.cpp | 8 +++++--- .../esim_gtest/esim_core_service_client_branch_test.cpp | 2 +- .../unittest/esim_gtest/esim_core_service_client_test.cpp | 2 +- test/unittest/esim_gtest/esim_core_service_proxy_test.cpp | 6 +++--- test/unittest/esim_gtest/esim_core_service_test.cpp | 2 +- test/unittest/esim_gtest/esim_manager_test.cpp | 2 +- 7 files changed, 13 insertions(+), 11 deletions(-) diff --git a/interfaces/innerkits/include/telephony_types.h b/interfaces/innerkits/include/telephony_types.h index 539ac139f..3d89389f2 100644 --- a/interfaces/innerkits/include/telephony_types.h +++ b/interfaces/innerkits/include/telephony_types.h @@ -60,7 +60,7 @@ inline constexpr const char *COUNTRY_CODE_KEY = "telephony.sim.countryCode"; inline constexpr const char *TEL_SATELLITE_SUPPORTED = "const.telephony.satellite.supported"; inline constexpr const char *DEFAULT_VSIM_MODEM_COUNT = "0"; inline constexpr const char *VSIM_MODEM_COUNT_STR = "const.telephony.vsimModemCount"; -inline constexpr const char *TEL_ESIM_SUPPORT = "const.telephony.esim.supported"; +inline constexpr const char *TEL_ESIM_SUPPORT = "persist.telephony.esim.supported"; template inline T GetVirtualModemSwitch() diff --git a/services/sim/src/esim_file.cpp b/services/sim/src/esim_file.cpp index 6e34095cf..19d6e7bd8 100644 --- a/services/sim/src/esim_file.cpp +++ b/services/sim/src/esim_file.cpp @@ -109,7 +109,7 @@ bool EsimFile::ProcessEstablishDefaultSmdpAddressDone(const AppExecFwk::InnerEve TELEPHONY_LOGE("pAsn1Node is nullptr"); return false; } - setDpAddressResult_ = (ResultState)pAsn1Node->Asn1AsInteger(); + setDpAddressResult_ = static_cast(pAsn1Node->Asn1AsInteger()); { std::lock_guard lock(setDefaultSmdpAddressMutex_); isSetDefaultSmdpAddressReady_ = true; @@ -250,12 +250,14 @@ bool EsimFile::ProcessSendApduData(int32_t slotId, const AppExecFwk::InnerEvent: return false; } - EsimProfile *profile = &esimProfile_; - std::string hexStr = OHOS::Telephony::ToUtf8(profile->toBeSendApduDataHexStr); + std::string hexStr = OHOS::Telephony::ToUtf8(esimProfile_.toBeSendApduDataHexStr); RequestApduBuild codec(currentChannelId_); codec.BuildStoreData(hexStr); std::list> list = codec.GetCommands(); std::unique_ptr apdCmd = std::move(list.front()); + if (apdCmd == nullptr) { + return false; + } ApduSimIORequestInfo reqInfo; CopyApdCmdToReqInfo(&reqInfo, apdCmd.get()); if (telRilManager_ == nullptr) { diff --git a/test/unittest/esim_gtest/esim_core_service_client_branch_test.cpp b/test/unittest/esim_gtest/esim_core_service_client_branch_test.cpp index adb14a5ae..6eb645462 100644 --- a/test/unittest/esim_gtest/esim_core_service_client_branch_test.cpp +++ b/test/unittest/esim_gtest/esim_core_service_client_branch_test.cpp @@ -71,7 +71,7 @@ HWTEST_F(EsimCoreServiceClientBranchTest, ResetMemory_0100, Function | MediumTes HWTEST_F(EsimCoreServiceClientBranchTest, SetDefaultSmdpAddress_0100, Function | MediumTest | Level1) { int32_t slotId = 0; - std::u16string defaultSmdpAddress = Str8ToStr16("smdp.gsma.com"); + std::u16string defaultSmdpAddress = Str8ToStr16("test.com"); ResultState SetAddressResult; EXPECT_CALL(*samgr, CheckSystemAbility(testing::_)).WillOnce(testing::Return(nullptr)); int32_t result = CoreServiceClient::GetInstance(). diff --git a/test/unittest/esim_gtest/esim_core_service_client_test.cpp b/test/unittest/esim_gtest/esim_core_service_client_test.cpp index 33aa4b1bc..95a68cf58 100644 --- a/test/unittest/esim_gtest/esim_core_service_client_test.cpp +++ b/test/unittest/esim_gtest/esim_core_service_client_test.cpp @@ -59,7 +59,7 @@ HWTEST_F(EsimCoreServiceClientTest, ResetMemory_0001, Function | MediumTest | Le HWTEST_F(EsimCoreServiceClientTest, SetDefaultSmdpAddress_0001, Function | MediumTest | Level1) { int32_t slotId = 0; - std::u16string defaultSmdpAddress = Str8ToStr16("smdp.gsma.com"); + std::u16string defaultSmdpAddress = Str8ToStr16("test.com"); ResultState SetAddressResult; int32_t result = CoreServiceClient::GetInstance().SetDefaultSmdpAddress( slotId, defaultSmdpAddress, SetAddressResult); diff --git a/test/unittest/esim_gtest/esim_core_service_proxy_test.cpp b/test/unittest/esim_gtest/esim_core_service_proxy_test.cpp index 74b9e4d6b..3b4b1076a 100644 --- a/test/unittest/esim_gtest/esim_core_service_proxy_test.cpp +++ b/test/unittest/esim_gtest/esim_core_service_proxy_test.cpp @@ -141,7 +141,7 @@ HWTEST_F(EsimCoreServiceProxyTest, SetDefaultSmdpAddress_001, Function | MediumT { sptr remote = nullptr; CoreServiceProxy proxy(remote); - std::u16string defaultSmdpAddress = Str8ToStr16("smdp.gsma.com"); + std::u16string defaultSmdpAddress = Str8ToStr16("test.com"); ResultState setAddressResult; int32_t ret = proxy.SetDefaultSmdpAddress(SLOT_ID, defaultSmdpAddress, setAddressResult); EXPECT_EQ(ret, TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL); @@ -151,7 +151,7 @@ HWTEST_F(EsimCoreServiceProxyTest, SetDefaultSmdpAddress_002, Function | MediumT { sptr remote = new (std::nothrow) MockIRemoteObject(); CoreServiceProxy proxy(remote); - std::u16string defaultSmdpAddress = Str8ToStr16("smdp.gsma.com"); + std::u16string defaultSmdpAddress = Str8ToStr16("test.com"); ResultState setAddressResult; EXPECT_CALL(*remote, SendRequest(testing::_, testing::_, testing::_, testing::_)).WillOnce(testing::Return(-500)); int32_t ret = proxy.SetDefaultSmdpAddress(SLOT_ID, defaultSmdpAddress, setAddressResult); @@ -162,7 +162,7 @@ HWTEST_F(EsimCoreServiceProxyTest, SetDefaultSmdpAddress_003, Function | MediumT { sptr remote = new (std::nothrow) MockIRemoteObject(); CoreServiceProxy proxy(remote); - std::u16string defaultSmdpAddress = Str8ToStr16("smdp.gsma.com"); + std::u16string defaultSmdpAddress = Str8ToStr16("test.com"); ResultState setAddressResult; EXPECT_CALL(*remote, SendRequest(testing::_, testing::_, testing::_, testing::_)).WillOnce(testing::Return(0)); int32_t ret = proxy.SetDefaultSmdpAddress(SLOT_ID, defaultSmdpAddress, setAddressResult); diff --git a/test/unittest/esim_gtest/esim_core_service_test.cpp b/test/unittest/esim_gtest/esim_core_service_test.cpp index 3dd449273..fb4309707 100644 --- a/test/unittest/esim_gtest/esim_core_service_test.cpp +++ b/test/unittest/esim_gtest/esim_core_service_test.cpp @@ -67,7 +67,7 @@ HWTEST_F(EsimCoreServiceTest, SetDefaultSmdpAddress_0001, Function | MediumTest std::shared_ptr telRilManager = std::make_shared(); mCoreService->simManager_ = std::make_shared(telRilManager); int32_t slotId = 0; - std::u16string defaultSmdpAddress = Str8ToStr16("smdp.gsma.com"); + std::u16string defaultSmdpAddress = Str8ToStr16("test.com"); ResultState SetAddressResult; EXPECT_NE(mCoreService->SetDefaultSmdpAddress( slotId, defaultSmdpAddress, SetAddressResult), TELEPHONY_ERR_SUCCESS); diff --git a/test/unittest/esim_gtest/esim_manager_test.cpp b/test/unittest/esim_gtest/esim_manager_test.cpp index eb5095d76..805e88c19 100644 --- a/test/unittest/esim_gtest/esim_manager_test.cpp +++ b/test/unittest/esim_gtest/esim_manager_test.cpp @@ -81,7 +81,7 @@ HWTEST_F(EsimManagerTest, ResetMemory, Function | MediumTest | Level1) HWTEST_F(EsimManagerTest, SetDefaultSmdpAddress, Function | MediumTest | Level1) { int32_t slotId = 0; - std::u16string defaultSmdpAddress = Str8ToStr16("smdp.gsma.com"); + std::u16string defaultSmdpAddress = Str8ToStr16("test.com"); ResultState SetAddressResult; std::shared_ptr telRilManager = std::make_shared(); std::shared_ptr simManager = std::make_shared(telRilManager);