• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022-2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #define private public
16 #define protected public
17 #include "bluetooth_call_client.h"
18 #include "bluetooth_call_manager.h"
19 #include "bluetooth_call_service.h"
20 #include "bluetooth_connection.h"
21 #include "iremote_broker.h"
22 #include "call_ability_callback.h"
23 #include "call_ability_connect_callback.h"
24 #include "call_ability_report_proxy.h"
25 #include "call_connect_ability.h"
26 #include "call_control_manager.h"
27 #include "call_manager_client.h"
28 #include "call_manager_hisysevent.h"
29 #include "call_number_utils.h"
30 #include "call_policy.h"
31 #include "call_records_manager.h"
32 #include "call_request_event_handler_helper.h"
33 #include "call_request_handler.h"
34 #include "call_request_process.h"
35 #include "call_setting_manager.h"
36 #include "call_state_report_proxy.h"
37 #include "call_status_manager.h"
38 #include "cellular_call_connection.h"
39 #include "common_event_manager.h"
40 #include "common_event_support.h"
41 #include "cs_call.h"
42 #include "cs_conference.h"
43 #include "distributed_call_manager.h"
44 #include "gtest/gtest.h"
45 #include "i_voip_call_manager_service.h"
46 #include "ims_call.h"
47 #include "ims_conference.h"
48 #include "incoming_call_notification.h"
49 #include "missed_call_notification.h"
50 #include "ott_call.h"
51 #include "ott_conference.h"
52 #include "reject_call_sms.h"
53 #include "report_call_info_handler.h"
54 #include "satellite_call.h"
55 #include "surface_utils.h"
56 #include "telephony_errors.h"
57 #include "telephony_hisysevent.h"
58 #include "telephony_log_wrapper.h"
59 #include "video_call_state.h"
60 #include "video_control_manager.h"
61 #include "voip_call_manager_proxy.h"
62 #include "voip_call.h"
63 #include "accesstoken_kit.h"
64 #include "token_setproc.h"
65 #include "nativetoken_kit.h"
66 #include "number_identity_data_base_helper.h"
67 #include "call_ability_callback_death_recipient.h"
68 #include "app_state_observer.h"
69 #include "call_ability_callback_proxy.h"
70 #include "super_privacy_manager_client.h"
71 #include "call_status_callback.h"
72 #include "satellite_call_control.h"
73 #include "proximity_sensor.h"
74 #include "status_bar.h"
75 #include "wired_headset.h"
76 #include "call_status_policy.h"
77 
78 namespace OHOS {
79 namespace Telephony {
80 using namespace testing::ext;
81 
82 namespace {
83 const int32_t INVALID_SLOTID = 2;
84 const int32_t SIM1_SLOTID = 0;
85 const int32_t DEFAULT_INDEX = 1;
86 const int16_t CAMERA_ROTATION_0 = 0;
87 const int16_t CAMERA_ROTATION_90 = 90;
88 const int16_t CAMERA_ROTATION_180 = 180;
89 const int16_t CAMERA_ROTATION_270 = 270;
90 const int32_t INVALID_MODE = 0;
91 const int32_t VALID_CALLID = 1;
92 const int32_t ERROR_CALLID = -1;
93 const int32_t ONE_TIME = 1;
94 const int32_t STEP_1 = 1;
95 const int32_t IS_CELIA_CALL = 1;
96 const int32_t SOURCE_CALL = 2;
97 const int32_t TELEPHONY_EXT_SA_ID = 4011;
98 const int32_t DISTRIBUTED_CALL_SOURCE_SA_ID = 9855;
99 constexpr int16_t DEFAULT_TIME = 0;
100 constexpr const char *TEST_STR = "123";
101 constexpr const char *LONG_STR =
102     "11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"
103     "111111111";
104 } // namespace
105 
106 class DemoHandler : public AppExecFwk::EventHandler {
107 public:
DemoHandler(std::shared_ptr<AppExecFwk::EventRunner> & eventRunner)108     explicit DemoHandler(std::shared_ptr<AppExecFwk::EventRunner> &eventRunner) : AppExecFwk::EventHandler(eventRunner)
109     {}
~DemoHandler()110     virtual ~DemoHandler() {}
ProcessEvent(const AppExecFwk::InnerEvent::Pointer & event)111     void ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event) {}
112 };
113 
114 class ZeroBranch5Test : public testing::Test {
115 public:
116     void SetUp();
117     void TearDown();
118     static void SetUpTestCase();
119     static void TearDownTestCase();
120 };
121 
SetUp()122 void ZeroBranch5Test::SetUp() {}
123 
TearDown()124 void ZeroBranch5Test::TearDown() {}
125 
SetUpTestCase()126 void ZeroBranch5Test::SetUpTestCase()
127 {
128     constexpr int permissionNum = 1;
129     const char *perms[permissionNum] = {
130         "ohos.permission.GET_TELEPHONY_STATE"
131     };
132     NativeTokenInfoParams infoInstance = {
133         .dcapsNum = 0,  // Indicates the capsbility list of the sa.
134         .permsNum = permissionNum,
135         .aclsNum = 0,  // acls is the list of rights thar can be escalated.
136         .dcaps = nullptr,
137         .perms = perms,
138         .acls = nullptr,
139         .processName = "ZeroBranch5Test",
140         .aplStr = "system_basic",
141     };
142     uint64_t tokenId = GetAccessTokenId(&infoInstance);
143     SetSelfTokenID(tokenId);
144     auto result = Security::AccessToken::AccessTokenKit::ReloadNativeTokenInfo();
145     EXPECT_EQ(result, Security::AccessToken::RET_SUCCESS);
146 }
147 
TearDownTestCase()148 void ZeroBranch5Test::TearDownTestCase() {}
149 
CreateDataShareHelper(std::string uri)150 std::shared_ptr<DataShare::DataShareHelper> CreateDataShareHelper(std::string uri)
151 {
152     auto saManager = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
153     if (saManager == nullptr) {
154         printf("Get system ability mgr failed.");
155         return nullptr;
156     }
157     auto remoteObj = saManager->GetSystemAbility(TELEPHONY_CALL_MANAGER_SYS_ABILITY_ID);
158     if (remoteObj == nullptr) {
159         printf("GetSystemAbility Service Failed.");
160         return nullptr;
161     }
162     return DataShare::DataShareHelper::Creator(remoteObj, uri);
163 }
164 
165 /**
166  * @tc.number   Telephony_CallStatusManager_003
167  * @tc.name     test error branch
168  * @tc.desc     Function test
169  */
170 HWTEST_F(ZeroBranch5Test, Telephony_CallStatusManager_003, Function | MediumTest | Level3)
171 {
172     std::shared_ptr<CallStatusManager> callStatusManager = std::make_shared<CallStatusManager>();
173     callStatusManager->Init();
174     CellularCallEventInfo cellularCallEventInfo;
175     ASSERT_EQ(callStatusManager->HandleEventResultReportInfo(cellularCallEventInfo), TELEPHONY_SUCCESS);
176     cellularCallEventInfo.eventType = CellularCallEventType::EVENT_REQUEST_RESULT_TYPE;
177     cellularCallEventInfo.eventId = RequestResultEventId::RESULT_DIAL_NO_CARRIER;
178     ASSERT_EQ(callStatusManager->HandleEventResultReportInfo(cellularCallEventInfo), TELEPHONY_SUCCESS);
179     OttCallEventInfo ottCallEventInfo;
180     (void)memset_s(&ottCallEventInfo, sizeof(OttCallEventInfo), 0, sizeof(OttCallEventInfo));
181     ottCallEventInfo.ottCallEventId = OttCallEventId::OTT_CALL_EVENT_FUNCTION_UNSUPPORTED;
182     (void)memcpy_s(ottCallEventInfo.bundleName, kMaxBundleNameLen + 1, LONG_STR, strlen(LONG_STR));
183     ASSERT_EQ(callStatusManager->HandleOttEventReportInfo(ottCallEventInfo), TELEPHONY_SUCCESS);
184     (void)memset_s(&ottCallEventInfo, sizeof(OttCallEventInfo), 0, sizeof(OttCallEventInfo));
185     ottCallEventInfo.ottCallEventId = OttCallEventId::OTT_CALL_EVENT_FUNCTION_UNSUPPORTED;
186     (void)memcpy_s(ottCallEventInfo.bundleName, kMaxBundleNameLen + 1, TEST_STR, strlen(TEST_STR));
187     ASSERT_EQ(callStatusManager->HandleOttEventReportInfo(ottCallEventInfo), TELEPHONY_SUCCESS);
188     CallDetailInfo callDetailInfo;
189     std::string number = "";
190     memcpy_s(&callDetailInfo.phoneNum, kMaxNumberLen, number.c_str(), number.length());
191     callDetailInfo.state = TelCallState::CALL_STATUS_INCOMING;
192     callDetailInfo.callType = CallType::TYPE_CS;
193     ASSERT_EQ(callStatusManager->IncomingFilterPolicy(callDetailInfo), TELEPHONY_SUCCESS);
194     callStatusManager->CallFilterCompleteResult(callDetailInfo);
195     CallDirection dir = CallDirection::CALL_DIRECTION_OUT;
196     ASSERT_FALSE(callStatusManager->CreateNewCall(callDetailInfo, dir) == nullptr);
197     dir = CallDirection::CALL_DIRECTION_IN;
198     ASSERT_FALSE(callStatusManager->CreateNewCall(callDetailInfo, dir) == nullptr);
199     callDetailInfo.callType = CallType::TYPE_IMS;
200     dir = CallDirection::CALL_DIRECTION_OUT;
201     ASSERT_FALSE(callStatusManager->CreateNewCall(callDetailInfo, dir) == nullptr);
202     dir = CallDirection::CALL_DIRECTION_IN;
203     ASSERT_FALSE(callStatusManager->CreateNewCall(callDetailInfo, dir) == nullptr);
204     callDetailInfo.callType = CallType::TYPE_OTT;
205     dir = CallDirection::CALL_DIRECTION_OUT;
206     ASSERT_FALSE(callStatusManager->CreateNewCall(callDetailInfo, dir) == nullptr);
207     dir = CallDirection::CALL_DIRECTION_IN;
208     ASSERT_FALSE(callStatusManager->CreateNewCall(callDetailInfo, dir) == nullptr);
209     callDetailInfo.callType = CallType::TYPE_ERR_CALL;
210     ASSERT_TRUE(callStatusManager->CreateNewCall(callDetailInfo, dir) == nullptr);
211 }
212 
213 /**
214  * @tc.number   Telephony_CallStatusManager_004
215  * @tc.name     test error branch
216  * @tc.desc     Function test
217  */
218 HWTEST_F(ZeroBranch5Test, Telephony_CallStatusManager_004, Function | MediumTest | Level3)
219 {
220     std::shared_ptr<CallStatusManager> callStatusManager = std::make_shared<CallStatusManager>();
221     callStatusManager->Init();
222     sptr<CallBase> callObjectPtr = nullptr;
223     callStatusManager->HandleRejectCall(callObjectPtr, true);
224     DialParaInfo dialParaInfo;
225     dialParaInfo.callType = CallType::TYPE_CS;
226     dialParaInfo.callState = TelCallState::CALL_STATUS_INCOMING;
227     callObjectPtr = new CSCall(dialParaInfo);
228     callStatusManager->HandleRejectCall(callObjectPtr, true);
229     CallDetailInfo callDetailInfo;
230     std::string number = "";
231     memcpy_s(&callDetailInfo.phoneNum, kMaxNumberLen, number.c_str(), number.length());
232     callDetailInfo.state = TelCallState::CALL_STATUS_INCOMING;
233     callDetailInfo.callType = CallType::TYPE_CS;
234     callDetailInfo.voipCallInfo.voipCallId = "123456789";
235     callStatusManager->OutgoingVoipCallHandle(callDetailInfo);
236     std::vector<std::u16string> callIdList;
237     CallRunningState previousState = CallRunningState::CALL_RUNNING_STATE_CREATE;
238     TelCallState priorState = TelCallState::CALL_STATUS_INCOMING;
239     callStatusManager->HandleHoldCallOrAutoAnswerCall(callObjectPtr, callIdList, previousState, priorState);
240     callStatusManager->AutoAnswerForVoiceCall(callObjectPtr, SIM1_SLOTID, true);
241     callStatusManager->SetVideoCallState(callObjectPtr, TelCallState::CALL_STATUS_ACTIVE);
242     callObjectPtr->SetSlotId(-1);
243     callStatusManager->SetVideoCallState(callObjectPtr, TelCallState::CALL_STATUS_ACTIVE);
244     EXPECT_TRUE(callStatusManager->GetConferenceCallList(-1).empty());
245     callStatusManager->ShouldRejectIncomingCall();
246     callStatusManager->IsRingOnceCall(callObjectPtr, callDetailInfo);
247     sptr<CallBase> callObjectPtr1 = nullptr;
248     int32_t res = callStatusManager->HandleRingOnceCall(callObjectPtr1);
249     callStatusManager->HandleRingOnceCall(callObjectPtr);
250     ASSERT_NE(res, TELEPHONY_SUCCESS);
251 }
252 
253 /**
254  * @tc.number   Telephony_IncomingCallWakeup_001
255  * @tc.name     test error branch
256  * @tc.desc     Function test
257  */
258 HWTEST_F(ZeroBranch5Test, Telephony_IncomingCallWakeup_001, Function | MediumTest | Level3)
259 {
260     auto incomingCallWakeup = std::make_shared<IncomingCallWakeup>();
261     sptr<CallBase> callObjectPtr = nullptr;
262     incomingCallWakeup->NewCallCreated(callObjectPtr);
263     EXPECT_TRUE(incomingCallWakeup != nullptr);
264 }
265 
266 /**
267  * @tc.number   Telephony_CallStateReportProxy_001
268  * @tc.name     test error branch
269  * @tc.desc     Function test
270  */
271 HWTEST_F(ZeroBranch5Test, Telephony_CallStateReportProxy_001, Function | MediumTest | Level3)
272 {
273     CallStateReportProxy callStateReportPtr;
274     sptr<CallBase> callObjectPtr = nullptr;
275     callStateReportPtr.CallStateUpdated(
276         callObjectPtr, TelCallState::CALL_STATUS_INCOMING, TelCallState::CALL_STATUS_INCOMING);
277     DialParaInfo dialParaInfo;
278     dialParaInfo.callType = CallType::TYPE_CS;
279     dialParaInfo.callState = TelCallState::CALL_STATUS_INCOMING;
280     callObjectPtr = new CSCall(dialParaInfo);
281     ASSERT_TRUE(callObjectPtr != nullptr);
282     callStateReportPtr.CallStateUpdated(
283         callObjectPtr, TelCallState::CALL_STATUS_INCOMING, TelCallState::CALL_STATUS_INCOMING);
284     callObjectPtr->SetTelCallState(TelCallState::CALL_STATUS_ACTIVE);
285     callStateReportPtr.CallStateUpdated(
286         callObjectPtr, TelCallState::CALL_STATUS_INCOMING, TelCallState::CALL_STATUS_INCOMING);
287     callStateReportPtr.UpdateCallState(callObjectPtr, TelCallState::CALL_STATUS_INCOMING);
288     callStateReportPtr.UpdateCallStateForSlotId(callObjectPtr, TelCallState::CALL_STATUS_INCOMING);
289     std::string number = "123456789012";
290     std::u16string phoneNumber = Str8ToStr16(number);
291     callStateReportPtr.ReportCallState(0, phoneNumber);
292     callStateReportPtr.ReportCallStateForCallId(0, 0, phoneNumber);
293     ASSERT_TRUE(!number.empty());
294 }
295 
296 /**
297  * @tc.number   Telephony_CallStateListener_001
298  * @tc.name     test error branch
299  * @tc.desc     Function test
300  */
301 HWTEST_F(ZeroBranch5Test, Telephony_CallStateListener_001, Function | MediumTest | Level3)
302 {
303     CallStateListener callStateListener;
304     sptr<CallBase> callObjectPtr = nullptr;
305     callStateListener.NewCallCreated(callObjectPtr);
306     callStateListener.CallStateUpdated(
307         callObjectPtr, TelCallState::CALL_STATUS_INCOMING, TelCallState::CALL_STATUS_INCOMING);
308     callStateListener.IncomingCallHungUp(callObjectPtr, true, "");
309     callStateListener.IncomingCallActivated(callObjectPtr);
310     DialParaInfo dialParaInfo;
311     callObjectPtr = new CSCall(dialParaInfo);
312     callStateListener.NewCallCreated(callObjectPtr);
313     callStateListener.CallStateUpdated(
314         callObjectPtr, TelCallState::CALL_STATUS_INCOMING, TelCallState::CALL_STATUS_INCOMING);
315     callStateListener.IncomingCallHungUp(callObjectPtr, true, "");
316     callStateListener.IncomingCallActivated(callObjectPtr);
317     std::shared_ptr<CallStateReportProxy> callStateReportPtr = nullptr;
318     ASSERT_FALSE(callStateListener.AddOneObserver(callStateReportPtr));
319     ASSERT_FALSE(callStateListener.RemoveOneObserver(callStateReportPtr));
320     callStateReportPtr = std::make_shared<CallStateReportProxy>();
321     ASSERT_TRUE(callStateListener.AddOneObserver(callStateReportPtr));
322     ASSERT_TRUE(callStateListener.AddOneObserver(callStateReportPtr));
323 }
324 
325 /**
326  * @tc.number   Telephony_ConferenceBase_001
327  * @tc.name     test error branch
328  * @tc.desc     Function test
329  */
330 HWTEST_F(ZeroBranch5Test, Telephony_ConferenceBase_001, Function | MediumTest | Level3)
331 {
332     std::shared_ptr<ConferenceBase> conference = std::make_shared<CsConference>();
333     std::vector<std::u16string> callIdList;
334     ASSERT_NE(conference->GetSubCallIdList(VALID_CALLID, callIdList), TELEPHONY_SUCCESS);
335     ASSERT_NE(conference->GetCallIdListForConference(VALID_CALLID, callIdList), TELEPHONY_SUCCESS);
336     ASSERT_NE(conference->JoinToConference(VALID_CALLID), TELEPHONY_SUCCESS);
337     ASSERT_NE(conference->LeaveFromConference(VALID_CALLID), TELEPHONY_SUCCESS);
338     ASSERT_NE(conference->HoldConference(VALID_CALLID), TELEPHONY_SUCCESS);
339     ASSERT_NE(conference->CanSeparateConference(), TELEPHONY_SUCCESS);
340     ASSERT_NE(conference->CanKickOutFromConference(), TELEPHONY_SUCCESS);
341     ASSERT_EQ(conference->SetMainCall(ERROR_CALLID), TELEPHONY_SUCCESS);
342     ASSERT_EQ(conference->SetMainCall(VALID_CALLID), TELEPHONY_SUCCESS);
343     ASSERT_NE(conference->CanSeparateConference(), TELEPHONY_SUCCESS);
344     ASSERT_NE(conference->CanKickOutFromConference(), TELEPHONY_SUCCESS);
345     conference->SetConferenceState(ConferenceState::CONFERENCE_STATE_CREATING);
346     ASSERT_EQ(conference->JoinToConference(VALID_CALLID), TELEPHONY_SUCCESS);
347     ASSERT_EQ(conference->GetSubCallIdList(VALID_CALLID, callIdList), TELEPHONY_SUCCESS);
348     ASSERT_EQ(conference->GetCallIdListForConference(VALID_CALLID, callIdList), TELEPHONY_SUCCESS);
349     ASSERT_EQ(conference->CanSeparateConference(), TELEPHONY_SUCCESS);
350     ASSERT_EQ(conference->CanKickOutFromConference(), TELEPHONY_SUCCESS);
351     ASSERT_EQ(conference->HoldConference(VALID_CALLID), TELEPHONY_SUCCESS);
352     ASSERT_EQ(conference->SetMainCall(VALID_CALLID), TELEPHONY_SUCCESS);
353     ASSERT_EQ(conference->JoinToConference(VALID_CALLID), TELEPHONY_SUCCESS);
354     ASSERT_EQ(conference->LeaveFromConference(VALID_CALLID), TELEPHONY_SUCCESS);
355 }
356 
357 /**
358  * @tc.number   Telephony_CallAbilityReportProxy_001
359  * @tc.name     test error branch
360  * @tc.desc     Function test
361  */
362 HWTEST_F(ZeroBranch5Test, Telephony_CallAbilityReportProxy_001, Function | MediumTest | Level3)
363 {
364     CallAbilityConnectCallback callAbilityConnectCallback;
365     callAbilityConnectCallback.ReConnectAbility();
366     if (CallObjectManager::HasCallExist()) {
367         callAbilityConnectCallback.ReConnectAbility();
368     }
369     CallConnectAbility callConnectCalluiAbility;
370     ASSERT_FALSE(callConnectCalluiAbility.WaitForConnectResult());
371     std::shared_ptr<CallAbilityReportProxy> callAbilityReportProxy = std::make_shared<CallAbilityReportProxy>();
372     sptr<ICallAbilityCallback> callAbilityCallbackPtr = nullptr;
373     std::string pidName = "123";
374     ASSERT_NE(callAbilityReportProxy->RegisterCallBack(callAbilityCallbackPtr, pidName), TELEPHONY_SUCCESS);
375     ASSERT_NE(callAbilityReportProxy->UnRegisterCallBack(pidName), TELEPHONY_SUCCESS);
376     sptr<IRemoteObject> object = nullptr;
377     ASSERT_NE(callAbilityReportProxy->UnRegisterCallBack(object), TELEPHONY_SUCCESS);
378     sptr<CallBase> callObjectPtr = nullptr;
379     callAbilityReportProxy->CallStateUpdated(
380         callObjectPtr, TelCallState::CALL_STATUS_INCOMING, TelCallState::CALL_STATUS_INCOMING);
381     callAbilityCallbackPtr = new CallAbilityCallback();
382     ASSERT_EQ(callAbilityReportProxy->RegisterCallBack(callAbilityCallbackPtr, pidName), TELEPHONY_SUCCESS);
383     DisconnectedDetails disconnectedDetails;
384     callAbilityReportProxy->CallDestroyed(disconnectedDetails);
385     CallAttributeInfo callAttributeInfo;
386     callAbilityReportProxy->ReportCallStateInfo(callAttributeInfo);
387     callAbilityReportProxy->ReportCallStateInfo(callAttributeInfo, pidName);
388     CallEventInfo callEventInfo;
389     callAbilityReportProxy->CallEventUpdated(callEventInfo);
390     callAbilityReportProxy->ReportCallEvent(callEventInfo);
391     CallResultReportId reportId = CallResultReportId::GET_CALL_CLIP_ID;
392     AppExecFwk::PacMap resultInfo;
393     callAbilityReportProxy->ReportAsyncResults(reportId, resultInfo);
394     MmiCodeInfo mmiCodeInfo;
395     callAbilityReportProxy->ReportMmiCodeResult(mmiCodeInfo);
396     OttCallRequestId ottReportId = OttCallRequestId::OTT_REQUEST_ANSWER;
397     callAbilityReportProxy->OttCallRequest(ottReportId, resultInfo);
398     callAbilityReportProxy->ReportPostDialDelay(TEST_STR);
399     std::string ottBundleName = "com.ohos.callservice";
400     sptr<CallAbilityCallback> ottCallAbilityCallbackPtr = new CallAbilityCallback();
401     ASSERT_EQ(callAbilityReportProxy->RegisterCallBack(ottCallAbilityCallbackPtr, ottBundleName), TELEPHONY_SUCCESS);
402     callAbilityReportProxy->OttCallRequest(ottReportId, resultInfo);
403     ASSERT_EQ(callAbilityReportProxy->UnRegisterCallBack(ottBundleName), TELEPHONY_SUCCESS);
404     CallMediaModeInfo imsCallModeInfo;
405     callAbilityReportProxy->ReportImsCallModeChange(imsCallModeInfo);
406     CallSessionEvent callSessionEventOptions;
407     callAbilityReportProxy->ReportCallSessionEventChange(callSessionEventOptions);
408     PeerDimensionsDetail peerDimensionsDetail;
409     callAbilityReportProxy->ReportPeerDimensionsChange(peerDimensionsDetail);
410 }
411 
412 /**
413  * @tc.number   Telephony_CallAbilityReportProxy_002
414  * @tc.name     test error branch
415  * @tc.desc     Function test
416  */
417 HWTEST_F(ZeroBranch5Test, Telephony_CallAbilityReportProxy_002, Function | MediumTest | Level3)
418 {
419     CallAbilityConnectCallback callAbilityConnectCallback;
420     callAbilityConnectCallback.ReConnectAbility();
421     if (CallObjectManager::HasCallExist()) {
422         callAbilityConnectCallback.ReConnectAbility();
423     }
424     CallConnectAbility callConnectCalluiAbility;
425     callConnectCalluiAbility.WaitForConnectResult();
426     std::shared_ptr<CallAbilityReportProxy> callAbilityReportProxy = std::make_shared<CallAbilityReportProxy>();
427     ASSERT_NE(callAbilityReportProxy, nullptr);
428     int64_t dataUsage = 0;
429     std::string pidName = "123";
430     ASSERT_NE(callAbilityReportProxy->ReportCallDataUsageChange(dataUsage), TELEPHONY_SUCCESS);
431     CameraCapabilities cameraCapabilities;
432     ASSERT_NE(callAbilityReportProxy->ReportCameraCapabilities(cameraCapabilities), TELEPHONY_SUCCESS);
433     ASSERT_NE(callAbilityReportProxy->UnRegisterCallBack(pidName), TELEPHONY_SUCCESS);
434 }
435 
436 /**
437  * @tc.number   Telephony_CallAbilityReportProxy_003
438  * @tc.name     test error branch
439  * @tc.desc     Function test
440  */
441 HWTEST_F(ZeroBranch5Test, Telephony_CallAbilityReportProxy_003, Function | MediumTest | Level3)
442 {
443     CallAttributeInfo callAttributeInfo;
444     std::shared_ptr<CallAbilityReportProxy> callAbilityReportProxy = std::make_shared<CallAbilityReportProxy>();
445     EXPECT_EQ(callAbilityReportProxy->ReportMeeTimeStateInfo(callAttributeInfo), TELEPHONY_ERR_FAIL);
446 }
447 
448 /**
449  * @tc.number   Telephony_CallAbilityConnectCallback_001
450  * @tc.name     test error branch
451  * @tc.desc     Function test
452  */
453 HWTEST_F(ZeroBranch5Test, Telephony_CallAbilityConnectCallback_001, Function | MediumTest | Level3)
454 {
455     CallAbilityConnectCallback callAbilityConnectCallback;
456     callAbilityConnectCallback.ReConnectAbility();
457     if (CallObjectManager::HasCallExist()) {
458         callAbilityConnectCallback.ReConnectAbility();
459     }
460     std::string bundle = "111";
461     std::string ability = "222";
462     AppExecFwk::ElementName element("", bundle, ability);
463     int resultCode = 0;
464     callAbilityConnectCallback.OnAbilityConnectDone(element, nullptr, resultCode);
465     ASSERT_EQ(resultCode, 0);
466     callAbilityConnectCallback.OnAbilityDisconnectDone(element, resultCode);
467     ASSERT_EQ(resultCode, 0);
468 }
469 
470 /**
471  * @tc.number   Telephony_AutoAnswerState_001
472  * @tc.name     test error branch
473  * @tc.desc     Function test
474  */
475 HWTEST_F(ZeroBranch5Test, Telephony_AutoAnswerState_001, Function | MediumTest | Level3)
476 {
477     bool flag = true;
478     sptr<CallBase> callObjectPtr = nullptr;
479     DialParaInfo dialParaInfo;
480     dialParaInfo.callType = CallType::TYPE_IMS;
481     dialParaInfo.callState = TelCallState::CALL_STATUS_INCOMING;
482     callObjectPtr = new IMSCall(dialParaInfo);
483     ASSERT_TRUE(callObjectPtr != nullptr);
484     callObjectPtr->SetAutoAnswerState(flag);
485     ASSERT_EQ(callObjectPtr->GetAutoAnswerState(), true);
486 }
487 
488 /**
489  * @tc.number   Telephony_CanUnHoldState_001
490  * @tc.name     test error branch
491  * @tc.desc     Function test
492  */
493 HWTEST_F(ZeroBranch5Test, Telephony_CanUnHoldState_001, Function | MediumTest | Level3)
494 {
495     bool flag = true;
496     sptr<CallBase> callObjectPtr = nullptr;
497     DialParaInfo dialParaInfo;
498     dialParaInfo.callType = CallType::TYPE_IMS;
499     dialParaInfo.callState = TelCallState::CALL_STATUS_INCOMING;
500     callObjectPtr = new IMSCall(dialParaInfo);
501     ASSERT_TRUE(callObjectPtr != nullptr);
502     callObjectPtr->SetCanUnHoldState(flag);
503     ASSERT_EQ(callObjectPtr->GetCanUnHoldState(), true);
504 }
505 
506 /**
507  * @tc.number   Telephony_SatelliteCall_001
508  * @tc.name     test error branch
509  * @tc.desc     Function test
510  */
511 HWTEST_F(ZeroBranch5Test, Telephony_SatelliteCall_001, Function | MediumTest | Level3)
512 {
513     DialParaInfo dialParaInfo;
514     SatelliteCall call { dialParaInfo };
515     int32_t ret1 = call.DialingProcess();
516     int32_t ret2 = call.AnswerCall(0);
517     int32_t ret3 = call.RejectCall();
518     int32_t ret4 = call.HangUpCall();
519     CallAttributeInfo callAttributeInfo;
520     call.GetCallAttributeInfo(callAttributeInfo);
521     EXPECT_EQ(ret1, TELEPHONY_SUCCESS);
522     EXPECT_NE(ret2, TELEPHONY_SUCCESS);
523     EXPECT_NE(ret3, TELEPHONY_SUCCESS);
524     EXPECT_NE(ret4, TELEPHONY_SUCCESS);
525 }
526 
527 /**
528  * @tc.number   Telephony_VoipCallManagerProxy_001
529  * @tc.name     test error branch
530  * @tc.desc     Function test
531  */
532 HWTEST_F(ZeroBranch5Test, Telephony_VoipCallManagerProxy_001, Function | MediumTest | Level3)
533 {
534     sptr<ISystemAbilityManager> managerPtr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
535     sptr<IVoipCallManagerService> voipCallManagerInterfacePtr = nullptr;
536     if (managerPtr != nullptr) {
537         sptr<IRemoteObject> iRemoteObjectPtr = managerPtr->GetSystemAbility(TELEPHONY_CALL_MANAGER_SYS_ABILITY_ID);
538         if (iRemoteObjectPtr != nullptr) {
539             voipCallManagerInterfacePtr = iface_cast<IVoipCallManagerService>(iRemoteObjectPtr);
540         }
541     }
542     AppExecFwk::PacMap mPacMap;
543     ErrorReason error = ErrorReason::VOIP_CALL_EXISTS;
544     if (voipCallManagerInterfacePtr != nullptr) {
545         std::vector<uint8_t> userProfile = { 0 };
546         int32_t ret1 = voipCallManagerInterfacePtr->ReportIncomingCall(mPacMap, userProfile, error);
547         int32_t ret2 = voipCallManagerInterfacePtr->ReportIncomingCallError(mPacMap);
548         VoipCallState voipCallState = VoipCallState::VOIP_CALL_STATE_ACTIVE;
549         VoipCallType voipCallType = VoipCallType::VOIP_CALL_VOICE;
550         std::string callId = "123";
551         int32_t ret3 = voipCallManagerInterfacePtr->ReportCallStateChange(callId, voipCallState, voipCallType);
552         int32_t ret4 = voipCallManagerInterfacePtr->UnRegisterCallBack();
553         std::string bundleName = " ";
554         std::string processMode = "0";
555         int32_t uid = 0;
556         int32_t ret5 = voipCallManagerInterfacePtr->ReportVoipIncomingCall(callId, bundleName, processMode, uid);
557         std::string extensionId = " ";
558         int32_t ret6 = voipCallManagerInterfacePtr->ReportVoipCallExtensionId(callId, bundleName, extensionId, uid);
559         VoipCallEventInfo voipCallEventInfo;
560         voipCallEventInfo.voipCallId = "123";
561         int32_t ret7 = voipCallManagerInterfacePtr->Answer(voipCallEventInfo,
562             static_cast<int32_t>(VideoStateType::TYPE_VOICE));
563         int32_t ret8 = voipCallManagerInterfacePtr->HangUp(voipCallEventInfo);
564         int32_t ret9 = voipCallManagerInterfacePtr->Reject(voipCallEventInfo);
565         int32_t ret10 = voipCallManagerInterfacePtr->UnloadVoipSa();
566         sptr<ICallStatusCallback> statusCallback = (std::make_unique<CallStatusCallback>()).release();
567         int32_t ret11 = voipCallManagerInterfacePtr->RegisterCallManagerCallBack(statusCallback);
568         int32_t ret12 = voipCallManagerInterfacePtr->UnRegisterCallManagerCallBack();
569         EXPECT_NE(ret1, TELEPHONY_SUCCESS);
570         EXPECT_NE(ret2, TELEPHONY_SUCCESS);
571         EXPECT_NE(ret3, TELEPHONY_SUCCESS);
572         EXPECT_NE(ret4, TELEPHONY_SUCCESS);
573         EXPECT_NE(ret5, TELEPHONY_SUCCESS);
574         EXPECT_NE(ret6, TELEPHONY_SUCCESS);
575         EXPECT_NE(ret7, TELEPHONY_SUCCESS);
576         EXPECT_NE(ret8, TELEPHONY_SUCCESS);
577         EXPECT_NE(ret9, TELEPHONY_SUCCESS);
578         EXPECT_NE(ret10, TELEPHONY_SUCCESS);
579         EXPECT_NE(ret11, TELEPHONY_SUCCESS);
580         EXPECT_NE(ret12, TELEPHONY_SUCCESS);
581     }
582 }
583 
584 /**
585  * @tc.number   Telephony_CallRequestEventHandlerHelper_001
586  * @tc.name     test error branch
587  * @tc.desc     Function test
588  */
589 HWTEST_F(ZeroBranch5Test, Telephony_CallRequestEventHandlerHelper_001, Function | MediumTest | Level3)
590 {
591     bool flag = false;
592     DelayedSingleton<CallRequestEventHandlerHelper>::GetInstance()->RestoreDialingFlag(flag);
593     EXPECT_FALSE(DelayedSingleton<CallRequestEventHandlerHelper>::GetInstance()->IsDialingCallProcessing());
594 }
595 
596 /**
597  * @tc.number   Telephony_DistributedCallManager_001
598  * @tc.name     test error branch
599  * @tc.desc     Function test
600  */
601 HWTEST_F(ZeroBranch5Test, Telephony_DistributedCallManager_001, Function | MediumTest | Level3)
602 {
603     DistributedCallManager manager;
604     AudioDevice device;
605     std::string deviceId = "{ \"devIds\": \"101\" }";
606     device.deviceType = AudioDeviceType::DEVICE_EARPIECE;
607     std::string restr = manager.GetDevIdFromAudioDevice(device);
608     EXPECT_FALSE(manager.IsSelectVirtualModem());
609     EXPECT_TRUE(manager.SwitchOnDCallDeviceSync(device));
610     device.deviceType = AudioDeviceType::DEVICE_DISTRIBUTED_PHONE;
611     std::string devId = "";
612     std::vector<std::string> devices;
613     devices.push_back("TEST_STR");
614     manager.CreateDAudioDevice(devId, device);
615     manager.CreateDAudioDevice(TEST_STR, device);
616     manager.dcallProxy_ = std::make_shared<DistributedCallProxy>();
617     manager.CreateDAudioDevice(TEST_STR, device);
618     manager.AddDCallDevice(TEST_STR);
619     manager.RemoveDCallDevice(TEST_STR);
620     manager.onlineDCallDevices_.insert(std::make_pair(TEST_STR, device));
621     manager.AddDCallDevice(TEST_STR);
622     manager.RemoveDCallDevice(TEST_STR);
623     manager.GetConnectedDCallDeviceId();
624     manager.SwitchOffDCallDeviceSync();
625     manager.dCallDeviceSwitchedOn_.store(true);
626     manager.SwitchOffDCallDeviceSync();
627     manager.GetConnectedDCallDeviceId();
628     manager.GetConnectedDCallDevice(device);
629     manager.SetConnectedDCallDevice(device);
630     manager.ClearConnectedDCallDevice();
631     manager.IsSelectVirtualModem();
632     manager.SwitchOnDCallDeviceSync(device);
633     manager.OnDCallSystemAbilityAdded(TEST_STR);
634     manager.IsDistributedCarDeviceOnline();
635     manager.ReportDistributedDeviceInfoForSwitchOff();
636     manager.NotifyOnlineDCallDevices(devices);
637     manager.RemoveDCallDevice(TEST_STR);
638     device.deviceType = AudioDeviceType::DEVICE_DISTRIBUTED_PHONE;
639     ASSERT_EQ(memcpy_s(device.address, kMaxAddressLen + 1, deviceId.c_str(), deviceId.size()), EOK);
640     manager.GetDevIdFromAudioDevice(device);
641     deviceId = "{ \"devId\": \"101\" }";
642     ASSERT_EQ(memcpy_s(device.address, kMaxAddressLen + 1, deviceId.c_str(), deviceId.size()), EOK);
643     manager.GetDevIdFromAudioDevice(device);
644     EXPECT_TRUE(restr.empty());
645 }
646 
647 /**
648  * @tc.number   Telephony_DistributedCallManager_002
649  * @tc.name     test normal branch
650  * @tc.desc     Function test
651  */
652 HWTEST_F(ZeroBranch5Test, Telephony_DistributedCallManager_002, Function | MediumTest | Level3)
653 {
654     DistributedCallManager manager;
655     AudioDevice device;
656     std::string deviceId = "";
657     DialParaInfo dialParaInfo;
658     sptr<CallBase> call = new IMSCall(dialParaInfo);
659     manager.statusChangeListener_ = nullptr;
660     manager.Init();
661     manager.statusChangeListener_ = new (std::nothrow) DCallSystemAbilityListener();
662     manager.Init();
663     manager.AddDCallDevice(LONG_STR);
664     manager.RemoveDCallDevice(LONG_STR);
665     manager.ClearDCallDevices();
666     manager.GetConnectedDCallDeviceType();
667     manager.isCallActived_.store(false);
668     ASSERT_TRUE(manager.SwitchOnDCallDeviceSync(device));
669     manager.isCallActived_.store(true);
670     device.deviceType = AudioDeviceType::DEVICE_UNKNOWN;
671     ASSERT_FALSE(manager.SwitchOnDCallDeviceSync(device));
672 
673     device.deviceType = AudioDeviceType::DEVICE_DISTRIBUTED_PHONE;
674     ASSERT_EQ(memcpy_s(device.address, kMaxAddressLen + 1, deviceId.c_str(), deviceId.size()), EOK);
675     ASSERT_FALSE(manager.SwitchOnDCallDeviceSync(device));
676 
677     deviceId = "{ \"devId\": \"101\" }";
678     ASSERT_EQ(memcpy_s(device.address, kMaxAddressLen + 1, deviceId.c_str(), deviceId.size()), EOK);
679     manager.dcallProxy_ = nullptr;
680     manager.SwitchOnDCallDeviceSync(device);
681     manager.dcallProxy_ = std::make_shared<DistributedCallProxy>();
682     manager.SwitchOnDCallDeviceSync(device);
683     manager.SetCallState(false);
684     manager.DealDisconnectCall();
685     manager.onlineDCallDevices_["101"] = device;
686     ASSERT_TRUE(manager.IsDistributedCarDeviceOnline());
687     manager.onlineDCallDevices_.clear();
688     ASSERT_FALSE(manager.IsDistributedCarDeviceOnline());
689     CallObjectManager::callObjectPtrList_.clear();
690     ASSERT_FALSE(manager.isCeliaCall());
691     call->callType_ = CallType::TYPE_IMS;
692     call->callState_ = TelCallState::CALL_STATUS_WAITING;
693     call->celiaCallType_ = IS_CELIA_CALL;
694     CallObjectManager::callObjectPtrList_.push_back(call);
695     EXPECT_TRUE(manager.isCeliaCall());
696     manager.SwitchOnDCallDeviceAsync(device); // is celia call, return
697     CallObjectManager::callObjectPtrList_.clear();
698     call->celiaCallType_ = IS_CELIA_CALL + 1;
699     CallObjectManager::callObjectPtrList_.push_back(call);
700     EXPECT_FALSE(manager.isCeliaCall());
701     manager.SwitchOnDCallDeviceAsync(device); // not celia call
702     CallObjectManager::callObjectPtrList_.clear();
703 }
704 
705 /**
706  * @tc.number   Telephony_DistributedCallManager_003
707  * @tc.name     test normal branch
708  * @tc.desc     Function test
709  */
710 HWTEST_F(ZeroBranch5Test, Telephony_DistributedCallManager_003, Function | MediumTest | Level3)
711 {
712     AudioDevice device;
713     std::string deviceId = "";
714     DistributedCallManager manager;
715     auto listener = new (std::nothrow) DCallSystemAbilityListener();
716     manager.onlineDCallDevices_.clear();
717     ASSERT_FALSE(manager.IsSelectVirtualModem());
718     manager.onlineDCallDevices_["101"] = device;
719     manager.dcallProxy_ = nullptr;
720     ASSERT_FALSE(manager.IsSelectVirtualModem());
721     manager.dcallProxy_ = std::make_shared<DistributedCallProxy>();
722     manager.IsSelectVirtualModem();
723     manager.onlineDCallDevices_.clear();
724 
725     manager.IsDCallDeviceSwitchedOn();
726     manager.OnDCallSystemAbilityRemoved(deviceId);
727     listener->OnAddSystemAbility(-1, deviceId); // invalid sa id
728     listener->OnAddSystemAbility(TELEPHONY_EXT_SA_ID, deviceId);
729     listener->OnAddSystemAbility(DISTRIBUTED_CALL_SOURCE_SA_ID, deviceId);
730     listener->OnRemoveSystemAbility(-1, deviceId);
731     listener->OnRemoveSystemAbility(TELEPHONY_EXT_SA_ID, deviceId);
732     listener->OnRemoveSystemAbility(DISTRIBUTED_CALL_SOURCE_SA_ID, deviceId);
733     ASSERT_EQ(memcpy_s(device.address, kMaxAddressLen + 1, deviceId.c_str(), deviceId.size()), EOK);
734     manager.SetCallState(true);
735     manager.ReportDistributedDeviceInfo(device);
736     ASSERT_TRUE(manager.isCallActived_);
737 }
738 
739 /**
740  * @tc.number   Telephony_DistributedCallProxy_001
741  * @tc.name     test error branch
742  * @tc.desc     Function test
743  */
744 HWTEST_F(ZeroBranch5Test, Telephony_DistributedCallProxy_001, Function | MediumTest | Level3)
745 {
746     std::unique_ptr<DistributedCallProxy> proxy = std::make_unique<DistributedCallProxy>();
747     std::shared_ptr<OHOS::DistributedHardware::IDCallDeviceCallback> callback = nullptr;
748     std::string name = "123";
749     proxy->GetDCallClient();
750     proxy->RegisterDeviceCallback(name, callback);
751     proxy->UnRegisterDeviceCallback(name);
752     int32_t res = proxy->Init();
753     proxy->GetDCallClient();
754     proxy->dcallClient_ = nullptr;
755     int32_t res1 = proxy->UnInit();
756     bool res2 = proxy->IsSelectVirtualModem();
757     int32_t res3 = proxy->SwitchDevice(TEST_STR, 1);
758     std::vector<std::string> devList;
759     int32_t res4 = proxy->GetOnlineDeviceList(devList);
760     OHOS::DistributedHardware::DCallDeviceInfo devInfo;
761     int32_t res5 = proxy->GetDCallDeviceInfo(TEST_STR, devInfo);
762     proxy->GetDCallClient();
763     proxy->IsSelectVirtualModem();
764     int32_t res6 = proxy->SwitchDevice(TEST_STR, 1);
765     int32_t res7 = proxy->GetOnlineDeviceList(devList);
766     proxy->GetDCallDeviceInfo(TEST_STR, devInfo);
767     int32_t res8 = proxy->UnInit();
768     proxy->GetDCallClient();
769     proxy->UnInit();
770     proxy->SwitchDevice(TEST_STR, 1);
771     proxy->GetDCallDeviceInfo(TEST_STR, devInfo);
772     proxy->RegisterDeviceCallback(name, callback);
773     proxy->UnRegisterDeviceCallback(name);
774     proxy->GetDCallDeviceInfo(TEST_STR, devInfo);
775     proxy->IsSelectVirtualModem();
776     EXPECT_NE(res, TELEPHONY_SUCCESS);
777     EXPECT_NE(res1, TELEPHONY_SUCCESS);
778     EXPECT_FALSE(res2);
779     EXPECT_NE(res3, TELEPHONY_SUCCESS);
780     EXPECT_NE(res4, TELEPHONY_SUCCESS);
781     EXPECT_NE(res5, TELEPHONY_SUCCESS);
782     EXPECT_NE(res6, TELEPHONY_SUCCESS);
783     EXPECT_NE(res7, TELEPHONY_SUCCESS);
784     EXPECT_NE(res8, TELEPHONY_SUCCESS);
785 }
786 
787 /**
788  * @tc.number   Telephony_BluetoothCallManager_001
789  * @tc.name     test error branch
790  * @tc.desc     Function test
791  */
792 HWTEST_F(ZeroBranch5Test, Telephony_BluetoothCallManager_001, Function | MediumTest | Level3)
793 {
794     int32_t state = 0;
795     int32_t numActive = CallObjectManager::GetCallNum(TelCallState::CALL_STATUS_ACTIVE);
796     int32_t numHeld = CallObjectManager::GetCallNum(TelCallState::CALL_STATUS_HOLDING);
797     int32_t numDial = CallObjectManager::GetCallNum(TelCallState::CALL_STATUS_DIALING);
798     int32_t callState = static_cast<int32_t>(TelCallState::CALL_STATUS_IDLE);
799     std::string number = CallObjectManager::GetCallNumber(TelCallState::CALL_STATUS_HOLDING);
800     BluetoothCallManager bluetoothCallManager;
801     ASSERT_EQ(bluetoothCallManager.SendBtCallState(numActive, numHeld, callState, number), TELEPHONY_SUCCESS);
802     ASSERT_EQ(bluetoothCallManager.SendCallDetailsChange(1, 1), TELEPHONY_SUCCESS);
803     ASSERT_NE(bluetoothCallManager.IsBtAvailble(), true);
804     bluetoothCallManager.btConnection_ = nullptr;
805     EXPECT_FALSE(bluetoothCallManager.IsBtAvailble());
806     EXPECT_FALSE(bluetoothCallManager.SendBtCallState(numActive, numHeld, callState, number));
807     EXPECT_FALSE(bluetoothCallManager.SendCallDetailsChange(1, 1));
808 }
809 
810 /**
811  * @tc.number   Telephony_CallAbilityCallbackDeathRecipient_001
812  * @tc.name     test error branch
813  * @tc.desc     Function test
814  */
815 HWTEST_F(ZeroBranch5Test, Telephony_CallAbilityCallbackDeathRecipient_001, Function | MediumTest | Level3)
816 {
817     CallAbilityCallbackDeathRecipient recipient;
818     OHOS::wptr<OHOS::IRemoteObject> object;
819     recipient.OnRemoteDied(object);
820     ASSERT_EQ(object, nullptr);
821 }
822 
823 /**
824  * @tc.number   Telephony_ApplicationStateObserver_001
825  * @tc.name     test error branch
826  * @tc.desc     Function test
827  */
828 HWTEST_F(ZeroBranch5Test, Telephony_ApplicationStateObserver_001, Function | MediumTest | Level3)
829 {
830     ApplicationStateObserver applicationStateObserver;
831     AppExecFwk::ProcessData processData;
832     applicationStateObserver.OnProcessDied(processData);
833     ASSERT_NE(sizeof(processData), 0);
834 }
835 
836 /**
837  * @tc.number   Telephony_CallAbilityCallbackProxy_001
838  * @tc.name     test error branch
839  * @tc.desc     Function test
840  */
841 HWTEST_F(ZeroBranch5Test, Telephony_CallAbilityCallbackProxy_001, Function | MediumTest | Level3)
842 {
843     sptr<IRemoteObject> impl;
844     CallAbilityCallbackProxy callAbilityCallbackProxy(impl);
845     CallAttributeInfo callAttributeInfo;
846     callAbilityCallbackProxy.OnCallDetailsChange(callAttributeInfo);
847     callAbilityCallbackProxy.OnMeeTimeDetailsChange(callAttributeInfo);
848     CallEventInfo info;
849     callAbilityCallbackProxy.OnCallEventChange(info);
850     DisconnectedDetails details;
851     callAbilityCallbackProxy.OnCallDisconnectedCause(details);
852     AppExecFwk::PacMap resultInfo;
853 
854     callAbilityCallbackProxy.OnReportAsyncResults(CallResultReportId::GET_CALL_CLIP_ID, resultInfo);
855     MmiCodeInfo mmiCodeInfo;
856     callAbilityCallbackProxy.OnReportMmiCodeResult(mmiCodeInfo);
857     callAbilityCallbackProxy.OnOttCallRequest(OttCallRequestId::OTT_REQUEST_ANSWER, resultInfo);
858     CallMediaModeInfo imsCallModeInfo;
859     callAbilityCallbackProxy.OnReportImsCallModeChange(imsCallModeInfo);
860     CallSessionEvent callSessionEventOptions;
861     callAbilityCallbackProxy.OnReportCallSessionEventChange(callSessionEventOptions);
862     PeerDimensionsDetail peerDimensionsDetail;
863     callAbilityCallbackProxy.OnReportPeerDimensionsChange(peerDimensionsDetail);
864     int64_t dataUsage = 0;
865     callAbilityCallbackProxy.OnReportCallDataUsageChange(dataUsage);
866     CameraCapabilities cameraCapabilities;
867     callAbilityCallbackProxy.OnReportCameraCapabilities(cameraCapabilities);
868 
869     AudioDeviceInfo audioDeviceInfo;
870     callAbilityCallbackProxy.OnReportAudioDeviceChange(audioDeviceInfo);
871     const std::string str {"123"};
872     callAbilityCallbackProxy.OnReportPostDialDelay(str);
873     ASSERT_TRUE(!str.empty());
874 }
875 
876 /**
877  * @tc.number   Telephony_OTTCallConnection_001
878  * @tc.name     test error branch
879  * @tc.desc     Function test
880  */
881 HWTEST_F(ZeroBranch5Test, Telephony_OTTCallConnection_001, Function | MediumTest | Level3)
882 {
883     OTTCallConnection ott;
884     OttCallRequestInfo requestInfo;
885     ott.Answer(requestInfo);
886     ott.HoldCall(requestInfo);
887     ott.HangUp(requestInfo);
888     ott.Reject(requestInfo);
889     ott.UnHoldCall(requestInfo);
890     ott.SwitchCall(requestInfo);
891     ott.CombineConference(requestInfo);
892     ott.SeparateConference(requestInfo);
893     ott.KickOutFromConference(requestInfo);
894     std::vector<std::string> numberList;
895     int32_t result = ott.InviteToConference(requestInfo, numberList);
896     ott.UpdateImsCallMode(requestInfo, ImsCallMode::CALL_MODE_AUDIO_ONLY);
897     AppExecFwk::PacMap info;
898     ott.PackCellularCallInfo(requestInfo, info);
899     ASSERT_NE(result, TELEPHONY_SUCCESS);
900 }
901 
902 /**
903  * @tc.number   Telephony_SuperPrivacyManagerClient_001
904  * @tc.name     test error branch
905  * @tc.desc     Function test
906  */
907 HWTEST_F(ZeroBranch5Test, Telephony_SuperPrivacyManagerClient_001, Function | MediumTest | Level3)
908 {
909     int32_t privacy = SuperPrivacyManagerClient::GetInstance().
910         SetSuperPrivacyMode(static_cast<int32_t>(CallSuperPrivacyModeType::OFF), SOURCE_CALL);
911 #ifdef CALL_MANAGER_AUTO_START_OPTIMIZE
912     ASSERT_EQ(privacy, 22);
913 #else
914     ASSERT_EQ(privacy, 0);
915 #endif
916 }
917 
918 /**
919  * @tc.number   Telephony_CallStatusCallback_001
920  * @tc.name     test error branch
921  * @tc.desc     Function test
922  */
923 HWTEST_F(ZeroBranch5Test, Telephony_CallStatusCallback_001, Function | MediumTest | Level3)
924 {
925     auto callStatusCallback = std::make_shared<CallStatusCallback>();
926     CallReportInfo callReportInfo;
927     callStatusCallback->UpdateCallReportInfo(callReportInfo);
928     CallsReportInfo callsReportInfo;
929     callStatusCallback->UpdateCallsReportInfo(callsReportInfo);
930     DisconnectedDetails disconnectedDetails;
931     callStatusCallback->UpdateDisconnectedCause(disconnectedDetails);
932     CellularCallEventInfo cellularCallEventIndo;
933     callStatusCallback->UpdateEventResultInfo(cellularCallEventIndo);
934     RBTPlayInfo rbtpPlyaInfo = RBTPlayInfo::LOCAL_ALERTING;
935     callStatusCallback->UpdateRBTPlayInfo(rbtpPlyaInfo);
936     int32_t result = 0;
937     callStatusCallback->StartDtmfResult(result);
938     callStatusCallback->StopDtmfResult(result);
939     callStatusCallback->SendUssdResult(result);
940     callStatusCallback->GetImsCallDataResult(result);
941     CallWaitResponse callWaitResponse;
942     callStatusCallback->UpdateGetWaitingResult(callWaitResponse);
943     callStatusCallback->UpdateSetWaitingResult(result);
944     CallRestrictionResponse callRestrictionResponse;
945     callStatusCallback->UpdateGetRestrictionResult(callRestrictionResponse);
946     callStatusCallback->UpdateSetRestrictionResult(result);
947     callStatusCallback->UpdateSetRestrictionPasswordResult(result);
948     CallTransferResponse callTransferResponse;
949     callStatusCallback->UpdateGetTransferResult(callTransferResponse);
950     callStatusCallback->UpdateSetTransferResult(result);
951     ClipResponse clipResponse;
952     callStatusCallback->UpdateGetCallClipResult(clipResponse);
953     ClirResponse clirResponse;
954     callStatusCallback->UpdateGetCallClirResult(clirResponse);
955     callStatusCallback->UpdateSetCallClirResult(result);
956     callStatusCallback->StartRttResult(result);
957     callStatusCallback->StopRttResult(result);
958     GetImsConfigResponse getImsConfigResponse;
959     callStatusCallback->GetImsConfigResult(getImsConfigResponse);
960     callStatusCallback->SetImsConfigResult(result);
961     GetImsFeatureValueResponse getImsFeatureValueResopnse;
962     callStatusCallback->GetImsFeatureValueResult(getImsFeatureValueResopnse);
963     callStatusCallback->SetImsFeatureValueResult(result);
964     CallModeReportInfo callModeReportInfo;
965     callStatusCallback->ReceiveUpdateCallMediaModeRequest(callModeReportInfo);
966     callStatusCallback->ReceiveUpdateCallMediaModeResponse(callModeReportInfo);
967     callStatusCallback->InviteToConferenceResult(result);
968     MmiCodeInfo mmiCodeInfo;
969     callStatusCallback->SendMmiCodeResult(mmiCodeInfo);
970     int32_t res = callStatusCallback->CloseUnFinishedUssdResult(result);
971     ASSERT_NE(res, TELEPHONY_SUCCESS);
972 }
973 
974 /**
975  * @tc.number   Telephony_CallStatusCallback_002
976  * @tc.name     test error branch
977  * @tc.desc     Function test
978  */
979 HWTEST_F(ZeroBranch5Test, Telephony_CallStatusCallback_002, Function | MediumTest | Level3)
980 {
981     auto callStatusCallback = std::make_shared<CallStatusCallback>();
982     std::string c("a");
983     callStatusCallback->ReportPostDialChar(c);
984     std::string str("abc");
985     callStatusCallback->ReportPostDialDelay(str);
986     CallSessionReportInfo callSessionReportInfo;
987     callStatusCallback->HandleCallSessionEventChanged(callSessionReportInfo);
988     PeerDimensionsReportInfo peerDimensionReportInfo;
989     callStatusCallback->HandlePeerDimensionsChanged(peerDimensionReportInfo);
990     int64_t res = 0;
991     callStatusCallback->HandleCallDataUsageChanged(res);
992     CameraCapabilitiesReportInfo cameraCapabilities;
993     callStatusCallback->HandleCameraCapabilitiesChanged(cameraCapabilities);
994     VoipCallEventInfo voipCallEventInfo;
995     res = callStatusCallback->UpdateVoipEventInfo(voipCallEventInfo);
996     ASSERT_NE(res, TELEPHONY_SUCCESS);
997 }
998 
999 /**
1000  * @tc.number   Telephony_CallStatusCallbackStub_001
1001  * @tc.name     test error branch
1002  * @tc.desc     Function test
1003  */
1004 HWTEST_F(ZeroBranch5Test, Telephony_CallStatusCallbackStub_001, Function | MediumTest | Level3)
1005 {
1006     auto callStatusCallback = std::make_shared<CallStatusCallback>();
1007     MessageParcel data;
1008     MessageParcel reply;
1009     MessageOption option;
1010     data.WriteInterfaceToken(CallStatusCallbackStub::GetDescriptor());
1011     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::UPDATE_CALL_INFO),
1012         data, reply, option);
1013     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::UPDATE_CALLS_INFO),
1014         data, reply, option);
1015     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::UPDATE_DISCONNECTED_CAUSE),
1016         data, reply, option);
1017     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::UPDATE_EVENT_RESULT_INFO),
1018         data, reply, option);
1019     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::UPDATE_RBT_PLAY_INFO),
1020         data, reply, option);
1021     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::UPDATE_GET_WAITING),
1022         data, reply, option);
1023     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::UPDATE_SET_WAITING),
1024         data, reply, option);
1025     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::UPDATE_GET_RESTRICTION),
1026         data, reply, option);
1027     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::UPDATE_SET_RESTRICTION),
1028         data, reply, option);
1029     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::UPDATE_GET_TRANSFER),
1030         data, reply, option);
1031     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::UPDATE_SET_TRANSFER),
1032         data, reply, option);
1033     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::UPDATE_GET_CALL_CLIP),
1034         data, reply, option);
1035     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::UPDATE_GET_CALL_CLIR),
1036         data, reply, option);
1037     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::UPDATE_SET_CALL_CLIR),
1038         data, reply, option);
1039     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::GET_IMS_SWITCH_STATUS),
1040         data, reply, option);
1041     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::SET_IMS_SWITCH_STATUS),
1042         data, reply, option);
1043     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::UPDATE_STARTRTT_STATUS),
1044         data, reply, option);
1045     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::UPDATE_STOPRTT_STATUS),
1046         data, reply, option);
1047     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::GET_IMS_CONFIG),
1048         data, reply, option);
1049     int32_t res =  callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::SET_IMS_CONFIG),
1050         data, reply, option);
1051     ASSERT_NE(res, TELEPHONY_SUCCESS);
1052 }
1053 
1054 /**
1055  * @tc.number   Telephony_CallStatusCallbackStub_002
1056  * @tc.name     test error branch
1057  * @tc.desc     Function test
1058  */
1059 HWTEST_F(ZeroBranch5Test, Telephony_CallStatusCallbackStub_002, Function | MediumTest | Level3)
1060 {
1061     auto callStatusCallback = std::make_shared<CallStatusCallback>();
1062     MessageParcel data;
1063     MessageParcel reply;
1064     MessageOption option;
1065     data.WriteInterfaceToken(CallStatusCallbackStub::GetDescriptor());
1066     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::GET_IMS_FEATURE_VALUE),
1067         data, reply, option);
1068     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::SET_IMS_FEATURE_VALUE),
1069         data, reply, option);
1070     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::GET_LTE_ENHANCE_MODE),
1071         data, reply, option);
1072     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::SET_LTE_ENHANCE_MODE),
1073         data, reply, option);
1074     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(
1075         CallStatusInterfaceCode::RECEIVE_UPDATE_MEDIA_MODE_RESPONSE), data, reply, option);
1076     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::INVITE_TO_CONFERENCE),
1077         data, reply, option);
1078     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::START_DTMF),
1079         data, reply, option);
1080     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::STOP_DTMF),
1081         data, reply, option);
1082     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::SEND_USSD),
1083         data, reply, option);
1084     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::GET_IMS_CALL_DATA),
1085         data, reply, option);
1086     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::MMI_CODE_INFO_RESPONSE),
1087         data, reply, option);
1088     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::CLOSE_UNFINISHED_USSD),
1089         data, reply, option);
1090     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::UPDATE_SET_RESTRICTION_PWD),
1091         data, reply, option);
1092     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::POST_DIAL_CHAR),
1093         data, reply, option);
1094     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::POST_DIAL_DELAY),
1095         data, reply, option);
1096     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::CALL_SESSION_EVENT),
1097         data, reply, option);
1098     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::PEER_DIMENSION_CHANGE),
1099         data, reply, option);
1100     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::CALL_DATA_USAGE),
1101         data, reply, option);
1102     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(CallStatusInterfaceCode::CAMERA_CAPBILITIES_CHANGE),
1103         data, reply, option);
1104     callStatusCallback->OnRemoteRequest(static_cast<uint32_t>(
1105         CallStatusInterfaceCode::RECEIVE_UPDATE_MEDIA_MODE_REQUEST), data, reply, option);
1106     int32_t res = callStatusCallback->OnRemoteRequest(
1107         static_cast<uint32_t>(CallStatusInterfaceCode::UPDATE_VOIP_EVENT_INFO), data, reply, option);
1108     ASSERT_NE(res, TELEPHONY_SUCCESS);
1109 }
1110 
1111 /**
1112  * @tc.number   Telephony_CallStatusCallbackStub_003
1113  * @tc.name     test error branch
1114  * @tc.desc     Function test
1115  */
1116 HWTEST_F(ZeroBranch5Test, Telephony_CallStatusCallbackStub_003, Function | MediumTest | Level3)
1117 {
1118     auto callStatusCallback = std::make_shared<CallStatusCallback>();
1119     MessageParcel data;
1120     MessageParcel reply;
1121     int32_t accountId = 0;
1122     int32_t defaultNumber = 0;
1123     std::string defaultString = "";
1124     std::vector<uint8_t> userProfile = {};
1125     char accountNum[kMaxNumberLen + 1] = { 0 };
1126     data.WriteInterfaceToken(CallStatusCallbackStub::GetDescriptor());
1127     data.WriteInt32(0);
1128     data.WriteCString(accountNum);
1129     data.WriteInt32(accountId);
1130     data.WriteInt32(static_cast<int32_t>(CallType::TYPE_VOIP));
1131     data.WriteInt32(static_cast<int32_t>(VideoStateType::TYPE_VOICE));
1132     data.WriteInt32(static_cast<int32_t>(TelCallState::CALL_STATUS_ACTIVE));
1133     data.WriteInt32(defaultNumber);
1134     data.WriteInt32(defaultNumber);
1135     data.WriteInt32(defaultNumber);
1136     data.WriteInt32(defaultNumber);
1137     data.WriteString(defaultString);
1138     data.WriteString(defaultString);
1139     data.WriteString(defaultString);
1140     data.WriteString(defaultString);
1141     data.WriteString(defaultString);
1142     data.WriteUInt8Vector(userProfile);
1143     data.RewindRead(0);
1144     ASSERT_EQ(callStatusCallback->OnUpdateCallReportInfo(data, reply), TELEPHONY_SUCCESS);
1145 }
1146 } // namespace Telephony
1147 } // namespace OHOS
1148