/* * Copyright (c) 2021-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef POWERMGR_SERVICES_IPOWER_MANAGER_PROXY_H #define POWERMGR_SERVICES_IPOWER_MANAGER_PROXY_H #include #include #include #include #include #include #include #include "refbase.h" #include "iremote_broker.h" #include "iremote_object.h" #include "ipower_mode_callback.h" #include "ipower_state_callback.h" #include "ipower_runninglock_callback.h" #include "ipower_mgr.h" #include "iscreen_off_pre_callback.h" #include "running_lock_info.h" #include "power_state_machine_info.h" #include "power_errors.h" namespace OHOS { namespace PowerMgr { class PowerMgrProxy : public IRemoteProxy { public: explicit PowerMgrProxy(const sptr& impl) : IRemoteProxy(impl) {} ~PowerMgrProxy() = default; DISALLOW_COPY_AND_MOVE(PowerMgrProxy); virtual PowerErrors CreateRunningLock(const sptr& remoteObj, const RunningLockInfo& runningLockInfo) override; virtual bool ReleaseRunningLock(const sptr& remoteObj, const std::string& name = "") override; virtual bool IsRunningLockTypeSupported(RunningLockType type) override; virtual bool UpdateWorkSource(const sptr& remoteObj, const std::map& workSources) override; virtual PowerErrors Lock(const sptr& remoteObj, int32_t timeOutMs = -1) override; virtual PowerErrors UnLock(const sptr& remoteObj, const std::string& name = "") override; virtual bool QueryRunningLockLists(std::map& runningLockLists) override; virtual bool ProxyRunningLock(bool isProxied, pid_t pid, pid_t uid) override; virtual bool ProxyRunningLocks(bool isProxied, const std::vector>& processInfos) override; virtual bool ResetRunningLocks() override; virtual bool IsUsed(const sptr& remoteObj) override; // Use for PowerStateMachine virtual PowerErrors SuspendDevice(int64_t callTimeMs, SuspendDeviceType reason, bool suspendImmed) override; virtual PowerErrors WakeupDevice(int64_t callTimeMs, WakeupDeviceType reason, const std::string& details) override; virtual void WakeupDeviceAsync(int64_t callTimeMs, WakeupDeviceType reason, const std::string& details) override; virtual bool RefreshActivity(int64_t callTimeMs, UserActivityType type, bool needChangeBacklight) override; virtual PowerErrors OverrideScreenOffTime(int64_t timeout) override; virtual PowerErrors RestoreScreenOffTime() override; virtual PowerState GetState() override; virtual bool IsScreenOn(bool needPrintLog = true) override; virtual bool IsFoldScreenOn() override; virtual bool IsCollaborationScreenOn() override; virtual PowerErrors ForceSuspendDevice(int64_t callTimeMs) override; virtual PowerErrors RebootDevice(const std::string& reason) override; virtual PowerErrors RebootDeviceForDeprecated(const std::string& reason) override; virtual PowerErrors ShutDownDevice(const std::string& reason) override; virtual PowerErrors SetSuspendTag(const std::string& tag) override; virtual bool RegisterPowerStateCallback(const sptr& callback, bool isSync = true) override; virtual bool UnRegisterPowerStateCallback(const sptr& callback) override; virtual bool RegisterPowerModeCallback(const sptr& callback) override; virtual bool UnRegisterPowerModeCallback(const sptr& callback) override; virtual bool RegisterScreenStateCallback(int32_t remainTime, const sptr& callback) override; virtual bool UnRegisterScreenStateCallback(const sptr& callback) override; virtual bool RegisterRunningLockCallback(const sptr& callback) override; virtual bool UnRegisterRunningLockCallback(const sptr& callback) override; virtual bool SetDisplaySuspend(bool enable) override; virtual PowerErrors Hibernate(bool clearMemory) override; virtual PowerErrors SetDeviceMode(const PowerMode& mode) override; virtual PowerMode GetDeviceMode() override; virtual std::string ShellDump(const std::vector& args, uint32_t argc) override; virtual PowerErrors IsStandby(bool& isStandby) override; virtual PowerErrors SetForceTimingOut(bool enabled, const sptr& token) override; virtual PowerErrors LockScreenAfterTimingOut( bool enabledLockScreen, bool checkLock, bool sendScreenOffEvent, const sptr& token) override; void RegisterShutdownCallback(const sptr& callback, ShutdownPriority priority) override; void UnRegisterShutdownCallback(const sptr& callback) override; void RegisterShutdownCallback(const sptr& callback, ShutdownPriority priority) override; void UnRegisterShutdownCallback(const sptr& callback) override; void RegisterShutdownCallback(const sptr& callback, ShutdownPriority priority) override; void UnRegisterShutdownCallback(const sptr& callback) override; virtual bool RegisterSyncHibernateCallback(const sptr& callback) override; virtual bool UnRegisterSyncHibernateCallback(const sptr& callback) override; virtual bool RegisterSyncSleepCallback(const sptr& callback, SleepPriority priority) override; virtual bool UnRegisterSyncSleepCallback(const sptr& callback) override; private: static inline BrokerDelegator delegator_; }; } // namespace PowerMgr } // namespace OHOS #endif // POWERMGR_SERVICES_IPOWER_MANAGER_PROXY_H