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 std::string PHONE_NUMBER = "0000000";
39d95e75fdSopenharmony_ciconst std::string PHONE_NUMBER_SECOND = "1111111";
40d95e75fdSopenharmony_ciconst std::string PHONE_NUMBER_THIRD = "2222222";
41d95e75fdSopenharmony_ciconst std::string PHONE_NUMBER_FOUR = "3333333";
42d95e75fdSopenharmony_ci
43d95e75fdSopenharmony_ci/**
44d95e75fdSopenharmony_ci * @tc.number   cellular_call_ims_test_001
45d95e75fdSopenharmony_ci * @tc.name     Test the corresponding functions by entering commands, such as 300 -- SetCallPreferenceMode, 301 --
46d95e75fdSopenharmony_ci *              GetCallPreferenceMode, etc
47d95e75fdSopenharmony_ci * @tc.desc     Function test
48d95e75fdSopenharmony_ci */
49d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_ims_test_001, Function | MediumTest | Level0)
50d95e75fdSopenharmony_ci{
51d95e75fdSopenharmony_ci    AccessToken token;
52d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
53d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
54d95e75fdSopenharmony_ci    auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
55d95e75fdSopenharmony_ci    ASSERT_TRUE(remote != nullptr);
56d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(remote);
57d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
58d95e75fdSopenharmony_ci    std::cout << "HWTEST_F cellular_call_ims_test_001";
59d95e75fdSopenharmony_ci}
60d95e75fdSopenharmony_ci
61d95e75fdSopenharmony_ci/**
62d95e75fdSopenharmony_ci * @tc.number   cellular_call_ims_test_002
63d95e75fdSopenharmony_ci * @tc.name     Test the corresponding functions by entering commands, such as 300 -- SetCallPreferenceMode, 301 --
64d95e75fdSopenharmony_ci *              GetCallPreferenceMode, etc
65d95e75fdSopenharmony_ci * @tc.desc     Function test
66d95e75fdSopenharmony_ci */
67d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_ims_test_002, Function | MediumTest | Level1)
68d95e75fdSopenharmony_ci{
69d95e75fdSopenharmony_ci    AccessToken token;
70d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
71d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
72d95e75fdSopenharmony_ci    auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
73d95e75fdSopenharmony_ci    ASSERT_TRUE(remote != nullptr);
74d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(remote);
75d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
76d95e75fdSopenharmony_ci    std::cout << "HWTEST_F cellular_call_ims_test_002";
77d95e75fdSopenharmony_ci}
78d95e75fdSopenharmony_ci
79d95e75fdSopenharmony_ci/**
80d95e75fdSopenharmony_ci * @tc.number   cellular_call_DialCall_0001
81d95e75fdSopenharmony_ci * @tc.name     Test for SetClip function by ims
82d95e75fdSopenharmony_ci * @tc.desc     Function test
83d95e75fdSopenharmony_ci */
84d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_DialCall_0001, Function | MediumTest | Level2)
85d95e75fdSopenharmony_ci{
86d95e75fdSopenharmony_ci    AccessToken token;
87d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
88d95e75fdSopenharmony_ci        return;
89d95e75fdSopenharmony_ci    }
90d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) {
91d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*30#");
92d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
93d95e75fdSopenharmony_ci    }
94d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) {
95d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*30#");
96d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
97d95e75fdSopenharmony_ci    }
98d95e75fdSopenharmony_ci}
99d95e75fdSopenharmony_ci
100d95e75fdSopenharmony_ci/**
101d95e75fdSopenharmony_ci * @tc.number   cellular_call_DialCall_0002
102d95e75fdSopenharmony_ci * @tc.name     Test for SetClip function by ims
103d95e75fdSopenharmony_ci * @tc.desc     Function test
104d95e75fdSopenharmony_ci */
105d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_DialCall_0002, Function | MediumTest | Level2)
106d95e75fdSopenharmony_ci{
107d95e75fdSopenharmony_ci    AccessToken token;
108d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
109d95e75fdSopenharmony_ci        return;
110d95e75fdSopenharmony_ci    }
111d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) {
112d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByIms(SIM1_SLOTID, "#30#");
113d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
114d95e75fdSopenharmony_ci    }
115d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) {
116d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByIms(SIM2_SLOTID, "#30#");
117d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
118d95e75fdSopenharmony_ci    }
119d95e75fdSopenharmony_ci}
120d95e75fdSopenharmony_ci
121d95e75fdSopenharmony_ci/**
122d95e75fdSopenharmony_ci * @tc.number   cellular_call_DialCall_0003
123d95e75fdSopenharmony_ci * @tc.name     Test for getClip function by ims
124d95e75fdSopenharmony_ci * @tc.desc     Function test
125d95e75fdSopenharmony_ci */
126d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_DialCall_0003, Function | MediumTest | Level2)
127d95e75fdSopenharmony_ci{
128d95e75fdSopenharmony_ci    AccessToken token;
129d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
130d95e75fdSopenharmony_ci        return;
131d95e75fdSopenharmony_ci    }
132d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) {
133d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*#30#");
134d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
135d95e75fdSopenharmony_ci    }
136d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) {
137d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*#30#");
138d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
139d95e75fdSopenharmony_ci    }
140d95e75fdSopenharmony_ci}
141d95e75fdSopenharmony_ci
142d95e75fdSopenharmony_ci/**
143d95e75fdSopenharmony_ci * @tc.number   cellular_call_DialCall_0004
144d95e75fdSopenharmony_ci * @tc.name     Test for SetClir function by ims
145d95e75fdSopenharmony_ci * @tc.desc     Function test
146d95e75fdSopenharmony_ci */
147d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_DialCall_0004, Function | MediumTest | Level2)
148d95e75fdSopenharmony_ci{
149d95e75fdSopenharmony_ci    AccessToken token;
150d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
151d95e75fdSopenharmony_ci        return;
152d95e75fdSopenharmony_ci    }
153d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) {
154d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*31#");
155d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
156d95e75fdSopenharmony_ci    }
157d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) {
158d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*31#");
159d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
160d95e75fdSopenharmony_ci    }
161d95e75fdSopenharmony_ci}
162d95e75fdSopenharmony_ci
163d95e75fdSopenharmony_ci/**
164d95e75fdSopenharmony_ci * @tc.number   cellular_call_DialCall_0005
165d95e75fdSopenharmony_ci * @tc.name     Test for SetClir function by ims
166d95e75fdSopenharmony_ci * @tc.desc     Function test
167d95e75fdSopenharmony_ci */
168d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_DialCall_0005, Function | MediumTest | Level2)
169d95e75fdSopenharmony_ci{
170d95e75fdSopenharmony_ci    AccessToken token;
171d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
172d95e75fdSopenharmony_ci        return;
173d95e75fdSopenharmony_ci    }
174d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) {
175d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByIms(SIM1_SLOTID, "#31#");
176d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
177d95e75fdSopenharmony_ci    }
178d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) {
179d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByIms(SIM2_SLOTID, "#31#");
180d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
181d95e75fdSopenharmony_ci    }
182d95e75fdSopenharmony_ci}
183d95e75fdSopenharmony_ci
184d95e75fdSopenharmony_ci/**
185d95e75fdSopenharmony_ci * @tc.number   cellular_call_DialCall_0006
186d95e75fdSopenharmony_ci * @tc.name     Test for GetClir function by ims
187d95e75fdSopenharmony_ci * @tc.desc     Function test
188d95e75fdSopenharmony_ci */
189d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_DialCall_0006, Function | MediumTest | Level2)
190d95e75fdSopenharmony_ci{
191d95e75fdSopenharmony_ci    AccessToken token;
192d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
193d95e75fdSopenharmony_ci        return;
194d95e75fdSopenharmony_ci    }
195d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) {
196d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*#31#");
197d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
198d95e75fdSopenharmony_ci    }
199d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) {
200d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*#31#");
201d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
202d95e75fdSopenharmony_ci    }
203d95e75fdSopenharmony_ci}
204d95e75fdSopenharmony_ci
205d95e75fdSopenharmony_ci/**
206d95e75fdSopenharmony_ci * @tc.number   cellular_call_DialCall_0007
207d95e75fdSopenharmony_ci * @tc.name     Test for SetCallTransfer function by ims
208d95e75fdSopenharmony_ci * @tc.desc     Function test
209d95e75fdSopenharmony_ci */
210d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_DialCall_0007, Function | MediumTest | Level2)
211d95e75fdSopenharmony_ci{
212d95e75fdSopenharmony_ci    AccessToken token;
213d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
214d95e75fdSopenharmony_ci        return;
215d95e75fdSopenharmony_ci    }
216d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) {
217d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*21#");
218d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
219d95e75fdSopenharmony_ci    }
220d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) {
221d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*21#");
222d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
223d95e75fdSopenharmony_ci    }
224d95e75fdSopenharmony_ci}
225d95e75fdSopenharmony_ci
226d95e75fdSopenharmony_ci/**
227d95e75fdSopenharmony_ci * @tc.number   cellular_call_DialCall_0008
228d95e75fdSopenharmony_ci * @tc.name     Test for SetCallTransfer function by ims
229d95e75fdSopenharmony_ci * @tc.desc     Function test
230d95e75fdSopenharmony_ci */
231d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_DialCall_0008, Function | MediumTest | Level2)
232d95e75fdSopenharmony_ci{
233d95e75fdSopenharmony_ci    AccessToken token;
234d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
235d95e75fdSopenharmony_ci        return;
236d95e75fdSopenharmony_ci    }
237d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) {
238d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByIms(SIM1_SLOTID, "#21#");
239d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
240d95e75fdSopenharmony_ci    }
241d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) {
242d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByIms(SIM2_SLOTID, "#21#");
243d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
244d95e75fdSopenharmony_ci    }
245d95e75fdSopenharmony_ci}
246d95e75fdSopenharmony_ci
247d95e75fdSopenharmony_ci/**
248d95e75fdSopenharmony_ci * @tc.number   cellular_call_DialCall_0009
249d95e75fdSopenharmony_ci * @tc.name     Test for GetCallTransfer function by ims
250d95e75fdSopenharmony_ci * @tc.desc     Function test
251d95e75fdSopenharmony_ci */
252d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_DialCall_0009, Function | MediumTest | Level2)
253d95e75fdSopenharmony_ci{
254d95e75fdSopenharmony_ci    AccessToken token;
255d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
256d95e75fdSopenharmony_ci        return;
257d95e75fdSopenharmony_ci    }
258d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) {
259d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*#21#");
260d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
261d95e75fdSopenharmony_ci    }
262d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) {
263d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*#21#");
264d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
265d95e75fdSopenharmony_ci    }
266d95e75fdSopenharmony_ci}
267d95e75fdSopenharmony_ci
268d95e75fdSopenharmony_ci/**
269d95e75fdSopenharmony_ci * @tc.number   cellular_call_DialCall_0010
270d95e75fdSopenharmony_ci * @tc.name     Test for SetCallRestriction function by ims
271d95e75fdSopenharmony_ci * @tc.desc     Function test
272d95e75fdSopenharmony_ci */
273d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_DialCall_0010, Function | MediumTest | Level2)
274d95e75fdSopenharmony_ci{
275d95e75fdSopenharmony_ci    AccessToken token;
276d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
277d95e75fdSopenharmony_ci        return;
278d95e75fdSopenharmony_ci    }
279d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) {
280d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*33#");
281d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
282d95e75fdSopenharmony_ci    }
283d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) {
284d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*33#");
285d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
286d95e75fdSopenharmony_ci    }
287d95e75fdSopenharmony_ci}
288d95e75fdSopenharmony_ci
289d95e75fdSopenharmony_ci/**
290d95e75fdSopenharmony_ci * @tc.number   cellular_call_DialCall_0011
291d95e75fdSopenharmony_ci * @tc.name     Test for SetCallRestriction function by ims
292d95e75fdSopenharmony_ci * @tc.desc     Function test
293d95e75fdSopenharmony_ci */
294d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_DialCall_0011, Function | MediumTest | Level2)
295d95e75fdSopenharmony_ci{
296d95e75fdSopenharmony_ci    AccessToken token;
297d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
298d95e75fdSopenharmony_ci        return;
299d95e75fdSopenharmony_ci    }
300d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) {
301d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByIms(SIM1_SLOTID, "#33#");
302d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
303d95e75fdSopenharmony_ci    }
304d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) {
305d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByIms(SIM2_SLOTID, "#33#");
306d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
307d95e75fdSopenharmony_ci    }
308d95e75fdSopenharmony_ci}
309d95e75fdSopenharmony_ci
310d95e75fdSopenharmony_ci/**
311d95e75fdSopenharmony_ci * @tc.number   cellular_call_DialCall_0012
312d95e75fdSopenharmony_ci * @tc.name     Test for GetCallRestriction function by ims
313d95e75fdSopenharmony_ci * @tc.desc     Function test
314d95e75fdSopenharmony_ci */
315d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_DialCall_0012, Function | MediumTest | Level2)
316d95e75fdSopenharmony_ci{
317d95e75fdSopenharmony_ci    AccessToken token;
318d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
319d95e75fdSopenharmony_ci        return;
320d95e75fdSopenharmony_ci    }
321d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) {
322d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*#33#");
323d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
324d95e75fdSopenharmony_ci    }
325d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) {
326d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*#33#");
327d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
328d95e75fdSopenharmony_ci    }
329d95e75fdSopenharmony_ci}
330d95e75fdSopenharmony_ci
331d95e75fdSopenharmony_ci/**
332d95e75fdSopenharmony_ci * @tc.number   cellular_call_DialCall_0013
333d95e75fdSopenharmony_ci * @tc.name     Test for SetCallWaiting function by ims
334d95e75fdSopenharmony_ci * @tc.desc     Function test
335d95e75fdSopenharmony_ci */
336d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_DialCall_0013, Function | MediumTest | Level2)
337d95e75fdSopenharmony_ci{
338d95e75fdSopenharmony_ci    AccessToken token;
339d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
340d95e75fdSopenharmony_ci        return;
341d95e75fdSopenharmony_ci    }
342d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) {
343d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*43#");
344d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
345d95e75fdSopenharmony_ci    }
346d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) {
347d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*43#");
348d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
349d95e75fdSopenharmony_ci    }
350d95e75fdSopenharmony_ci}
351d95e75fdSopenharmony_ci
352d95e75fdSopenharmony_ci/**
353d95e75fdSopenharmony_ci * @tc.number   cellular_call_DialCall_0014
354d95e75fdSopenharmony_ci * @tc.name     Test for SetCallWaiting function by ims
355d95e75fdSopenharmony_ci * @tc.desc     Function test
356d95e75fdSopenharmony_ci */
357d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_DialCall_0014, Function | MediumTest | Level2)
358d95e75fdSopenharmony_ci{
359d95e75fdSopenharmony_ci    AccessToken token;
360d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
361d95e75fdSopenharmony_ci        return;
362d95e75fdSopenharmony_ci    }
363d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) {
364d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByIms(SIM1_SLOTID, "#43#");
365d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
366d95e75fdSopenharmony_ci    }
367d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) {
368d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByIms(SIM2_SLOTID, "#43#");
369d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
370d95e75fdSopenharmony_ci    }
371d95e75fdSopenharmony_ci}
372d95e75fdSopenharmony_ci
373d95e75fdSopenharmony_ci/**
374d95e75fdSopenharmony_ci * @tc.number   cellular_call_DialCall_0015
375d95e75fdSopenharmony_ci * @tc.name     Test for GetCallWaiting function by ims
376d95e75fdSopenharmony_ci * @tc.desc     Function test
377d95e75fdSopenharmony_ci */
378d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_DialCall_0015, Function | MediumTest | Level2)
379d95e75fdSopenharmony_ci{
380d95e75fdSopenharmony_ci    AccessToken token;
381d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
382d95e75fdSopenharmony_ci        return;
383d95e75fdSopenharmony_ci    }
384d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) {
385d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByIms(SIM1_SLOTID, "*#43#");
386d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
387d95e75fdSopenharmony_ci        ret = TestDialCallByIms(SIM1_SLOTID, "*#4@3#");
388d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
389d95e75fdSopenharmony_ci    }
390d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_UT)) {
391d95e75fdSopenharmony_ci        int32_t ret = TestDialCallByIms(SIM2_SLOTID, "*#43#");
392d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
393d95e75fdSopenharmony_ci        ret = TestDialCallByIms(SIM2_SLOTID, "*#4@3#");
394d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
395d95e75fdSopenharmony_ci    }
396d95e75fdSopenharmony_ci}
397d95e75fdSopenharmony_ci
398d95e75fdSopenharmony_ci/**
399d95e75fdSopenharmony_ci * @tc.number   cellular_call_HangUpCall_0001
400d95e75fdSopenharmony_ci * @tc.name     Test for HangUp function by ims
401d95e75fdSopenharmony_ci * @tc.desc     Function test
402d95e75fdSopenharmony_ci */
403d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_HangUpCall_0001, Function | MediumTest | Level2)
404d95e75fdSopenharmony_ci{
405d95e75fdSopenharmony_ci    AccessToken token;
406d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
407d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
408d95e75fdSopenharmony_ci    auto hangUpCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
409d95e75fdSopenharmony_ci    ASSERT_TRUE(hangUpCallRemote != nullptr);
410d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(hangUpCallRemote);
411d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
412d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
413d95e75fdSopenharmony_ci        return;
414d95e75fdSopenharmony_ci    }
415d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) {
416d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
417d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo);
418d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
419d95e75fdSopenharmony_ci        ret = telephonyService->HangUp(callInfo, CallSupplementType::TYPE_DEFAULT);
420d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
421d95e75fdSopenharmony_ci        ret = telephonyService->HangUp(callInfo, CallSupplementType::TYPE_HANG_UP_ACTIVE);
422d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
423d95e75fdSopenharmony_ci    }
424d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) {
425d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
426d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo);
427d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
428d95e75fdSopenharmony_ci        ret = telephonyService->HangUp(callInfo, CallSupplementType::TYPE_DEFAULT);
429d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
430d95e75fdSopenharmony_ci        ret = telephonyService->HangUp(callInfo, CallSupplementType::TYPE_HANG_UP_ACTIVE);
431d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
432d95e75fdSopenharmony_ci    }
433d95e75fdSopenharmony_ci}
434d95e75fdSopenharmony_ci
435d95e75fdSopenharmony_ci/**
436d95e75fdSopenharmony_ci * @tc.number   cellular_call_AnswerCall_0001
437d95e75fdSopenharmony_ci * @tc.name     Test for answer function by ims
438d95e75fdSopenharmony_ci * @tc.desc     Function test
439d95e75fdSopenharmony_ci */
440d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_AnswerCall_0001, Function | MediumTest | Level2)
441d95e75fdSopenharmony_ci{
442d95e75fdSopenharmony_ci    AccessToken token;
443d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
444d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
445d95e75fdSopenharmony_ci    auto answerCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
446d95e75fdSopenharmony_ci    ASSERT_TRUE(answerCallRemote != nullptr);
447d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(answerCallRemote);
448d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
449d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
450d95e75fdSopenharmony_ci        return;
451d95e75fdSopenharmony_ci    }
452d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) {
453d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
454d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo);
455d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
456d95e75fdSopenharmony_ci        ret = telephonyService->Answer(callInfo);
457d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
458d95e75fdSopenharmony_ci    }
459d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) {
460d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
461d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo);
462d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
463d95e75fdSopenharmony_ci        ret = telephonyService->Answer(callInfo);
464d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
465d95e75fdSopenharmony_ci    }
466d95e75fdSopenharmony_ci}
467d95e75fdSopenharmony_ci
468d95e75fdSopenharmony_ci/**
469d95e75fdSopenharmony_ci * @tc.number   cellular_call_RejectCall_0001
470d95e75fdSopenharmony_ci * @tc.name     Test for reject function by ims
471d95e75fdSopenharmony_ci * @tc.desc     Function test
472d95e75fdSopenharmony_ci */
473d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_RejectCall_0001, Function | MediumTest | Level2)
474d95e75fdSopenharmony_ci{
475d95e75fdSopenharmony_ci    AccessToken token;
476d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
477d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
478d95e75fdSopenharmony_ci    auto rejectCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
479d95e75fdSopenharmony_ci    ASSERT_TRUE(rejectCallRemote != nullptr);
480d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(rejectCallRemote);
481d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
482d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
483d95e75fdSopenharmony_ci        return;
484d95e75fdSopenharmony_ci    }
485d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) {
486d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
487d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo);
488d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
489d95e75fdSopenharmony_ci        ret = telephonyService->Reject(callInfo);
490d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
491d95e75fdSopenharmony_ci    }
492d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) {
493d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
494d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo);
495d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
496d95e75fdSopenharmony_ci        ret = telephonyService->Reject(callInfo);
497d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
498d95e75fdSopenharmony_ci    }
499d95e75fdSopenharmony_ci}
500d95e75fdSopenharmony_ci
501d95e75fdSopenharmony_ci/**
502d95e75fdSopenharmony_ci * @tc.number   cellular_call_HoldCall_0001
503d95e75fdSopenharmony_ci * @tc.name     Test for hold call function by ims
504d95e75fdSopenharmony_ci * @tc.desc     Function test
505d95e75fdSopenharmony_ci */
506d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_HoldCall_0001, Function | MediumTest | Level2)
507d95e75fdSopenharmony_ci{
508d95e75fdSopenharmony_ci    AccessToken token;
509d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
510d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
511d95e75fdSopenharmony_ci    auto holdCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
512d95e75fdSopenharmony_ci    ASSERT_TRUE(holdCallRemote != nullptr);
513d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(holdCallRemote);
514d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
515d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
516d95e75fdSopenharmony_ci        return;
517d95e75fdSopenharmony_ci    }
518d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) {
519d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
520d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo);
521d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
522d95e75fdSopenharmony_ci        ret = telephonyService->HoldCall(callInfo);
523d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
524d95e75fdSopenharmony_ci    }
525d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) {
526d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
527d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo);
528d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
529d95e75fdSopenharmony_ci        ret = telephonyService->HoldCall(callInfo);
530d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
531d95e75fdSopenharmony_ci    }
532d95e75fdSopenharmony_ci}
533d95e75fdSopenharmony_ci
534d95e75fdSopenharmony_ci/**
535d95e75fdSopenharmony_ci * @tc.number   cellular_call_UnHoldCall_0001
536d95e75fdSopenharmony_ci * @tc.name     Test for unhold call function by ims
537d95e75fdSopenharmony_ci * @tc.desc     Function test
538d95e75fdSopenharmony_ci */
539d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_UnHoldCall_0001, Function | MediumTest | Level2)
540d95e75fdSopenharmony_ci{
541d95e75fdSopenharmony_ci    AccessToken token;
542d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
543d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
544d95e75fdSopenharmony_ci    auto unHoldCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
545d95e75fdSopenharmony_ci    ASSERT_TRUE(unHoldCallRemote != nullptr);
546d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(unHoldCallRemote);
547d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
548d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
549d95e75fdSopenharmony_ci        return;
550d95e75fdSopenharmony_ci    }
551d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) {
552d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
553d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo);
554d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
555d95e75fdSopenharmony_ci        ret = telephonyService->UnHoldCall(callInfo);
556d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
557d95e75fdSopenharmony_ci    }
558d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) {
559d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
560d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo);
561d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
562d95e75fdSopenharmony_ci        ret = telephonyService->UnHoldCall(callInfo);
563d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
564d95e75fdSopenharmony_ci    }
565d95e75fdSopenharmony_ci}
566d95e75fdSopenharmony_ci
567d95e75fdSopenharmony_ci/**
568d95e75fdSopenharmony_ci * @tc.number   cellular_call_SwitchCall_0001
569d95e75fdSopenharmony_ci * @tc.name     Test for switch call function by ims
570d95e75fdSopenharmony_ci * @tc.desc     Function test
571d95e75fdSopenharmony_ci */
572d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_SwitchCall_0001, Function | MediumTest | Level2)
573d95e75fdSopenharmony_ci{
574d95e75fdSopenharmony_ci    AccessToken token;
575d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
576d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
577d95e75fdSopenharmony_ci    auto switchCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
578d95e75fdSopenharmony_ci    ASSERT_TRUE(switchCallRemote != nullptr);
579d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(switchCallRemote);
580d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
581d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
582d95e75fdSopenharmony_ci        return;
583d95e75fdSopenharmony_ci    }
584d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) {
585d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
586d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo);
587d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
588d95e75fdSopenharmony_ci        ret = telephonyService->SwitchCall(callInfo);
589d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
590d95e75fdSopenharmony_ci    }
591d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) {
592d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
593d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo);
594d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
595d95e75fdSopenharmony_ci        ret = telephonyService->SwitchCall(callInfo);
596d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
597d95e75fdSopenharmony_ci    }
598d95e75fdSopenharmony_ci}
599d95e75fdSopenharmony_ci
600d95e75fdSopenharmony_ci/**
601d95e75fdSopenharmony_ci * @tc.number   cellular_call_CombineConference_0001
602d95e75fdSopenharmony_ci * @tc.name     Test for combineConference function by ims
603d95e75fdSopenharmony_ci * @tc.desc     Function test
604d95e75fdSopenharmony_ci */
605d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_CombineConference_0001, Function | MediumTest | Level2)
606d95e75fdSopenharmony_ci{
607d95e75fdSopenharmony_ci    AccessToken token;
608d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
609d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
610d95e75fdSopenharmony_ci    auto combineRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
611d95e75fdSopenharmony_ci    ASSERT_TRUE(combineRemote != nullptr);
612d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(combineRemote);
613d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
614d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
615d95e75fdSopenharmony_ci        return;
616d95e75fdSopenharmony_ci    }
617d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) {
618d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
619d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo);
620d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
621d95e75fdSopenharmony_ci        ret = telephonyService->CombineConference(callInfo);
622d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
623d95e75fdSopenharmony_ci    }
624d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) {
625d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
626d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo);
627d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
628d95e75fdSopenharmony_ci        ret = telephonyService->CombineConference(callInfo);
629d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
630d95e75fdSopenharmony_ci    }
631d95e75fdSopenharmony_ci}
632d95e75fdSopenharmony_ci
633d95e75fdSopenharmony_ci/**
634d95e75fdSopenharmony_ci * @tc.number   cellular_call_SeparateConference_0001
635d95e75fdSopenharmony_ci * @tc.name     Test for separateConference function by ims
636d95e75fdSopenharmony_ci * @tc.desc     Function test
637d95e75fdSopenharmony_ci */
638d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_SeparateConference_0001, Function | MediumTest | Level2)
639d95e75fdSopenharmony_ci{
640d95e75fdSopenharmony_ci    AccessToken token;
641d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
642d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
643d95e75fdSopenharmony_ci    auto separateRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
644d95e75fdSopenharmony_ci    ASSERT_TRUE(separateRemote != nullptr);
645d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(separateRemote);
646d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
647d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
648d95e75fdSopenharmony_ci        return;
649d95e75fdSopenharmony_ci    }
650d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) {
651d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
652d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo);
653d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
654d95e75fdSopenharmony_ci        ret = telephonyService->SeparateConference(callInfo);
655d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_ERR_ARGUMENT_INVALID);
656d95e75fdSopenharmony_ci    }
657d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) {
658d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
659d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo);
660d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
661d95e75fdSopenharmony_ci        ret = telephonyService->SeparateConference(callInfo);
662d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_ERR_ARGUMENT_INVALID);
663d95e75fdSopenharmony_ci    }
664d95e75fdSopenharmony_ci}
665d95e75fdSopenharmony_ci
666d95e75fdSopenharmony_ci/**
667d95e75fdSopenharmony_ci * @tc.number   cellular_call_KickOutFromConference_0001
668d95e75fdSopenharmony_ci * @tc.name     Test for KickOutFromConference function by ims
669d95e75fdSopenharmony_ci * @tc.desc     Function test
670d95e75fdSopenharmony_ci */
671d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_KickOutFromConference_0001, Function | MediumTest | Level2)
672d95e75fdSopenharmony_ci{
673d95e75fdSopenharmony_ci    AccessToken token;
674d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
675d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
676d95e75fdSopenharmony_ci    auto kickOutRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
677d95e75fdSopenharmony_ci    ASSERT_TRUE(kickOutRemote != nullptr);
678d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(kickOutRemote);
679d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
680d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
681d95e75fdSopenharmony_ci        return;
682d95e75fdSopenharmony_ci    }
683d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) {
684d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
685d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo);
686d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
687d95e75fdSopenharmony_ci        ret = telephonyService->KickOutFromConference(callInfo);
688d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
689d95e75fdSopenharmony_ci    }
690d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) {
691d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
692d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo);
693d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
694d95e75fdSopenharmony_ci        ret = telephonyService->KickOutFromConference(callInfo);
695d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
696d95e75fdSopenharmony_ci    }
697d95e75fdSopenharmony_ci}
698d95e75fdSopenharmony_ci
699d95e75fdSopenharmony_ci/**
700d95e75fdSopenharmony_ci * @tc.number   cellular_call_StartDtmf_0001
701d95e75fdSopenharmony_ci * @tc.name     Test for startDtmf function by ims
702d95e75fdSopenharmony_ci * @tc.desc     Function test
703d95e75fdSopenharmony_ci */
704d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_StartDtmf_0001, Function | MediumTest | Level2)
705d95e75fdSopenharmony_ci{
706d95e75fdSopenharmony_ci    AccessToken token;
707d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
708d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
709d95e75fdSopenharmony_ci    auto startDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
710d95e75fdSopenharmony_ci    ASSERT_TRUE(startDtmfRemote != nullptr);
711d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(startDtmfRemote);
712d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
713d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
714d95e75fdSopenharmony_ci        return;
715d95e75fdSopenharmony_ci    }
716d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) {
717d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
718d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo);
719d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
720d95e75fdSopenharmony_ci        char code = '1';
721d95e75fdSopenharmony_ci        ret = telephonyService->StartDtmf(code, callInfo);
722d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
723d95e75fdSopenharmony_ci    }
724d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) {
725d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
726d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo);
727d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
728d95e75fdSopenharmony_ci        char code = '1';
729d95e75fdSopenharmony_ci        ret = telephonyService->StartDtmf(code, callInfo);
730d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
731d95e75fdSopenharmony_ci    }
732d95e75fdSopenharmony_ci}
733d95e75fdSopenharmony_ci
734d95e75fdSopenharmony_ci/**
735d95e75fdSopenharmony_ci * @tc.number   cellular_call_StopDtmf_0001
736d95e75fdSopenharmony_ci * @tc.name     Test for stopDtmf function by ims
737d95e75fdSopenharmony_ci * @tc.desc     Function test
738d95e75fdSopenharmony_ci */
739d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_StopDtmf_0001, Function | MediumTest | Level2)
740d95e75fdSopenharmony_ci{
741d95e75fdSopenharmony_ci    AccessToken token;
742d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
743d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
744d95e75fdSopenharmony_ci    auto stopDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
745d95e75fdSopenharmony_ci    ASSERT_TRUE(stopDtmfRemote != nullptr);
746d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(stopDtmfRemote);
747d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
748d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
749d95e75fdSopenharmony_ci        return;
750d95e75fdSopenharmony_ci    }
751d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) {
752d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
753d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo);
754d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
755d95e75fdSopenharmony_ci        ret = telephonyService->StopDtmf(callInfo);
756d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
757d95e75fdSopenharmony_ci    }
758d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) {
759d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
760d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo);
761d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
762d95e75fdSopenharmony_ci        ret = telephonyService->StopDtmf(callInfo);
763d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
764d95e75fdSopenharmony_ci    }
765d95e75fdSopenharmony_ci}
766d95e75fdSopenharmony_ci
767d95e75fdSopenharmony_ci/**
768d95e75fdSopenharmony_ci * @tc.number   cellular_call_SendDtmf_0001
769d95e75fdSopenharmony_ci * @tc.name     Test for sendDtmf function by ims
770d95e75fdSopenharmony_ci * @tc.desc     Function test
771d95e75fdSopenharmony_ci */
772d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_SendDtmf_0001, Function | MediumTest | Level2)
773d95e75fdSopenharmony_ci{
774d95e75fdSopenharmony_ci    AccessToken token;
775d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
776d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
777d95e75fdSopenharmony_ci    auto sendDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
778d95e75fdSopenharmony_ci    ASSERT_TRUE(sendDtmfRemote != nullptr);
779d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(sendDtmfRemote);
780d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
781d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
782d95e75fdSopenharmony_ci        return;
783d95e75fdSopenharmony_ci    }
784d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_VOICE)) {
785d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
786d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo);
787d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
788d95e75fdSopenharmony_ci        char code = '1';
789d95e75fdSopenharmony_ci        ret = telephonyService->SendDtmf(code, callInfo);
790d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
791d95e75fdSopenharmony_ci    }
792d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID) && CanUseImsService(SIM2_SLOTID, ImsServiceType::TYPE_VOICE)) {
793d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
794d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo);
795d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
796d95e75fdSopenharmony_ci        char code = '1';
797d95e75fdSopenharmony_ci        ret = telephonyService->SendDtmf(code, callInfo);
798d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
799d95e75fdSopenharmony_ci    }
800d95e75fdSopenharmony_ci}
801d95e75fdSopenharmony_ci
802d95e75fdSopenharmony_ci/**
803d95e75fdSopenharmony_ci * @tc.number   cellular_call_CanSetCallTransferTime_0001
804d95e75fdSopenharmony_ci * @tc.name     Test for CanSetCallTransferTime function by ims
805d95e75fdSopenharmony_ci * @tc.desc     Function test
806d95e75fdSopenharmony_ci */
807d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_CanSetCallTransferTime_0001, Function | MediumTest | Level2)
808d95e75fdSopenharmony_ci{
809d95e75fdSopenharmony_ci    AccessToken token;
810d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
811d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
812d95e75fdSopenharmony_ci    auto transferRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
813d95e75fdSopenharmony_ci    ASSERT_TRUE(transferRemote != nullptr);
814d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(transferRemote);
815d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
816d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
817d95e75fdSopenharmony_ci        return;
818d95e75fdSopenharmony_ci    }
819d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID) && CanUseImsService(SIM1_SLOTID, ImsServiceType::TYPE_UT)) {
820d95e75fdSopenharmony_ci        bool result;
821d95e75fdSopenharmony_ci        int32_t ret = telephonyService->CanSetCallTransferTime(SIM1_SLOTID, result);
822d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
823d95e75fdSopenharmony_ci    }
824d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
825d95e75fdSopenharmony_ci        bool result;
826d95e75fdSopenharmony_ci        int32_t ret = telephonyService->CanSetCallTransferTime(SIM2_SLOTID, result);
827d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
828d95e75fdSopenharmony_ci    }
829d95e75fdSopenharmony_ci}
830d95e75fdSopenharmony_ci
831d95e75fdSopenharmony_ci
832d95e75fdSopenharmony_ci/**
833d95e75fdSopenharmony_ci * @tc.number   cellular_call_SetVoNRState_0001
834d95e75fdSopenharmony_ci * @tc.name     Test for SetVoNRState function
835d95e75fdSopenharmony_ci * @tc.desc     Function test
836d95e75fdSopenharmony_ci */
837d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_SetVoNRState_0001, Function | MediumTest | Level2)
838d95e75fdSopenharmony_ci{
839d95e75fdSopenharmony_ci    AccessToken token;
840d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
841d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
842d95e75fdSopenharmony_ci    auto setVoNRRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
843d95e75fdSopenharmony_ci    ASSERT_TRUE(setVoNRRemote != nullptr);
844d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(setVoNRRemote);
845d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
846d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
847d95e75fdSopenharmony_ci        return;
848d95e75fdSopenharmony_ci    }
849d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
850d95e75fdSopenharmony_ci        int32_t ret = telephonyService->SetVoNRState(SIM1_SLOTID, 1);
851d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
852d95e75fdSopenharmony_ci    }
853d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
854d95e75fdSopenharmony_ci        int32_t ret = telephonyService->SetVoNRState(SIM2_SLOTID, 1);
855d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
856d95e75fdSopenharmony_ci    }
857d95e75fdSopenharmony_ci}
858d95e75fdSopenharmony_ci} // namespace Telephony
859d95e75fdSopenharmony_ci} // namespace OHOS
860