1d95e75fdSopenharmony_ci/*
2d95e75fdSopenharmony_ci * Copyright (C) 2021-2023 Huawei Device Co., Ltd.
3d95e75fdSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4d95e75fdSopenharmony_ci * you may not use this file except in compliance with the License.
5d95e75fdSopenharmony_ci * You may obtain a copy of the License at
6d95e75fdSopenharmony_ci *
7d95e75fdSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8d95e75fdSopenharmony_ci *
9d95e75fdSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10d95e75fdSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11d95e75fdSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12d95e75fdSopenharmony_ci * See the License for the specific language governing permissions and
13d95e75fdSopenharmony_ci * limitations under the License.
14d95e75fdSopenharmony_ci */
15d95e75fdSopenharmony_ci
16d95e75fdSopenharmony_ci#include "ims_test.h"
17d95e75fdSopenharmony_ci
18d95e75fdSopenharmony_ci#define private public
19d95e75fdSopenharmony_ci#define protected public
20d95e75fdSopenharmony_ci#include "cellular_call_config.h"
21d95e75fdSopenharmony_ci#include "cellular_call_handler.h"
22d95e75fdSopenharmony_ci#include "cellular_call_proxy.h"
23d95e75fdSopenharmony_ci#include "cellular_call_register.h"
24d95e75fdSopenharmony_ci#include "cellular_call_service.h"
25d95e75fdSopenharmony_ci#include "tel_ril_call_parcel.h"
26d95e75fdSopenharmony_ci#include "ims_call_callback_proxy.h"
27d95e75fdSopenharmony_ci#include "ims_call_callback_stub.h"
28d95e75fdSopenharmony_ci#include "ims_call_client.h"
29d95e75fdSopenharmony_ci#include "ims_control.h"
30d95e75fdSopenharmony_ci#include "ims_error.h"
31d95e75fdSopenharmony_ci#include "securec.h"
32d95e75fdSopenharmony_ci
33d95e75fdSopenharmony_cinamespace OHOS {
34d95e75fdSopenharmony_cinamespace Telephony {
35d95e75fdSopenharmony_ciusing namespace testing::ext;
36d95e75fdSopenharmony_ciconst int32_t SIM1_SLOTID = 0;
37d95e75fdSopenharmony_ciconst int32_t SIM2_SLOTID = 1;
38d95e75fdSopenharmony_ciconst int32_t SLOT_COUNT = 2;
39d95e75fdSopenharmony_ciconst int32_t INVALID_SLOTID = -1;
40d95e75fdSopenharmony_ciconst int32_t INVALID_HANG_UP_TYPE = -1;
41d95e75fdSopenharmony_ciconst int32_t RESULT = 1;
42d95e75fdSopenharmony_ciconst std::string PHONE_NUMBER = "0000000";
43d95e75fdSopenharmony_ciconst std::string PHONE_NUMBER_SECOND = "1111111";
44d95e75fdSopenharmony_ciconst std::string PHONE_NUMBER_THIRD = "2222222";
45d95e75fdSopenharmony_ciconst std::string PHONE_NUMBER_FOUR = "3333333";
46d95e75fdSopenharmony_ci
47d95e75fdSopenharmony_ci/**
48d95e75fdSopenharmony_ci * @tc.number   cellular_call_SetVoNRState_0002
49d95e75fdSopenharmony_ci * @tc.name     Test for SetVoNRState function
50d95e75fdSopenharmony_ci * @tc.desc     Function test
51d95e75fdSopenharmony_ci */
52d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_SetVoNRState_0002, Function | MediumTest | Level2)
53d95e75fdSopenharmony_ci{
54d95e75fdSopenharmony_ci    AccessToken token;
55d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
56d95e75fdSopenharmony_ci        return;
57d95e75fdSopenharmony_ci    }
58d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
59d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
60d95e75fdSopenharmony_ci    auto setVoNRRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
61d95e75fdSopenharmony_ci    ASSERT_TRUE(setVoNRRemote != nullptr);
62d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(setVoNRRemote);
63d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
64d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
65d95e75fdSopenharmony_ci        int32_t ret = telephonyService->SetVoNRState(SIM1_SLOTID, 0);
66d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
67d95e75fdSopenharmony_ci    }
68d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
69d95e75fdSopenharmony_ci        int32_t ret = telephonyService->SetVoNRState(SIM2_SLOTID, 0);
70d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
71d95e75fdSopenharmony_ci    }
72d95e75fdSopenharmony_ci}
73d95e75fdSopenharmony_ci
74d95e75fdSopenharmony_ci/**
75d95e75fdSopenharmony_ci * @tc.number   cellular_call_GetVoNRState_0001
76d95e75fdSopenharmony_ci * @tc.name     Test for GetVoNRState function
77d95e75fdSopenharmony_ci * @tc.desc     Function test
78d95e75fdSopenharmony_ci */
79d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_GetVoNRState_0001, Function | MediumTest | Level2)
80d95e75fdSopenharmony_ci{
81d95e75fdSopenharmony_ci    AccessToken token;
82d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
83d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
84d95e75fdSopenharmony_ci    auto getVoNRRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
85d95e75fdSopenharmony_ci    ASSERT_TRUE(getVoNRRemote != nullptr);
86d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(getVoNRRemote);
87d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
88d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
89d95e75fdSopenharmony_ci        return;
90d95e75fdSopenharmony_ci    }
91d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
92d95e75fdSopenharmony_ci        int32_t result;
93d95e75fdSopenharmony_ci        int32_t ret = telephonyService->GetVoNRState(SIM1_SLOTID, result);
94d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
95d95e75fdSopenharmony_ci    }
96d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
97d95e75fdSopenharmony_ci        int32_t result;
98d95e75fdSopenharmony_ci        int32_t ret = telephonyService->GetVoNRState(SIM2_SLOTID, result);
99d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
100d95e75fdSopenharmony_ci    }
101d95e75fdSopenharmony_ci}
102d95e75fdSopenharmony_ci
103d95e75fdSopenharmony_ci/**
104d95e75fdSopenharmony_ci * @tc.number   cellular_call_StartRtt_0001
105d95e75fdSopenharmony_ci * @tc.name     Test for StartRtt function
106d95e75fdSopenharmony_ci * @tc.desc     Function test
107d95e75fdSopenharmony_ci */
108d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_StartRtt_0001, Function | MediumTest | Level2)
109d95e75fdSopenharmony_ci{
110d95e75fdSopenharmony_ci    AccessToken token;
111d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
112d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
113d95e75fdSopenharmony_ci    auto startRttRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
114d95e75fdSopenharmony_ci    ASSERT_TRUE(startRttRemote != nullptr);
115d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(startRttRemote);
116d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
117d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
118d95e75fdSopenharmony_ci        return;
119d95e75fdSopenharmony_ci    }
120d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) {
121d95e75fdSopenharmony_ci        int32_t ret = telephonyService->StartRtt(SIM1_SLOTID, PHONE_NUMBER);
122d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
123d95e75fdSopenharmony_ci    }
124d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) {
125d95e75fdSopenharmony_ci        int32_t ret = telephonyService->StartRtt(SIM2_SLOTID, PHONE_NUMBER);
126d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
127d95e75fdSopenharmony_ci    }
128d95e75fdSopenharmony_ci}
129d95e75fdSopenharmony_ci
130d95e75fdSopenharmony_ci/**
131d95e75fdSopenharmony_ci * @tc.number   cellular_call_StopRtt_0001
132d95e75fdSopenharmony_ci * @tc.name     Test for StopRtt function
133d95e75fdSopenharmony_ci * @tc.desc     Function test
134d95e75fdSopenharmony_ci */
135d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_StopRtt_0001, Function | MediumTest | Level2)
136d95e75fdSopenharmony_ci{
137d95e75fdSopenharmony_ci    AccessToken token;
138d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
139d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
140d95e75fdSopenharmony_ci    auto stopRttRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
141d95e75fdSopenharmony_ci    ASSERT_TRUE(stopRttRemote != nullptr);
142d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(stopRttRemote);
143d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
144d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
145d95e75fdSopenharmony_ci        return;
146d95e75fdSopenharmony_ci    }
147d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) {
148d95e75fdSopenharmony_ci        int32_t ret = telephonyService->StopRtt(SIM1_SLOTID);
149d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
150d95e75fdSopenharmony_ci    }
151d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) {
152d95e75fdSopenharmony_ci        int32_t ret = telephonyService->StopRtt(SIM2_SLOTID);
153d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
154d95e75fdSopenharmony_ci    }
155d95e75fdSopenharmony_ci}
156d95e75fdSopenharmony_ci
157d95e75fdSopenharmony_ci/**
158d95e75fdSopenharmony_ci * @tc.number   cellular_call_SetDomainPreferenceMode_0001
159d95e75fdSopenharmony_ci * @tc.name     Test for SetDomainPreferenceMode function
160d95e75fdSopenharmony_ci * @tc.desc     Function test
161d95e75fdSopenharmony_ci */
162d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_SetDomainPreferenceMode_0001, Function | MediumTest | Level2)
163d95e75fdSopenharmony_ci{
164d95e75fdSopenharmony_ci    AccessToken token;
165d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
166d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
167d95e75fdSopenharmony_ci    auto domainPrefModeRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
168d95e75fdSopenharmony_ci    ASSERT_TRUE(domainPrefModeRemote != nullptr);
169d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(domainPrefModeRemote);
170d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
171d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
172d95e75fdSopenharmony_ci        return;
173d95e75fdSopenharmony_ci    }
174d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) {
175d95e75fdSopenharmony_ci        int32_t mode = -1;
176d95e75fdSopenharmony_ci        int32_t ret = telephonyService->SetDomainPreferenceMode(SIM1_SLOTID, mode);
177d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_PARAMETER_OUT_OF_RANGE);
178d95e75fdSopenharmony_ci    }
179d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) {
180d95e75fdSopenharmony_ci        int32_t mode = -1;
181d95e75fdSopenharmony_ci        int32_t ret = telephonyService->SetDomainPreferenceMode(SIM2_SLOTID, mode);
182d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_PARAMETER_OUT_OF_RANGE);
183d95e75fdSopenharmony_ci    }
184d95e75fdSopenharmony_ci}
185d95e75fdSopenharmony_ci
186d95e75fdSopenharmony_ci/**
187d95e75fdSopenharmony_ci * @tc.number   cellular_call_GetImsConfig_0001
188d95e75fdSopenharmony_ci * @tc.name     Test for GetImsConfig function
189d95e75fdSopenharmony_ci * @tc.desc     Function test
190d95e75fdSopenharmony_ci */
191d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_GetImsConfig_0001, Function | MediumTest | Level2)
192d95e75fdSopenharmony_ci{
193d95e75fdSopenharmony_ci    AccessToken token;
194d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
195d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
196d95e75fdSopenharmony_ci    auto getImsConfigRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
197d95e75fdSopenharmony_ci    ASSERT_TRUE(getImsConfigRemote != nullptr);
198d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(getImsConfigRemote);
199d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
200d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
201d95e75fdSopenharmony_ci        return;
202d95e75fdSopenharmony_ci    }
203d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) {
204d95e75fdSopenharmony_ci        ImsConfigItem mode = ITEM_IMS_SWITCH_STATUS;
205d95e75fdSopenharmony_ci        int32_t ret = telephonyService->GetImsConfig(SIM1_SLOTID, mode);
206d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
207d95e75fdSopenharmony_ci    }
208d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) {
209d95e75fdSopenharmony_ci        ImsConfigItem mode = ITEM_IMS_SWITCH_STATUS;
210d95e75fdSopenharmony_ci        int32_t ret = telephonyService->GetImsConfig(SIM2_SLOTID, mode);
211d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
212d95e75fdSopenharmony_ci    }
213d95e75fdSopenharmony_ci}
214d95e75fdSopenharmony_ci
215d95e75fdSopenharmony_ci/**
216d95e75fdSopenharmony_ci * @tc.number   cellular_call_GetImsFeatureValue_0001
217d95e75fdSopenharmony_ci * @tc.name     Test for GetImsFeatureValue function
218d95e75fdSopenharmony_ci * @tc.desc     Function test
219d95e75fdSopenharmony_ci */
220d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_GetImsFeatureValue_0001, Function | MediumTest | Level2)
221d95e75fdSopenharmony_ci{
222d95e75fdSopenharmony_ci    AccessToken token;
223d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
224d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
225d95e75fdSopenharmony_ci    auto getImsFeatureRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
226d95e75fdSopenharmony_ci    ASSERT_TRUE(getImsFeatureRemote != nullptr);
227d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(getImsFeatureRemote);
228d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
229d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
230d95e75fdSopenharmony_ci        return;
231d95e75fdSopenharmony_ci    }
232d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) {
233d95e75fdSopenharmony_ci        FeatureType mode = TYPE_VOICE_OVER_LTE;
234d95e75fdSopenharmony_ci        int32_t ret = telephonyService->GetImsFeatureValue(SIM1_SLOTID, mode);
235d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
236d95e75fdSopenharmony_ci    }
237d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) {
238d95e75fdSopenharmony_ci        FeatureType mode = TYPE_VOICE_OVER_LTE;
239d95e75fdSopenharmony_ci        int32_t ret = telephonyService->GetImsFeatureValue(SIM2_SLOTID, mode);
240d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
241d95e75fdSopenharmony_ci    }
242d95e75fdSopenharmony_ci}
243d95e75fdSopenharmony_ci
244d95e75fdSopenharmony_ci/**
245d95e75fdSopenharmony_ci * @tc.number   cellular_call_SetMute_0001
246d95e75fdSopenharmony_ci * @tc.name     Test for SetMute function
247d95e75fdSopenharmony_ci * @tc.desc     Function test
248d95e75fdSopenharmony_ci */
249d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_SetMute_0001, Function | MediumTest | Level2)
250d95e75fdSopenharmony_ci{
251d95e75fdSopenharmony_ci    AccessToken token;
252d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
253d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
254d95e75fdSopenharmony_ci    auto setMuteRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
255d95e75fdSopenharmony_ci    ASSERT_TRUE(setMuteRemote != nullptr);
256d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(setMuteRemote);
257d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
258d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
259d95e75fdSopenharmony_ci        return;
260d95e75fdSopenharmony_ci    }
261d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) {
262d95e75fdSopenharmony_ci        int32_t mode = 0;
263d95e75fdSopenharmony_ci        int32_t ret = telephonyService->SetMute(SIM1_SLOTID, mode);
264d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
265d95e75fdSopenharmony_ci    }
266d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) {
267d95e75fdSopenharmony_ci        int32_t mode = 0;
268d95e75fdSopenharmony_ci        int32_t ret = telephonyService->SetMute(SIM2_SLOTID, mode);
269d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
270d95e75fdSopenharmony_ci    }
271d95e75fdSopenharmony_ci}
272d95e75fdSopenharmony_ci
273d95e75fdSopenharmony_ci/**
274d95e75fdSopenharmony_ci * @tc.number   cellular_call_SetCallWaiting_0001
275d95e75fdSopenharmony_ci * @tc.name     Test for SetCallWaiting function
276d95e75fdSopenharmony_ci * @tc.desc     Function test
277d95e75fdSopenharmony_ci */
278d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_SetCallWaiting_0001, Function | MediumTest | Level2)
279d95e75fdSopenharmony_ci{
280d95e75fdSopenharmony_ci    AccessToken token;
281d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
282d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
283d95e75fdSopenharmony_ci    auto SetCWRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
284d95e75fdSopenharmony_ci    ASSERT_TRUE(SetCWRemote != nullptr);
285d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(SetCWRemote);
286d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
287d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
288d95e75fdSopenharmony_ci        return;
289d95e75fdSopenharmony_ci    }
290d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) {
291d95e75fdSopenharmony_ci        bool act = true;
292d95e75fdSopenharmony_ci        int32_t ret = telephonyService->SetCallWaiting(SIM1_SLOTID, act);
293d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
294d95e75fdSopenharmony_ci    }
295d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) {
296d95e75fdSopenharmony_ci        bool act = true;
297d95e75fdSopenharmony_ci        int32_t ret = telephonyService->SetCallWaiting(SIM2_SLOTID, act);
298d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
299d95e75fdSopenharmony_ci    }
300d95e75fdSopenharmony_ci}
301d95e75fdSopenharmony_ci
302d95e75fdSopenharmony_ci/**
303d95e75fdSopenharmony_ci * @tc.number   cellular_call_GetCallWaiting_0001
304d95e75fdSopenharmony_ci * @tc.name     Test for GetCallWaiting function
305d95e75fdSopenharmony_ci * @tc.desc     Function test
306d95e75fdSopenharmony_ci */
307d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_GetCallWaiting_0001, Function | MediumTest | Level2)
308d95e75fdSopenharmony_ci{
309d95e75fdSopenharmony_ci    AccessToken token;
310d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
311d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
312d95e75fdSopenharmony_ci    auto getCWRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
313d95e75fdSopenharmony_ci    ASSERT_TRUE(getCWRemote != nullptr);
314d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(getCWRemote);
315d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
316d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
317d95e75fdSopenharmony_ci        return;
318d95e75fdSopenharmony_ci    }
319d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) {
320d95e75fdSopenharmony_ci        int32_t ret = telephonyService->GetCallWaiting(SIM1_SLOTID);
321d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
322d95e75fdSopenharmony_ci    }
323d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) {
324d95e75fdSopenharmony_ci        int32_t ret = telephonyService->GetCallWaiting(SIM2_SLOTID);
325d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
326d95e75fdSopenharmony_ci    }
327d95e75fdSopenharmony_ci}
328d95e75fdSopenharmony_ci
329d95e75fdSopenharmony_ci/**
330d95e75fdSopenharmony_ci * @tc.number   cellular_call_SetCallRestriction_0001
331d95e75fdSopenharmony_ci * @tc.name     Test for SetCallRestriction function
332d95e75fdSopenharmony_ci * @tc.desc     Function test
333d95e75fdSopenharmony_ci */
334d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_SetCallRestriction_0001, Function | MediumTest | Level2)
335d95e75fdSopenharmony_ci{
336d95e75fdSopenharmony_ci    AccessToken token;
337d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
338d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
339d95e75fdSopenharmony_ci    auto setCRRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
340d95e75fdSopenharmony_ci    ASSERT_TRUE(setCRRemote != nullptr);
341d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(setCRRemote);
342d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
343d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
344d95e75fdSopenharmony_ci        return;
345d95e75fdSopenharmony_ci    }
346d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) {
347d95e75fdSopenharmony_ci        CallRestrictionInfo crInfo;
348d95e75fdSopenharmony_ci        int32_t ret = telephonyService->SetCallRestriction(SIM1_SLOTID, crInfo);
349d95e75fdSopenharmony_ci        EXPECT_NE(ret, TELEPHONY_SUCCESS);
350d95e75fdSopenharmony_ci    }
351d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) {
352d95e75fdSopenharmony_ci        CallRestrictionInfo crInfo;
353d95e75fdSopenharmony_ci        int32_t ret = telephonyService->SetCallRestriction(SIM2_SLOTID, crInfo);
354d95e75fdSopenharmony_ci        EXPECT_NE(ret, TELEPHONY_SUCCESS);
355d95e75fdSopenharmony_ci    }
356d95e75fdSopenharmony_ci}
357d95e75fdSopenharmony_ci
358d95e75fdSopenharmony_ci/**
359d95e75fdSopenharmony_ci * @tc.number   cellular_call_GetCallRestriction_0001
360d95e75fdSopenharmony_ci * @tc.name     Test for GetCallRestriction function
361d95e75fdSopenharmony_ci * @tc.desc     Function test
362d95e75fdSopenharmony_ci */
363d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_GetCallRestriction_0001, Function | MediumTest | Level2)
364d95e75fdSopenharmony_ci{
365d95e75fdSopenharmony_ci    AccessToken token;
366d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
367d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
368d95e75fdSopenharmony_ci    auto getCRRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
369d95e75fdSopenharmony_ci    ASSERT_TRUE(getCRRemote != nullptr);
370d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(getCRRemote);
371d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
372d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
373d95e75fdSopenharmony_ci        return;
374d95e75fdSopenharmony_ci    }
375d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) {
376d95e75fdSopenharmony_ci        CallRestrictionType facType = CallRestrictionType::RESTRICTION_TYPE_ALL_INCOMING;
377d95e75fdSopenharmony_ci        int32_t ret = telephonyService->GetCallRestriction(SIM1_SLOTID, facType);
378d95e75fdSopenharmony_ci        EXPECT_NE(ret, TELEPHONY_SUCCESS);
379d95e75fdSopenharmony_ci    }
380d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) {
381d95e75fdSopenharmony_ci        CallRestrictionType facType = CallRestrictionType::RESTRICTION_TYPE_ALL_INCOMING;
382d95e75fdSopenharmony_ci        int32_t ret = telephonyService->GetCallRestriction(SIM2_SLOTID, facType);
383d95e75fdSopenharmony_ci        EXPECT_NE(ret, TELEPHONY_SUCCESS);
384d95e75fdSopenharmony_ci    }
385d95e75fdSopenharmony_ci}
386d95e75fdSopenharmony_ci
387d95e75fdSopenharmony_ci/**
388d95e75fdSopenharmony_ci * @tc.number   cellular_call_SetCallTransferInfo_0001
389d95e75fdSopenharmony_ci * @tc.name     Test for SetCallTransferInfo function
390d95e75fdSopenharmony_ci * @tc.desc     Function test
391d95e75fdSopenharmony_ci */
392d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_SetCallTransferInfo_0001, Function | MediumTest | Level2)
393d95e75fdSopenharmony_ci{
394d95e75fdSopenharmony_ci    AccessToken token;
395d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
396d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
397d95e75fdSopenharmony_ci    auto setTransferRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
398d95e75fdSopenharmony_ci    ASSERT_TRUE(setTransferRemote != nullptr);
399d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(setTransferRemote);
400d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
401d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
402d95e75fdSopenharmony_ci        return;
403d95e75fdSopenharmony_ci    }
404d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) {
405d95e75fdSopenharmony_ci        CallTransferInfo ctInfo;
406d95e75fdSopenharmony_ci        int32_t ret = telephonyService->SetCallTransferInfo(SIM1_SLOTID, ctInfo);
407d95e75fdSopenharmony_ci        EXPECT_NE(ret, TELEPHONY_SUCCESS);
408d95e75fdSopenharmony_ci    }
409d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) {
410d95e75fdSopenharmony_ci        CallTransferInfo ctInfo;
411d95e75fdSopenharmony_ci        int32_t ret = telephonyService->SetCallTransferInfo(SIM2_SLOTID, ctInfo);
412d95e75fdSopenharmony_ci        EXPECT_NE(ret, TELEPHONY_SUCCESS);
413d95e75fdSopenharmony_ci    }
414d95e75fdSopenharmony_ci}
415d95e75fdSopenharmony_ci
416d95e75fdSopenharmony_ci/**
417d95e75fdSopenharmony_ci * @tc.number   cellular_call_GetCallTransferInfo_0001
418d95e75fdSopenharmony_ci * @tc.name     Test for GetCallTransferInfo function
419d95e75fdSopenharmony_ci * @tc.desc     Function test
420d95e75fdSopenharmony_ci */
421d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_GetCallTransferInfo_0001, Function | MediumTest | Level2)
422d95e75fdSopenharmony_ci{
423d95e75fdSopenharmony_ci    AccessToken token;
424d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
425d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
426d95e75fdSopenharmony_ci    auto getTransferRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
427d95e75fdSopenharmony_ci    ASSERT_TRUE(getTransferRemote != nullptr);
428d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(getTransferRemote);
429d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
430d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
431d95e75fdSopenharmony_ci        return;
432d95e75fdSopenharmony_ci    }
433d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) {
434d95e75fdSopenharmony_ci        CallTransferType type = CallTransferType::TRANSFER_TYPE_UNCONDITIONAL;
435d95e75fdSopenharmony_ci        int32_t ret = telephonyService->GetCallTransferInfo(SIM1_SLOTID, type);
436d95e75fdSopenharmony_ci        EXPECT_NE(ret, TELEPHONY_SUCCESS);
437d95e75fdSopenharmony_ci    }
438d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) {
439d95e75fdSopenharmony_ci        CallTransferType type = CallTransferType::TRANSFER_TYPE_UNCONDITIONAL;
440d95e75fdSopenharmony_ci        int32_t ret = telephonyService->GetCallTransferInfo(SIM2_SLOTID, type);
441d95e75fdSopenharmony_ci        EXPECT_NE(ret, TELEPHONY_SUCCESS);
442d95e75fdSopenharmony_ci    }
443d95e75fdSopenharmony_ci}
444d95e75fdSopenharmony_ci
445d95e75fdSopenharmony_ci/**
446d95e75fdSopenharmony_ci * @tc.number   cellular_call_ImsControl_0001
447d95e75fdSopenharmony_ci * @tc.name     Test for ImsControl
448d95e75fdSopenharmony_ci * @tc.desc     Function test
449d95e75fdSopenharmony_ci */
450d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_ImsControl_0001, Function | MediumTest | Level3)
451d95e75fdSopenharmony_ci{
452d95e75fdSopenharmony_ci    AccessToken token;
453d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
454d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
455d95e75fdSopenharmony_ci    auto imsControlRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
456d95e75fdSopenharmony_ci    ASSERT_TRUE(imsControlRemote != nullptr);
457d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
458d95e75fdSopenharmony_ci        return;
459d95e75fdSopenharmony_ci    }
460d95e75fdSopenharmony_ci    auto imsControl = std::make_shared<IMSControl>();
461d95e75fdSopenharmony_ci    CellularCallInfo cellularCallInfo;
462d95e75fdSopenharmony_ci    for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) {
463d95e75fdSopenharmony_ci        if (!HasSimCard(slotId) || !CanUseImsService(slotId, ImsServiceType::TYPE_VOICE)) {
464d95e75fdSopenharmony_ci            continue;
465d95e75fdSopenharmony_ci        }
466d95e75fdSopenharmony_ci        EXPECT_NE(imsControl->Answer(cellularCallInfo), TELEPHONY_SUCCESS);
467d95e75fdSopenharmony_ci        EXPECT_NE(imsControl->Reject(cellularCallInfo), TELEPHONY_SUCCESS);
468d95e75fdSopenharmony_ci        EXPECT_EQ(InitCellularCallInfo(slotId, PHONE_NUMBER, cellularCallInfo), TELEPHONY_SUCCESS);
469d95e75fdSopenharmony_ci        bool enabled = false;
470d95e75fdSopenharmony_ci        EXPECT_EQ(imsControl->Dial(cellularCallInfo, enabled), CALL_ERR_GET_RADIO_STATE_FAILED);
471d95e75fdSopenharmony_ci        CLIRMode mode = CLIRMode::DEFAULT;
472d95e75fdSopenharmony_ci        EXPECT_EQ(imsControl->DialJudgment(slotId, PHONE_NUMBER_SECOND, mode, 0), TELEPHONY_SUCCESS);
473d95e75fdSopenharmony_ci        EXPECT_EQ(imsControl->DialJudgment(slotId, PHONE_NUMBER_THIRD, mode, 0), TELEPHONY_SUCCESS);
474d95e75fdSopenharmony_ci        EXPECT_EQ(InitCellularCallInfo(slotId, PHONE_NUMBER_SECOND, cellularCallInfo), TELEPHONY_SUCCESS);
475d95e75fdSopenharmony_ci        EXPECT_NE(imsControl->Answer(cellularCallInfo), TELEPHONY_SUCCESS);
476d95e75fdSopenharmony_ci        EXPECT_EQ(InitCellularCallInfo(slotId, PHONE_NUMBER_THIRD, cellularCallInfo), TELEPHONY_SUCCESS);
477d95e75fdSopenharmony_ci        EXPECT_NE(imsControl->Answer(cellularCallInfo), TELEPHONY_SUCCESS);
478d95e75fdSopenharmony_ci        EXPECT_EQ(InitCellularCallInfo(slotId, PHONE_NUMBER_FOUR, cellularCallInfo), TELEPHONY_SUCCESS);
479d95e75fdSopenharmony_ci        EXPECT_NE(imsControl->Answer(cellularCallInfo), TELEPHONY_SUCCESS);
480d95e75fdSopenharmony_ci        EXPECT_NE(imsControl->Reject(cellularCallInfo), TELEPHONY_SUCCESS);
481d95e75fdSopenharmony_ci        EXPECT_EQ(imsControl->HoldCall(slotId), TELEPHONY_SUCCESS);
482d95e75fdSopenharmony_ci        std::vector<std::string> numberList;
483d95e75fdSopenharmony_ci        EXPECT_EQ(imsControl->KickOutFromConference(slotId, PHONE_NUMBER, cellularCallInfo.index), TELEPHONY_SUCCESS);
484d95e75fdSopenharmony_ci        EXPECT_EQ(imsControl->InviteToConference(slotId, numberList), TELEPHONY_SUCCESS);
485d95e75fdSopenharmony_ci        EXPECT_EQ(imsControl->StartRtt(slotId, PHONE_NUMBER), TELEPHONY_SUCCESS);
486d95e75fdSopenharmony_ci        EXPECT_EQ(imsControl->StopRtt(slotId), TELEPHONY_SUCCESS);
487d95e75fdSopenharmony_ci        EXPECT_NE(imsControl->HangUp(cellularCallInfo, CallSupplementType::TYPE_DEFAULT), TELEPHONY_SUCCESS);
488d95e75fdSopenharmony_ci        EXPECT_EQ(imsControl->HangUp(cellularCallInfo, CallSupplementType::TYPE_HANG_UP_ACTIVE),
489d95e75fdSopenharmony_ci            CALL_ERR_RESOURCE_UNAVAILABLE);
490d95e75fdSopenharmony_ci        EXPECT_EQ(imsControl->HangUp(cellularCallInfo, CallSupplementType::TYPE_HANG_UP_ALL), TELEPHONY_SUCCESS);
491d95e75fdSopenharmony_ci        EXPECT_EQ(imsControl->HangUp(cellularCallInfo, static_cast<CallSupplementType>(INVALID_HANG_UP_TYPE)),
492d95e75fdSopenharmony_ci            TELEPHONY_ERR_ARGUMENT_INVALID);
493d95e75fdSopenharmony_ci    }
494d95e75fdSopenharmony_ci}
495d95e75fdSopenharmony_ci
496d95e75fdSopenharmony_ci/**
497d95e75fdSopenharmony_ci * @tc.number   cellular_call_ImsControl_0002
498d95e75fdSopenharmony_ci * @tc.name     Test for ImsControl
499d95e75fdSopenharmony_ci * @tc.desc     Function test
500d95e75fdSopenharmony_ci */
501d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_ImsControl_0002, Function | MediumTest | Level3)
502d95e75fdSopenharmony_ci{
503d95e75fdSopenharmony_ci    AccessToken token;
504d95e75fdSopenharmony_ci    auto imsControl = std::make_shared<IMSControl>();
505d95e75fdSopenharmony_ci    for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) {
506d95e75fdSopenharmony_ci        if (!HasSimCard(slotId) || !CanUseImsService(slotId, ImsServiceType::TYPE_VOICE)) {
507d95e75fdSopenharmony_ci            continue;
508d95e75fdSopenharmony_ci        }
509d95e75fdSopenharmony_ci        ImsCurrentCallList callList;
510d95e75fdSopenharmony_ci        callList.callSize = 0;
511d95e75fdSopenharmony_ci        CallInfoList callInfoList;
512d95e75fdSopenharmony_ci        EXPECT_EQ(imsControl->ReportCallsData(slotId, callInfoList), TELEPHONY_ERROR);
513d95e75fdSopenharmony_ci        EXPECT_EQ(imsControl->ReportImsCallsData(slotId, callList), TELEPHONY_ERROR);
514d95e75fdSopenharmony_ci        EXPECT_NE(imsControl->ReportUpdateInfo(slotId, callList), TELEPHONY_SUCCESS);
515d95e75fdSopenharmony_ci        ImsCurrentCall callInfo;
516d95e75fdSopenharmony_ci        callList.callSize = 1;
517d95e75fdSopenharmony_ci        callInfo.number = PHONE_NUMBER;
518d95e75fdSopenharmony_ci        callInfo.index = 1;
519d95e75fdSopenharmony_ci        callInfo.state = static_cast<int32_t>(TelCallState::CALL_STATUS_INCOMING);
520d95e75fdSopenharmony_ci        callList.calls.push_back(callInfo);
521d95e75fdSopenharmony_ci        EXPECT_EQ(imsControl->ReportImsCallsData(slotId, callList), TELEPHONY_SUCCESS);
522d95e75fdSopenharmony_ci        EXPECT_EQ(imsControl->HangUpAllConnection(slotId), TELEPHONY_SUCCESS);
523d95e75fdSopenharmony_ci        callList.callSize = 2;
524d95e75fdSopenharmony_ci        callInfo.index = 2;
525d95e75fdSopenharmony_ci        callInfo.state = static_cast<int32_t>(TelCallState::CALL_STATUS_ACTIVE);
526d95e75fdSopenharmony_ci        callInfo.number = PHONE_NUMBER_SECOND;
527d95e75fdSopenharmony_ci        callList.calls.push_back(callInfo);
528d95e75fdSopenharmony_ci        callList.callSize = 3;
529d95e75fdSopenharmony_ci        callInfo.index = 3;
530d95e75fdSopenharmony_ci        callInfo.state = static_cast<int32_t>(TelCallState::CALL_STATUS_WAITING);
531d95e75fdSopenharmony_ci        callInfo.number = PHONE_NUMBER_THIRD;
532d95e75fdSopenharmony_ci        callList.calls.push_back(callInfo);
533d95e75fdSopenharmony_ci        callList.callSize = 4;
534d95e75fdSopenharmony_ci        callInfo.index = 4;
535d95e75fdSopenharmony_ci        callInfo.state = static_cast<int32_t>(TelCallState::CALL_STATUS_DISCONNECTED);
536d95e75fdSopenharmony_ci        callInfo.number = PHONE_NUMBER_FOUR;
537d95e75fdSopenharmony_ci        callList.calls.push_back(callInfo);
538d95e75fdSopenharmony_ci        EXPECT_EQ(imsControl->ReportImsCallsData(slotId, callList), TELEPHONY_SUCCESS);
539d95e75fdSopenharmony_ci        callList.callSize = 0;
540d95e75fdSopenharmony_ci        EXPECT_EQ(imsControl->ReportImsCallsData(slotId, callList), TELEPHONY_SUCCESS);
541d95e75fdSopenharmony_ci    }
542d95e75fdSopenharmony_ci}
543d95e75fdSopenharmony_ci
544d95e75fdSopenharmony_ci/**
545d95e75fdSopenharmony_ci * @tc.number   cellular_call_CellularCallConnectionIMS_0001
546d95e75fdSopenharmony_ci * @tc.name     Test for CellularCallConnectionIMS
547d95e75fdSopenharmony_ci * @tc.desc     Function test
548d95e75fdSopenharmony_ci */
549d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_CellularCallConnectionIMS_0001, Function | MediumTest | Level3)
550d95e75fdSopenharmony_ci{
551d95e75fdSopenharmony_ci    AccessToken token;
552d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
553d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
554d95e75fdSopenharmony_ci    auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
555d95e75fdSopenharmony_ci    ASSERT_TRUE(remote != nullptr);
556d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
557d95e75fdSopenharmony_ci        return;
558d95e75fdSopenharmony_ci    }
559d95e75fdSopenharmony_ci    for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) {
560d95e75fdSopenharmony_ci        if (!HasSimCard(slotId) || !CanUseImsService(slotId, ImsServiceType::TYPE_VOICE)) {
561d95e75fdSopenharmony_ci            continue;
562d95e75fdSopenharmony_ci        }
563d95e75fdSopenharmony_ci        CellularCallConnectionIMS imsConnection;
564d95e75fdSopenharmony_ci        EXPECT_EQ(imsConnection.SendDtmfRequest(slotId, '1', 1), TELEPHONY_SUCCESS);
565d95e75fdSopenharmony_ci        EXPECT_EQ(imsConnection.StartDtmfRequest(slotId, '1', 1), TELEPHONY_SUCCESS);
566d95e75fdSopenharmony_ci        EXPECT_EQ(imsConnection.StopDtmfRequest(slotId, 1), TELEPHONY_SUCCESS);
567d95e75fdSopenharmony_ci        EXPECT_EQ(imsConnection.GetImsCallsDataRequest(slotId, 1), TELEPHONY_SUCCESS);
568d95e75fdSopenharmony_ci        EXPECT_EQ(imsConnection.GetCallFailReasonRequest(slotId), TELEPHONY_SUCCESS);
569d95e75fdSopenharmony_ci        EXPECT_EQ(imsConnection.AnswerRequest(slotId, PHONE_NUMBER, 0, slotId), TELEPHONY_SUCCESS);
570d95e75fdSopenharmony_ci        ImsDialInfoStruct imsDialInfo;
571d95e75fdSopenharmony_ci        imsDialInfo.phoneNum = PHONE_NUMBER_SECOND;
572d95e75fdSopenharmony_ci        EXPECT_EQ(imsConnection.DialRequest(slotId, imsDialInfo), TELEPHONY_SUCCESS);
573d95e75fdSopenharmony_ci        EXPECT_EQ(imsConnection.HangUpRequest(slotId, PHONE_NUMBER_SECOND, slotId), TELEPHONY_SUCCESS);
574d95e75fdSopenharmony_ci        EXPECT_EQ(imsConnection.StartRttRequest(slotId, PHONE_NUMBER_THIRD), TELEPHONY_SUCCESS);
575d95e75fdSopenharmony_ci        EXPECT_EQ(imsConnection.StopRttRequest(slotId), TELEPHONY_SUCCESS);
576d95e75fdSopenharmony_ci    }
577d95e75fdSopenharmony_ci}
578d95e75fdSopenharmony_ci
579d95e75fdSopenharmony_ci/**
580d95e75fdSopenharmony_ci * @tc.number   cellular_call_CellularCallRegister_0001
581d95e75fdSopenharmony_ci * @tc.name     Test for CellularCallRegister
582d95e75fdSopenharmony_ci * @tc.desc     Function test
583d95e75fdSopenharmony_ci */
584d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_CellularCallRegister_0001, Function | MediumTest | Level3)
585d95e75fdSopenharmony_ci{
586d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
587d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
588d95e75fdSopenharmony_ci    auto registerRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
589d95e75fdSopenharmony_ci    ASSERT_TRUE(registerRemote != nullptr);
590d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
591d95e75fdSopenharmony_ci        return;
592d95e75fdSopenharmony_ci    }
593d95e75fdSopenharmony_ci    auto callRegister = DelayedSingleton<CellularCallRegister>::GetInstance();
594d95e75fdSopenharmony_ci    ASSERT_TRUE(callRegister != nullptr);
595d95e75fdSopenharmony_ci    GetImsConfigResponse imsConfigResponse;
596d95e75fdSopenharmony_ci    callRegister->ReportGetImsConfigResult(imsConfigResponse);
597d95e75fdSopenharmony_ci    callRegister->ReportSetImsConfigResult(RESULT);
598d95e75fdSopenharmony_ci    GetImsFeatureValueResponse imsFeatureValueResponse;
599d95e75fdSopenharmony_ci    callRegister->ReportGetImsFeatureResult(imsFeatureValueResponse);
600d95e75fdSopenharmony_ci    callRegister->ReportSetImsFeatureResult(RESULT);
601d95e75fdSopenharmony_ci    ImsCallModeReceiveInfo callModeInfo;
602d95e75fdSopenharmony_ci    callRegister->ReceiveUpdateCallMediaModeRequest(-1, callModeInfo);
603d95e75fdSopenharmony_ci    callRegister->ReceiveUpdateCallMediaModeResponse(-1, callModeInfo);
604d95e75fdSopenharmony_ci    ImsCallSessionEventInfo callSessionEventInfo;
605d95e75fdSopenharmony_ci    callRegister->HandleCallSessionEventChanged(callSessionEventInfo);
606d95e75fdSopenharmony_ci    ImsCallPeerDimensionsInfo callPeerDimensionsInfo;
607d95e75fdSopenharmony_ci    callRegister->HandlePeerDimensionsChanged(callPeerDimensionsInfo);
608d95e75fdSopenharmony_ci    ImsCallDataUsageInfo callDataUsageInfo;
609d95e75fdSopenharmony_ci    callRegister->HandleCallDataUsageChanged(callDataUsageInfo);
610d95e75fdSopenharmony_ci    CameraCapabilitiesInfo cameraCapabilitiesInfo;
611d95e75fdSopenharmony_ci    callRegister->HandleCameraCapabilitiesChanged(cameraCapabilitiesInfo);
612d95e75fdSopenharmony_ci}
613d95e75fdSopenharmony_ci
614d95e75fdSopenharmony_ci/**
615d95e75fdSopenharmony_ci * @tc.number   cellular_call_CellularCallRegister_0002
616d95e75fdSopenharmony_ci * @tc.name     Test for CellularCallRegister
617d95e75fdSopenharmony_ci * @tc.desc     Function test
618d95e75fdSopenharmony_ci */
619d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_CellularCallRegister_0002, Function | MediumTest | Level3)
620d95e75fdSopenharmony_ci{
621d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
622d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
623d95e75fdSopenharmony_ci    auto registerRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
624d95e75fdSopenharmony_ci    ASSERT_TRUE(registerRemote != nullptr);
625d95e75fdSopenharmony_ci    auto callRegister = DelayedSingleton<CellularCallRegister>::GetInstance();
626d95e75fdSopenharmony_ci    ASSERT_TRUE(callRegister != nullptr);
627d95e75fdSopenharmony_ci    GetImsConfigResponse imsConfigResponse;
628d95e75fdSopenharmony_ci    callRegister->ReportGetImsConfigResult(imsConfigResponse);
629d95e75fdSopenharmony_ci    callRegister->ReportSetImsConfigResult(RESULT);
630d95e75fdSopenharmony_ci    GetImsFeatureValueResponse imsFeatureValueResponse;
631d95e75fdSopenharmony_ci    callRegister->ReportGetImsFeatureResult(imsFeatureValueResponse);
632d95e75fdSopenharmony_ci    callRegister->ReportSetImsFeatureResult(RESULT);
633d95e75fdSopenharmony_ci    ImsCallModeReceiveInfo callModeInfo;
634d95e75fdSopenharmony_ci    callRegister->ReceiveUpdateCallMediaModeRequest(-1, callModeInfo);
635d95e75fdSopenharmony_ci    callRegister->ReceiveUpdateCallMediaModeResponse(-1, callModeInfo);
636d95e75fdSopenharmony_ci    ImsCallSessionEventInfo callSessionEventInfo;
637d95e75fdSopenharmony_ci    callRegister->HandleCallSessionEventChanged(callSessionEventInfo);
638d95e75fdSopenharmony_ci    ImsCallPeerDimensionsInfo callPeerDimensionsInfo;
639d95e75fdSopenharmony_ci    callRegister->HandlePeerDimensionsChanged(callPeerDimensionsInfo);
640d95e75fdSopenharmony_ci    ImsCallDataUsageInfo callDataUsageInfo;
641d95e75fdSopenharmony_ci    callRegister->HandleCallDataUsageChanged(callDataUsageInfo);
642d95e75fdSopenharmony_ci    CameraCapabilitiesInfo cameraCapabilitiesInfo;
643d95e75fdSopenharmony_ci    callRegister->HandleCameraCapabilitiesChanged(cameraCapabilitiesInfo);
644d95e75fdSopenharmony_ci}
645d95e75fdSopenharmony_ci
646d95e75fdSopenharmony_ci/**
647d95e75fdSopenharmony_ci * @tc.number   cellular_call_CellularCallConfig_0001
648d95e75fdSopenharmony_ci * @tc.name     Test for CellularCallConfig
649d95e75fdSopenharmony_ci * @tc.desc     Function test
650d95e75fdSopenharmony_ci */
651d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_CellularCallConfig_0001, Function | MediumTest | Level3)
652d95e75fdSopenharmony_ci{
653d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
654d95e75fdSopenharmony_ci        return;
655d95e75fdSopenharmony_ci    }
656d95e75fdSopenharmony_ci
657d95e75fdSopenharmony_ci    for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) {
658d95e75fdSopenharmony_ci        if (!HasSimCard(slotId)) {
659d95e75fdSopenharmony_ci            continue;
660d95e75fdSopenharmony_ci        }
661d95e75fdSopenharmony_ci        CellularCallConfig cellularCallConfig;
662d95e75fdSopenharmony_ci        ASSERT_TRUE(cellularCallConfig.GetImsSwitchOnByDefaultConfig(INVALID_SLOTID));
663d95e75fdSopenharmony_ci        ASSERT_TRUE(cellularCallConfig.GetImsSwitchOnByDefaultConfig(slotId));
664d95e75fdSopenharmony_ci        ASSERT_FALSE(cellularCallConfig.GethideImsSwitchConfig(INVALID_SLOTID));
665d95e75fdSopenharmony_ci        ASSERT_FALSE(cellularCallConfig.GethideImsSwitchConfig(slotId));
666d95e75fdSopenharmony_ci        ASSERT_FALSE(cellularCallConfig.GetvolteSupportedConfig(INVALID_SLOTID));
667d95e75fdSopenharmony_ci        ASSERT_FALSE(cellularCallConfig.GetvolteSupportedConfig(slotId));
668d95e75fdSopenharmony_ci        cellularCallConfig.GetNrModeSupportedListConfig(INVALID_SLOTID);
669d95e75fdSopenharmony_ci        cellularCallConfig.GetNrModeSupportedListConfig(slotId);
670d95e75fdSopenharmony_ci        ASSERT_FALSE(cellularCallConfig.GetVolteProvisioningSupportedConfig(INVALID_SLOTID));
671d95e75fdSopenharmony_ci        ASSERT_FALSE(cellularCallConfig.GetVolteProvisioningSupportedConfig(slotId));
672d95e75fdSopenharmony_ci        ASSERT_FALSE(cellularCallConfig.GetSsOverUtSupportedConfig(INVALID_SLOTID));
673d95e75fdSopenharmony_ci        ASSERT_FALSE(cellularCallConfig.GetSsOverUtSupportedConfig(slotId));
674d95e75fdSopenharmony_ci        ASSERT_FALSE(cellularCallConfig.GetImsGbaRequiredConfig(INVALID_SLOTID));
675d95e75fdSopenharmony_ci        ASSERT_FALSE(cellularCallConfig.GetImsGbaRequiredConfig(slotId));
676d95e75fdSopenharmony_ci        ASSERT_FALSE(cellularCallConfig.GetUtProvisioningSupportedConfig(INVALID_SLOTID));
677d95e75fdSopenharmony_ci        ASSERT_FALSE(cellularCallConfig.GetUtProvisioningSupportedConfig(slotId));
678d95e75fdSopenharmony_ci        ASSERT_TRUE(cellularCallConfig.GetImsPreferForEmergencyConfig(INVALID_SLOTID));
679d95e75fdSopenharmony_ci        ASSERT_TRUE(cellularCallConfig.GetImsPreferForEmergencyConfig(slotId));
680d95e75fdSopenharmony_ci        cellularCallConfig.GetCallWaitingServiceClassConfig(INVALID_SLOTID);
681d95e75fdSopenharmony_ci        cellularCallConfig.GetCallWaitingServiceClassConfig(slotId);
682d95e75fdSopenharmony_ci        cellularCallConfig.GetImsCallDisconnectResoninfoMappingConfig(INVALID_SLOTID);
683d95e75fdSopenharmony_ci        cellularCallConfig.GetImsCallDisconnectResoninfoMappingConfig(slotId);
684d95e75fdSopenharmony_ci        ASSERT_FALSE(cellularCallConfig.GetForceVolteSwitchOnConfig(INVALID_SLOTID));
685d95e75fdSopenharmony_ci        ASSERT_FALSE(cellularCallConfig.GetForceVolteSwitchOnConfig(slotId));
686d95e75fdSopenharmony_ci    }
687d95e75fdSopenharmony_ci}
688d95e75fdSopenharmony_ci
689d95e75fdSopenharmony_ci/**
690d95e75fdSopenharmony_ci * @tc.number   cellular_call_CellularCallConfig_0002
691d95e75fdSopenharmony_ci * @tc.name     Test for CellularCallConfig
692d95e75fdSopenharmony_ci * @tc.desc     Function test
693d95e75fdSopenharmony_ci */
694d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_CellularCallConfig_0002, Function | MediumTest | Level3)
695d95e75fdSopenharmony_ci{
696d95e75fdSopenharmony_ci    for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) {
697d95e75fdSopenharmony_ci        CellularCallConfig cellularCallConfig;
698d95e75fdSopenharmony_ci        ASSERT_TRUE(cellularCallConfig.GetImsSwitchOnByDefaultConfig(INVALID_SLOTID));
699d95e75fdSopenharmony_ci        ASSERT_TRUE(cellularCallConfig.GetImsSwitchOnByDefaultConfig(slotId));
700d95e75fdSopenharmony_ci        ASSERT_FALSE(cellularCallConfig.GethideImsSwitchConfig(INVALID_SLOTID));
701d95e75fdSopenharmony_ci        ASSERT_FALSE(cellularCallConfig.GethideImsSwitchConfig(slotId));
702d95e75fdSopenharmony_ci        ASSERT_FALSE(cellularCallConfig.GetvolteSupportedConfig(INVALID_SLOTID));
703d95e75fdSopenharmony_ci        ASSERT_FALSE(cellularCallConfig.GetvolteSupportedConfig(slotId));
704d95e75fdSopenharmony_ci        cellularCallConfig.GetNrModeSupportedListConfig(INVALID_SLOTID);
705d95e75fdSopenharmony_ci        cellularCallConfig.GetNrModeSupportedListConfig(slotId);
706d95e75fdSopenharmony_ci        ASSERT_FALSE(cellularCallConfig.GetVolteProvisioningSupportedConfig(INVALID_SLOTID));
707d95e75fdSopenharmony_ci        ASSERT_FALSE(cellularCallConfig.GetVolteProvisioningSupportedConfig(slotId));
708d95e75fdSopenharmony_ci        ASSERT_FALSE(cellularCallConfig.GetSsOverUtSupportedConfig(INVALID_SLOTID));
709d95e75fdSopenharmony_ci        ASSERT_FALSE(cellularCallConfig.GetSsOverUtSupportedConfig(slotId));
710d95e75fdSopenharmony_ci        ASSERT_FALSE(cellularCallConfig.GetImsGbaRequiredConfig(INVALID_SLOTID));
711d95e75fdSopenharmony_ci        ASSERT_FALSE(cellularCallConfig.GetImsGbaRequiredConfig(slotId));
712d95e75fdSopenharmony_ci        ASSERT_FALSE(cellularCallConfig.GetUtProvisioningSupportedConfig(INVALID_SLOTID));
713d95e75fdSopenharmony_ci        ASSERT_FALSE(cellularCallConfig.GetUtProvisioningSupportedConfig(slotId));
714d95e75fdSopenharmony_ci        ASSERT_TRUE(cellularCallConfig.GetImsPreferForEmergencyConfig(INVALID_SLOTID));
715d95e75fdSopenharmony_ci        ASSERT_TRUE(cellularCallConfig.GetImsPreferForEmergencyConfig(slotId));
716d95e75fdSopenharmony_ci        cellularCallConfig.GetCallWaitingServiceClassConfig(INVALID_SLOTID);
717d95e75fdSopenharmony_ci        cellularCallConfig.GetCallWaitingServiceClassConfig(slotId);
718d95e75fdSopenharmony_ci        cellularCallConfig.GetImsCallDisconnectResoninfoMappingConfig(INVALID_SLOTID);
719d95e75fdSopenharmony_ci        cellularCallConfig.GetImsCallDisconnectResoninfoMappingConfig(slotId);
720d95e75fdSopenharmony_ci        ASSERT_FALSE(cellularCallConfig.GetForceVolteSwitchOnConfig(INVALID_SLOTID));
721d95e75fdSopenharmony_ci        ASSERT_FALSE(cellularCallConfig.GetForceVolteSwitchOnConfig(slotId));
722d95e75fdSopenharmony_ci    }
723d95e75fdSopenharmony_ci}
724d95e75fdSopenharmony_ci
725d95e75fdSopenharmony_ci/**
726d95e75fdSopenharmony_ci * @tc.number   cellular_call_CellularCallHandler_0001
727d95e75fdSopenharmony_ci * @tc.name     Test for CellularCallHandler
728d95e75fdSopenharmony_ci * @tc.desc     Function test
729d95e75fdSopenharmony_ci */
730d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_CellularCallHandler_0001, Function | MediumTest | Level3)
731d95e75fdSopenharmony_ci{
732d95e75fdSopenharmony_ci    EventFwk::MatchingSkills matchingSkills;
733d95e75fdSopenharmony_ci    matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_OPERATOR_CONFIG_CHANGED);
734d95e75fdSopenharmony_ci    EventFwk::CommonEventSubscribeInfo subscriberInfo(matchingSkills);
735d95e75fdSopenharmony_ci    CellularCallHandler handler { subscriberInfo };
736d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
737d95e75fdSopenharmony_ci        return;
738d95e75fdSopenharmony_ci    }
739d95e75fdSopenharmony_ci    for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) {
740d95e75fdSopenharmony_ci        if (!HasSimCard(slotId)) {
741d95e75fdSopenharmony_ci            continue;
742d95e75fdSopenharmony_ci        }
743d95e75fdSopenharmony_ci        handler.SetSlotId(slotId);
744d95e75fdSopenharmony_ci        auto event = AppExecFwk::InnerEvent::Get(0);
745d95e75fdSopenharmony_ci        handler.GetImsCallsDataResponse(event);
746d95e75fdSopenharmony_ci        handler.GetImsCallsDataRequest(event);
747d95e75fdSopenharmony_ci        auto rilRadioResponse = std::make_shared<RadioResponseInfo>();
748d95e75fdSopenharmony_ci        rilRadioResponse->error = ErrType::ERR_GENERIC_FAILURE;
749d95e75fdSopenharmony_ci        auto responseEvent = AppExecFwk::InnerEvent::Get(0, rilRadioResponse);
750d95e75fdSopenharmony_ci        handler.SetDomainPreferenceModeResponse(responseEvent);
751d95e75fdSopenharmony_ci        handler.GetDomainPreferenceModeResponse(event);
752d95e75fdSopenharmony_ci        handler.SetDomainPreferenceModeResponse(event);
753d95e75fdSopenharmony_ci        handler.SetVoNRSwitchStatusResponse(responseEvent);
754d95e75fdSopenharmony_ci        ASSERT_EQ(handler.GetSlotId(), slotId);
755d95e75fdSopenharmony_ci        handler.OnRilAdapterHostDied(event);
756d95e75fdSopenharmony_ci        auto serviceInstance = DelayedSingleton<CellularCallService>::GetInstance();
757d95e75fdSopenharmony_ci        if (serviceInstance != nullptr) {
758d95e75fdSopenharmony_ci            std::shared_ptr<CSControl> csControl;
759d95e75fdSopenharmony_ci            serviceInstance->SetCsControl(slotId, csControl);
760d95e75fdSopenharmony_ci            std::shared_ptr<IMSControl> imsControl;
761d95e75fdSopenharmony_ci            serviceInstance->SetImsControl(slotId, imsControl);
762d95e75fdSopenharmony_ci            handler.OnRilAdapterHostDied(event);
763d95e75fdSopenharmony_ci            ASSERT_TRUE(serviceInstance->GetCsControl(slotId) == nullptr);
764d95e75fdSopenharmony_ci            ASSERT_TRUE(serviceInstance->GetCsControl(slotId) == nullptr);
765d95e75fdSopenharmony_ci        }
766d95e75fdSopenharmony_ci    }
767d95e75fdSopenharmony_ci}
768d95e75fdSopenharmony_ci
769d95e75fdSopenharmony_ci/**
770d95e75fdSopenharmony_ci * @tc.number   cellular_call_CellularCallHandler_0002
771d95e75fdSopenharmony_ci * @tc.name     Test for CellularCallHandler
772d95e75fdSopenharmony_ci * @tc.desc     Function test
773d95e75fdSopenharmony_ci */
774d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_CellularCallHandler_0002, Function | MediumTest | Level3)
775d95e75fdSopenharmony_ci{
776d95e75fdSopenharmony_ci    EventFwk::MatchingSkills matchingSkills;
777d95e75fdSopenharmony_ci    matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_OPERATOR_CONFIG_CHANGED);
778d95e75fdSopenharmony_ci    EventFwk::CommonEventSubscribeInfo subscriberInfo(matchingSkills);
779d95e75fdSopenharmony_ci    CellularCallHandler handler { subscriberInfo };
780d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
781d95e75fdSopenharmony_ci        return;
782d95e75fdSopenharmony_ci    }
783d95e75fdSopenharmony_ci    for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) {
784d95e75fdSopenharmony_ci        if (!HasSimCard(slotId)) {
785d95e75fdSopenharmony_ci            continue;
786d95e75fdSopenharmony_ci        }
787d95e75fdSopenharmony_ci        handler.SetSlotId(slotId);
788d95e75fdSopenharmony_ci        auto event = AppExecFwk::InnerEvent::Get(0);
789d95e75fdSopenharmony_ci        handler.ReceiveUpdateCallMediaModeRequest(event);
790d95e75fdSopenharmony_ci        handler.ReceiveUpdateCallMediaModeResponse(event);
791d95e75fdSopenharmony_ci        handler.HandleCallSessionEventChanged(event);
792d95e75fdSopenharmony_ci        handler.HandlePeerDimensionsChanged(event);
793d95e75fdSopenharmony_ci        handler.HandleCallDataUsageChanged(event);
794d95e75fdSopenharmony_ci        handler.HandleCameraCapabilitiesChanged(event);
795d95e75fdSopenharmony_ci    }
796d95e75fdSopenharmony_ci}
797d95e75fdSopenharmony_ci
798d95e75fdSopenharmony_ci/**
799d95e75fdSopenharmony_ci * @tc.number   cellular_call_CellularCallHandler_0003
800d95e75fdSopenharmony_ci * @tc.name     Test for CellularCallHandler
801d95e75fdSopenharmony_ci * @tc.desc     Function test
802d95e75fdSopenharmony_ci */
803d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_CellularCallHandler_0003, Function | MediumTest | Level3)
804d95e75fdSopenharmony_ci{
805d95e75fdSopenharmony_ci    EventFwk::MatchingSkills matchingSkills;
806d95e75fdSopenharmony_ci    matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_OPERATOR_CONFIG_CHANGED);
807d95e75fdSopenharmony_ci    EventFwk::CommonEventSubscribeInfo subscriberInfo(matchingSkills);
808d95e75fdSopenharmony_ci    CellularCallHandler handler { subscriberInfo };
809d95e75fdSopenharmony_ci    for (int32_t slotId = 0; slotId < SLOT_COUNT; slotId++) {
810d95e75fdSopenharmony_ci        handler.SetSlotId(slotId);
811d95e75fdSopenharmony_ci        auto event = AppExecFwk::InnerEvent::Get(0);
812d95e75fdSopenharmony_ci        handler.GetImsCallsDataResponse(event);
813d95e75fdSopenharmony_ci        handler.GetImsCallsDataRequest(event);
814d95e75fdSopenharmony_ci        auto rilRadioResponse = std::make_shared<RadioResponseInfo>();
815d95e75fdSopenharmony_ci        rilRadioResponse->error = ErrType::ERR_GENERIC_FAILURE;
816d95e75fdSopenharmony_ci        auto responseEvent = AppExecFwk::InnerEvent::Get(0, rilRadioResponse);
817d95e75fdSopenharmony_ci        handler.SetDomainPreferenceModeResponse(responseEvent);
818d95e75fdSopenharmony_ci        handler.GetDomainPreferenceModeResponse(event);
819d95e75fdSopenharmony_ci        handler.SetDomainPreferenceModeResponse(event);
820d95e75fdSopenharmony_ci        handler.SetVoNRSwitchStatusResponse(responseEvent);
821d95e75fdSopenharmony_ci        ASSERT_EQ(handler.GetSlotId(), slotId);
822d95e75fdSopenharmony_ci        handler.OnRilAdapterHostDied(event);
823d95e75fdSopenharmony_ci        auto serviceInstance = DelayedSingleton<CellularCallService>::GetInstance();
824d95e75fdSopenharmony_ci        if (serviceInstance != nullptr) {
825d95e75fdSopenharmony_ci            std::shared_ptr<CSControl> csControl;
826d95e75fdSopenharmony_ci            serviceInstance->SetCsControl(slotId, csControl);
827d95e75fdSopenharmony_ci            std::shared_ptr<IMSControl> imsControl;
828d95e75fdSopenharmony_ci            serviceInstance->SetImsControl(slotId, imsControl);
829d95e75fdSopenharmony_ci            handler.OnRilAdapterHostDied(event);
830d95e75fdSopenharmony_ci            ASSERT_TRUE(serviceInstance->GetCsControl(slotId) == nullptr);
831d95e75fdSopenharmony_ci            ASSERT_TRUE(serviceInstance->GetCsControl(slotId) == nullptr);
832d95e75fdSopenharmony_ci        }
833d95e75fdSopenharmony_ci    }
834d95e75fdSopenharmony_ci}
835d95e75fdSopenharmony_ci
836d95e75fdSopenharmony_ci/**
837d95e75fdSopenharmony_ci * @tc.number   cellular_call_CellularCallHandler_0004
838d95e75fdSopenharmony_ci * @tc.name     Test for CellularCallHandler
839d95e75fdSopenharmony_ci * @tc.desc     Function test
840d95e75fdSopenharmony_ci */
841d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_CellularCallHandler_0004, Function | MediumTest | Level3)
842d95e75fdSopenharmony_ci{
843d95e75fdSopenharmony_ci    EventFwk::MatchingSkills matchingSkills;
844d95e75fdSopenharmony_ci    matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_OPERATOR_CONFIG_CHANGED);
845d95e75fdSopenharmony_ci    EventFwk::CommonEventSubscribeInfo subscriberInfo(matchingSkills);
846d95e75fdSopenharmony_ci    CellularCallHandler handler { subscriberInfo };
847d95e75fdSopenharmony_ci    for (int32_t slotId = 0; slotId < SLOT_COUNT; slotId++) {
848d95e75fdSopenharmony_ci        handler.SetSlotId(slotId);
849d95e75fdSopenharmony_ci        auto event = AppExecFwk::InnerEvent::Get(0);
850d95e75fdSopenharmony_ci        handler.ReceiveUpdateCallMediaModeRequest(event);
851d95e75fdSopenharmony_ci        handler.ReceiveUpdateCallMediaModeResponse(event);
852d95e75fdSopenharmony_ci        handler.HandleCallSessionEventChanged(event);
853d95e75fdSopenharmony_ci        handler.HandlePeerDimensionsChanged(event);
854d95e75fdSopenharmony_ci        handler.HandleCallDataUsageChanged(event);
855d95e75fdSopenharmony_ci        handler.HandleCameraCapabilitiesChanged(event);
856d95e75fdSopenharmony_ci        ASSERT_EQ(handler.GetSlotId(), slotId);
857d95e75fdSopenharmony_ci    }
858d95e75fdSopenharmony_ci}
859d95e75fdSopenharmony_ci
860d95e75fdSopenharmony_ci/**
861d95e75fdSopenharmony_ci * @tc.number   cellular_call_CellularCallHandler_0005
862d95e75fdSopenharmony_ci * @tc.name     Test for CellularCallHandler
863d95e75fdSopenharmony_ci * @tc.desc     Function test
864d95e75fdSopenharmony_ci */
865d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_CellularCallHandler_0005, Function | MediumTest | Level3)
866d95e75fdSopenharmony_ci{
867d95e75fdSopenharmony_ci    EventFwk::MatchingSkills matchingSkills;
868d95e75fdSopenharmony_ci    matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_OPERATOR_CONFIG_CHANGED);
869d95e75fdSopenharmony_ci    EventFwk::CommonEventSubscribeInfo subscriberInfo(matchingSkills);
870d95e75fdSopenharmony_ci    CellularCallHandler handler { subscriberInfo };
871d95e75fdSopenharmony_ci    auto imsCurrentCallList = std::make_shared<ImsCurrentCallList>();
872d95e75fdSopenharmony_ci    imsCurrentCallList->callSize = 0;
873d95e75fdSopenharmony_ci    handler.ProcessImsPhoneNumber(*imsCurrentCallList);
874d95e75fdSopenharmony_ci    EXPECT_EQ(imsCurrentCallList->callSize, 0);
875d95e75fdSopenharmony_ci    imsCurrentCallList->callSize = 1;
876d95e75fdSopenharmony_ci    handler.ProcessImsPhoneNumber(*imsCurrentCallList);
877d95e75fdSopenharmony_ci    EXPECT_EQ(imsCurrentCallList->callSize, 1);
878d95e75fdSopenharmony_ci    imsCurrentCallList->callSize = 1;
879d95e75fdSopenharmony_ci    ImsCurrentCall imsCurrent;
880d95e75fdSopenharmony_ci    std::string phoneNumber = "123";
881d95e75fdSopenharmony_ci    imsCurrent.number = phoneNumber;
882d95e75fdSopenharmony_ci    imsCurrentCallList->calls.push_back(imsCurrent);
883d95e75fdSopenharmony_ci    handler.ProcessImsPhoneNumber(*imsCurrentCallList);
884d95e75fdSopenharmony_ci    EXPECT_EQ(imsCurrentCallList->calls[0].number, phoneNumber);
885d95e75fdSopenharmony_ci    imsCurrentCallList->calls.clear();
886d95e75fdSopenharmony_ci    std::string unexpected = "00861565910xxxx";
887d95e75fdSopenharmony_ci    std::string expected = "+861565910xxxx";
888d95e75fdSopenharmony_ci    imsCurrent.number = unexpected;
889d95e75fdSopenharmony_ci    imsCurrentCallList->calls.push_back(imsCurrent);
890d95e75fdSopenharmony_ci    handler.ProcessImsPhoneNumber(*imsCurrentCallList);
891d95e75fdSopenharmony_ci    EXPECT_EQ(imsCurrentCallList->calls[0].number, expected);
892d95e75fdSopenharmony_ci    imsCurrentCallList->calls.clear();
893d95e75fdSopenharmony_ci    unexpected = "0861565910xxxx";
894d95e75fdSopenharmony_ci    imsCurrent.number = unexpected;
895d95e75fdSopenharmony_ci    imsCurrentCallList->calls.push_back(imsCurrent);
896d95e75fdSopenharmony_ci    handler.ProcessImsPhoneNumber(*imsCurrentCallList);
897d95e75fdSopenharmony_ci    EXPECT_EQ(imsCurrentCallList->calls[0].number, unexpected);
898d95e75fdSopenharmony_ci}
899d95e75fdSopenharmony_ci
900d95e75fdSopenharmony_ci/**
901d95e75fdSopenharmony_ci * @tc.number   cellular_call_ImsCallClient_0001
902d95e75fdSopenharmony_ci * @tc.name     test for ImsCallClient
903d95e75fdSopenharmony_ci * @tc.desc     Function test
904d95e75fdSopenharmony_ci */
905d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_ImsCallClient_0001, Function | MediumTest | Level3)
906d95e75fdSopenharmony_ci{
907d95e75fdSopenharmony_ci    ImsCallClient::SystemAbilityListener listen;
908d95e75fdSopenharmony_ci    int32_t systemAbilityId = 1;
909d95e75fdSopenharmony_ci    std::string deviceId = "123";
910d95e75fdSopenharmony_ci    listen.OnAddSystemAbility(systemAbilityId, deviceId);
911d95e75fdSopenharmony_ci    listen.OnRemoveSystemAbility(systemAbilityId, deviceId);
912d95e75fdSopenharmony_ci    listen.OnAddSystemAbility(COMMON_EVENT_SERVICE_ID, deviceId);
913d95e75fdSopenharmony_ci    listen.OnRemoveSystemAbility(COMMON_EVENT_SERVICE_ID, deviceId);
914d95e75fdSopenharmony_ci}
915d95e75fdSopenharmony_ci} // namespace Telephony
916d95e75fdSopenharmony_ci} // namespace OHOS
917