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 #include "status_bar.h"
17 
18 #include "call_manager_errors.h"
19 
20 namespace OHOS {
21 namespace Telephony {
StatusBar()22 StatusBar::StatusBar() : isDisplayMute_(false), isDisplayIcon_(false) {}
23 
~StatusBar()24 StatusBar::~StatusBar() {}
25 
UpdateMuteIcon(bool isDisplayMute)26 void StatusBar::UpdateMuteIcon(bool isDisplayMute)
27 {
28     if (isDisplayMute_ == isDisplayMute) {
29         return;
30     }
31 #ifdef ABILITY_STATUS_BAR_CONTROL_SUPPORT
32     if (isDisplayMute) {
33         statusBarControl.setIcon("Mute");
34     } else {
35         statusBarControl.removeIcon("Mute");
36     }
37 #endif
38     isDisplayMute_ = isDisplayMute;
39 }
40 
UpdateSpeakerphoneIcon(bool isDisplay)41 void StatusBar::UpdateSpeakerphoneIcon(bool isDisplay)
42 {
43     if (isDisplayIcon_ == isDisplay) {
44         return;
45     }
46 #ifdef ABILITY_STATUS_BAR_CONTROL_SUPPORT
47     if (isDisplaySpeakerphone) {
48         statusBarControl.setIcon("Speakerphone");
49     } else {
50         statusBarControl.removeIcon("Speakerphone");
51     }
52 #endif
53     isDisplayIcon_ = isDisplay;
54 }
55 
CallDestroyed(const DisconnectedDetails & details)56 void StatusBar::CallDestroyed(const DisconnectedDetails &details)
57 {
58     UpdateMuteIcon(false);
59     UpdateSpeakerphoneIcon(false);
60 }
61 
NewCallCreated(sptr<CallBase> & callObjectPtr)62 void StatusBar::NewCallCreated(sptr<CallBase> &callObjectPtr) {}
63 
CallStateUpdated(sptr<CallBase> & callObjectPtr,TelCallState priorState,TelCallState nextState)64 void StatusBar::CallStateUpdated(sptr<CallBase> &callObjectPtr, TelCallState priorState, TelCallState nextState) {}
65 
IncomingCallHungUp(sptr<CallBase> & callObjectPtr,bool isSendSms,std::string content)66 void StatusBar::IncomingCallHungUp(sptr<CallBase> &callObjectPtr, bool isSendSms, std::string content) {}
67 
IncomingCallActivated(sptr<CallBase> & callObjectPtr)68 void StatusBar::IncomingCallActivated(sptr<CallBase> &callObjectPtr) {}
69 } // namespace Telephony
70 } // namespace OHOS