1d95e75fdSopenharmony_ci/*
2d95e75fdSopenharmony_ci * Copyright (C) 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#define private public
16d95e75fdSopenharmony_ci#define protected public
17d95e75fdSopenharmony_ci
18d95e75fdSopenharmony_ci#include "cellular_call_config.h"
19d95e75fdSopenharmony_ci#include "cellular_call_connection_ims.h"
20d95e75fdSopenharmony_ci#include "cellular_call_handler.h"
21d95e75fdSopenharmony_ci#include "cellular_call_proxy.h"
22d95e75fdSopenharmony_ci#include "cellular_call_register.h"
23d95e75fdSopenharmony_ci#include "cellular_call_service.h"
24d95e75fdSopenharmony_ci#include "cellular_call_supplement.h"
25d95e75fdSopenharmony_ci#include "config_request.h"
26d95e75fdSopenharmony_ci#include "control_base.h"
27d95e75fdSopenharmony_ci#include "cs_control.h"
28d95e75fdSopenharmony_ci#include "gtest/gtest.h"
29d95e75fdSopenharmony_ci#include "tel_ril_call_parcel.h"
30d95e75fdSopenharmony_ci#include "ims_call_callback_proxy.h"
31d95e75fdSopenharmony_ci#include "ims_call_callback_stub.h"
32d95e75fdSopenharmony_ci#include "ims_call_client.h"
33d95e75fdSopenharmony_ci#include "ims_control.h"
34d95e75fdSopenharmony_ci#include "ims_error.h"
35d95e75fdSopenharmony_ci#include "ims_test.h"
36d95e75fdSopenharmony_ci#include "securec.h"
37d95e75fdSopenharmony_ci#include "cellular_call_hisysevent.h"
38d95e75fdSopenharmony_ci#include "standardize_utils.h"
39d95e75fdSopenharmony_ci#include "cellular_call_rdb_helper.h"
40d95e75fdSopenharmony_ci#include "cellular_call_dump_helper.h"
41d95e75fdSopenharmony_ci#include "emergency_utils.h"
42d95e75fdSopenharmony_ci#include "satellite_call_client.h"
43d95e75fdSopenharmony_ci
44d95e75fdSopenharmony_cinamespace OHOS {
45d95e75fdSopenharmony_cinamespace Telephony {
46d95e75fdSopenharmony_ciusing namespace testing::ext;
47d95e75fdSopenharmony_ci
48d95e75fdSopenharmony_ci#ifdef CALL_MANAGER_AUTO_START_OPTIMIZE
49d95e75fdSopenharmony_cistatic const int32_t INVALID_VALUE = -1;
50d95e75fdSopenharmony_ci#endif
51d95e75fdSopenharmony_ci
52d95e75fdSopenharmony_cinamespace {
53d95e75fdSopenharmony_ciconst int32_t INVALID_SLOTID = 2;
54d95e75fdSopenharmony_ciconst int32_t SIM1_SLOTID = 0;
55d95e75fdSopenharmony_ciconst int32_t SIM2_SLOTID = 1;
56d95e75fdSopenharmony_ciconst std::string PHONE_NUMBER = "00000000";
57d95e75fdSopenharmony_ciconst int32_t DEFAULT_INDEX = 1;
58d95e75fdSopenharmony_ci} // namespace
59d95e75fdSopenharmony_ci
60d95e75fdSopenharmony_ciclass DemoHandler : public AppExecFwk::EventHandler {
61d95e75fdSopenharmony_cipublic:
62d95e75fdSopenharmony_ci    explicit DemoHandler(std::shared_ptr<AppExecFwk::EventRunner> &runner) : AppExecFwk::EventHandler(runner) {}
63d95e75fdSopenharmony_ci    virtual ~DemoHandler() {}
64d95e75fdSopenharmony_ci    void ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event) {}
65d95e75fdSopenharmony_ci};
66d95e75fdSopenharmony_ci
67d95e75fdSopenharmony_ciclass BranchTest : public testing::Test {
68d95e75fdSopenharmony_cipublic:
69d95e75fdSopenharmony_ci    static void SetUpTestCase();
70d95e75fdSopenharmony_ci    static void TearDownTestCase();
71d95e75fdSopenharmony_ci    void SetUp();
72d95e75fdSopenharmony_ci    void TearDown();
73d95e75fdSopenharmony_ci    int32_t InitCellularCallInfo(int32_t accountId, std::string phonenumber, CellularCallInfo &callInfo);
74d95e75fdSopenharmony_ci    void InitImsCallInfoList(ImsCurrentCallList &callInfoList, int32_t num);
75d95e75fdSopenharmony_ci    void InitCsCallInfoList(CallInfoList &callInfoList, int32_t num);
76d95e75fdSopenharmony_ci    void MakeCallInfoParcelData(bool isError, MessageParcel &data);
77d95e75fdSopenharmony_ci};
78d95e75fdSopenharmony_ci
79d95e75fdSopenharmony_civoid BranchTest::SetUpTestCase()
80d95e75fdSopenharmony_ci{
81d95e75fdSopenharmony_ci    std::cout << "---------- CellularCallService start ------------" << std::endl;
82d95e75fdSopenharmony_ci    DelayedSingleton<CellularCallService>::GetInstance()->Init();
83d95e75fdSopenharmony_ci    DelayedSingleton<ImsCallClient>::GetInstance()->Init();
84d95e75fdSopenharmony_ci}
85d95e75fdSopenharmony_ci
86d95e75fdSopenharmony_civoid BranchTest::TearDownTestCase() {}
87d95e75fdSopenharmony_ci
88d95e75fdSopenharmony_civoid BranchTest::SetUp() {}
89d95e75fdSopenharmony_ci
90d95e75fdSopenharmony_civoid BranchTest::TearDown() {}
91d95e75fdSopenharmony_ci
92d95e75fdSopenharmony_ciint32_t BranchTest::InitCellularCallInfo(int32_t accountId, std::string phonenumber, CellularCallInfo &callInfo)
93d95e75fdSopenharmony_ci{
94d95e75fdSopenharmony_ci    callInfo.accountId = accountId;
95d95e75fdSopenharmony_ci    callInfo.slotId = accountId;
96d95e75fdSopenharmony_ci    callInfo.index = accountId;
97d95e75fdSopenharmony_ci    callInfo.callType = CallType::TYPE_IMS;
98d95e75fdSopenharmony_ci    callInfo.videoState = 0; // 0 means audio
99d95e75fdSopenharmony_ci    if (memset_s(callInfo.phoneNum, kMaxNumberLen, 0, kMaxNumberLen) != EOK) {
100d95e75fdSopenharmony_ci        return TELEPHONY_ERR_MEMSET_FAIL;
101d95e75fdSopenharmony_ci    }
102d95e75fdSopenharmony_ci    if (phonenumber.length() > static_cast<size_t>(kMaxNumberLen)) {
103d95e75fdSopenharmony_ci        return CALL_ERR_NUMBER_OUT_OF_RANGE;
104d95e75fdSopenharmony_ci    }
105d95e75fdSopenharmony_ci    if (memcpy_s(callInfo.phoneNum, kMaxNumberLen, phonenumber.c_str(), phonenumber.length()) != EOK) {
106d95e75fdSopenharmony_ci        return TELEPHONY_ERR_MEMCPY_FAIL;
107d95e75fdSopenharmony_ci    }
108d95e75fdSopenharmony_ci    return TELEPHONY_SUCCESS;
109d95e75fdSopenharmony_ci}
110d95e75fdSopenharmony_ci
111d95e75fdSopenharmony_civoid BranchTest::InitImsCallInfoList(ImsCurrentCallList &callInfoList, int32_t num)
112d95e75fdSopenharmony_ci{
113d95e75fdSopenharmony_ci    callInfoList.callSize = num;
114d95e75fdSopenharmony_ci    ImsCurrentCall call;
115d95e75fdSopenharmony_ci    int32_t callStateSum = 6;
116d95e75fdSopenharmony_ci    for (int32_t i = 0; i < num; ++i) {
117d95e75fdSopenharmony_ci        call.index = i;
118d95e75fdSopenharmony_ci        call.state = i % callStateSum;
119d95e75fdSopenharmony_ci        callInfoList.calls.push_back(call);
120d95e75fdSopenharmony_ci    }
121d95e75fdSopenharmony_ci}
122d95e75fdSopenharmony_ci
123d95e75fdSopenharmony_civoid BranchTest::MakeCallInfoParcelData(bool isError, MessageParcel &data)
124d95e75fdSopenharmony_ci{
125d95e75fdSopenharmony_ci    if (isError) {
126d95e75fdSopenharmony_ci        int32_t errorSize = 0;
127d95e75fdSopenharmony_ci        data.WriteInt32(errorSize);
128d95e75fdSopenharmony_ci    } else {
129d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
130d95e75fdSopenharmony_ci        callInfo.slotId = -1;
131d95e75fdSopenharmony_ci        int32_t size = 1;
132d95e75fdSopenharmony_ci        data.WriteInt32(size);
133d95e75fdSopenharmony_ci        data.WriteRawData(static_cast<const void *>(&callInfo), sizeof(CellularCallInfo));
134d95e75fdSopenharmony_ci    }
135d95e75fdSopenharmony_ci}
136d95e75fdSopenharmony_ci
137d95e75fdSopenharmony_civoid BranchTest::InitCsCallInfoList(CallInfoList &callInfoList, int32_t num)
138d95e75fdSopenharmony_ci{
139d95e75fdSopenharmony_ci    callInfoList.callSize = num;
140d95e75fdSopenharmony_ci    CallInfo call;
141d95e75fdSopenharmony_ci    int32_t callStateSum = 9;
142d95e75fdSopenharmony_ci    for (int32_t i = 0; i < num; ++i) {
143d95e75fdSopenharmony_ci        call.index = i;
144d95e75fdSopenharmony_ci        call.state = i % callStateSum;
145d95e75fdSopenharmony_ci        callInfoList.calls.push_back(call);
146d95e75fdSopenharmony_ci    }
147d95e75fdSopenharmony_ci}
148d95e75fdSopenharmony_ci
149d95e75fdSopenharmony_ci/**
150d95e75fdSopenharmony_ci * @tc.number   Telephony_CellularCallConfig_001
151d95e75fdSopenharmony_ci * @tc.name     Test error branch
152d95e75fdSopenharmony_ci * @tc.desc     Function test
153d95e75fdSopenharmony_ci */
154d95e75fdSopenharmony_ciHWTEST_F(BranchTest, Telephony_CellularCallConfig_001, Function | MediumTest | Level3)
155d95e75fdSopenharmony_ci{
156d95e75fdSopenharmony_ci    AccessToken token;
157d95e75fdSopenharmony_ci    CellularCallConfig config;
158d95e75fdSopenharmony_ci    config.SetDomainPreferenceMode(SIM1_SLOTID, 1);
159d95e75fdSopenharmony_ci    config.SetDomainPreferenceMode(SIM1_SLOTID, -1);
160d95e75fdSopenharmony_ci    config.GetDomainPreferenceMode(SIM1_SLOTID);
161d95e75fdSopenharmony_ci    bool enabled = false;
162d95e75fdSopenharmony_ci    config.SetImsSwitchStatus(INVALID_SLOTID, enabled);
163d95e75fdSopenharmony_ci    config.SetImsSwitchStatus(SIM1_SLOTID, enabled);
164d95e75fdSopenharmony_ci    config.volteSupported_[SIM1_SLOTID] = true;
165d95e75fdSopenharmony_ci    config.volteSupported_[INVALID_SLOTID] = true;
166d95e75fdSopenharmony_ci    config.volteProvisioningSupported_[SIM1_SLOTID] = true;
167d95e75fdSopenharmony_ci    config.volteProvisioningSupported_[INVALID_SLOTID] = true;
168d95e75fdSopenharmony_ci    config.SetImsSwitchStatus(INVALID_SLOTID, enabled);
169d95e75fdSopenharmony_ci    config.SetImsSwitchStatus(SIM1_SLOTID, true);
170d95e75fdSopenharmony_ci    config.volteSupported_[SIM1_SLOTID] = enabled;
171d95e75fdSopenharmony_ci    config.volteSupported_[INVALID_SLOTID] = enabled;
172d95e75fdSopenharmony_ci    config.volteProvisioningSupported_[SIM1_SLOTID] = enabled;
173d95e75fdSopenharmony_ci    config.volteProvisioningSupported_[INVALID_SLOTID] = enabled;
174d95e75fdSopenharmony_ci    config.GetImsSwitchStatus(SIM1_SLOTID, enabled);
175d95e75fdSopenharmony_ci    config.saveImsSwitchStatusToLocalForPowerOn(SIM1_SLOTID);
176d95e75fdSopenharmony_ci    config.saveImsSwitchStatusToLocal(SIM1_SLOTID, true);
177d95e75fdSopenharmony_ci    config.GetImsSwitchStatus(SIM1_SLOTID, enabled);
178d95e75fdSopenharmony_ci    int32_t state = 0;
179d95e75fdSopenharmony_ci    config.SetVoNRSwitchStatus(SIM1_SLOTID, state);
180d95e75fdSopenharmony_ci    config.SetVoNRSwitchStatus(INVALID_SLOTID, state);
181d95e75fdSopenharmony_ci    config.GetVoNRSwitchStatus(SIM1_SLOTID, state);
182d95e75fdSopenharmony_ci    config.GetVoNRSwitchStatus(SIM2_SLOTID, state);
183d95e75fdSopenharmony_ci    config.GetDomainPreferenceModeResponse(SIM1_SLOTID, 1);
184d95e75fdSopenharmony_ci    config.GetImsSwitchStatusResponse(SIM1_SLOTID, 1);
185d95e75fdSopenharmony_ci    config.GetPreferenceMode(SIM1_SLOTID);
186d95e75fdSopenharmony_ci    std::string value = "";
187d95e75fdSopenharmony_ci    config.SetImsConfig(ImsConfigItem::ITEM_VIDEO_QUALITY, value);
188d95e75fdSopenharmony_ci    config.SetImsConfig(ImsConfigItem::ITEM_VIDEO_QUALITY, 1);
189d95e75fdSopenharmony_ci    config.GetImsConfig(ImsConfigItem::ITEM_VIDEO_QUALITY);
190d95e75fdSopenharmony_ci    config.SetImsFeatureValue(FeatureType::TYPE_VOICE_OVER_LTE, 1);
191d95e75fdSopenharmony_ci    int32_t res = config.GetImsFeatureValue(FeatureType::TYPE_VOICE_OVER_LTE);
192d95e75fdSopenharmony_ci    config.HandleFactoryReset(0);
193d95e75fdSopenharmony_ci    config.HandleFactoryReset(1);
194d95e75fdSopenharmony_ci#ifdef CALL_MANAGER_AUTO_START_OPTIMIZE
195d95e75fdSopenharmony_ci    ASSERT_EQ(res, CALL_ERR_RESOURCE_UNAVAILABLE);
196d95e75fdSopenharmony_ci#else
197d95e75fdSopenharmony_ci    ASSERT_EQ(res, TELEPHONY_SUCCESS);
198d95e75fdSopenharmony_ci#endif
199d95e75fdSopenharmony_ci}
200d95e75fdSopenharmony_ci
201d95e75fdSopenharmony_ci/**
202d95e75fdSopenharmony_ci * @tc.number   Telephony_CellularCallConfig_002
203d95e75fdSopenharmony_ci * @tc.name     Test error branch
204d95e75fdSopenharmony_ci * @tc.desc     Function test
205d95e75fdSopenharmony_ci */
206d95e75fdSopenharmony_ciHWTEST_F(BranchTest, Telephony_CellularCallConfig_002, Function | MediumTest | Level3)
207d95e75fdSopenharmony_ci{
208d95e75fdSopenharmony_ci    AccessToken token;
209d95e75fdSopenharmony_ci    CellularCallConfig config;
210d95e75fdSopenharmony_ci    config.SetMute(SIM1_SLOTID, 0);
211d95e75fdSopenharmony_ci    config.GetMute(SIM1_SLOTID);
212d95e75fdSopenharmony_ci    config.GetEmergencyCallList(SIM1_SLOTID);
213d95e75fdSopenharmony_ci    std::vector<EmergencyCall> eccVec = {};
214d95e75fdSopenharmony_ci    config.SetEmergencyCallList(SIM1_SLOTID, eccVec);
215d95e75fdSopenharmony_ci    config.SetTempMode(SIM1_SLOTID);
216d95e75fdSopenharmony_ci    config.InitModeActive();
217d95e75fdSopenharmony_ci    EmergencyInfoList eccList;
218d95e75fdSopenharmony_ci    config.UpdateEmergencyCallFromRadio(SIM1_SLOTID, eccList);
219d95e75fdSopenharmony_ci    config.GetEccCallList(SIM1_SLOTID);
220d95e75fdSopenharmony_ci    config.GetMcc(SIM1_SLOTID);
221d95e75fdSopenharmony_ci    config.SetReadyToCall(SIM1_SLOTID, true);
222d95e75fdSopenharmony_ci    config.SetReadyToCall(INVALID_SLOTID, true);
223d95e75fdSopenharmony_ci    config.IsReadyToCall(SIM1_SLOTID);
224d95e75fdSopenharmony_ci    config.IsReadyToCall(INVALID_SLOTID);
225d95e75fdSopenharmony_ci
226d95e75fdSopenharmony_ci    config.HandleSimStateChanged(SIM1_SLOTID);
227d95e75fdSopenharmony_ci    config.HandleSetLteImsSwitchResult(SIM1_SLOTID, ErrType::NONE);
228d95e75fdSopenharmony_ci    config.HandleSetVoNRSwitchResult(SIM1_SLOTID, ErrType::NONE);
229d95e75fdSopenharmony_ci    config.HandleSimRecordsLoaded(SIM1_SLOTID);
230d95e75fdSopenharmony_ci    config.HandleOperatorConfigChanged(SIM1_SLOTID);
231d95e75fdSopenharmony_ci    OperatorConfig poc;
232d95e75fdSopenharmony_ci    config.ParseAndCacheOperatorConfigs(SIM1_SLOTID, poc);
233d95e75fdSopenharmony_ci    config.UpdateImsCapabilities(SIM1_SLOTID, true);
234d95e75fdSopenharmony_ci    bool enabled = false;
235d95e75fdSopenharmony_ci    config.ChangeImsSwitchWithOperatorConfig(SIM1_SLOTID, true);
236d95e75fdSopenharmony_ci    config.SaveImsSwitch(SIM1_SLOTID, true);
237d95e75fdSopenharmony_ci    config.IsUtProvisioned(SIM1_SLOTID);
238d95e75fdSopenharmony_ci    config.utProvisioningSupported_[SIM1_SLOTID] = true;
239d95e75fdSopenharmony_ci    config.IsUtProvisioned(SIM1_SLOTID);
240d95e75fdSopenharmony_ci    config.utProvisioningSupported_[SIM1_SLOTID] = enabled;
241d95e75fdSopenharmony_ci    config.ResetImsSwitch(SIM1_SLOTID);
242d95e75fdSopenharmony_ci    config.HandleSimAccountLoaded(SIM1_SLOTID);
243d95e75fdSopenharmony_ci    ASSERT_FALSE(config.utProvisioningSupported_[SIM1_SLOTID]);
244d95e75fdSopenharmony_ci}
245d95e75fdSopenharmony_ci
246d95e75fdSopenharmony_ci/**
247d95e75fdSopenharmony_ci * @tc.number   Telephony_CellularCallSupplement_001
248d95e75fdSopenharmony_ci * @tc.name     Test error branch
249d95e75fdSopenharmony_ci * @tc.desc     Function test
250d95e75fdSopenharmony_ci */
251d95e75fdSopenharmony_ciHWTEST_F(BranchTest, Telephony_CellularCallSupplement_001, Function | MediumTest | Level3)
252d95e75fdSopenharmony_ci{
253d95e75fdSopenharmony_ci    AccessToken token;
254d95e75fdSopenharmony_ci    CellularCallSupplement callSup;
255d95e75fdSopenharmony_ci    MMIData mmiDataEmp = {};
256d95e75fdSopenharmony_ci    MMIData mmiDataAct = { .actionString = "*" };
257d95e75fdSopenharmony_ci    MMIData mmiDataDeact = { .actionString = "#" };
258d95e75fdSopenharmony_ci    MMIData mmiDataInterrogate = { .actionString = "*#" };
259d95e75fdSopenharmony_ci    callSup.HandleClip(SIM1_SLOTID, mmiDataEmp);
260d95e75fdSopenharmony_ci    callSup.HandleClip(SIM1_SLOTID, mmiDataAct);
261d95e75fdSopenharmony_ci    callSup.HandleClip(SIM1_SLOTID, mmiDataDeact);
262d95e75fdSopenharmony_ci    callSup.HandleClip(SIM1_SLOTID, mmiDataInterrogate);
263d95e75fdSopenharmony_ci    callSup.HandleClir(SIM1_SLOTID, mmiDataEmp);
264d95e75fdSopenharmony_ci    callSup.HandleClir(SIM1_SLOTID, mmiDataAct);
265d95e75fdSopenharmony_ci    callSup.HandleClir(SIM1_SLOTID, mmiDataDeact);
266d95e75fdSopenharmony_ci    callSup.HandleClir(SIM1_SLOTID, mmiDataInterrogate);
267d95e75fdSopenharmony_ci    callSup.HandleColr(SIM1_SLOTID, mmiDataEmp);
268d95e75fdSopenharmony_ci    callSup.HandleColr(SIM1_SLOTID, mmiDataAct);
269d95e75fdSopenharmony_ci    callSup.HandleColr(SIM1_SLOTID, mmiDataDeact);
270d95e75fdSopenharmony_ci    callSup.HandleColr(SIM1_SLOTID, mmiDataInterrogate);
271d95e75fdSopenharmony_ci    callSup.HandleColp(SIM1_SLOTID, mmiDataEmp);
272d95e75fdSopenharmony_ci    callSup.HandleColp(SIM1_SLOTID, mmiDataAct);
273d95e75fdSopenharmony_ci    callSup.HandleColp(SIM1_SLOTID, mmiDataDeact);
274d95e75fdSopenharmony_ci    callSup.HandleColp(SIM1_SLOTID, mmiDataInterrogate);
275d95e75fdSopenharmony_ci    callSup.HandleCallTransfer(SIM1_SLOTID, mmiDataEmp);
276d95e75fdSopenharmony_ci    callSup.HandleCallTransfer(SIM1_SLOTID, mmiDataInterrogate);
277d95e75fdSopenharmony_ci    callSup.HandleCallTransfer(SIM1_SLOTID, mmiDataAct);
278d95e75fdSopenharmony_ci    callSup.HandleCallRestriction(SIM1_SLOTID, mmiDataEmp);
279d95e75fdSopenharmony_ci    callSup.HandleCallRestriction(SIM1_SLOTID, mmiDataAct);
280d95e75fdSopenharmony_ci    callSup.HandleCallRestriction(SIM1_SLOTID, mmiDataDeact);
281d95e75fdSopenharmony_ci    callSup.HandleCallRestriction(SIM1_SLOTID, mmiDataInterrogate);
282d95e75fdSopenharmony_ci    callSup.HandleCallWaiting(SIM1_SLOTID, mmiDataEmp);
283d95e75fdSopenharmony_ci    callSup.HandleCallWaiting(SIM1_SLOTID, mmiDataAct);
284d95e75fdSopenharmony_ci    callSup.HandleCallWaiting(SIM1_SLOTID, mmiDataDeact);
285d95e75fdSopenharmony_ci    ASSERT_FALSE(mmiDataAct.actionString.empty());
286d95e75fdSopenharmony_ci}
287d95e75fdSopenharmony_ci
288d95e75fdSopenharmony_ci/**
289d95e75fdSopenharmony_ci * @tc.number   Telephony_CellularCallSupplement_002
290d95e75fdSopenharmony_ci * @tc.name     Test error branch
291d95e75fdSopenharmony_ci * @tc.desc     Function test
292d95e75fdSopenharmony_ci */
293d95e75fdSopenharmony_ciHWTEST_F(BranchTest, Telephony_CellularCallSupplement_002, Function | MediumTest | Level3)
294d95e75fdSopenharmony_ci{
295d95e75fdSopenharmony_ci    AccessToken token;
296d95e75fdSopenharmony_ci    CellularCallSupplement callSup;
297d95e75fdSopenharmony_ci    callSup.SendUssd(SIM1_SLOTID, "*#21#");
298d95e75fdSopenharmony_ci    PinPukResponse pinPuk;
299d95e75fdSopenharmony_ci    callSup.EventSetPinPuk(pinPuk);
300d95e75fdSopenharmony_ci    MMIData mmiDataPin = { .serviceInfoA = "1234", .serviceInfoB = "1111", .serviceInfoC = "1111" };
301d95e75fdSopenharmony_ci    callSup.AlterPinPassword(SIM1_SLOTID, mmiDataPin);
302d95e75fdSopenharmony_ci    callSup.UnlockPuk(SIM1_SLOTID, mmiDataPin);
303d95e75fdSopenharmony_ci    callSup.AlterPin2Password(SIM1_SLOTID, mmiDataPin);
304d95e75fdSopenharmony_ci    callSup.UnlockPuk2(SIM1_SLOTID, mmiDataPin);
305d95e75fdSopenharmony_ci    mmiDataPin = { .serviceInfoA = "1234", .serviceInfoB = "1111", .serviceInfoC = "1112" };
306d95e75fdSopenharmony_ci    callSup.AlterPinPassword(SIM1_SLOTID, mmiDataPin);
307d95e75fdSopenharmony_ci    callSup.UnlockPuk(SIM1_SLOTID, mmiDataPin);
308d95e75fdSopenharmony_ci    callSup.AlterPin2Password(SIM1_SLOTID, mmiDataPin);
309d95e75fdSopenharmony_ci    callSup.UnlockPuk2(SIM1_SLOTID, mmiDataPin);
310d95e75fdSopenharmony_ci    mmiDataPin = { .serviceInfoA = "1234", .serviceInfoB = "1111", .serviceInfoC = "111111111" };
311d95e75fdSopenharmony_ci    callSup.AlterPinPassword(SIM1_SLOTID, mmiDataPin);
312d95e75fdSopenharmony_ci    callSup.UnlockPuk(SIM1_SLOTID, mmiDataPin);
313d95e75fdSopenharmony_ci    callSup.AlterPin2Password(SIM1_SLOTID, mmiDataPin);
314d95e75fdSopenharmony_ci    callSup.UnlockPuk2(SIM1_SLOTID, mmiDataPin);
315d95e75fdSopenharmony_ci    callSup.CloseUnFinishedUssd(SIM1_SLOTID);
316d95e75fdSopenharmony_ci    GetClipResult getClipResult;
317d95e75fdSopenharmony_ci    std::string message = "";
318d95e75fdSopenharmony_ci    callSup.EventGetClip(getClipResult, message, 0);
319d95e75fdSopenharmony_ci    callSup.EventGetClip(getClipResult, message, 1);
320d95e75fdSopenharmony_ci    callSup.EventSetClip(0, message, 0);
321d95e75fdSopenharmony_ci    callSup.EventSetClip(0, message, 1);
322d95e75fdSopenharmony_ci    GetClirResult getClirResult;
323d95e75fdSopenharmony_ci    callSup.EventGetClir(getClirResult, message, 0);
324d95e75fdSopenharmony_ci    callSup.EventGetClir(getClirResult, message, 1);
325d95e75fdSopenharmony_ci    callSup.EventSetClir(0, message, 0);
326d95e75fdSopenharmony_ci    callSup.EventSetClir(0, message, 1);
327d95e75fdSopenharmony_ci    GetColrResult getColrResult;
328d95e75fdSopenharmony_ci    callSup.EventGetColr(getColrResult, message, 0);
329d95e75fdSopenharmony_ci    callSup.EventGetColr(getColrResult, message, 1);
330d95e75fdSopenharmony_ci    callSup.EventSetColr(0, message, 0);
331d95e75fdSopenharmony_ci    callSup.EventSetColr(0, message, 1);
332d95e75fdSopenharmony_ci    ASSERT_TRUE(mmiDataPin.actionString.empty());
333d95e75fdSopenharmony_ci}
334d95e75fdSopenharmony_ci
335d95e75fdSopenharmony_ci/**
336d95e75fdSopenharmony_ci * @tc.number   Telephony_CellularCallSupplement_003
337d95e75fdSopenharmony_ci * @tc.name     Test error branch
338d95e75fdSopenharmony_ci * @tc.desc     Function test
339d95e75fdSopenharmony_ci */
340d95e75fdSopenharmony_ciHWTEST_F(BranchTest, Telephony_CellularCallSupplement_003, Function | MediumTest | Level3)
341d95e75fdSopenharmony_ci{
342d95e75fdSopenharmony_ci    AccessToken token;
343d95e75fdSopenharmony_ci    CellularCallSupplement callSup;
344d95e75fdSopenharmony_ci    GetColpResult getColpResult;
345d95e75fdSopenharmony_ci    std::string message = "";
346d95e75fdSopenharmony_ci    callSup.EventGetColp(getColpResult, message, 0);
347d95e75fdSopenharmony_ci    callSup.EventGetColp(getColpResult, message, 1);
348d95e75fdSopenharmony_ci    callSup.EventSetColp(0, message, 0);
349d95e75fdSopenharmony_ci    callSup.EventSetColp(0, message, 1);
350d95e75fdSopenharmony_ci    CallRestrictionResult callResResult;
351d95e75fdSopenharmony_ci    callSup.EventGetCallRestriction(callResResult, message, 0);
352d95e75fdSopenharmony_ci    callSup.EventGetCallRestriction(callResResult, message, 1);
353d95e75fdSopenharmony_ci    callResResult.status = 1;
354d95e75fdSopenharmony_ci    callSup.EventGetCallRestriction(callResResult, message, 0);
355d95e75fdSopenharmony_ci    callResResult.result.result = 1;
356d95e75fdSopenharmony_ci    callSup.EventGetCallRestriction(callResResult, message, 0);
357d95e75fdSopenharmony_ci    callSup.EventSetCallRestriction(0, message, 0);
358d95e75fdSopenharmony_ci    callSup.EventSetCallRestriction(0, message, 1);
359d95e75fdSopenharmony_ci    callSup.EventSetBarringPassword(0, message, 0);
360d95e75fdSopenharmony_ci    callSup.EventSetBarringPassword(0, message, 1);
361d95e75fdSopenharmony_ci    callSup.EventSetCallWaiting(0, message, 0);
362d95e75fdSopenharmony_ci    callSup.EventSetCallWaiting(0, message, 1);
363d95e75fdSopenharmony_ci    CallForwardQueryInfoList cFQueryList;
364d95e75fdSopenharmony_ci    callSup.EventGetCallTransferInfo(cFQueryList, message, 0);
365d95e75fdSopenharmony_ci    CallForwardQueryResult queryResult;
366d95e75fdSopenharmony_ci    callSup.BuildCallForwardQueryInfo(queryResult, message, 0);
367d95e75fdSopenharmony_ci    callSup.BuildCallForwardQueryInfo(queryResult, message, 1);
368d95e75fdSopenharmony_ci    queryResult.classx = 1;
369d95e75fdSopenharmony_ci    callSup.BuildCallForwardQueryInfo(queryResult, message, 0);
370d95e75fdSopenharmony_ci    queryResult.status = 1;
371d95e75fdSopenharmony_ci    callSup.BuildCallForwardQueryInfo(queryResult, message, 0);
372d95e75fdSopenharmony_ci    queryResult.reason = 2;
373d95e75fdSopenharmony_ci    callSup.BuildCallForwardQueryInfo(queryResult, message, 0);
374d95e75fdSopenharmony_ci    callSup.EventSetCallTransferInfo(0, message, 0);
375d95e75fdSopenharmony_ci    callSup.EventSetCallTransferInfo(0, message, 1);
376d95e75fdSopenharmony_ci    RadioResponseInfo responseInfo;
377d95e75fdSopenharmony_ci    callSup.EventSendUssd(responseInfo);
378d95e75fdSopenharmony_ci    SsNoticeInfo ssNoticeInfo;
379d95e75fdSopenharmony_ci    callSup.EventSsNotify(ssNoticeInfo);
380d95e75fdSopenharmony_ci    UssdNoticeInfo ussdNoticeInfo;
381d95e75fdSopenharmony_ci    callSup.EventUssdNotify(ussdNoticeInfo);
382d95e75fdSopenharmony_ci    RadioResponseInfo response;
383d95e75fdSopenharmony_ci    callSup.EventCloseUnFinishedUssd(response);
384d95e75fdSopenharmony_ci    callSup.GetCallTransferInfo(SIM1_SLOTID, CallTransferType::TRANSFER_TYPE_UNCONDITIONAL);
385d95e75fdSopenharmony_ci    ASSERT_NE(callSup.GetCallTransferInfo(SIM2_SLOTID, CallTransferType::TRANSFER_TYPE_UNCONDITIONAL),
386d95e75fdSopenharmony_ci        TELEPHONY_SUCCESS);
387d95e75fdSopenharmony_ci}
388d95e75fdSopenharmony_ci
389d95e75fdSopenharmony_ci/**
390d95e75fdSopenharmony_ci * @tc.number   Telephony_CellularCallSupplement_004
391d95e75fdSopenharmony_ci * @tc.name     Test error branch
392d95e75fdSopenharmony_ci * @tc.desc     Function test
393d95e75fdSopenharmony_ci */
394d95e75fdSopenharmony_ciHWTEST_F(BranchTest, Telephony_CellularCallSupplement_004, Function | MediumTest | Level3)
395d95e75fdSopenharmony_ci{
396d95e75fdSopenharmony_ci    AccessToken token;
397d95e75fdSopenharmony_ci    CellularCallSupplement callSup;
398d95e75fdSopenharmony_ci    CallWaitResult waitingInfo;
399d95e75fdSopenharmony_ci    std::string message = "";
400d95e75fdSopenharmony_ci    callSup.EventGetCallWaiting(waitingInfo, message, 0);
401d95e75fdSopenharmony_ci    callSup.EventGetCallWaiting(waitingInfo, message, 1);
402d95e75fdSopenharmony_ci    waitingInfo.status =1;
403d95e75fdSopenharmony_ci    callSup.EventGetCallWaiting(waitingInfo, message, 0);
404d95e75fdSopenharmony_ci    waitingInfo.classCw =1;
405d95e75fdSopenharmony_ci    callSup.EventGetCallWaiting(waitingInfo, message, 0);
406d95e75fdSopenharmony_ci    waitingInfo.classCw =4;
407d95e75fdSopenharmony_ci    callSup.EventGetCallWaiting(waitingInfo, message, 0);
408d95e75fdSopenharmony_ci    waitingInfo.classCw =8;
409d95e75fdSopenharmony_ci    callSup.EventGetCallWaiting(waitingInfo, message, 0);
410d95e75fdSopenharmony_ci    waitingInfo.classCw =16;
411d95e75fdSopenharmony_ci    callSup.EventGetCallWaiting(waitingInfo, message, 0);
412d95e75fdSopenharmony_ci    waitingInfo.classCw =32;
413d95e75fdSopenharmony_ci    callSup.EventGetCallWaiting(waitingInfo, message, 0);
414d95e75fdSopenharmony_ci    waitingInfo.classCw =64;
415d95e75fdSopenharmony_ci    callSup.EventGetCallWaiting(waitingInfo, message, 0);
416d95e75fdSopenharmony_ci    waitingInfo.classCw =128;
417d95e75fdSopenharmony_ci    callSup.EventGetCallWaiting(waitingInfo, message, 0);
418d95e75fdSopenharmony_ci    CallTransferInfo cfInfo;
419d95e75fdSopenharmony_ci    callSup.SetCallTransferInfo(SIM1_SLOTID, cfInfo);
420d95e75fdSopenharmony_ci    strcpy_s(cfInfo.transferNum, kMaxNumberLen + 1, "111");
421d95e75fdSopenharmony_ci    callSup.SetCallTransferInfo(SIM1_SLOTID, cfInfo);
422d95e75fdSopenharmony_ci    callSup.SetCallTransferInfo(SIM2_SLOTID, cfInfo);
423d95e75fdSopenharmony_ci    auto utCommand = std::make_shared<SsRequestCommand>();
424d95e75fdSopenharmony_ci    callSup.SetCallTransferInfoByIms(SIM1_SLOTID, cfInfo, utCommand);
425d95e75fdSopenharmony_ci    callSup.SetCallTransferInfoByIms(SIM2_SLOTID, cfInfo, utCommand);
426d95e75fdSopenharmony_ci    bool activate = false;
427d95e75fdSopenharmony_ci    callSup.SetCallWaiting(SIM1_SLOTID, activate);
428d95e75fdSopenharmony_ci    callSup.SetCallWaiting(SIM2_SLOTID, activate);
429d95e75fdSopenharmony_ci    callSup.GetCallWaiting(SIM1_SLOTID);
430d95e75fdSopenharmony_ci    callSup.GetCallWaiting(SIM2_SLOTID);
431d95e75fdSopenharmony_ci    CallRestrictionInfo crInfo;
432d95e75fdSopenharmony_ci    callSup.SetCallRestriction(SIM1_SLOTID, crInfo);
433d95e75fdSopenharmony_ci    callSup.SetCallRestriction(SIM2_SLOTID, crInfo);
434d95e75fdSopenharmony_ci    auto crCommand = std::make_shared<SsRequestCommand>();
435d95e75fdSopenharmony_ci    std::string info(crInfo.password);
436d95e75fdSopenharmony_ci    std::string fac("AO");
437d95e75fdSopenharmony_ci    callSup.SetCallRestrictionByIms(SIM1_SLOTID, fac, static_cast<int32_t>(crInfo.mode), info, crCommand);
438d95e75fdSopenharmony_ci    callSup.SetCallRestrictionByIms(SIM2_SLOTID, fac, static_cast<int32_t>(crInfo.mode), info, crCommand);
439d95e75fdSopenharmony_ci    callSup.GetCallRestriction(SIM1_SLOTID, CallRestrictionType::RESTRICTION_TYPE_ALL_INCOMING);
440d95e75fdSopenharmony_ci    callSup.GetCallRestriction(SIM2_SLOTID, CallRestrictionType::RESTRICTION_TYPE_ALL_INCOMING);
441d95e75fdSopenharmony_ci    callSup.SetBarringPassword(SIM1_SLOTID, CallRestrictionType::RESTRICTION_TYPE_ALL_INCOMING, "1111", "0000");
442d95e75fdSopenharmony_ci    ASSERT_NE(callSup.SetBarringPassword(SIM2_SLOTID, CallRestrictionType::RESTRICTION_TYPE_ALL_INCOMING,
443d95e75fdSopenharmony_ci        "1111", "0000"), TELEPHONY_SUCCESS);
444d95e75fdSopenharmony_ci}
445d95e75fdSopenharmony_ci
446d95e75fdSopenharmony_ci/**
447d95e75fdSopenharmony_ci * @tc.number   Telephony_CellularCallSupplement_005
448d95e75fdSopenharmony_ci * @tc.name     Test error branch
449d95e75fdSopenharmony_ci * @tc.desc     Function test
450d95e75fdSopenharmony_ci */
451d95e75fdSopenharmony_ciHWTEST_F(BranchTest, Telephony_CellularCallSupplement_005, Function | MediumTest | Level3)
452d95e75fdSopenharmony_ci{
453d95e75fdSopenharmony_ci    AccessToken token;
454d95e75fdSopenharmony_ci    CellularCallSupplement callSup;
455d95e75fdSopenharmony_ci    MMIData mmiDataEmp = {};
456d95e75fdSopenharmony_ci    MMIData mmiDataAct = { .actionString = "*" };
457d95e75fdSopenharmony_ci    MMIData mmiDataDeact = { .actionString = "#" };
458d95e75fdSopenharmony_ci    MMIData mmiDataInterrogate = { .actionString = "*#" };
459d95e75fdSopenharmony_ci    callSup.HandleClip(SIM2_SLOTID, mmiDataEmp);
460d95e75fdSopenharmony_ci    callSup.HandleClip(SIM2_SLOTID, mmiDataAct);
461d95e75fdSopenharmony_ci    callSup.HandleClip(SIM2_SLOTID, mmiDataDeact);
462d95e75fdSopenharmony_ci    callSup.HandleClip(SIM2_SLOTID, mmiDataInterrogate);
463d95e75fdSopenharmony_ci    callSup.HandleColr(SIM2_SLOTID, mmiDataEmp);
464d95e75fdSopenharmony_ci    callSup.HandleColr(SIM2_SLOTID, mmiDataAct);
465d95e75fdSopenharmony_ci    callSup.HandleColr(SIM2_SLOTID, mmiDataDeact);
466d95e75fdSopenharmony_ci    callSup.HandleColr(SIM2_SLOTID, mmiDataInterrogate);
467d95e75fdSopenharmony_ci    callSup.HandleColp(SIM2_SLOTID, mmiDataEmp);
468d95e75fdSopenharmony_ci    callSup.HandleColp(SIM2_SLOTID, mmiDataAct);
469d95e75fdSopenharmony_ci    callSup.HandleColp(SIM2_SLOTID, mmiDataDeact);
470d95e75fdSopenharmony_ci    callSup.HandleColp(SIM2_SLOTID, mmiDataInterrogate);
471d95e75fdSopenharmony_ci    callSup.HandleCallTransfer(SIM2_SLOTID, mmiDataEmp);
472d95e75fdSopenharmony_ci    callSup.HandleCallTransfer(SIM2_SLOTID, mmiDataInterrogate);
473d95e75fdSopenharmony_ci    callSup.HandleCallTransfer(SIM2_SLOTID, mmiDataAct);
474d95e75fdSopenharmony_ci    callSup.HandleCallRestriction(SIM2_SLOTID, mmiDataEmp);
475d95e75fdSopenharmony_ci    callSup.HandleCallRestriction(SIM2_SLOTID, mmiDataAct);
476d95e75fdSopenharmony_ci    callSup.HandleCallRestriction(SIM2_SLOTID, mmiDataDeact);
477d95e75fdSopenharmony_ci    callSup.HandleCallRestriction(SIM2_SLOTID, mmiDataInterrogate);
478d95e75fdSopenharmony_ci    callSup.HandleCallWaiting(SIM2_SLOTID, mmiDataEmp);
479d95e75fdSopenharmony_ci    callSup.HandleCallWaiting(SIM2_SLOTID, mmiDataAct);
480d95e75fdSopenharmony_ci    callSup.HandleCallWaiting(SIM2_SLOTID, mmiDataDeact);
481d95e75fdSopenharmony_ci    bool enable = false;
482d95e75fdSopenharmony_ci#ifdef CALL_MANAGER_AUTO_START_OPTIMIZE
483d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.CanSetCallTransferTime(SIM1_SLOTID, enable), CALL_ERR_RESOURCE_UNAVAILABLE);
484d95e75fdSopenharmony_ci#else
485d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.CanSetCallTransferTime(SIM1_SLOTID, enable), TELEPHONY_SUCCESS);
486d95e75fdSopenharmony_ci#endif
487d95e75fdSopenharmony_ci}
488d95e75fdSopenharmony_ci
489d95e75fdSopenharmony_ci/**
490d95e75fdSopenharmony_ci * @tc.number   Telephony_CellularCallSupplement_006
491d95e75fdSopenharmony_ci * @tc.name     Test error branch
492d95e75fdSopenharmony_ci * @tc.desc     Function test
493d95e75fdSopenharmony_ci */
494d95e75fdSopenharmony_ciHWTEST_F(BranchTest, Telephony_CellularCallSupplement_006, Function | MediumTest | Level3)
495d95e75fdSopenharmony_ci{
496d95e75fdSopenharmony_ci    AccessToken token;
497d95e75fdSopenharmony_ci    CellularCallSupplement callSup;
498d95e75fdSopenharmony_ci    MMIData mmiDataEmp = {};
499d95e75fdSopenharmony_ci    MMIData mmiDataAct = { .actionString = "*" };
500d95e75fdSopenharmony_ci    MMIData mmiDataDeact = { .actionString = "#" };
501d95e75fdSopenharmony_ci    MMIData mmiDataInterrogate = { .actionString = "*#" };
502d95e75fdSopenharmony_ci    EventFwk::MatchingSkills matchingSkills;
503d95e75fdSopenharmony_ci    matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_OPERATOR_CONFIG_CHANGED);
504d95e75fdSopenharmony_ci    EventFwk::CommonEventSubscribeInfo subscriberInfo(matchingSkills);
505d95e75fdSopenharmony_ci    auto handler = std::make_shared<CellularCallHandler>(subscriberInfo);
506d95e75fdSopenharmony_ci    auto callClient = DelayedSingleton<SatelliteCallClient>::GetInstance();
507d95e75fdSopenharmony_ci    ASSERT_EQ(callClient->RegisterSatelliteCallCallbackHandler(SIM1_SLOTID, handler), TELEPHONY_SUCCESS);
508d95e75fdSopenharmony_ci    callSup.HandleClip(SIM1_SLOTID, mmiDataAct);
509d95e75fdSopenharmony_ci    callSup.HandleClip(SIM1_SLOTID, mmiDataDeact);
510d95e75fdSopenharmony_ci    callSup.HandleClip(SIM1_SLOTID, mmiDataInterrogate);
511d95e75fdSopenharmony_ci    callSup.HandleColr(SIM1_SLOTID, mmiDataAct);
512d95e75fdSopenharmony_ci    callSup.HandleColr(SIM1_SLOTID, mmiDataDeact);
513d95e75fdSopenharmony_ci    callSup.HandleColr(SIM1_SLOTID, mmiDataInterrogate);
514d95e75fdSopenharmony_ci    callSup.HandleColp(SIM1_SLOTID, mmiDataAct);
515d95e75fdSopenharmony_ci    callSup.HandleColp(SIM1_SLOTID, mmiDataDeact);
516d95e75fdSopenharmony_ci    callSup.HandleColp(SIM1_SLOTID, mmiDataInterrogate);
517d95e75fdSopenharmony_ci    int32_t cause = 0;
518d95e75fdSopenharmony_ci    callSup.HandleGetCallTransfer(SIM1_SLOTID, cause);
519d95e75fdSopenharmony_ci    int32_t serviceCode = 0;
520d95e75fdSopenharmony_ci    std::string phoneNumber("1234567890");
521d95e75fdSopenharmony_ci    CallTransferSettingType callTransferAction = CallTransferSettingType::CALL_TRANSFER_DISABLE;
522d95e75fdSopenharmony_ci    callSup.HandleSetCallTransfer(SIM1_SLOTID, serviceCode, cause, phoneNumber, callTransferAction);
523d95e75fdSopenharmony_ci    callSup.HandleCallRestriction(SIM1_SLOTID, mmiDataAct);
524d95e75fdSopenharmony_ci    callSup.HandleCallRestriction(SIM1_SLOTID, mmiDataDeact);
525d95e75fdSopenharmony_ci    callSup.HandleCallRestriction(SIM1_SLOTID, mmiDataInterrogate);
526d95e75fdSopenharmony_ci    callSup.HandleCallWaiting(SIM1_SLOTID, mmiDataAct);
527d95e75fdSopenharmony_ci    callSup.HandleCallWaiting(SIM1_SLOTID, mmiDataDeact);
528d95e75fdSopenharmony_ci    callSup.HandleCallWaiting(SIM1_SLOTID, mmiDataInterrogate);
529d95e75fdSopenharmony_ci}
530d95e75fdSopenharmony_ci
531d95e75fdSopenharmony_ci/**
532d95e75fdSopenharmony_ci * @tc.number   Telephony_CellularCallSupplement_007
533d95e75fdSopenharmony_ci * @tc.name     Test error branch
534d95e75fdSopenharmony_ci * @tc.desc     Function test
535d95e75fdSopenharmony_ci */
536d95e75fdSopenharmony_ciHWTEST_F(BranchTest, Telephony_CellularCallSupplement_007, Function | MediumTest | Level3)
537d95e75fdSopenharmony_ci{
538d95e75fdSopenharmony_ci    AccessToken token;
539d95e75fdSopenharmony_ci    CellularCallSupplement callSup;
540d95e75fdSopenharmony_ci    MMIData mmiDataEmp = {};
541d95e75fdSopenharmony_ci    MMIData mmiDataAct = { .actionString = "*" };
542d95e75fdSopenharmony_ci    MMIData mmiDataDeact = { .actionString = "#" };
543d95e75fdSopenharmony_ci    MMIData mmiDataInterrogate = { .actionString = "*#" };
544d95e75fdSopenharmony_ci    EventFwk::MatchingSkills matchingSkills;
545d95e75fdSopenharmony_ci    matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_OPERATOR_CONFIG_CHANGED);
546d95e75fdSopenharmony_ci    EventFwk::CommonEventSubscribeInfo subscriberInfo(matchingSkills);
547d95e75fdSopenharmony_ci    auto handler = std::make_shared<CellularCallHandler>(subscriberInfo);
548d95e75fdSopenharmony_ci    auto callClient = DelayedSingleton<SatelliteCallClient>::GetInstance();
549d95e75fdSopenharmony_ci    ASSERT_EQ(callClient->RegisterSatelliteCallCallbackHandler(SIM1_SLOTID, handler), TELEPHONY_SUCCESS);
550d95e75fdSopenharmony_ci    std::string serviceInfoB("10");
551d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.ObtainServiceCode(serviceInfoB), 13);
552d95e75fdSopenharmony_ci    serviceInfoB = "11";
553d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.ObtainServiceCode(serviceInfoB), 1);
554d95e75fdSopenharmony_ci    serviceInfoB = "12";
555d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.ObtainServiceCode(serviceInfoB), 12);
556d95e75fdSopenharmony_ci    serviceInfoB = "13";
557d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.ObtainServiceCode(serviceInfoB), 4);
558d95e75fdSopenharmony_ci    serviceInfoB = "16";
559d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.ObtainServiceCode(serviceInfoB), 8);
560d95e75fdSopenharmony_ci    serviceInfoB = "19";
561d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.ObtainServiceCode(serviceInfoB), 5);
562d95e75fdSopenharmony_ci    serviceInfoB = "20";
563d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.ObtainServiceCode(serviceInfoB), 48);
564d95e75fdSopenharmony_ci    serviceInfoB = "21";
565d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.ObtainServiceCode(serviceInfoB), 160);
566d95e75fdSopenharmony_ci    serviceInfoB = "22";
567d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.ObtainServiceCode(serviceInfoB), 80);
568d95e75fdSopenharmony_ci    serviceInfoB = "24";
569d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.ObtainServiceCode(serviceInfoB), 16);
570d95e75fdSopenharmony_ci    serviceInfoB = "25";
571d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.ObtainServiceCode(serviceInfoB), 32);
572d95e75fdSopenharmony_ci    serviceInfoB = "99";
573d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.ObtainServiceCode(serviceInfoB), 64);
574d95e75fdSopenharmony_ci    std::string phoneNumber("1234");
575d95e75fdSopenharmony_ci    CallTransferSettingType callTransferAction;
576d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.ObtainCallTrasferAction("*", phoneNumber, callTransferAction), TELEPHONY_SUCCESS);
577d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.ObtainCallTrasferAction("**", phoneNumber, callTransferAction), TELEPHONY_SUCCESS);
578d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.ObtainCallTrasferAction("#", phoneNumber, callTransferAction), TELEPHONY_SUCCESS);
579d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.ObtainCallTrasferAction("##", phoneNumber, callTransferAction), TELEPHONY_SUCCESS);
580d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.ObtainCause("21"), static_cast<int32_t>(CallTransferType::TRANSFER_TYPE_UNCONDITIONAL));
581d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.ObtainCause("61"), static_cast<int32_t>(CallTransferType::TRANSFER_TYPE_NO_REPLY));
582d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.ObtainCause("62"), static_cast<int32_t>(CallTransferType::TRANSFER_TYPE_NOT_REACHABLE));
583d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.ObtainCause("67"), static_cast<int32_t>(CallTransferType::TRANSFER_TYPE_BUSY));
584d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.ObtainCause("99"), TELEPHONY_ERROR);
585d95e75fdSopenharmony_ci}
586d95e75fdSopenharmony_ci
587d95e75fdSopenharmony_ci/**
588d95e75fdSopenharmony_ci * @tc.number   Telephony_CellularCallSupplement_008
589d95e75fdSopenharmony_ci * @tc.name     Test error branch
590d95e75fdSopenharmony_ci * @tc.desc     Function test
591d95e75fdSopenharmony_ci */
592d95e75fdSopenharmony_ciHWTEST_F(BranchTest, Telephony_CellularCallSupplement_008, Function | MediumTest | Level3)
593d95e75fdSopenharmony_ci{
594d95e75fdSopenharmony_ci    AccessToken token;
595d95e75fdSopenharmony_ci    CellularCallSupplement callSup;
596d95e75fdSopenharmony_ci    MMIData mmiDataAct = { .actionString = "*" };
597d95e75fdSopenharmony_ci    EventFwk::MatchingSkills matchingSkills;
598d95e75fdSopenharmony_ci    matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_OPERATOR_CONFIG_CHANGED);
599d95e75fdSopenharmony_ci    EventFwk::CommonEventSubscribeInfo subscriberInfo(matchingSkills);
600d95e75fdSopenharmony_ci    auto handler = std::make_shared<CellularCallHandler>(subscriberInfo);
601d95e75fdSopenharmony_ci    auto callClient = DelayedSingleton<SatelliteCallClient>::GetInstance();
602d95e75fdSopenharmony_ci    ASSERT_EQ(callClient->RegisterSatelliteCallCallbackHandler(SIM1_SLOTID, handler), TELEPHONY_SUCCESS);
603d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.ObtainBarringInstallation("33"), "AO");
604d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.ObtainBarringInstallation("331"), "OI");
605d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.ObtainBarringInstallation("332"), "OX");
606d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.ObtainBarringInstallation("351"), "IR");
607d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.ObtainBarringInstallation("35"), "AI");
608d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.ObtainBarringInstallation("330"), "AB");
609d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.ObtainBarringInstallation("333"), "AG");
610d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.ObtainBarringInstallation("353"), "AC");
611d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.ObtainBarringInstallation("1000"), "");
612d95e75fdSopenharmony_ci    std::string fac;
613d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.CheckCallRestrictionType(fac, CallRestrictionType::RESTRICTION_TYPE_ALL_OUTGOING),
614d95e75fdSopenharmony_ci        TELEPHONY_SUCCESS);
615d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.CheckCallRestrictionType(fac, CallRestrictionType::RESTRICTION_TYPE_INTERNATIONAL),
616d95e75fdSopenharmony_ci        TELEPHONY_SUCCESS);
617d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.CheckCallRestrictionType(fac,
618d95e75fdSopenharmony_ci        CallRestrictionType::RESTRICTION_TYPE_INTERNATIONAL_EXCLUDING_HOME), TELEPHONY_SUCCESS);
619d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.CheckCallRestrictionType(fac, CallRestrictionType::RESTRICTION_TYPE_ALL_INCOMING),
620d95e75fdSopenharmony_ci        TELEPHONY_SUCCESS);
621d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.CheckCallRestrictionType(fac, CallRestrictionType::RESTRICTION_TYPE_ROAMING_INCOMING),
622d95e75fdSopenharmony_ci        TELEPHONY_SUCCESS);
623d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.CheckCallRestrictionType(fac, CallRestrictionType::RESTRICTION_TYPE_ALL_CALLS),
624d95e75fdSopenharmony_ci        TELEPHONY_SUCCESS);
625d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.CheckCallRestrictionType(fac, CallRestrictionType::RESTRICTION_TYPE_OUTGOING_SERVICES),
626d95e75fdSopenharmony_ci        TELEPHONY_SUCCESS);
627d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.CheckCallRestrictionType(fac, CallRestrictionType::RESTRICTION_TYPE_INCOMING_SERVICES),
628d95e75fdSopenharmony_ci        TELEPHONY_SUCCESS);
629d95e75fdSopenharmony_ci    MmiCodeInfo mmiCodeInfo;
630d95e75fdSopenharmony_ci    SsNoticeInfo ssNoticeInfo;
631d95e75fdSopenharmony_ci    ssNoticeInfo.result = 0;
632d95e75fdSopenharmony_ci    callSup.GetMessage(mmiCodeInfo, ssNoticeInfo);
633d95e75fdSopenharmony_ci    ssNoticeInfo.result = 1;
634d95e75fdSopenharmony_ci    ssNoticeInfo.serviceType = static_cast<int32_t>(CallTransferType::TRANSFER_TYPE_UNCONDITIONAL);
635d95e75fdSopenharmony_ci    callSup.GetMessage(mmiCodeInfo, ssNoticeInfo);
636d95e75fdSopenharmony_ci    ssNoticeInfo.serviceType = static_cast<int32_t>(CallTransferType::TRANSFER_TYPE_BUSY);
637d95e75fdSopenharmony_ci    callSup.GetMessage(mmiCodeInfo, ssNoticeInfo);
638d95e75fdSopenharmony_ci    ssNoticeInfo.serviceType = static_cast<int32_t>(CallTransferType::TRANSFER_TYPE_NO_REPLY);
639d95e75fdSopenharmony_ci    callSup.GetMessage(mmiCodeInfo, ssNoticeInfo);
640d95e75fdSopenharmony_ci    ssNoticeInfo.serviceType = static_cast<int32_t>(CallTransferType::TRANSFER_TYPE_NOT_REACHABLE);
641d95e75fdSopenharmony_ci    callSup.GetMessage(mmiCodeInfo, ssNoticeInfo);
642d95e75fdSopenharmony_ci    callSup.AlterPinPassword(SIM1_SLOTID, mmiDataAct);
643d95e75fdSopenharmony_ci    callSup.UnlockPuk(SIM1_SLOTID, mmiDataAct);
644d95e75fdSopenharmony_ci    callSup.AlterPin2Password(SIM1_SLOTID, mmiDataAct);
645d95e75fdSopenharmony_ci    callSup.UnlockPuk2(SIM1_SLOTID, mmiDataAct);
646d95e75fdSopenharmony_ci    ASSERT_FALSE(callSup.IsVaildPinOrPuk("123", "123"));
647d95e75fdSopenharmony_ci    ASSERT_FALSE(callSup.IsVaildPinOrPuk("1234567", "123"));
648d95e75fdSopenharmony_ci    ASSERT_TRUE(callSup.IsVaildPinOrPuk("1234567", "1234567"));
649d95e75fdSopenharmony_ci}
650d95e75fdSopenharmony_ci
651d95e75fdSopenharmony_ci/**
652d95e75fdSopenharmony_ci * @tc.number   Telephony_CellularCallSupplement_009
653d95e75fdSopenharmony_ci * @tc.name     Test error branch
654d95e75fdSopenharmony_ci * @tc.desc     Function test
655d95e75fdSopenharmony_ci */
656d95e75fdSopenharmony_ciHWTEST_F(BranchTest, Telephony_CellularCallSupplement_009, Function | MediumTest | Level3)
657d95e75fdSopenharmony_ci{
658d95e75fdSopenharmony_ci    AccessToken token;
659d95e75fdSopenharmony_ci    CellularCallSupplement callSup;
660d95e75fdSopenharmony_ci    auto command = std::make_shared<SsRequestCommand>();
661d95e75fdSopenharmony_ci    CallTransferInfo cfInfo;
662d95e75fdSopenharmony_ci#ifdef CALL_MANAGER_AUTO_START_OPTIMIZE
663d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.SetCallTransferInfoByIms(SIM1_SLOTID, cfInfo, command), TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL);
664d95e75fdSopenharmony_ci#else
665d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.SetCallTransferInfoByIms(SIM1_SLOTID, cfInfo, command), TELEPHONY_SUCCESS);
666d95e75fdSopenharmony_ci#endif
667d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.SetCallTransferInfo(SIM1_SLOTID, cfInfo), TELEPHONY_ERR_ARGUMENT_INVALID);
668d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.GetCallTransferInfo(SIM1_SLOTID, CallTransferType::TRANSFER_TYPE_UNCONDITIONAL),
669d95e75fdSopenharmony_ci        CALL_ERR_UNSUPPORTED_NETWORK_TYPE);
670d95e75fdSopenharmony_ci    bool activate = true;
671d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.SetCallWaiting(SIM1_SLOTID, activate), CALL_ERR_UNSUPPORTED_NETWORK_TYPE);
672d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.GetCallWaiting(SIM1_SLOTID), CALL_ERR_UNSUPPORTED_NETWORK_TYPE);
673d95e75fdSopenharmony_ci    CallRestrictionInfo cRInfo;
674d95e75fdSopenharmony_ci    std::string info(cRInfo.password);
675d95e75fdSopenharmony_ci    std::string fac("AO");
676d95e75fdSopenharmony_ci#ifdef CALL_MANAGER_AUTO_START_OPTIMIZE
677d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.SetCallRestrictionByIms(SIM1_SLOTID, fac, static_cast<int32_t>(cRInfo.mode), info, command),
678d95e75fdSopenharmony_ci        TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL);
679d95e75fdSopenharmony_ci#else
680d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.SetCallRestrictionByIms(SIM1_SLOTID, fac, static_cast<int32_t>(cRInfo.mode), info, command),
681d95e75fdSopenharmony_ci        TELEPHONY_SUCCESS);
682d95e75fdSopenharmony_ci#endif
683d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.GetCallRestriction(SIM1_SLOTID, CallRestrictionType::RESTRICTION_TYPE_ALL_INCOMING),
684d95e75fdSopenharmony_ci        CALL_ERR_UNSUPPORTED_NETWORK_TYPE);
685d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.SetBarringPassword(SIM1_SLOTID, CallRestrictionType::RESTRICTION_TYPE_ALL_INCOMING,
686d95e75fdSopenharmony_ci        "1111", "0000"), CALL_ERR_UNSUPPORTED_NETWORK_TYPE);
687d95e75fdSopenharmony_ci    ASSERT_EQ(callSup.SetCallRestriction(SIM1_SLOTID, cRInfo), CALL_ERR_UNSUPPORTED_NETWORK_TYPE);
688d95e75fdSopenharmony_ci}
689d95e75fdSopenharmony_ci
690d95e75fdSopenharmony_ci/**
691d95e75fdSopenharmony_ci * @tc.number   Telephony_CellularCallCsControl_001
692d95e75fdSopenharmony_ci * @tc.name     Test error branch
693d95e75fdSopenharmony_ci * @tc.desc     Function test
694d95e75fdSopenharmony_ci */
695d95e75fdSopenharmony_ciHWTEST_F(BranchTest, Telephony_CellularCallCsControl_001, Function | MediumTest | Level3)
696d95e75fdSopenharmony_ci{
697d95e75fdSopenharmony_ci    AccessToken token;
698d95e75fdSopenharmony_ci    CSControl csControl;
699d95e75fdSopenharmony_ci    CellularCallInfo cellularCallInfo;
700d95e75fdSopenharmony_ci    InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, cellularCallInfo);
701d95e75fdSopenharmony_ci    CallInfoList callInfoList;
702d95e75fdSopenharmony_ci    csControl.ReportCallsData(SIM1_SLOTID, callInfoList);
703d95e75fdSopenharmony_ci    csControl.connectionMap_.insert(std::make_pair(1, CellularCallConnectionCS()));
704d95e75fdSopenharmony_ci    csControl.ReportCallsData(SIM1_SLOTID, callInfoList);
705d95e75fdSopenharmony_ci    csControl.connectionMap_.insert(std::make_pair(1, CellularCallConnectionCS()));
706d95e75fdSopenharmony_ci    InitCsCallInfoList(callInfoList, 5);
707d95e75fdSopenharmony_ci    csControl.ReportCallsData(SIM1_SLOTID, callInfoList);
708d95e75fdSopenharmony_ci    csControl.connectionMap_.clear();
709d95e75fdSopenharmony_ci    csControl.ReportCallsData(SIM1_SLOTID, callInfoList);
710d95e75fdSopenharmony_ci    bool enabled = false;
711d95e75fdSopenharmony_ci    csControl.Dial(cellularCallInfo, enabled);
712d95e75fdSopenharmony_ci    csControl.DialCdma(cellularCallInfo);
713d95e75fdSopenharmony_ci    csControl.DialGsm(cellularCallInfo);
714d95e75fdSopenharmony_ci    csControl.CalculateInternationalRoaming(SIM1_SLOTID);
715d95e75fdSopenharmony_ci    csControl.Answer(cellularCallInfo);
716d95e75fdSopenharmony_ci    csControl.Reject(cellularCallInfo);
717d95e75fdSopenharmony_ci    csControl.SeparateConference(SIM1_SLOTID, PHONE_NUMBER, 1);
718d95e75fdSopenharmony_ci    csControl.SeparateConference(SIM1_SLOTID, "", 1);
719d95e75fdSopenharmony_ci    int32_t invlaidCallType = -1;
720d95e75fdSopenharmony_ci    csControl.HangUp(cellularCallInfo, CallSupplementType::TYPE_DEFAULT);
721d95e75fdSopenharmony_ci    csControl.HangUp(cellularCallInfo, CallSupplementType::TYPE_HANG_UP_ACTIVE);
722d95e75fdSopenharmony_ci    csControl.HangUp(cellularCallInfo, CallSupplementType::TYPE_HANG_UP_ALL);
723d95e75fdSopenharmony_ci    csControl.HangUp(cellularCallInfo, static_cast<CallSupplementType>(invlaidCallType));
724d95e75fdSopenharmony_ci    csControl.HoldCall(SIM1_SLOTID);
725d95e75fdSopenharmony_ci    csControl.UnHoldCall(SIM1_SLOTID);
726d95e75fdSopenharmony_ci    csControl.SwitchCall(SIM1_SLOTID);
727d95e75fdSopenharmony_ci    csControl.CombineConference(SIM1_SLOTID);
728d95e75fdSopenharmony_ci    csControl.HangUpAllConnection(SIM1_SLOTID);
729d95e75fdSopenharmony_ci    csControl.GetConnectionMap();
730d95e75fdSopenharmony_ci    csControl.ReportHangUpInfo(SIM1_SLOTID);
731d95e75fdSopenharmony_ci    csControl.ReportIncomingInfo(SIM1_SLOTID, callInfoList);
732d95e75fdSopenharmony_ci    csControl.ReportUpdateInfo(SIM1_SLOTID, callInfoList);
733d95e75fdSopenharmony_ci    CallInfo callInfo;
734d95e75fdSopenharmony_ci    csControl.EncapsulationCallReportInfo(SIM1_SLOTID, callInfo);
735d95e75fdSopenharmony_ci    std::string phoneNum = "00000000";
736d95e75fdSopenharmony_ci    CLIRMode clirMode = CLIRMode::DEFAULT;
737d95e75fdSopenharmony_ci    int res = csControl.EncapsulateDialCommon(SIM1_SLOTID, phoneNum, clirMode);
738d95e75fdSopenharmony_ci    CallsReportInfo callsReportInfo;
739d95e75fdSopenharmony_ci    csControl.DeleteConnection(callsReportInfo, callInfoList);
740d95e75fdSopenharmony_ci    csControl.ReleaseAllConnection();
741d95e75fdSopenharmony_ci    ASSERT_EQ(res, TELEPHONY_SUCCESS);
742d95e75fdSopenharmony_ci}
743d95e75fdSopenharmony_ci
744d95e75fdSopenharmony_ci/**
745d95e75fdSopenharmony_ci * @tc.number   Telephony_CellularCallCsControl_002
746d95e75fdSopenharmony_ci * @tc.name     Test error branch
747d95e75fdSopenharmony_ci * @tc.desc     Function test
748d95e75fdSopenharmony_ci */
749d95e75fdSopenharmony_ciHWTEST_F(BranchTest, Telephony_CellularCallCsControl_002, Function | MediumTest | Level3)
750d95e75fdSopenharmony_ci{
751d95e75fdSopenharmony_ci    AccessToken token;
752d95e75fdSopenharmony_ci    CSControl csControl;
753d95e75fdSopenharmony_ci    CellularCallInfo cellularCallInfo;
754d95e75fdSopenharmony_ci    InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, cellularCallInfo);
755d95e75fdSopenharmony_ci    CellularCallInfo cellularCallInfo_new;
756d95e75fdSopenharmony_ci    cellularCallInfo_new.callType = CallType::TYPE_CS;
757d95e75fdSopenharmony_ci    std::vector<CellularCallInfo> infos;
758d95e75fdSopenharmony_ci    bool enabled = false;
759d95e75fdSopenharmony_ci    infos.emplace_back(cellularCallInfo);
760d95e75fdSopenharmony_ci    infos.emplace_back(cellularCallInfo_new);
761d95e75fdSopenharmony_ci    csControl.PostDialProceed(cellularCallInfo, true);
762d95e75fdSopenharmony_ci    csControl.PostDialProceed(cellularCallInfo, enabled);
763d95e75fdSopenharmony_ci    csControl.ExecutePostDial(SIM1_SLOTID, 0);
764d95e75fdSopenharmony_ci    csControl.connectionMap_.insert(std::make_pair(1, CellularCallConnectionCS()));
765d95e75fdSopenharmony_ci    cellularCallInfo.index = 1;
766d95e75fdSopenharmony_ci    csControl.Answer(cellularCallInfo);
767d95e75fdSopenharmony_ci    csControl.PostDialProceed(cellularCallInfo, true);
768d95e75fdSopenharmony_ci    csControl.ExecutePostDial(SIM1_SLOTID, 0);
769d95e75fdSopenharmony_ci    csControl.ExecutePostDial(SIM1_SLOTID, 1);
770d95e75fdSopenharmony_ci    csControl.connectionMap_.clear();
771d95e75fdSopenharmony_ci    for (uint16_t i = 0; i <= 7; ++i) {
772d95e75fdSopenharmony_ci        csControl.connectionMap_.insert(std::make_pair(i, CellularCallConnectionCS()));
773d95e75fdSopenharmony_ci    }
774d95e75fdSopenharmony_ci    csControl.DialCdma(cellularCallInfo);
775d95e75fdSopenharmony_ci    csControl.DialGsm(cellularCallInfo);
776d95e75fdSopenharmony_ci    csControl.connectionMap_.clear();
777d95e75fdSopenharmony_ci    ASSERT_EQ(csControl.ReportHangUp(infos, SIM1_SLOTID), TELEPHONY_SUCCESS);
778d95e75fdSopenharmony_ci}
779d95e75fdSopenharmony_ci
780d95e75fdSopenharmony_ci/**
781d95e75fdSopenharmony_ci * @tc.number   Telephony_CellularCallImsControl_001
782d95e75fdSopenharmony_ci * @tc.name     Test error branch
783d95e75fdSopenharmony_ci * @tc.desc     Function test
784d95e75fdSopenharmony_ci */
785d95e75fdSopenharmony_ciHWTEST_F(BranchTest, Telephony_CellularCallImsControl_001, Function | MediumTest | Level3)
786d95e75fdSopenharmony_ci{
787d95e75fdSopenharmony_ci    AccessToken token;
788d95e75fdSopenharmony_ci    IMSControl imsControl;
789d95e75fdSopenharmony_ci    CellularCallInfo cellularCallInfo;
790d95e75fdSopenharmony_ci    std::vector<CellularCallInfo> infos;
791d95e75fdSopenharmony_ci    infos.emplace_back(cellularCallInfo);
792d95e75fdSopenharmony_ci    CellularCallInfo cellularCallInfo_new;
793d95e75fdSopenharmony_ci    bool enabled = false;
794d95e75fdSopenharmony_ci    int32_t invalidSupType = -1;
795d95e75fdSopenharmony_ci    ImsCurrentCallList ImsCallList;
796d95e75fdSopenharmony_ci    InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, cellularCallInfo);
797d95e75fdSopenharmony_ci    imsControl.ReportImsCallsData(SIM1_SLOTID, ImsCallList);
798d95e75fdSopenharmony_ci    InitImsCallInfoList(ImsCallList, 5);
799d95e75fdSopenharmony_ci    imsControl.ReportImsCallsData(SIM1_SLOTID, ImsCallList);
800d95e75fdSopenharmony_ci    imsControl.Dial(cellularCallInfo, true);
801d95e75fdSopenharmony_ci    cellularCallInfo_new.slotId = 1;
802d95e75fdSopenharmony_ci    imsControl.Dial(cellularCallInfo_new, true);
803d95e75fdSopenharmony_ci    cellularCallInfo_new.callType = CallType::TYPE_IMS;
804d95e75fdSopenharmony_ci    infos.emplace_back(cellularCallInfo_new);
805d95e75fdSopenharmony_ci    imsControl.HangUp(cellularCallInfo, CallSupplementType::TYPE_DEFAULT);
806d95e75fdSopenharmony_ci    imsControl.HangUp(cellularCallInfo, CallSupplementType::TYPE_HANG_UP_HOLD_WAIT);
807d95e75fdSopenharmony_ci    imsControl.HangUp(cellularCallInfo, CallSupplementType::TYPE_HANG_UP_ACTIVE);
808d95e75fdSopenharmony_ci    imsControl.HangUp(cellularCallInfo, CallSupplementType::TYPE_HANG_UP_ALL);
809d95e75fdSopenharmony_ci    imsControl.HangUp(cellularCallInfo, static_cast<CallSupplementType>(invalidSupType));
810d95e75fdSopenharmony_ci    imsControl.Answer(cellularCallInfo);
811d95e75fdSopenharmony_ci    imsControl.Reject(cellularCallInfo);
812d95e75fdSopenharmony_ci    imsControl.PostDialProceed(cellularCallInfo, true);
813d95e75fdSopenharmony_ci    imsControl.PostDialProceed(cellularCallInfo, enabled);
814d95e75fdSopenharmony_ci    imsControl.RestoreConnection(infos, SIM1_SLOTID);
815d95e75fdSopenharmony_ci    imsControl.RestoreConnection(infos, SIM2_SLOTID);
816d95e75fdSopenharmony_ci    imsControl.ReportHangUp(infos, SIM1_SLOTID);
817d95e75fdSopenharmony_ci    imsControl.ReportHangUp(infos, SIM2_SLOTID);
818d95e75fdSopenharmony_ci    imsControl.HoldCall(SIM1_SLOTID);
819d95e75fdSopenharmony_ci    imsControl.UnHoldCall(SIM1_SLOTID);
820d95e75fdSopenharmony_ci    imsControl.SwitchCall(SIM1_SLOTID);
821d95e75fdSopenharmony_ci    imsControl.CombineConference(SIM1_SLOTID);
822d95e75fdSopenharmony_ci    std::vector<std::string> numberList;
823d95e75fdSopenharmony_ci    imsControl.InviteToConference(SIM1_SLOTID, numberList);
824d95e75fdSopenharmony_ci    std::string kickOutStr = "";
825d95e75fdSopenharmony_ci    imsControl.KickOutFromConference(SIM1_SLOTID, kickOutStr, 0);
826d95e75fdSopenharmony_ci    kickOutStr = "111";
827d95e75fdSopenharmony_ci    imsControl.KickOutFromConference(SIM1_SLOTID, kickOutStr, 0);
828d95e75fdSopenharmony_ci    imsControl.HangUpAllConnection(SIM1_SLOTID);
829d95e75fdSopenharmony_ci    CLIRMode clirMode = CLIRMode::DEFAULT;
830d95e75fdSopenharmony_ci    int32_t videoState = 0;
831d95e75fdSopenharmony_ci    imsControl.DialJudgment(SIM1_SLOTID, PHONE_NUMBER, clirMode, videoState);
832d95e75fdSopenharmony_ci#ifdef CALL_MANAGER_AUTO_START_OPTIMIZE
833d95e75fdSopenharmony_ci    ASSERT_EQ(imsControl.EncapsulateDial(SIM1_SLOTID, PHONE_NUMBER, clirMode, videoState),
834d95e75fdSopenharmony_ci        TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL);
835d95e75fdSopenharmony_ci#else
836d95e75fdSopenharmony_ci    ASSERT_EQ(imsControl.EncapsulateDial(SIM1_SLOTID, PHONE_NUMBER, clirMode, videoState), TELEPHONY_SUCCESS);
837d95e75fdSopenharmony_ci#endif
838d95e75fdSopenharmony_ci}
839d95e75fdSopenharmony_ci
840d95e75fdSopenharmony_ci/**
841d95e75fdSopenharmony_ci * @tc.number   Telephony_CellularCallImsControl_002
842d95e75fdSopenharmony_ci * @tc.name     Test error branch
843d95e75fdSopenharmony_ci * @tc.desc     Function test
844d95e75fdSopenharmony_ci */
845d95e75fdSopenharmony_ciHWTEST_F(BranchTest, Telephony_CellularCallImsControl_002, Function | MediumTest | Level3)
846d95e75fdSopenharmony_ci{
847d95e75fdSopenharmony_ci    AccessToken token;
848d95e75fdSopenharmony_ci    IMSControl imsControl;
849d95e75fdSopenharmony_ci    ImsCurrentCallList ImsCallList;
850d95e75fdSopenharmony_ci    imsControl.ReportImsCallsData(SIM1_SLOTID, ImsCallList);
851d95e75fdSopenharmony_ci    InitImsCallInfoList(ImsCallList, 5);
852d95e75fdSopenharmony_ci    imsControl.ReportImsCallsData(SIM1_SLOTID, ImsCallList);
853d95e75fdSopenharmony_ci    CallInfoList callInfoList;
854d95e75fdSopenharmony_ci    imsControl.ReportCallsData(SIM1_SLOTID, callInfoList);
855d95e75fdSopenharmony_ci    imsControl.ReportHangUpInfo(SIM1_SLOTID);
856d95e75fdSopenharmony_ci    imsControl.ReportIncomingInfo(SIM1_SLOTID, ImsCallList);
857d95e75fdSopenharmony_ci    imsControl.ReportUpdateInfo(SIM1_SLOTID, ImsCallList);
858d95e75fdSopenharmony_ci    ImsCurrentCall ImsCallInfo;
859d95e75fdSopenharmony_ci    imsControl.EncapsulationCallReportInfo(SIM1_SLOTID, ImsCallInfo);
860d95e75fdSopenharmony_ci    CallsReportInfo callsReportInfo;
861d95e75fdSopenharmony_ci    imsControl.DeleteConnection(callsReportInfo, ImsCallList);
862d95e75fdSopenharmony_ci    imsControl.ReleaseAllConnection();
863d95e75fdSopenharmony_ci    imsControl.DialAfterHold(SIM1_SLOTID);
864d95e75fdSopenharmony_ci    std::string msg = "";
865d95e75fdSopenharmony_ci    imsControl.StartRtt(SIM1_SLOTID, msg);
866d95e75fdSopenharmony_ci    int res = imsControl.StopRtt(SIM1_SLOTID);
867d95e75fdSopenharmony_ci    imsControl.GetConnectionMap();
868d95e75fdSopenharmony_ci    imsControl.ReleaseAllConnection();
869d95e75fdSopenharmony_ci#ifdef CALL_MANAGER_AUTO_START_OPTIMIZE
870d95e75fdSopenharmony_ci    ASSERT_EQ(res, INVALID_VALUE);
871d95e75fdSopenharmony_ci#else
872d95e75fdSopenharmony_ci    ASSERT_EQ(res, TELEPHONY_SUCCESS);
873d95e75fdSopenharmony_ci#endif
874d95e75fdSopenharmony_ci}
875d95e75fdSopenharmony_ci
876d95e75fdSopenharmony_ci/**
877d95e75fdSopenharmony_ci * @tc.number   Telephony_CellularCallImsControl_003
878d95e75fdSopenharmony_ci * @tc.name     Test error branch
879d95e75fdSopenharmony_ci * @tc.desc     Function test
880d95e75fdSopenharmony_ci */
881d95e75fdSopenharmony_ciHWTEST_F(BranchTest, Telephony_CellularCallImsControl_003, Function | MediumTest | Level3)
882d95e75fdSopenharmony_ci{
883d95e75fdSopenharmony_ci    AccessToken token;
884d95e75fdSopenharmony_ci    IMSControl imsControl;
885d95e75fdSopenharmony_ci    imsControl.connectionMap_.insert(std::make_pair(1, CellularCallConnectionIMS()));
886d95e75fdSopenharmony_ci    imsControl.RecoverPendingHold();
887d95e75fdSopenharmony_ci    imsControl.DialAfterHold(SIM1_SLOTID);
888d95e75fdSopenharmony_ci    imsControl.HangUpAllConnection(SIM1_SLOTID);
889d95e75fdSopenharmony_ci    ImsCurrentCallList imsCallList;
890d95e75fdSopenharmony_ci    CallsReportInfo callsReportInfo;
891d95e75fdSopenharmony_ci    imsControl.DeleteConnection(callsReportInfo, imsCallList);
892d95e75fdSopenharmony_ci    ASSERT_EQ(imsControl.ReportHangUpInfo(SIM1_SLOTID), TELEPHONY_SUCCESS);
893d95e75fdSopenharmony_ci}
894d95e75fdSopenharmony_ci
895d95e75fdSopenharmony_ci/**
896d95e75fdSopenharmony_ci * @tc.number   Telephony_ImsVideoCallControl_001
897d95e75fdSopenharmony_ci * @tc.name     Test error branch
898d95e75fdSopenharmony_ci * @tc.desc     Function test
899d95e75fdSopenharmony_ci */
900d95e75fdSopenharmony_ciHWTEST_F(BranchTest, Telephony_ImsVideoCallControl_001, Function | MediumTest | Level3)
901d95e75fdSopenharmony_ci{
902d95e75fdSopenharmony_ci    AccessToken token;
903d95e75fdSopenharmony_ci    auto imsVideoCallControl = DelayedSingleton<ImsVideoCallControl>::GetInstance();
904d95e75fdSopenharmony_ci    ASSERT_NE(imsVideoCallControl, nullptr);
905d95e75fdSopenharmony_ci    std::string cameraId = "";
906d95e75fdSopenharmony_ci    std::string surfaceId = "";
907d95e75fdSopenharmony_ci    std::string path = "";
908d95e75fdSopenharmony_ci    CellularCallInfo cellularCallInfo;
909d95e75fdSopenharmony_ci    InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, cellularCallInfo);
910d95e75fdSopenharmony_ci#ifdef CALL_MANAGER_AUTO_START_OPTIMIZE
911d95e75fdSopenharmony_ci    ASSERT_EQ(imsVideoCallControl->ControlCamera(SIM1_SLOTID, DEFAULT_INDEX, cameraId), INVALID_VALUE);
912d95e75fdSopenharmony_ci    ASSERT_EQ(imsVideoCallControl->SetPreviewWindow(SIM1_SLOTID, DEFAULT_INDEX, surfaceId, nullptr),
913d95e75fdSopenharmony_ci        INVALID_VALUE);
914d95e75fdSopenharmony_ci    ASSERT_EQ(imsVideoCallControl->SetDisplayWindow(SIM1_SLOTID, DEFAULT_INDEX, surfaceId, nullptr),
915d95e75fdSopenharmony_ci        INVALID_VALUE);
916d95e75fdSopenharmony_ci    ASSERT_EQ(imsVideoCallControl->SetCameraZoom(1.0), INVALID_VALUE);
917d95e75fdSopenharmony_ci    ASSERT_EQ(imsVideoCallControl->SetPausePicture(SIM1_SLOTID, DEFAULT_INDEX, path), INVALID_VALUE);
918d95e75fdSopenharmony_ci    ASSERT_EQ(imsVideoCallControl->SetDeviceDirection(SIM1_SLOTID, DEFAULT_INDEX, 0), INVALID_VALUE);
919d95e75fdSopenharmony_ci    ASSERT_EQ(imsVideoCallControl->SendUpdateCallMediaModeRequest(cellularCallInfo, ImsCallMode::CALL_MODE_AUDIO_ONLY),
920d95e75fdSopenharmony_ci        INVALID_VALUE);
921d95e75fdSopenharmony_ci    ASSERT_EQ(imsVideoCallControl->SendUpdateCallMediaModeResponse(cellularCallInfo, ImsCallMode::CALL_MODE_AUDIO_ONLY),
922d95e75fdSopenharmony_ci        INVALID_VALUE);
923d95e75fdSopenharmony_ci    ASSERT_EQ(imsVideoCallControl->CancelCallUpgrade(SIM1_SLOTID, DEFAULT_INDEX), INVALID_VALUE);
924d95e75fdSopenharmony_ci    ASSERT_EQ(imsVideoCallControl->RequestCameraCapabilities(SIM1_SLOTID, DEFAULT_INDEX), INVALID_VALUE);
925d95e75fdSopenharmony_ci#else
926d95e75fdSopenharmony_ci    ASSERT_EQ(imsVideoCallControl->ControlCamera(SIM1_SLOTID, DEFAULT_INDEX, cameraId), TELEPHONY_SUCCESS);
927d95e75fdSopenharmony_ci    ASSERT_EQ(imsVideoCallControl->SetPreviewWindow(SIM1_SLOTID, DEFAULT_INDEX, surfaceId, nullptr),
928d95e75fdSopenharmony_ci        TELEPHONY_SUCCESS);
929d95e75fdSopenharmony_ci    ASSERT_EQ(imsVideoCallControl->SetDisplayWindow(SIM1_SLOTID, DEFAULT_INDEX, surfaceId, nullptr),
930d95e75fdSopenharmony_ci        TELEPHONY_SUCCESS);
931d95e75fdSopenharmony_ci    ASSERT_EQ(imsVideoCallControl->SetCameraZoom(1.0), TELEPHONY_SUCCESS);
932d95e75fdSopenharmony_ci    ASSERT_EQ(imsVideoCallControl->SetPausePicture(SIM1_SLOTID, DEFAULT_INDEX, path), TELEPHONY_SUCCESS);
933d95e75fdSopenharmony_ci    ASSERT_EQ(imsVideoCallControl->SetDeviceDirection(SIM1_SLOTID, DEFAULT_INDEX, 0), TELEPHONY_SUCCESS);
934d95e75fdSopenharmony_ci    ASSERT_EQ(imsVideoCallControl->SendUpdateCallMediaModeRequest(cellularCallInfo, ImsCallMode::CALL_MODE_AUDIO_ONLY),
935d95e75fdSopenharmony_ci        TELEPHONY_ERR_FAIL);
936d95e75fdSopenharmony_ci    ASSERT_EQ(imsVideoCallControl->SendUpdateCallMediaModeResponse(cellularCallInfo, ImsCallMode::CALL_MODE_AUDIO_ONLY),
937d95e75fdSopenharmony_ci        TELEPHONY_ERR_FAIL);
938d95e75fdSopenharmony_ci    ASSERT_EQ(imsVideoCallControl->CancelCallUpgrade(SIM1_SLOTID, DEFAULT_INDEX), TELEPHONY_SUCCESS);
939d95e75fdSopenharmony_ci    ASSERT_EQ(imsVideoCallControl->RequestCameraCapabilities(SIM1_SLOTID, DEFAULT_INDEX), TELEPHONY_SUCCESS);
940d95e75fdSopenharmony_ci#endif
941d95e75fdSopenharmony_ci}
942d95e75fdSopenharmony_ci
943d95e75fdSopenharmony_ci/**
944d95e75fdSopenharmony_ci * @tc.number   Telephony_ImsVideoCallControl_002
945d95e75fdSopenharmony_ci * @tc.name     Test error branch
946d95e75fdSopenharmony_ci * @tc.desc     Function test
947d95e75fdSopenharmony_ci */
948d95e75fdSopenharmony_ciHWTEST_F(BranchTest, Telephony_ImsVideoCallControl_002, Function | MediumTest | Level3)
949d95e75fdSopenharmony_ci{
950d95e75fdSopenharmony_ci    AccessToken token;
951d95e75fdSopenharmony_ci    auto imsVideoCallControl = DelayedSingleton<ImsVideoCallControl>::GetInstance();
952d95e75fdSopenharmony_ci    ASSERT_NE(imsVideoCallControl, nullptr);
953d95e75fdSopenharmony_ci    ImsCallMode mode = ImsCallMode::CALL_MODE_AUDIO_ONLY;
954d95e75fdSopenharmony_ci    ASSERT_EQ(imsVideoCallControl->ConverToImsCallType(mode), ImsCallType::TEL_IMS_CALL_TYPE_VOICE);
955d95e75fdSopenharmony_ci    mode = ImsCallMode::CALL_MODE_RECEIVE_ONLY;
956d95e75fdSopenharmony_ci    ASSERT_EQ(imsVideoCallControl->ConverToImsCallType(mode), ImsCallType::TEL_IMS_CALL_TYPE_VT_RX);
957d95e75fdSopenharmony_ci    mode = ImsCallMode::CALL_MODE_SEND_ONLY;
958d95e75fdSopenharmony_ci    ASSERT_EQ(imsVideoCallControl->ConverToImsCallType(mode), ImsCallType::TEL_IMS_CALL_TYPE_VT_TX);
959d95e75fdSopenharmony_ci    mode = ImsCallMode::CALL_MODE_SEND_RECEIVE;
960d95e75fdSopenharmony_ci    ASSERT_EQ(imsVideoCallControl->ConverToImsCallType(mode), ImsCallType::TEL_IMS_CALL_TYPE_VT);
961d95e75fdSopenharmony_ci    mode = ImsCallMode::CALL_MODE_VIDEO_PAUSED;
962d95e75fdSopenharmony_ci    ASSERT_EQ(imsVideoCallControl->ConverToImsCallType(mode), ImsCallType::TEL_IMS_CALL_TYPE_PAUSE);
963d95e75fdSopenharmony_ci}
964d95e75fdSopenharmony_ci
965d95e75fdSopenharmony_ci/**
966d95e75fdSopenharmony_ci * @tc.number   Telephony_CellularCallConnectionIms_001
967d95e75fdSopenharmony_ci * @tc.name     Test error branch
968d95e75fdSopenharmony_ci * @tc.desc     Function test
969d95e75fdSopenharmony_ci */
970d95e75fdSopenharmony_ciHWTEST_F(BranchTest, Telephony_CellularCallConnectionIms_001, Function | MediumTest | Level3)
971d95e75fdSopenharmony_ci{
972d95e75fdSopenharmony_ci    AccessToken token;
973d95e75fdSopenharmony_ci    CellularCallConnectionIMS callConn;
974d95e75fdSopenharmony_ci    ImsDialInfoStruct dialRequest;
975d95e75fdSopenharmony_ci    std::vector<std::string> numberList = {};
976d95e75fdSopenharmony_ci    std::string msg = "";
977d95e75fdSopenharmony_ci#ifdef CALL_MANAGER_AUTO_START_OPTIMIZE
978d95e75fdSopenharmony_ci    ASSERT_EQ(callConn.DialRequest(SIM1_SLOTID, dialRequest), TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL);
979d95e75fdSopenharmony_ci    ASSERT_EQ(callConn.HangUpRequest(SIM1_SLOTID, PHONE_NUMBER, 0), INVALID_VALUE);
980d95e75fdSopenharmony_ci    ASSERT_EQ(callConn.AnswerRequest(SIM1_SLOTID, PHONE_NUMBER, 0, 0), INVALID_VALUE);
981d95e75fdSopenharmony_ci    ASSERT_EQ(callConn.RejectRequest(SIM1_SLOTID, PHONE_NUMBER, 0), INVALID_VALUE);
982d95e75fdSopenharmony_ci    ASSERT_EQ(callConn.HoldCallRequest(SIM1_SLOTID), INVALID_VALUE);
983d95e75fdSopenharmony_ci    ASSERT_EQ(callConn.UnHoldCallRequest(SIM1_SLOTID), INVALID_VALUE);
984d95e75fdSopenharmony_ci    ASSERT_EQ(callConn.SwitchCallRequest(SIM1_SLOTID), INVALID_VALUE);
985d95e75fdSopenharmony_ci    ASSERT_EQ(callConn.CombineConferenceRequest(SIM1_SLOTID, 0), INVALID_VALUE);
986d95e75fdSopenharmony_ci    ASSERT_EQ(callConn.InviteToConferenceRequest(SIM1_SLOTID, numberList), INVALID_VALUE);
987d95e75fdSopenharmony_ci    ASSERT_EQ(callConn.KickOutFromConferenceRequest(SIM1_SLOTID, 0), INVALID_VALUE);
988d95e75fdSopenharmony_ci    ASSERT_EQ(callConn.CallSupplementRequest(SIM1_SLOTID, CallSupplementType::TYPE_DEFAULT), TELEPHONY_SUCCESS);
989d95e75fdSopenharmony_ci    ASSERT_EQ(callConn.StartRttRequest(SIM1_SLOTID, msg), INVALID_VALUE);
990d95e75fdSopenharmony_ci    ASSERT_EQ(callConn.StopRttRequest(SIM1_SLOTID), INVALID_VALUE);
991d95e75fdSopenharmony_ci    ASSERT_EQ(callConn.GetImsCallsDataRequest(SIM1_SLOTID, 0), INVALID_VALUE);
992d95e75fdSopenharmony_ci    ASSERT_EQ(callConn.SendDtmfRequest(SIM1_SLOTID, '*', 0), INVALID_VALUE);
993d95e75fdSopenharmony_ci    ASSERT_EQ(callConn.StartDtmfRequest(SIM1_SLOTID, '*', 0), INVALID_VALUE);
994d95e75fdSopenharmony_ci    ASSERT_EQ(callConn.StopDtmfRequest(SIM1_SLOTID, 0), INVALID_VALUE);
995d95e75fdSopenharmony_ci    ASSERT_EQ(callConn.GetCallFailReasonRequest(SIM1_SLOTID), INVALID_VALUE);
996d95e75fdSopenharmony_ci#else
997d95e75fdSopenharmony_ci    ASSERT_EQ(callConn.DialRequest(SIM1_SLOTID, dialRequest), TELEPHONY_SUCCESS);
998d95e75fdSopenharmony_ci    ASSERT_EQ(callConn.HangUpRequest(SIM1_SLOTID, PHONE_NUMBER, 0), TELEPHONY_SUCCESS);
999d95e75fdSopenharmony_ci    ASSERT_EQ(callConn.AnswerRequest(SIM1_SLOTID, PHONE_NUMBER, 0, 0), TELEPHONY_SUCCESS);
1000d95e75fdSopenharmony_ci    ASSERT_EQ(callConn.RejectRequest(SIM1_SLOTID, PHONE_NUMBER, 0), TELEPHONY_SUCCESS);
1001d95e75fdSopenharmony_ci    ASSERT_EQ(callConn.HoldCallRequest(SIM1_SLOTID), TELEPHONY_SUCCESS);
1002d95e75fdSopenharmony_ci    ASSERT_EQ(callConn.UnHoldCallRequest(SIM1_SLOTID), TELEPHONY_SUCCESS);
1003d95e75fdSopenharmony_ci    ASSERT_EQ(callConn.SwitchCallRequest(SIM1_SLOTID), TELEPHONY_SUCCESS);
1004d95e75fdSopenharmony_ci    ASSERT_EQ(callConn.CombineConferenceRequest(SIM1_SLOTID, 0), TELEPHONY_SUCCESS);
1005d95e75fdSopenharmony_ci    ASSERT_EQ(callConn.InviteToConferenceRequest(SIM1_SLOTID, numberList), TELEPHONY_SUCCESS);
1006d95e75fdSopenharmony_ci    ASSERT_EQ(callConn.KickOutFromConferenceRequest(SIM1_SLOTID, 0), TELEPHONY_SUCCESS);
1007d95e75fdSopenharmony_ci    ASSERT_EQ(callConn.CallSupplementRequest(SIM1_SLOTID, CallSupplementType::TYPE_DEFAULT), TELEPHONY_SUCCESS);
1008d95e75fdSopenharmony_ci    ASSERT_EQ(callConn.StartRttRequest(SIM1_SLOTID, msg), TELEPHONY_SUCCESS);
1009d95e75fdSopenharmony_ci    ASSERT_EQ(callConn.StopRttRequest(SIM1_SLOTID), TELEPHONY_SUCCESS);
1010d95e75fdSopenharmony_ci    ASSERT_EQ(callConn.GetImsCallsDataRequest(SIM1_SLOTID, 0), TELEPHONY_SUCCESS);
1011d95e75fdSopenharmony_ci    ASSERT_EQ(callConn.SendDtmfRequest(SIM1_SLOTID, '*', 0), TELEPHONY_SUCCESS);
1012d95e75fdSopenharmony_ci    ASSERT_EQ(callConn.StartDtmfRequest(SIM1_SLOTID, '*', 0), TELEPHONY_SUCCESS);
1013d95e75fdSopenharmony_ci    ASSERT_EQ(callConn.StopDtmfRequest(SIM1_SLOTID, 0), TELEPHONY_SUCCESS);
1014d95e75fdSopenharmony_ci    ASSERT_EQ(callConn.GetCallFailReasonRequest(SIM1_SLOTID), TELEPHONY_SUCCESS);
1015d95e75fdSopenharmony_ci#endif
1016d95e75fdSopenharmony_ci}
1017d95e75fdSopenharmony_ci
1018d95e75fdSopenharmony_ci/**
1019d95e75fdSopenharmony_ci * @tc.number   Telephony_CellularCallConfigRequest_001
1020d95e75fdSopenharmony_ci * @tc.name     Test error branch
1021d95e75fdSopenharmony_ci * @tc.desc     Function test
1022d95e75fdSopenharmony_ci */
1023d95e75fdSopenharmony_ciHWTEST_F(BranchTest, Telephony_CellularCallConfigRequest_001, Function | MediumTest | Level3)
1024d95e75fdSopenharmony_ci{
1025d95e75fdSopenharmony_ci    AccessToken token;
1026d95e75fdSopenharmony_ci    ConfigRequest configReq;
1027d95e75fdSopenharmony_ci    configReq.SetDomainPreferenceModeRequest(SIM1_SLOTID, 1);
1028d95e75fdSopenharmony_ci    configReq.GetDomainPreferenceModeRequest(SIM1_SLOTID);
1029d95e75fdSopenharmony_ci    configReq.SetDomainPreferenceModeRequest(SIM2_SLOTID, 1);
1030d95e75fdSopenharmony_ci    configReq.GetDomainPreferenceModeRequest(SIM2_SLOTID);
1031d95e75fdSopenharmony_ci    bool enabled = false;
1032d95e75fdSopenharmony_ci    configReq.SetImsSwitchStatusRequest(SIM1_SLOTID, enabled);
1033d95e75fdSopenharmony_ci    configReq.GetImsSwitchStatusRequest(SIM1_SLOTID);
1034d95e75fdSopenharmony_ci    int32_t state = 0;
1035d95e75fdSopenharmony_ci    configReq.SetVoNRSwitchStatusRequest(SIM1_SLOTID, state);
1036d95e75fdSopenharmony_ci    configReq.SetVoNRSwitchStatusRequest(SIM2_SLOTID, state);
1037d95e75fdSopenharmony_ci    std::string value = "";
1038d95e75fdSopenharmony_ci    configReq.SetImsConfigRequest(ImsConfigItem::ITEM_VIDEO_QUALITY, value);
1039d95e75fdSopenharmony_ci    configReq.SetImsConfigRequest(ImsConfigItem::ITEM_VIDEO_QUALITY, 1);
1040d95e75fdSopenharmony_ci    configReq.GetImsConfigRequest(ImsConfigItem::ITEM_VIDEO_QUALITY);
1041d95e75fdSopenharmony_ci    configReq.SetImsFeatureValueRequest(FeatureType::TYPE_VOICE_OVER_LTE, 1);
1042d95e75fdSopenharmony_ci    int32_t imsFeature = 0;
1043d95e75fdSopenharmony_ci    configReq.GetImsFeatureValueRequest(FeatureType::TYPE_VOICE_OVER_LTE, imsFeature);
1044d95e75fdSopenharmony_ci    configReq.SetMuteRequest(SIM1_SLOTID, 0);
1045d95e75fdSopenharmony_ci    configReq.GetMuteRequest(SIM1_SLOTID);
1046d95e75fdSopenharmony_ci    configReq.SetMuteRequest(SIM2_SLOTID, 0);
1047d95e75fdSopenharmony_ci    configReq.GetMuteRequest(SIM2_SLOTID);
1048d95e75fdSopenharmony_ci    std::vector<EmergencyCall> eccVec = {};
1049d95e75fdSopenharmony_ci    configReq.GetEmergencyCallListRequest(SIM1_SLOTID);
1050d95e75fdSopenharmony_ci    configReq.SetEmergencyCallListRequest(SIM1_SLOTID, eccVec);
1051d95e75fdSopenharmony_ci    configReq.GetEmergencyCallListRequest(SIM2_SLOTID);
1052d95e75fdSopenharmony_ci    configReq.SetEmergencyCallListRequest(SIM2_SLOTID, eccVec);
1053d95e75fdSopenharmony_ci    ImsCapabilityList imsCapabilityList;
1054d95e75fdSopenharmony_ci#ifdef CALL_MANAGER_AUTO_START_OPTIMIZE
1055d95e75fdSopenharmony_ci    ASSERT_EQ(configReq.UpdateImsCapabilities(SIM1_SLOTID, imsCapabilityList), CALL_ERR_RESOURCE_UNAVAILABLE);
1056d95e75fdSopenharmony_ci#else
1057d95e75fdSopenharmony_ci    ASSERT_EQ(configReq.UpdateImsCapabilities(SIM1_SLOTID, imsCapabilityList), TELEPHONY_SUCCESS);
1058d95e75fdSopenharmony_ci#endif
1059d95e75fdSopenharmony_ci}
1060d95e75fdSopenharmony_ci} // namespace Telephony
1061d95e75fdSopenharmony_ci} // namespace OHOS