1 /*
2  * Copyright (c) 2021-2023 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 POWERMGR_SERVICES_IPOWER_MANAGER_STUB_H
17 #define POWERMGR_SERVICES_IPOWER_MANAGER_STUB_H
18 
19 #include <iremote_stub.h>
20 #include <nocopyable.h>
21 
22 #include "ipower_mgr.h"
23 
24 namespace OHOS {
25 namespace PowerMgr {
26 class PowerMgrStub : public IRemoteStub<IPowerMgr> {
27 public:
28     DISALLOW_COPY_AND_MOVE(PowerMgrStub);
29     PowerMgrStub() = default;
30     ~PowerMgrStub() override = default;
31     int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
32 
33 private:
34     static bool IsShutdownCommand(uint32_t code);
35 
36     int32_t WakeupDeviceStub(MessageParcel& data, MessageParcel& reply);
37     int32_t SuspendDeviceStub(MessageParcel& data, MessageParcel& reply);
38     int32_t RefreshActivityStub(MessageParcel& data);
39     int32_t OverrideScreenOffTimeStub(MessageParcel& data, MessageParcel& reply);
40     int32_t RestoreScreenOffTimeStub(MessageParcel& reply);
41     int32_t GetStateStub(MessageParcel& reply);
42     int32_t IsScreenOnStub(MessageParcel& data, MessageParcel& reply);
43     int32_t IsFoldScreenOnStub(MessageParcel& reply);
44     int32_t IsCollaborationScreenOnStub(MessageParcel& reply);
45     int32_t ForceSuspendDeviceStub(MessageParcel& data, MessageParcel& reply);
46     int32_t ProxyRunningLockStub(MessageParcel& data, MessageParcel& reply);
47     int32_t ProxyRunningLocksStub(MessageParcel& data, MessageParcel& reply);
48     int32_t ResetAllPorxyStub(MessageParcel& data, MessageParcel& reply);
49     int32_t CreateRunningLockStub(MessageParcel& data, MessageParcel& reply);
50     int32_t ReleaseRunningLockStub(MessageParcel& data);
51     int32_t IsRunningLockTypeSupportedStub(MessageParcel& data, MessageParcel& reply);
52     int32_t UpdateWorkSourceStub(MessageParcel& data);
53     int32_t LockStub(MessageParcel& data, MessageParcel& reply);
54     int32_t UnLockStub(MessageParcel& data, MessageParcel& reply);
55     int32_t QueryRunningLockListsStub(MessageParcel& data, MessageParcel& reply);
56     int32_t IsUsedStub(MessageParcel& data, MessageParcel& reply);
57     int32_t RebootDeviceStub(MessageParcel& data, MessageParcel& reply);
58     int32_t RebootDeviceForDeprecatedStub(MessageParcel& data, MessageParcel& reply);
59     int32_t ShutDownDeviceStub(MessageParcel& data, MessageParcel& reply);
60     int32_t SetSuspendTagStub(MessageParcel& data, MessageParcel& reply);
61     int32_t RegisterPowerStateCallbackStub(MessageParcel& data);
62 
63     int32_t RegisterSyncHibernateCallbackStub(MessageParcel& data);
64     int32_t UnRegisterSyncHibernateCallbackStub(MessageParcel& data);
65     int32_t RegisterSyncSleepCallbackStub(MessageParcel& data);
66     int32_t UnRegisterSyncSleepCallbackStub(MessageParcel& data);
67 
68     int32_t UnRegisterPowerStateCallbackStub(MessageParcel& data);
69     int32_t RegisterPowerModeCallbackStub(MessageParcel& data);
70     int32_t UnRegisterPowerModeCallbackStub(MessageParcel& data);
71     int32_t RegisterScreenStateCallbackStub(MessageParcel& data);
72     int32_t UnRegisterScreenStateCallbackStub(MessageParcel& data);
73     int32_t RegisterRunningLockCallbackStub(MessageParcel& data);
74     int32_t UnRegisterRunningLockCallbackStub(MessageParcel& data);
75     int32_t SetDisplaySuspendStub(MessageParcel& data);
76     int32_t HibernateStub(MessageParcel& data, MessageParcel& reply);
77     int32_t SetDeviceModeStub(MessageParcel& data, MessageParcel& reply);
78     int32_t GetDeviceModeStub(MessageParcel& reply);
79     int32_t ShellDumpStub(MessageParcel& data, MessageParcel& reply);
80     int32_t IsStandbyStub(MessageParcel& data, MessageParcel& reply);
81     int32_t SetForceTimingOutStub(MessageParcel& data, MessageParcel& reply);
82     int32_t LockScreenAfterTimingOutStub(MessageParcel& data, MessageParcel& reply);
83 };
84 } // namespace PowerMgr
85 } // namespace OHOS
86 #endif // POWERMGR_SERVICES_IPOWER_MANAGER_STUB_H
87