1 /* 2 * Copyright (c) 2021 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 OHOS_WINDOW_MANAGER_INTERFACE_H 17 #define OHOS_WINDOW_MANAGER_INTERFACE_H 18 19 #include <iremote_broker.h> 20 #include <rs_iwindow_animation_finished_callback.h> 21 22 #include "common/include/window_session_property.h" 23 #include "interfaces/include/ws_common_inner.h" 24 #include "pixel_map.h" 25 #include "session/container/include/zidl/session_stage_interface.h" 26 #include "session/container/include/zidl/window_event_channel_interface.h" 27 #include "window_property.h" 28 #include "window_transition_info.h" 29 #include "mission_snapshot.h" 30 #include "zidl/window_interface.h" 31 #include "zidl/window_manager_agent_interface.h" 32 #include "interfaces/include/ws_common.h" 33 34 namespace OHOS { 35 namespace Rosen { 36 class RSIWindowAnimationController; 37 class RSSurfaceNode; 38 39 class IWindowManager : public IRemoteBroker { 40 public: 41 DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.IWindowManager"); 42 43 enum class WindowManagerMessage : uint32_t { 44 TRANS_ID_CREATE_WINDOW, 45 TRANS_ID_ADD_WINDOW, 46 TRANS_ID_REMOVE_WINDOW, 47 TRANS_ID_DESTROY_WINDOW, 48 TRANS_ID_REQUEST_FOCUS, 49 TRANS_ID_REGISTER_FOCUS_CHANGED_LISTENER, 50 TRANS_ID_UNREGISTER_FOCUS_CHANGED_LISTENER, 51 TRANS_ID_REGISTER_WINDOW_MANAGER_AGENT, 52 TRANS_ID_UNREGISTER_WINDOW_MANAGER_AGENT, 53 TRANS_ID_GET_AVOID_AREA, 54 TRANS_ID_GET_TOP_WINDOW_ID, 55 TRANS_ID_PROCESS_POINT_DOWN, 56 TRANS_ID_PROCESS_POINT_UP, 57 TRANS_ID_MINIMIZE_ALL_APP_WINDOWS, 58 TRANS_ID_TOGGLE_SHOWN_STATE_FOR_ALL_APP_WINDOWS, 59 TRANS_ID_SET_BACKGROUND_BLUR, 60 TRANS_ID_SET_ALPHA, 61 TRANS_ID_UPDATE_LAYOUT_MODE, 62 TRANS_ID_UPDATE_PROPERTY, 63 TRANS_ID_GET_ACCESSIBILITY_WINDOW_INFO_ID, 64 TRANS_ID_GET_VISIBILITY_WINDOW_INFO_ID, 65 TRANS_ID_ANIMATION_SET_CONTROLLER, 66 TRANS_ID_GET_SYSTEM_CONFIG, 67 TRANS_ID_NOTIFY_WINDOW_TRANSITION, 68 TRANS_ID_GET_FULLSCREEN_AND_SPLIT_HOT_ZONE, 69 TRANS_ID_GET_ANIMATION_CALLBACK, 70 TRANS_ID_UPDATE_AVOIDAREA_LISTENER, 71 TRANS_ID_UPDATE_RS_TREE, 72 TRANS_ID_BIND_DIALOG_TARGET, 73 TRANS_ID_NOTIFY_READY_MOVE_OR_DRAG, 74 TRANS_ID_SET_ANCHOR_AND_SCALE, 75 TRANS_ID_SET_ANCHOR_OFFSET, 76 TRANS_ID_OFF_WINDOW_ZOOM, 77 TRANS_ID_RAISE_WINDOW_Z_ORDER, 78 TRANS_ID_GET_SNAPSHOT, 79 TRANS_ID_GESTURE_NAVIGATION_ENABLED, 80 TRANS_ID_SET_WINDOW_GRAVITY, 81 TRANS_ID_DISPATCH_KEY_EVENT, 82 TRANS_ID_NOTIFY_DUMP_INFO_RESULT, 83 TRANS_ID_GET_WINDOW_ANIMATION_TARGETS, 84 TRANS_ID_SET_MAXIMIZE_MODE, 85 TRANS_ID_GET_MAXIMIZE_MODE, 86 TRANS_ID_GET_FOCUS_WINDOW_INFO, 87 TRANS_ID_ADD_EXTENSION_WINDOW_STAGE_TO_SCB, 88 TRANS_ID_UPDATE_MODALEXTENSION_RECT_TO_SCB, 89 TRANS_ID_PROCESS_MODALEXTENSION_POINTDOWN_TO_SCB, 90 TRANS_ID_UPDATE_EXTENSION_WINDOW_FLAGS, 91 TRANS_ID_GET_HOST_WINDOW_RECT, 92 TRANS_ID_GET_UNRELIABLE_WINDOW_INFO_ID, 93 TRANS_ID_GET_FREE_MULTI_WINDOW_ENABLE_STATE, 94 }; 95 virtual WMError CreateWindow(sptr<IWindow>& window, sptr<WindowProperty>& property, 96 const std::shared_ptr<RSSurfaceNode>& surfaceNode, 97 uint32_t& windowId, sptr<IRemoteObject> token) = 0; 98 virtual WMError AddWindow(sptr<WindowProperty>& property) = 0; 99 virtual WMError RemoveWindow(uint32_t windowId, bool isFromInnerkits) = 0; 100 virtual WMError DestroyWindow(uint32_t windowId, bool onlySelf = false) = 0; 101 virtual WMError RequestFocus(uint32_t windowId) = 0; 102 virtual AvoidArea GetAvoidAreaByType(uint32_t windowId, AvoidAreaType type) = 0; 103 virtual WMError GetTopWindowId(uint32_t mainWinId, uint32_t& topWinId) = 0; 104 virtual void NotifyServerReadyToMoveOrDrag(uint32_t windowId, sptr<WindowProperty>& windowProperty, 105 sptr<MoveDragProperty>& moveDragProperty) = 0; 106 virtual void ProcessPointDown(uint32_t windowId, bool isPointDown) = 0; 107 virtual void ProcessPointUp(uint32_t windowId) = 0; 108 virtual WMError MinimizeAllAppWindows(DisplayId displayId) = 0; 109 virtual WMError ToggleShownStateForAllAppWindows() = 0; 110 virtual WMError SetWindowLayoutMode(WindowLayoutMode mode) = 0; 111 virtual WMError UpdateProperty(sptr<WindowProperty>& windowProperty, PropertyChangeAction action, 112 bool isAsyncTask = false) = 0; 113 virtual WMError SetWindowGravity(uint32_t windowId, WindowGravity gravity, uint32_t percent) = 0; 114 virtual WMError RegisterWindowManagerAgent(WindowManagerAgentType type, 115 const sptr<IWindowManagerAgent>& windowManagerAgent) = 0; 116 virtual WMError UnregisterWindowManagerAgent(WindowManagerAgentType type, 117 const sptr<IWindowManagerAgent>& windowManagerAgent) = 0; 118 virtual WMError GetAccessibilityWindowInfo(std::vector<sptr<AccessibilityWindowInfo>>& infos) = 0; 119 virtual WMError GetUnreliableWindowInfo(int32_t windowId, std::vector<sptr<UnreliableWindowInfo>>& infos) = 0; 120 virtual WMError GetVisibilityWindowInfo(std::vector<sptr<WindowVisibilityInfo>>& infos) = 0; 121 virtual WMError SetWindowAnimationController(const sptr<RSIWindowAnimationController>& controller) = 0; 122 virtual WMError GetSystemConfig(SystemConfig& systemConfig) = 0; 123 virtual WMError NotifyWindowTransition(sptr<WindowTransitionInfo>& from, sptr<WindowTransitionInfo>& to, 124 bool isFromClient = false) = 0; 125 virtual WMError GetModeChangeHotZones(DisplayId displayId, ModeChangeHotZones& hotZones) = 0; 126 virtual void MinimizeWindowsByLauncher(std::vector<uint32_t> windowIds, bool isAnimated, 127 sptr<RSIWindowAnimationFinishedCallback>& finishCallback) = 0; 128 virtual WMError UpdateAvoidAreaListener(uint32_t windowId, bool haveListener) = 0; 129 virtual WMError UpdateRsTree(uint32_t windowId, bool isAdd) = 0; 130 virtual WMError BindDialogTarget(uint32_t& windowId, sptr<IRemoteObject> targetToken) = 0; 131 virtual void SetAnchorAndScale(int32_t x, int32_t y, float scale) = 0; 132 virtual void SetAnchorOffset(int32_t deltaX, int32_t deltaY) = 0; 133 virtual void OffWindowZoom() = 0; 134 virtual WMError RaiseToAppTop(uint32_t windowId) = 0; 135 virtual std::shared_ptr<Media::PixelMap> GetSnapshot(int32_t windowId) = 0; 136 virtual WMError SetGestureNavigaionEnabled(bool enable) = 0; 137 virtual void DispatchKeyEvent(uint32_t windowId, std::shared_ptr<MMI::KeyEvent> event) = 0; NotifyDumpInfoResult(const std::vector<std::string> & info)138 virtual void NotifyDumpInfoResult(const std::vector<std::string>& info) {}; DumpSessionAll(std::vector<std::string> & infos)139 virtual WSError DumpSessionAll(std::vector<std::string> &infos) { return WSError::WS_OK; } DumpSessionWithId(int32_t persistentId,std::vector<std::string> & infos)140 virtual WSError DumpSessionWithId(int32_t persistentId, std::vector<std::string> &infos) { return WSError::WS_OK; } GetUIContentRemoteObj(int32_t persistentId,sptr<IRemoteObject> & uiContentRemoteObj)141 virtual WSError GetUIContentRemoteObj(int32_t persistentId, sptr<IRemoteObject>& uiContentRemoteObj) 142 { 143 return WSError::WS_OK; 144 } 145 virtual WMError GetWindowAnimationTargets(std::vector<uint32_t> missionIds, 146 std::vector<sptr<RSWindowAnimationTarget>>& targets) = 0; 147 virtual void SetMaximizeMode(MaximizeMode maximizeMode) = 0; 148 virtual MaximizeMode GetMaximizeMode() = 0; 149 virtual void GetFocusWindowInfo(FocusChangeInfo& focusInfo) = 0; CheckWindowId(int32_t windowId,int32_t & pid)150 virtual WMError CheckWindowId(int32_t windowId, int32_t& pid) { return WMError::WM_OK; } UpdateSessionAvoidAreaListener(int32_t & persistentId,bool haveListener)151 virtual WSError UpdateSessionAvoidAreaListener(int32_t& persistentId, bool haveListener) { return WSError::WS_OK; } UpdateSessionTouchOutsideListener(int32_t & persistentId,bool haveListener)152 virtual WSError UpdateSessionTouchOutsideListener(int32_t& persistentId, bool haveListener) 153 { 154 return WSError::WS_OK; 155 } NotifyWindowExtensionVisibilityChange(int32_t pid,int32_t uid,bool visible)156 virtual WSError NotifyWindowExtensionVisibilityChange(int32_t pid, int32_t uid, bool visible) 157 { 158 return WSError::WS_OK; 159 } RaiseWindowToTop(int32_t persistentId)160 virtual WSError RaiseWindowToTop(int32_t persistentId) { return WSError::WS_OK; } UpdateSessionWindowVisibilityListener(int32_t persistentId,bool haveListener)161 virtual WSError UpdateSessionWindowVisibilityListener(int32_t persistentId, bool haveListener) 162 { 163 return WSError::WS_OK; 164 } ShiftAppWindowFocus(int32_t sourcePersistentId,int32_t targetPersistentId)165 virtual WSError ShiftAppWindowFocus(int32_t sourcePersistentId, int32_t targetPersistentId) 166 { 167 return WSError::WS_ERROR_DEVICE_NOT_SUPPORT; 168 } 169 virtual WSError CreateAndConnectSpecificSession(const sptr<ISessionStage>& sessionStage, 170 const sptr<IWindowEventChannel>& eventChannel, const std::shared_ptr<RSSurfaceNode>& surfaceNode, 171 sptr<WindowSessionProperty> property, int32_t& persistentId, sptr<ISession>& session, 172 SystemSessionConfig& systemConfig, sptr<IRemoteObject> token = nullptr) { return WSError::WS_OK; } 173 virtual WSError RecoverAndConnectSpecificSession(const sptr<ISessionStage>& sessionStage, 174 const sptr<IWindowEventChannel>& eventChannel, const std::shared_ptr<RSSurfaceNode>& surfaceNode, 175 sptr<WindowSessionProperty> property, sptr<ISession>& session, sptr<IRemoteObject> token = nullptr) 176 { 177 return WSError::WS_OK; 178 } DestroyAndDisconnectSpecificSession(const int32_t persistentId)179 virtual WSError DestroyAndDisconnectSpecificSession(const int32_t persistentId) { return WSError::WS_OK; } DestroyAndDisconnectSpecificSessionWithDetachCallback(const int32_t persistentId,const sptr<IRemoteObject> & callback)180 virtual WSError DestroyAndDisconnectSpecificSessionWithDetachCallback(const int32_t persistentId, 181 const sptr<IRemoteObject>& callback) { return WSError::WS_OK; } 182 virtual WSError RecoverAndReconnectSceneSession(const sptr<ISessionStage>& sessionStage, 183 const sptr<IWindowEventChannel>& eventChannel, const std::shared_ptr<RSSurfaceNode>& surfaceNode, 184 sptr<ISession>& session, sptr<WindowSessionProperty> property, sptr<IRemoteObject> token = nullptr) 185 { 186 return WSError::WS_OK; 187 } BindDialogSessionTarget(uint64_t persistentId,sptr<IRemoteObject> targetToken)188 virtual WSError BindDialogSessionTarget(uint64_t persistentId, sptr<IRemoteObject> targetToken) 189 { 190 return WSError::WS_OK; 191 } SetSessionGravity(int32_t persistentId,SessionGravity gravity,uint32_t percent)192 virtual WSError SetSessionGravity(int32_t persistentId, SessionGravity gravity, uint32_t percent) 193 { 194 return WSError::WS_OK; 195 } 196 virtual WMError RequestFocusStatus(int32_t persistentId, bool isFocused, bool byForeground = true, 197 FocusChangeReason reason = FocusChangeReason::DEFAULT) 198 { 199 return WMError::WM_OK; 200 } GetSnapshotByWindowId(int32_t persistentId,std::shared_ptr<Media::PixelMap> & pixelMap)201 virtual WMError GetSnapshotByWindowId(int32_t persistentId, std::shared_ptr<Media::PixelMap>& pixelMap) 202 { 203 return WMError::WM_OK; 204 } AddExtensionWindowStageToSCB(const sptr<ISessionStage> & sessionStage,const sptr<IRemoteObject> & token,uint64_t surfaceNodeId)205 virtual void AddExtensionWindowStageToSCB(const sptr<ISessionStage>& sessionStage, 206 const sptr<IRemoteObject>& token, uint64_t surfaceNodeId) {} RemoveExtensionWindowStageFromSCB(const sptr<ISessionStage> & sessionStage,const sptr<IRemoteObject> & token)207 virtual void RemoveExtensionWindowStageFromSCB(const sptr<ISessionStage>& sessionStage, 208 const sptr<IRemoteObject>& token) {} UpdateModalExtensionRect(const sptr<IRemoteObject> & token,Rect rect)209 virtual void UpdateModalExtensionRect(const sptr<IRemoteObject>& token, Rect rect) {} ProcessModalExtensionPointDown(const sptr<IRemoteObject> & token,int32_t posX,int32_t posY)210 virtual void ProcessModalExtensionPointDown(const sptr<IRemoteObject>& token, int32_t posX, int32_t posY) {} AddOrRemoveSecureSession(int32_t persistentId,bool shouldHide)211 virtual WSError AddOrRemoveSecureSession(int32_t persistentId, bool shouldHide) 212 { 213 return WSError::WS_OK; 214 } UpdateExtWindowFlags(const sptr<IRemoteObject> & token,uint32_t extWindowFlags,uint32_t extWindowActions)215 virtual WSError UpdateExtWindowFlags(const sptr<IRemoteObject>& token, uint32_t extWindowFlags, 216 uint32_t extWindowActions) 217 { 218 return WSError::WS_OK; 219 } GetHostWindowRect(int32_t hostWindowId,Rect & rect)220 virtual WSError GetHostWindowRect(int32_t hostWindowId, Rect& rect) 221 { 222 return WSError::WS_OK; 223 } GetFreeMultiWindowEnableState(bool & enable)224 virtual WSError GetFreeMultiWindowEnableState(bool& enable) 225 { 226 return WSError::WS_OK; 227 } GetCallingWindowWindowStatus(int32_t persistentId,WindowStatus & windowStatus)228 virtual WMError GetCallingWindowWindowStatus(int32_t persistentId, WindowStatus& windowStatus) 229 { 230 return WMError::WM_OK; 231 } GetCallingWindowRect(int32_t persistentId,Rect & rect)232 virtual WMError GetCallingWindowRect(int32_t persistentId, Rect& rect) 233 { 234 return WMError::WM_OK; 235 } GetWindowModeType(WindowModeType & windowModeType)236 virtual WMError GetWindowModeType(WindowModeType& windowModeType) 237 { 238 return WMError::WM_OK; 239 }; GetWindowStyleType(WindowStyleType & windowStyleType)240 virtual WMError GetWindowStyleType(WindowStyleType& windowStyleType) 241 { 242 return WMError::WM_OK; 243 }; IsWindowRectAutoSave(const std::string & key,bool & enabled)244 virtual WMError IsWindowRectAutoSave(const std::string& key, bool& enabled) { return WMError::WM_OK; } GetParentMainWindowId(int32_t windowId,int32_t & mainWindowId)245 virtual WMError GetParentMainWindowId(int32_t windowId, int32_t& mainWindowId) { return WMError::WM_OK; } GetWindowIdsByCoordinate(DisplayId displayId,int32_t windowNumber,int32_t x,int32_t y,std::vector<int32_t> & windowIds)246 virtual WMError GetWindowIdsByCoordinate(DisplayId displayId, int32_t windowNumber, 247 int32_t x, int32_t y, std::vector<int32_t>& windowIds) { return WMError::WM_ERROR_DEVICE_NOT_SUPPORT; } ReleaseForegroundSessionScreenLock()248 virtual WMError ReleaseForegroundSessionScreenLock() { return WMError::WM_OK; } GetDisplayIdByWindowId(const std::vector<uint64_t> & windowIds,std::unordered_map<uint64_t,DisplayId> & windowDisplayIdMap)249 virtual WMError GetDisplayIdByWindowId(const std::vector<uint64_t>& windowIds, 250 std::unordered_map<uint64_t, DisplayId>& windowDisplayIdMap) { return WMError::WM_OK; } IsPcWindow(bool & isPcWindow)251 virtual WMError IsPcWindow(bool& isPcWindow) { return WMError::WM_OK; } IsPcOrPadFreeMultiWindowMode(bool & isPcOrPadFreeMultiWindowMode)252 virtual WMError IsPcOrPadFreeMultiWindowMode(bool& isPcOrPadFreeMultiWindowMode) { return WMError::WM_OK; } SetGlobalDragResizeType(DragResizeType dragResizeType)253 virtual WMError SetGlobalDragResizeType(DragResizeType dragResizeType) { return WMError::WM_OK; } GetGlobalDragResizeType(DragResizeType & dragResizeType)254 virtual WMError GetGlobalDragResizeType(DragResizeType& dragResizeType) { return WMError::WM_OK; } SetAppDragResizeType(const std::string & bundleName,DragResizeType dragResizeType)255 virtual WMError SetAppDragResizeType(const std::string& bundleName, 256 DragResizeType dragResizeType) { return WMError::WM_OK; } GetAppDragResizeType(const std::string & bundleName,DragResizeType & dragResizeType)257 virtual WMError GetAppDragResizeType(const std::string& bundleName, 258 DragResizeType& dragResizeType) { return WMError::WM_OK; } 259 }; 260 } 261 } 262 #endif // OHOS_WINDOW_MANAGER_INTERFACE_H 263