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 "proximity_sensor.h"
17 #include "call_object_manager.h"
18
19 namespace OHOS {
20 namespace Telephony {
ProximitySensor()21 ProximitySensor::ProximitySensor() {}
22
~ProximitySensor()23 ProximitySensor::~ProximitySensor() {}
24
25 #ifdef ABILITY_POWER_SUPPORT
ShutDown(PowerMgr::SuspendDeviceType operationType,bool suspendImmed)26 void ProximitySensor::ShutDown(PowerMgr::SuspendDeviceType operationType, bool suspendImmed)
27 {
28 PowerMgr::PowerMgrClient::GetInstance().SuspendDevice(operationType, suspendImmed);
29 }
30
StartUp(PowerMgr::WakeupDeviceType operationType,std::string wakeupReason)31 void ProximitySensor::StartUp(PowerMgr::WakeupDeviceType operationType, std::string wakeupReason)
32 {
33 PowerMgr::PowerMgrClient::GetInstance().WakeupDevice(operationType, wakeupReason);
34 }
35 #endif
36
CallDestroyed(const DisconnectedDetails & details)37 void ProximitySensor::CallDestroyed(const DisconnectedDetails &details)
38 {
39 if (CallObjectManager::HasCallExist()) {
40 #ifdef ABILITY_POWER_SUPPORT
41 ShutDown(PowerMgr::SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION, true);
42 #endif
43 }
44 }
45
NewCallCreated(sptr<CallBase> & callObjectPtr)46 void ProximitySensor::NewCallCreated(sptr<CallBase> &callObjectPtr) {}
47
IncomingCallActivated(sptr<CallBase> & callObjectPtr)48 void ProximitySensor::IncomingCallActivated(sptr<CallBase> &callObjectPtr) {}
49
IncomingCallHungUp(sptr<CallBase> & callObjectPtr,bool isSendSms,std::string content)50 void ProximitySensor::IncomingCallHungUp(sptr<CallBase> &callObjectPtr, bool isSendSms, std::string content) {}
51
CallStateUpdated(sptr<CallBase> & callObjectPtr,TelCallState priorState,TelCallState nextState)52 void ProximitySensor::CallStateUpdated(
53 sptr<CallBase> &callObjectPtr, TelCallState priorState, TelCallState nextState)
54 {}
55 } // namespace Telephony
56 } // namespace OHOS