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