1 /* 2 * Copyright (C) 2021-2022 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 16 #ifndef CALL_MANAGER_SERVICE_H 17 #define CALL_MANAGER_SERVICE_H 18 19 #include <memory> 20 21 #include "bluetooth_call_manager.h" 22 #include "call_control_manager.h" 23 #include "call_manager_service_stub.h" 24 #include "call_state_report_proxy.h" 25 #include "call_status_manager.h" 26 #include "i_call_status_callback.h" 27 #include "iremote_stub.h" 28 #include "iservice_registry.h" 29 #include "singleton.h" 30 #include "system_ability.h" 31 #include "system_ability_definition.h" 32 #include "bluetooth_call_state.h" 33 34 namespace OHOS { 35 namespace Telephony { 36 class CallManagerService : public SystemAbility, 37 public CallManagerServiceStub, 38 public std::enable_shared_from_this<CallManagerService> { 39 DECLARE_DELAYED_SINGLETON(CallManagerService) 40 DECLARE_SYSTEM_ABILITY(CallManagerService) 41 public: 42 void SetCallStatusManager(std::shared_ptr<CallStatusManager> callStatusManager); 43 bool Init(); 44 void UnInit(); 45 46 /** 47 * service OnStart 48 */ 49 void OnStart() override; 50 51 /** 52 * service OnStop 53 */ 54 void OnStop() override; 55 56 /** 57 * service dump 58 * @param fd 59 * @param args 60 * @return 61 */ 62 int32_t Dump(std::int32_t fd, const std::vector<std::u16string> &args) override; 63 64 /** 65 * Get bindTime_ 66 * @return string 67 */ 68 std::string GetBindTime(); 69 70 /** 71 * Get spendTime_ 72 * @return string 73 */ 74 std::string GetStartServiceSpent(); 75 76 /** 77 * Get serviceRunningState_ 78 * @return serviceRunningState_ 79 */ 80 int32_t GetServiceRunningState(); 81 82 /** 83 * RegisterCallBack 84 * 85 * @brief Register callback 86 * @param callback[in], callback function pointer 87 * @param bundleName[in], bundle name 88 * @return Returns 0 on success, others on failure. 89 */ 90 int32_t RegisterCallBack(const sptr<ICallAbilityCallback> &callback) override; 91 92 /** 93 * UnRegisterCallBack 94 * 95 * @brief unregister callback 96 * @param bundleName[in], bundle name 97 * @return Returns 0 on success, others on failure. 98 */ 99 int32_t UnRegisterCallBack() override; 100 101 /** 102 * ObserverOnCallDetailsChange 103 * 104 * @brief excute when observe OnCallDetailsChange 105 * @return Returns 0 on success, others on failure. 106 */ 107 int32_t ObserverOnCallDetailsChange() override; 108 109 /** 110 * DialCall 111 * 112 * @brief Dial a phone call 113 * @param number[in], dial param. 114 * @param extras[in], extras date. 115 * @return Returns callId when the value is greater than zero, others on failure. 116 */ 117 int32_t DialCall(std::u16string number, AppExecFwk::PacMap &extras) override; 118 119 /** 120 * MakeCall 121 * 122 * @brief Make a phone call 123 * @param number[in], call param. 124 * @return Returns 0 on success, others on failure. 125 */ 126 int32_t MakeCall(std::string number) override; 127 128 /** 129 * AnswerCall 130 * 131 * @brief Answer a phone call 132 * @param callId[in], call id 133 * @param videoState[in], 0: audio, 1: video 134 * @return Returns 0 on success, others on failure. 135 */ 136 int32_t AnswerCall(int32_t callId, int32_t videoState) override; 137 138 /** 139 * RejectCall 140 * 141 * @brief Reject a phone call 142 * @param callId[in], call id 143 * @param rejectWithMessage[in], Whether to enter the reason for rejection,true:yes false:no 144 * @param textMessage[in], The reason you reject the call 145 * @return Returns 0 on success, others on failure. 146 */ 147 int32_t RejectCall(int32_t callId, bool rejectWithMessage, std::u16string textMessage) override; 148 149 /** 150 * HangUpCall 151 * 152 * @brief Hang up the phone 153 * @param callId[in], call id 154 * @return Returns 0 on success, others on failure. 155 */ 156 int32_t HangUpCall(int32_t callId) override; 157 158 /** 159 * GetCallState 160 * 161 * @brief Obtain the call status of the device 162 * @return Returns call state. 163 */ 164 int32_t GetCallState() override; 165 166 /** 167 * HoldCall 168 * 169 * @brief Park a phone call 170 * @param callId[in], call id 171 * @return Returns 0 on success, others on failure. 172 */ 173 int32_t HoldCall(int32_t callId) override; 174 175 /** 176 * UnHoldCall 177 * 178 * @brief Activate a phone call 179 * @param callId[in], call id 180 * @return Returns 0 on success, others on failure. 181 */ 182 int32_t UnHoldCall(int32_t callId) override; 183 184 /** 185 * SwitchCall 186 * 187 * @brief Switch the phone 188 * @param callId[in], call id 189 * @return Returns 0 on success, others on failure. 190 */ 191 int32_t SwitchCall(int32_t callId) override; 192 193 /** 194 * HasCall 195 * 196 * @brief Is there Call 197 * @param isInCludeVoipCall[in], include voip call or not 198 * @return Returns true on has call, others on there is no call. 199 */ 200 bool HasCall(const bool isInCludeVoipCall = true) override; 201 202 /** 203 * IsNewCallAllowed 204 * 205 * @brief Can I initiate a call 206 * @param enabled[out], true on can, others on there is not can 207 * @return Returns interface processing results. 208 */ 209 int32_t IsNewCallAllowed(bool &enabled) override; 210 211 /** 212 * SetMuted 213 * 214 * @brief Mute the Microphone 215 * @param isMute[in], mute state 216 * @return Returns 0 on success, others on failure. 217 */ 218 int32_t SetMuted(bool isMute) override; 219 220 /** 221 * MuteRinger 222 * 223 * @brief Call mute 224 * @return Returns 0 on success, others on failure. 225 */ 226 int32_t MuteRinger() override; 227 228 /** 229 * SetAudioDevice 230 * 231 * @brief Setting the Audio Channel 232 * @param audioDevice[in], contain audioDeviceType ande address 233 * @return Returns 0 on success, others on failure. 234 */ 235 int32_t SetAudioDevice(const AudioDevice &audioDevice) override; 236 237 /** 238 * IsRinging 239 * 240 * @brief Whether the ringing 241 * @param enabled[out], true on ringing, false on there is no ringing 242 * @return Returns interface processing results. 243 */ 244 int32_t IsRinging(bool &enabled) override; 245 246 /** 247 * IsInEmergencyCall 248 * 249 * @brief Is there an emergency call 250 * @param enabled[out], true on emergency call, false on no emergency call 251 * @return Returns interface processing results. 252 */ 253 int32_t IsInEmergencyCall(bool &enabled) override; 254 255 /** 256 * StartDtmf 257 * 258 * @brief Enable and send DTMF 259 * @param callId[in], call id 260 * @param str[in], Characters sent 261 * @return Returns 0 on success, others on failure. 262 */ 263 int32_t StartDtmf(int32_t callId, char str) override; 264 265 /** 266 * StopDtmf 267 * 268 * @brief Stop the DTMF 269 * @param callId[in], call id 270 * @return Returns 0 on success, others on failure. 271 */ 272 int32_t StopDtmf(int32_t callId) override; 273 274 int32_t PostDialProceed(int32_t callId, bool proceed) override; 275 276 /** 277 * GetCallWaiting 278 * 279 * @brief Gets whether the call waiting service of the current account is enabled 280 * @param slotId[in], The slot id 281 * @return Returns 0 on success, others on failure. 282 */ 283 int32_t GetCallWaiting(int32_t slotId) override; 284 285 /** 286 * SetCallWaiting 287 * 288 * @brief Set the call waiting function for the current account 289 * @param slotId[in], The slot id 290 * @param activate[in], Activation of switch 291 * @return Returns 0 on success, others on failure. 292 */ 293 int32_t SetCallWaiting(int32_t slotId, bool activate) override; 294 295 /** 296 * GetCallRestriction 297 * 298 * @brief Gets the call restriction information of the specified account 299 * @param slotId[in], The slot id 300 * @param type[in], Call Restriction type 301 * @return Returns 0 on success, others on failure. 302 */ 303 int32_t GetCallRestriction(int32_t slotId, CallRestrictionType type) override; 304 305 /** 306 * SetCallRestriction 307 * 308 * @brief Set the call restriction function for the current account 309 * @param slotId[in], The slot id 310 * @param info[in], Call restriction information 311 * @return Returns 0 on success, others on failure. 312 */ 313 int32_t SetCallRestriction(int32_t slotId, CallRestrictionInfo &info) override; 314 315 /** 316 * SetCallRestrictionPassword 317 * 318 * @brief Set the call restriction password function for the current account 319 * @param slotId[in], The slot id 320 * @param fac[in], Call restriction type 321 * @param oldPassword[in], Old password of call restriction type 322 * @param newPassword[in], New password of call restriction type 323 * @return Returns 0 on success, others on failure. 324 */ 325 int32_t SetCallRestrictionPassword( 326 int32_t slotId, CallRestrictionType fac, const char *oldPassword, const char *newPassword) override; 327 328 /** 329 * GetCallTransferInfo 330 * 331 * @brief Gets the call transfer information of the current account 332 * @param slotId[in], The slot id 333 * @param type[in], Call Transfer Type 334 * @return Returns 0 on success, others on failure. 335 */ 336 int32_t GetCallTransferInfo(int32_t slotId, CallTransferType type) override; 337 338 /** 339 * SetCallTransferInfo 340 * 341 * @brief Set the call transfer function for the current account 342 * @param slotId[in], The slot id 343 * @param info[in], Call Transfer Information 344 * @return Returns 0 on success, others on failure. 345 */ 346 int32_t SetCallTransferInfo(int32_t slotId, CallTransferInfo &info) override; 347 348 /** 349 * CanSetCallTransferTime 350 * 351 * @brief confirm whether IMS support call transfer due to time. 352 * @param slotId[in], The slot id 353 * @param result[out], The result of support or not 354 * @return Returns 0 on success, others on failure. 355 */ 356 int32_t CanSetCallTransferTime(int32_t slotId, bool &result) override; 357 358 /** 359 * CombineConference 360 * 361 * @brief Merge calls to form a conference 362 * @param callId[in], call id 363 * @return Returns 0 on success, others on failure. 364 */ 365 int32_t CombineConference(int32_t mainCallId) override; 366 367 /** 368 * SeparateConference 369 * 370 * @brief Separates a specified call from a conference call 371 * @param callId[in], call id 372 * @return Returns 0 on success, others on failure. 373 */ 374 int32_t SeparateConference(int32_t callId) override; 375 376 /** 377 * KickOutFromConference 378 * 379 * @brief Hangup a specified call from a conference call 380 * @param callId[in], call id 381 * @return Returns 0 on success, others on failure. 382 */ 383 int32_t KickOutFromConference(int32_t callId) override; 384 385 /** 386 * ControlCamera 387 * 388 * @brief Open or close camera 389 * @param callId[in], call id 390 * @param cameraId[in], The camera id 391 * @return Returns 0 on success, others on failure. 392 */ 393 int32_t ControlCamera(int32_t callId, std::u16string &cameraId) override; 394 395 /** 396 * SetPreviewWindow 397 * 398 * @brief Set the location and size of the preview window for videos captured by the local camera. 399 * @param callId[in], call id 400 * @param surfaceId[in], Window information 401 * @param surface[in], Window information 402 * @return Returns 0 on success, others on failure. 403 */ 404 int32_t SetPreviewWindow(int32_t callId, std::string &surfaceId, sptr<Surface> surface) override; 405 406 /** 407 * SetDisplayWindow 408 * 409 * @brief Sets the location and size of the remote video window. 410 * @param callId[in], call id 411 * @param surfaceId[in], Window information 412 * @param surface[in], Window information 413 * @return Returns 0 on success, others on failure. 414 */ 415 int32_t SetDisplayWindow(int32_t callId, std::string &surfaceId, sptr<Surface> surface) override; 416 417 /** 418 * SetCameraZoom 419 * 420 * @brief Sets the local camera zoom scale 421 * @param zoomRatio[in], Camera scale 422 * @return Returns 0 on success, others on failure. 423 */ 424 int32_t SetCameraZoom(float zoomRatio) override; 425 426 /** 427 * SetPausePicture 428 * 429 * @brief APP sets the screen of the remote video freeze immediately. 430 * If the APP does not call this interface when making a video call, 431 * the last frame before the remote video freeze is displayed by default 432 * @param callId[in], call id 433 * @param path[in], Local Picture address 434 * @return Returns 0 on success, others on failure. 435 */ 436 int32_t SetPausePicture(int32_t callId, std::u16string &path) override; 437 438 /** 439 * SetDeviceDirection 440 * 441 * @brief Set the rotation Angle of the local device. The default value is 0 442 * @param callId[in], call id 443 * @param rotation[in], Rotation Angle 444 * @return Returns 0 on success, others on failure. 445 */ 446 int32_t SetDeviceDirection(int32_t callId, int32_t rotation) override; 447 448 /** 449 * IsEmergencyPhoneNumber 450 * 451 * @brief Is it an emergency call 452 * @param number[in], Phone number to be formatted 453 * @param slotId[in], The slot id 454 * @param enabled[out] result of is it an emergency call 455 * @return Returns 0 on success, others on failure. 456 */ 457 int32_t IsEmergencyPhoneNumber(std::u16string &number, int32_t slotId, bool &enabled) override; 458 459 /** 460 * FormatPhoneNumber 461 * 462 * @brief Formatting a phone number 463 * @param number[in], Phone number to be formatted 464 * @param countryCode[in], Country code of the phone number 465 * @param formatNumber[out] Formatting a phone number 466 * @return Returns 0 on success, others on failure. 467 */ 468 int32_t FormatPhoneNumber( 469 std::u16string &number, std::u16string &countryCode, std::u16string &formatNumber) override; 470 471 /** 472 * FormatPhoneNumberToE164 473 * 474 * @brief Formatting a phone number 475 * @param number[in]. Phone number to be formatted 476 * @param countryCode[in], Country code of the phone number 477 * @param formatNumber[out] Formatting a phone number 478 * @return Returns 0 on success, others on failure. 479 */ 480 int32_t FormatPhoneNumberToE164( 481 std::u16string &number, std::u16string &countryCode, std::u16string &formatNumber) override; 482 483 /** 484 * GetMainCallId 485 * 486 * @brief Obtain the ID of the primary call in a conference 487 * @param callId[in], Id of a call in a conference 488 * @return Returns main call id, -1 on not call id. 489 */ 490 int32_t GetMainCallId(int32_t callId, int32_t &mainCallId) override; 491 492 /** 493 * GetSubCallIdList 494 * 495 * @brief Obtain the list of neutron call ids 496 * @param callId[in], Id of a call in a conference 497 * @param callIdList[out], the list of neutron call ids 498 * @return Returns 0 on success, others on failure. 499 */ 500 int32_t GetSubCallIdList(int32_t callId, std::vector<std::u16string> &callIdList) override; 501 502 /** 503 * GetCallIdListForConference 504 * 505 * @brief Obtain the callId list of all calls in a conference 506 * @param callId[in], Id of a call in a conference 507 * @param callIdList[out], the callId list of all calls in a conference 508 * @return Returns 0 on success, others on failure. 509 */ 510 int32_t GetCallIdListForConference(int32_t callId, std::vector<std::u16string> &callIdList) override; 511 512 /** 513 * SetCallPreferenceMode 514 * 515 * @brief Setting the Call Type 516 * @param slotId[in], The slot id 517 * @param mode[in], Preference Mode 518 * @return Returns 0 on success, others on failure. 519 */ 520 int32_t SetCallPreferenceMode(int32_t slotId, int32_t mode) override; 521 522 /** 523 * GetImsConfig 524 * 525 * @brief Obtain the IMS service configuration 526 * @param slotId[in], The slot id 527 * @param item[in] 528 * @return Returns 0 on success, others on failure. 529 */ 530 int32_t GetImsConfig(int32_t slotId, ImsConfigItem item) override; 531 532 /** 533 * SetImsConfig 534 * 535 * @brief Example Set the IMS service configuration 536 * @param slotId[in], The slot id 537 * @param item[in] 538 * @return Returns 0 on success, others on failure. 539 */ 540 int32_t SetImsConfig(int32_t slotId, ImsConfigItem item, std::u16string &value) override; 541 542 /** 543 * GetImsFeatureValue 544 * 545 * @brief Gets the value of the IMS function item of the specified network type 546 * @param slotId[in], The slot id 547 * @param info[in], FeatureType 548 * @return Returns 0 on success, others on failure. 549 */ 550 int32_t GetImsFeatureValue(int32_t slotId, FeatureType type) override; 551 552 /** 553 * SetImsFeatureValue 554 * 555 * @brief Set the value of the IMS function item of the specified network type 556 * @param slotId[in], The slot id 557 * @param info[in], FeatureType 558 * @param value[in] 559 * @return Returns 0 on success, others on failure. 560 */ 561 int32_t SetImsFeatureValue(int32_t slotId, FeatureType type, int32_t value) override; 562 563 /** 564 * UpdateImsCallMode 565 * 566 * @brief Setting the Call Mode 567 * @param callId[in], The call id 568 * @param mode[in], Calling patterns 569 * @return Returns 0 on success, others on failure. 570 */ 571 int32_t UpdateImsCallMode(int32_t callId, ImsCallMode mode) override; 572 573 /** 574 * EnableImsSwitch 575 * 576 * @brief Start VoLte 577 * @param slotId[in], The slot id 578 * @return Returns 0 on success, others on failure. 579 */ 580 int32_t EnableImsSwitch(int32_t slotId) override; 581 582 /** 583 * DisableImsSwitch 584 * 585 * @brief Stop VoLte 586 * @param slotId[in], The slot id 587 * @return Returns 0 on success, others on failure. 588 */ 589 int32_t DisableImsSwitch(int32_t slotId) override; 590 591 /** 592 * IsImsSwitchEnabled 593 * 594 * @brief Whether to enable VoLte 595 * @param slotId[in], The slot id 596 * @param enabled[out], The result of enable or not 597 * @return Returns 0 on success, others on failure. 598 */ 599 int32_t IsImsSwitchEnabled(int32_t slotId, bool &enabled) override; 600 601 /** 602 * SetVoNRState 603 * 604 * @brief Set VoNR State 605 * @param slotId[in], The slot id 606 * @param state[in], The state of VoNR 607 * @return Returns 0 on success, others on failure. 608 */ 609 int32_t SetVoNRState(int32_t slotId, int32_t state) override; 610 611 /** 612 * GetVoNRState 613 * 614 * @brief Get VoNR State 615 * @param slotId[in], The slot id 616 * @param state[out], The result of VoNR state ON or OFF 617 * @return Returns 0 on success, others on failure. 618 */ 619 int32_t GetVoNRState(int32_t slotId, int32_t &state) override; 620 621 /** 622 * StartRtt 623 * 624 * @brief Enable and send RTT information 625 * @param callId[in], The call id 626 * @param msg[in], RTT information 627 * @return Returns 0 on success, others on failure. 628 */ 629 int32_t StartRtt(int32_t callId, std::u16string &msg) override; 630 631 /** 632 * StopRtt 633 * 634 * @brief Close the RTT 635 * @param callId[in], The call id 636 * @return Returns 0 on success, others on failure. 637 */ 638 int32_t StopRtt(int32_t callId) override; 639 640 /** 641 * JoinConference 642 * 643 * @brief Bring someone into a meeting 644 * @param callId[in], The call id 645 * @param numberList[in], List of calls to join the conference 646 * @return Returns 0 on success, others on failure. 647 */ 648 int32_t JoinConference(int32_t callId, std::vector<std::u16string> &numberList) override; 649 650 /** 651 * ReportOttCallDetailsInfo 652 * 653 * @brief report ott call details info 654 * @param ottVec[in], ott call status detail info list 655 * @return Returns 0 on success, others on failure. 656 */ 657 int32_t ReportOttCallDetailsInfo(std::vector<OttCallDetailsInfo> &ottVec) override; 658 659 /** 660 * ReportOttCallEventInfo 661 * 662 * @brief report ott call details info 663 * @param ottVec[in], ott call status detail info list 664 * @return Returns 0 on success, others on failure. 665 */ 666 int32_t ReportOttCallEventInfo(OttCallEventInfo &eventInfo) override; 667 668 /** 669 * CloseUnFinishedUssd 670 * 671 * @brief Close Unfinished ussd function for the current account 672 * @param slotId[in], The slot id 673 * @return Returns 0 on success, others on failure. 674 */ 675 int32_t CloseUnFinishedUssd(int32_t slotId) override; 676 677 /** 678 * Remove missed incoming call notification. 679 * 680 * @return Returns 0 on success, others on failure. 681 */ 682 int32_t RemoveMissedIncomingCallNotification() override; 683 684 /** 685 * SetVoIPCallState 686 * 687 * @brief Set VoIP Call State 688 * @param state[in], The state of VoIP Call 689 * @return Returns 0 on success, others on failure. 690 */ 691 int32_t SetVoIPCallState(int32_t state) override; 692 693 /** 694 * GetVoIPCallState 695 * 696 * @brief Get VoIP Call State 697 * @param state[out], The result of VoIP Call 698 * @return Returns 0 on success, others on failure. 699 */ 700 int32_t GetVoIPCallState(int32_t &state) override; 701 702 /** 703 * @brief Set VoIP Call info 704 * 705 * @param callId[out] Indicates the VoIP Call id 706 * @param state[out] Indicates the VoIP Call state 707 * @param phoneNumber[out] Indicates the VoIP Call phone number 708 * @return Returns 0 on success, others on failure. 709 */ 710 int32_t SetVoIPCallInfo(int32_t callId, int32_t state, std::string phoneNumber) override; 711 712 /** 713 * @brief Get VoIP Call Switch Status 714 * 715 * @param callId[out] Indicates the VoIP Call id 716 * @param state[out] Indicates the VoIP Call state 717 * @param phoneNumber[out] Indicates the VoIP Call phone number 718 * @return Returns 0 on success, others on failure. 719 */ 720 int32_t GetVoIPCallInfo(int32_t &callId, int32_t &state, std::string &phoneNumber) override; 721 722 /** 723 * Handle special code from dialer. 724 * 725 * @param specialCode[in], special code 726 * @return Returns 0 on success, others on failure. 727 */ 728 int32_t InputDialerSpecialCode(const std::string &specialCode) override; 729 730 /** 731 * GetProxyObjectPtr 732 * 733 * @brief get callManager proxy object ptr 734 * @param proxyType[in], proxy type 735 * @return Returns nullptr on failure, others on success. 736 */ 737 sptr<IRemoteObject> GetProxyObjectPtr(CallManagerProxyType proxyType) override; 738 739 /** 740 * ReportAudioDeviceInfo 741 * 742 * @brief report audio device info 743 * @return Returns 0 on success, others on failure. 744 */ 745 int32_t ReportAudioDeviceInfo() override; 746 747 /** 748 * CancelCallUpgrade 749 * 750 * @brief cancel upgrade to video call 751 * @param callId[in], The call id 752 * 753 * @return Returns 0 on success, others on failure. 754 */ 755 int32_t CancelCallUpgrade(int32_t callId) override; 756 757 /** 758 * RequestCameraCapabilities 759 * 760 * @brief request camera capabilities 761 * @param callId[in], The call id 762 * 763 * @return Returns 0 on success, others on failure. 764 */ 765 int32_t RequestCameraCapabilities(int32_t callId) override; 766 767 /** 768 * RegisterVoipCallManagerCallback 769 * 770 * @brief notify voip register callstatus callback 771 * @return Returns 0 on success, others on failure. 772 */ 773 int32_t RegisterVoipCallManagerCallback() override; 774 775 /** 776 * @brief notify voip unregister callstatus callback 777 * 778 * @return Returns 0 on success, others on failure. 779 */ 780 int32_t UnRegisterVoipCallManagerCallback() override; 781 782 /** 783 * @brief send call ui event 784 * 785 * @return Returns 0 on success, others on failure. 786 */ 787 int32_t SendCallUiEvent(int32_t callId, std::string &eventName) override; 788 789 /** 790 * OnAddSystemAbility 791 * 792 * @brief on system ability added 793 * @param systemAbilityId 794 * @param deviceId 795 */ 796 void OnAddSystemAbility(int32_t systemAbilityId, const std::string &deviceId) override; 797 798 /** 799 * RegisterBluetoothCallManagerCallbackPtr 800 * 801 * @brief notify bluetooth register callstatus callback 802 * @return Returns sptr<ICallStatusCallback>. 803 */ 804 sptr<ICallStatusCallback> RegisterBluetoothCallManagerCallbackPtr(std::string &macAddress) override; 805 806 /** 807 * @brief send ussd response to modem 808 * 809 * @param slotId[in] the slot id 810 * @param content[in] the content need send to modem 811 * @return Returns TELEPHONY_SUCCESS on success, others on failure. 812 */ 813 int32_t SendUssdResponse(int32_t slotId, const std::string &content) override; 814 815 /** 816 * SetCallPolicyInfo 817 * 818 * @brief set telephony call trust/block list policy 819 * @param isDialingTrustlist[in], dialing policy flag, false is block, true is trust. 820 * @param dialingList[in], dialing trust/block number list. 821 * @param isIncomingTrustlist[in], incoming policy flag, false is block, true is trust. 822 * @param incomingList[in], incoming trust/block number list. 823 * @return Returns 0 on success, others on failure. 824 */ 825 int32_t SetCallPolicyInfo(bool isDialingTrustlist, const std::vector<std::string> &dialingList, 826 bool isIncomingTrustlist, const std::vector<std::string> &incomingList) override; 827 private: 828 std::string GetBundleInfo(); 829 int32_t dealCeliaCallEvent(int32_t callId); 830 int32_t HandleDisplaySpecifiedCallPage(int32_t callId); 831 int32_t HandleCeliaAutoAnswerCall(int32_t callId, bool enable); 832 int32_t HandleVoIPCallEvent(int32_t callId, std::string &eventName); 833 void BtCallWaitSlotId(AppExecFwk::PacMap &dialInfo, const std::u16string &number); 834 835 private: 836 enum ServiceRunningState { 837 STATE_STOPPED = 0, 838 STATE_RUNNING, 839 }; 840 const std::string SOS_PULL_CALL_PAGE = "2"; 841 842 ServiceRunningState state_ { ServiceRunningState::STATE_STOPPED }; 843 #ifndef TELEPHONY_VOIP_CALL_MANAGER_SYS_ABILITY_ID 844 #define TELEPHONY_VOIP_CALL_MANAGER_SYS_ABILITY_ID 65968 845 #endif 846 std::shared_ptr<CallControlManager> callControlManagerPtr_; 847 std::map<uint32_t, sptr<IRemoteObject>> proxyObjectPtrMap_; 848 std::vector<std::string> supportSpecialCode_ { "*#2846#", "*#2846*", 849 "*#*#2846579#*#*", "#1#", "*#28465#", "*#*#121314#*#*", "*#*#19467328#*#*", 850 "*#*#2589#*#*", "*#*#2845#*#*", "*#*#2846#*#*", "*#*#2847#*#*", "*#*#28465#*#*", 851 "*#*#2627#*#*", "*#*#258#*#*", "*#28460" }; 852 std::mutex lock_; 853 std::mutex bluetoothCallCallbackLock_; 854 const int32_t startTime_ = 1900; 855 const int32_t extraMonth_ = 1; 856 int64_t bindTime_ = 0L; 857 int32_t spendTime_ = 0; 858 sptr<ICallStatusCallback> bluetoothCallCallbackPtr_ = nullptr; 859 std::shared_ptr<BluetoothCallState> bluetoothCallObserver_ = nullptr; 860 std::shared_ptr<CallStatusManager> callStatusManagerPtr_ = nullptr; 861 }; 862 } // namespace Telephony 863 } // namespace OHOS 864 865 #endif // CALL_MANAGER_SERVICE_H 866