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 "pixel_map.h" 23 #include "window_property.h" 24 #include "window_transition_info.h" 25 #include "zidl/window_interface.h" 26 #include "zidl/window_manager_agent_interface.h" 27 #include "interfaces/include/ws_common.h" 28 29 namespace OHOS { 30 namespace Rosen { 31 class RSIWindowAnimationController; 32 class RSSurfaceNode; 33 34 class IWindowManager : public IRemoteBroker { 35 public: 36 DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.IWindowManager"); 37 38 enum class WindowManagerMessage : uint32_t { 39 TRANS_ID_CREATE_WINDOW, 40 TRANS_ID_ADD_WINDOW, 41 TRANS_ID_REMOVE_WINDOW, 42 TRANS_ID_DESTROY_WINDOW, 43 TRANS_ID_REQUEST_FOCUS, 44 TRANS_ID_REGISTER_FOCUS_CHANGED_LISTENER, 45 TRANS_ID_UNREGISTER_FOCUS_CHANGED_LISTENER, 46 TRANS_ID_REGISTER_WINDOW_MANAGER_AGENT, 47 TRANS_ID_UNREGISTER_WINDOW_MANAGER_AGENT, 48 TRANS_ID_GET_AVOID_AREA, 49 TRANS_ID_GET_TOP_WINDOW_ID, 50 TRANS_ID_PROCESS_POINT_DOWN, 51 TRANS_ID_PROCESS_POINT_UP, 52 TRANS_ID_MINIMIZE_ALL_APP_WINDOWS, 53 TRANS_ID_TOGGLE_SHOWN_STATE_FOR_ALL_APP_WINDOWS, 54 TRANS_ID_SET_BACKGROUND_BLUR, 55 TRANS_ID_SET_ALPHA, 56 TRANS_ID_UPDATE_LAYOUT_MODE, 57 TRANS_ID_UPDATE_PROPERTY, 58 TRANS_ID_GET_ACCESSIBILITY_WINDOW_INFO_ID, 59 TRANS_ID_GET_VISIBILITY_WINDOW_INFO_ID, 60 TRANS_ID_ANIMATION_SET_CONTROLLER, 61 TRANS_ID_GET_SYSTEM_CONFIG, 62 TRANS_ID_NOTIFY_WINDOW_TRANSITION, 63 TRANS_ID_GET_FULLSCREEN_AND_SPLIT_HOT_ZONE, 64 TRANS_ID_GET_ANIMATION_CALLBACK, 65 TRANS_ID_UPDATE_AVOIDAREA_LISTENER, 66 TRANS_ID_UPDATE_RS_TREE, 67 TRANS_ID_BIND_DIALOG_TARGET, 68 TRANS_ID_NOTIFY_READY_MOVE_OR_DRAG, 69 TRANS_ID_SET_ANCHOR_AND_SCALE, 70 TRANS_ID_SET_ANCHOR_OFFSET, 71 TRANS_ID_OFF_WINDOW_ZOOM, 72 TRANS_ID_RAISE_WINDOW_Z_ORDER, 73 TRANS_ID_GET_SNAPSHOT, 74 TRANS_ID_GESTURE_NAVIGATION_ENABLED, 75 TRANS_ID_SET_WINDOW_GRAVITY, 76 TRANS_ID_DISPATCH_KEY_EVENT, 77 TRANS_ID_NOTIFY_DUMP_INFO_RESULT, 78 TRANS_ID_GET_WINDOW_ANIMATION_TARGETS, 79 TRANS_ID_SET_MAXIMIZE_MODE, 80 TRANS_ID_GET_MAXIMIZE_MODE, 81 TRANS_ID_GET_FOCUS_WINDOW_INFO, 82 }; 83 virtual WMError CreateWindow(sptr<IWindow>& window, sptr<WindowProperty>& property, 84 const std::shared_ptr<RSSurfaceNode>& surfaceNode, 85 uint32_t& windowId, sptr<IRemoteObject> token) = 0; 86 virtual WMError AddWindow(sptr<WindowProperty>& property) = 0; 87 virtual WMError RemoveWindow(uint32_t windowId, bool isFromInnerkits) = 0; 88 virtual WMError DestroyWindow(uint32_t windowId, bool onlySelf = false) = 0; 89 virtual WMError RequestFocus(uint32_t windowId) = 0; 90 virtual AvoidArea GetAvoidAreaByType(uint32_t windowId, AvoidAreaType type) = 0; 91 virtual WMError GetTopWindowId(uint32_t mainWinId, uint32_t& topWinId) = 0; 92 virtual void NotifyServerReadyToMoveOrDrag(uint32_t windowId, sptr<WindowProperty>& windowProperty, 93 sptr<MoveDragProperty>& moveDragProperty) = 0; 94 virtual void ProcessPointDown(uint32_t windowId, bool isPointDown) = 0; 95 virtual void ProcessPointUp(uint32_t windowId) = 0; 96 virtual WMError MinimizeAllAppWindows(DisplayId displayId) = 0; 97 virtual WMError ToggleShownStateForAllAppWindows() = 0; 98 virtual WMError SetWindowLayoutMode(WindowLayoutMode mode) = 0; 99 virtual WMError UpdateProperty(sptr<WindowProperty>& windowProperty, PropertyChangeAction action, 100 bool isAsyncTask = false) = 0; 101 virtual WMError SetWindowGravity(uint32_t windowId, WindowGravity gravity, uint32_t percent) = 0; 102 virtual WMError RegisterWindowManagerAgent(WindowManagerAgentType type, 103 const sptr<IWindowManagerAgent>& windowManagerAgent) = 0; 104 virtual WMError UnregisterWindowManagerAgent(WindowManagerAgentType type, 105 const sptr<IWindowManagerAgent>& windowManagerAgent) = 0; 106 virtual WMError GetAccessibilityWindowInfo(std::vector<sptr<AccessibilityWindowInfo>>& infos) = 0; 107 virtual WMError GetVisibilityWindowInfo(std::vector<sptr<WindowVisibilityInfo>>& infos) = 0; 108 virtual WMError SetWindowAnimationController(const sptr<RSIWindowAnimationController>& controller) = 0; 109 virtual WMError GetSystemConfig(SystemConfig& systemConfig) = 0; 110 virtual WMError NotifyWindowTransition(sptr<WindowTransitionInfo>& from, sptr<WindowTransitionInfo>& to, 111 bool isFromClient = false) = 0; 112 virtual WMError GetModeChangeHotZones(DisplayId displayId, ModeChangeHotZones& hotZones) = 0; 113 virtual void MinimizeWindowsByLauncher(std::vector<uint32_t> windowIds, bool isAnimated, 114 sptr<RSIWindowAnimationFinishedCallback>& finishCallback) = 0; 115 virtual WMError UpdateAvoidAreaListener(uint32_t windowId, bool haveListener) = 0; 116 virtual WMError UpdateRsTree(uint32_t windowId, bool isAdd) = 0; 117 virtual WMError BindDialogTarget(uint32_t& windowId, sptr<IRemoteObject> targetToken) = 0; 118 virtual void SetAnchorAndScale(int32_t x, int32_t y, float scale) = 0; 119 virtual void SetAnchorOffset(int32_t deltaX, int32_t deltaY) = 0; 120 virtual void OffWindowZoom() = 0; 121 virtual WmErrorCode RaiseToAppTop(uint32_t windowId) = 0; 122 virtual std::shared_ptr<Media::PixelMap> GetSnapshot(int32_t windowId) = 0; 123 virtual WMError SetGestureNavigaionEnabled(bool enable) = 0; 124 virtual void DispatchKeyEvent(uint32_t windowId, std::shared_ptr<MMI::KeyEvent> event) = 0; NotifyDumpInfoResult(const std::vector<std::string> & info)125 virtual void NotifyDumpInfoResult(const std::vector<std::string>& info) {}; 126 virtual WMError GetWindowAnimationTargets(std::vector<uint32_t> missionIds, 127 std::vector<sptr<RSWindowAnimationTarget>>& targets) = 0; 128 virtual void SetMaximizeMode(MaximizeMode maximizeMode) = 0; 129 virtual MaximizeMode GetMaximizeMode() = 0; 130 virtual void GetFocusWindowInfo(FocusChangeInfo& focusInfo) = 0; UpdateSessionAvoidAreaListener(int32_t & persistentId,bool haveListener)131 virtual WSError UpdateSessionAvoidAreaListener(int32_t& persistentId, bool haveListener) { return WSError::WS_OK; } 132 }; 133 } 134 } 135 #endif // OHOS_WINDOW_MANAGER_INTERFACE_H 136