1/* 2 * Copyright (c) 2025 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 16sequenceable OHOS.IRemoteObject; 17sequenceable RunningLockInfo..OHOS.PowerMgr.RunningLockInfo; 18sequenceable RunningLockInfo..OHOS.PowerMgr.VectorPair; 19interface OHOS.PowerMgr.IPowerStateCallback; 20interface OHOS.PowerMgr.ISyncSleepCallback; 21interface OHOS.PowerMgr.ISyncHibernateCallback; 22interface OHOS.PowerMgr.IPowerModeCallback; 23interface OHOS.PowerMgr.IScreenOffPreCallback; 24interface OHOS.PowerMgr.ITakeOverShutdownCallback; 25interface OHOS.PowerMgr.IAsyncShutdownCallback; 26interface OHOS.PowerMgr.ISyncShutdownCallback; 27interface OHOS.PowerMgr.IPowerRunninglockCallback; 28interface OHOS.PowerMgr.IPowerMgrAsync; 29interface OHOS.PowerMgr.ITakeOverSuspendCallback; 30 31interface OHOS.PowerMgr.IPowerMgr { 32 [ipccode 0] void CreateRunningLockIpc( 33 [in] IRemoteObject remoteObj, [in] RunningLockInfo runningLockInfo, [out] int powerError); 34 void ReleaseRunningLockIpc([in] IRemoteObject remoteObj, [in] String name); 35 void IsRunningLockTypeSupportedIpc([in] int lockType, [out] boolean lockTypesSupported); 36 [oneway] void UpdateWorkSourceIpc([in] IRemoteObject remoteObj, [in] int[] workSources); 37 void LockIpc([in] IRemoteObject remoteObj, [in] int timeOutMs, [out] int powerError); 38 void UnLockIpc([in] IRemoteObject remoteObj, [in] String name, [out] int powerError); 39 void QueryRunningLockListsIpc([out] OrderedMap<String, RunningLockInfo> runningLockLists); 40 void IsUsedIpc([in] IRemoteObject remoteObj, [out] boolean isUsed); 41 void ProxyRunningLockIpc([in] boolean isProxied, [in] int pid, [in] int uid); 42 43 void ProxyRunningLocksIpc([in] boolean isProxied, [in] VectorPair vectorPairInfos); 44 45 void ResetRunningLocksIpc(); 46 47 // Used for power state machine. 48 void RebootDeviceIpc([in] String reason, [out] int powerError); 49 void RebootDeviceForDeprecatedIpc([in] String reason, [out] int powerError); 50 void ShutDownDeviceIpc([in] String reason, [out] int powerError); 51 void SetSuspendTagIpc([in] String tag, [out] int powerError); 52 void SuspendDeviceIpc([in] long callTimeMs, [in] int reasonValue, [in] boolean suspendImmed, [in] String apiVersion, 53 [out] int powerError); 54 void WakeupDeviceIpc([in] long callTimeMs, [in] int reasonValue, [in] String details, [in] String apiVersion, 55 [out] int powerError); 56 [oneway] void WakeupDeviceAsyncIpc([in] long callTimeMs, [in] int reasonValue, [in] String details, 57 [in] String apiVersion); 58 void RefreshActivityIpc([in] long callTimeMs, [in] int activityType, [in] boolean needChangeBacklight); 59 void OverrideScreenOffTimeIpc([in] long timeout, [in] String apiVersion, [out] int powerError); 60 void RestoreScreenOffTimeIpc([in] String apiVersion, [out] int powerError); 61 void GetStateIpc([out] int powerState); 62 void IsScreenOnIpc([in] boolean needPrintLog, [out] boolean isScreenOn); 63 void IsFoldScreenOnIpc([out] boolean screenOn); 64 void IsCollaborationScreenOnIpc([out] boolean collaborationScreenOn); 65 [oneway] void ForceSuspendDeviceIpc([in] long callTimeMs, [in] String apiVersion, [in] IPowerMgrAsync powerProxy); 66 void RegisterPowerStateCallbackIpc([in] IPowerStateCallback powerCallback, [in] boolean isSync); 67 void UnRegisterPowerStateCallbackIpc([in] IPowerStateCallback powerCallback); 68 69 void RegisterSyncSleepCallbackIpc([in] ISyncSleepCallback powerCallback, [in] int priorityValue); 70 void UnRegisterSyncSleepCallbackIpc([in] ISyncSleepCallback powerCallback); 71 72 void RegisterSuspendTakeoverCallbackIpc([in] ITakeOverSuspendCallback takeOverSuspendCallback, [in] int priority); 73 void UnRegisterSuspendTakeoverCallbackIpc([in] ITakeOverSuspendCallback takeOverSuspendCallback); 74 75 void RegisterSyncHibernateCallbackIpc([in] ISyncHibernateCallback powerCallback); 76 void UnRegisterSyncHibernateCallbackIpc([in] ISyncHibernateCallback powerCallback); 77 78 // Used for Callback registration upon power mode. 79 void RegisterPowerModeCallbackIpc([in] IPowerModeCallback powerCallback); 80 void UnRegisterPowerModeCallbackIpc([in] IPowerModeCallback powerCallback); 81 82 void RegisterScreenStateCallbackIpc([in] int remainTime, [in] IScreenOffPreCallback powerCallback); 83 void UnRegisterScreenStateCallbackIpc([in] IScreenOffPreCallback powerCallback); 84 85 void SetDisplaySuspendIpc([in] boolean enable); 86 [oneway] void HibernateIpc([in] boolean clearMemory, [in] String reason, [in] String apiVersion, 87 [in] IPowerMgrAsync powerProxy); 88 void SetDeviceModeIpc([in] int modeValue, [out] int powerError); 89 void GetDeviceModeIpc([out] int powerMode); 90 void ShellDumpIpc([in] String[] args, [in] unsigned int argc, [out] String returnDump); 91 void IsStandbyIpc([out] boolean isStandby, [out] int powerError); 92 93 void SetForceTimingOutIpc([in] boolean enabled, [in] IRemoteObject token, [out] int powerError); 94 void LockScreenAfterTimingOutIpc([in] boolean enabledLockScreen, [in] boolean checkLock, 95 [in] boolean sendScreenOffEvent, [in] IRemoteObject token, [out] int powerError); 96 97 void RegisterShutdownCallbackIpc([in] ITakeOverShutdownCallback powerCallback, [in] int priorityValue); 98 void UnRegisterShutdownCallbackIpc([in] ITakeOverShutdownCallback powerCallback); 99 100 void RegisterShutdownCallbackIpc([in] IAsyncShutdownCallback powerCallback, [in] int priorityValue); 101 void UnRegisterShutdownCallbackIpc([in] IAsyncShutdownCallback powerCallback); 102 void RegisterShutdownCallbackIpc([in] ISyncShutdownCallback powerCallback, [in] int priorityValue); 103 void UnRegisterShutdownCallbackIpc([in] ISyncShutdownCallback powerCallback); 104 105 void RegisterRunningLockCallbackIpc([in] IPowerRunninglockCallback powerCallback); 106 void UnRegisterRunningLockCallbackIpc([in] IPowerRunninglockCallback powerCallback); 107 void IsRunningLockEnabledIpc([in] int lockType, [out] boolean lockEnabledResult, [out] int powerError); 108 void IsForceSleepingIpc([out] boolean isForceSleeping); 109 110 void RefreshActivityIpc([in] long callTimeMs, [in] int activityType, [in] String refreshReason, 111 [out] int powerError); 112}