• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
ShutDown(PowerMgr::SuspendDeviceType operationType,bool suspendImmed)25 void ProximitySensor::ShutDown(PowerMgr::SuspendDeviceType operationType, bool suspendImmed)
26 {
27     PowerMgr::PowerMgrClient::GetInstance().SuspendDevice(operationType, suspendImmed);
28 }
29 
StartUp(PowerMgr::WakeupDeviceType operationType,std::string wakeupReason)30 void ProximitySensor::StartUp(PowerMgr::WakeupDeviceType operationType, std::string wakeupReason)
31 {
32     PowerMgr::PowerMgrClient::GetInstance().WakeupDevice(operationType, wakeupReason);
33 }
34 
CallDestroyed(const DisconnectedDetails & details)35 void ProximitySensor::CallDestroyed(const DisconnectedDetails &details)
36 {
37     if (CallObjectManager::HasCallExist()) {
38         ShutDown(PowerMgr::SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION, true);
39     }
40 }
41 
NewCallCreated(sptr<CallBase> & callObjectPtr)42 void ProximitySensor::NewCallCreated(sptr<CallBase> &callObjectPtr) {}
43 
IncomingCallActivated(sptr<CallBase> & callObjectPtr)44 void ProximitySensor::IncomingCallActivated(sptr<CallBase> &callObjectPtr) {}
45 
IncomingCallHungUp(sptr<CallBase> & callObjectPtr,bool isSendSms,std::string content)46 void ProximitySensor::IncomingCallHungUp(sptr<CallBase> &callObjectPtr, bool isSendSms, std::string content) {}
47 
CallStateUpdated(sptr<CallBase> & callObjectPtr,TelCallState priorState,TelCallState nextState)48 void ProximitySensor::CallStateUpdated(
49     sptr<CallBase> &callObjectPtr, TelCallState priorState, TelCallState nextState)
50 {}
51 } // namespace Telephony
52 } // namespace OHOS