1 /*
2 * Copyright (c) 2022-2022 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 #include "window_manager_stub.h"
17 #include "window_manager_agent.h"
18 #include <rs_iwindow_animation_controller.h>
19 #include "window_impl.h"
20 #include "window_agent.h"
21
22 namespace OHOS {
23 namespace Rosen {
24 class WindowManagerStubImpl : public WindowManagerStub {
CreateWindow(sptr<IWindow> & window,sptr<WindowProperty> & property,const std::shared_ptr<RSSurfaceNode> & surfaceNode,uint32_t & windowId,sptr<IRemoteObject> token)25 WMError CreateWindow(sptr<IWindow>& window, sptr<WindowProperty>& property,
26 const std::shared_ptr<RSSurfaceNode>& surfaceNode,
27 uint32_t& windowId, sptr<IRemoteObject> token)
28 {
29 return WMError::WM_OK;
30 };
AddWindow(sptr<WindowProperty> & property)31 WMError AddWindow(sptr<WindowProperty>& property)
32 {
33 return WMError::WM_OK;
34 };
RemoveWindow(uint32_t windowId,bool isFromInnerkits)35 WMError RemoveWindow(uint32_t windowId, bool isFromInnerkits)
36 {
37 return WMError::WM_OK;
38 };
39 WMError DestroyWindow(uint32_t windowId, bool onlySelf = false)
40 {
41 return WMError::WM_OK;
42 };
RequestFocus(uint32_t windowId)43 WMError RequestFocus(uint32_t windowId)
44 {
45 return WMError::WM_OK;
46 };
GetAvoidAreaByType(uint32_t windowId,AvoidAreaType type,const Rect & rect)47 AvoidArea GetAvoidAreaByType(uint32_t windowId, AvoidAreaType type, const Rect& rect)
48 {
49 AvoidArea area;
50 return area;
51 };
GetTopWindowId(uint32_t mainWinId,uint32_t & topWinId)52 WMError GetTopWindowId(uint32_t mainWinId, uint32_t& topWinId)
53 {
54 return WMError::WM_OK;
55 };
NotifyServerReadyToMoveOrDrag(uint32_t windowId,sptr<WindowProperty> & windowProperty,sptr<MoveDragProperty> & moveDragProperty)56 void NotifyServerReadyToMoveOrDrag(uint32_t windowId, sptr<WindowProperty>& windowProperty,
57 sptr<MoveDragProperty>& moveDragProperty){};
ProcessPointDown(uint32_t windowId,bool isPointDown)58 void ProcessPointDown(uint32_t windowId, bool isPointDown){};
ProcessPointUp(uint32_t windowId)59 void ProcessPointUp(uint32_t windowId){};
MinimizeAllAppWindows(DisplayId displayId)60 WMError MinimizeAllAppWindows(DisplayId displayId)
61 {
62 return WMError::WM_OK;
63 };
ToggleShownStateForAllAppWindows()64 WMError ToggleShownStateForAllAppWindows()
65 {
66 return WMError::WM_OK;
67 };
SetWindowLayoutMode(WindowLayoutMode mode)68 WMError SetWindowLayoutMode(WindowLayoutMode mode)
69 {
70 return WMError::WM_OK;
71 };
NotifyScreenshotEvent(ScreenshotEventType type)72 WMError NotifyScreenshotEvent(ScreenshotEventType type)
73 {
74 return WMError::WM_OK;
75 };
76 WMError UpdateProperty(sptr<WindowProperty>& windowProperty, PropertyChangeAction action,
77 bool isAsyncTask = false)
78 {
79 return WMError::WM_OK;
80 };
SetWindowGravity(uint32_t windowId,WindowGravity gravity,uint32_t percent)81 WMError SetWindowGravity(uint32_t windowId, WindowGravity gravity, uint32_t percent)
82 {
83 return WMError::WM_OK;
84 };
RegisterWindowManagerAgent(WindowManagerAgentType type,const sptr<IWindowManagerAgent> & windowManagerAgent)85 WMError RegisterWindowManagerAgent(WindowManagerAgentType type,
86 const sptr<IWindowManagerAgent>& windowManagerAgent)
87 {
88 return WMError::WM_OK;
89 };
UnregisterWindowManagerAgent(WindowManagerAgentType type,const sptr<IWindowManagerAgent> & windowManagerAgent)90 WMError UnregisterWindowManagerAgent(WindowManagerAgentType type,
91 const sptr<IWindowManagerAgent>& windowManagerAgent)
92 {
93 return WMError::WM_OK;
94 };
GetAccessibilityWindowInfo(std::vector<sptr<AccessibilityWindowInfo>> & infos)95 WMError GetAccessibilityWindowInfo(std::vector<sptr<AccessibilityWindowInfo>>& infos)
96 {
97 return WMError::WM_OK;
98 };
GetUnreliableWindowInfo(int32_t windowId,std::vector<sptr<UnreliableWindowInfo>> & infos)99 WMError GetUnreliableWindowInfo(int32_t windowId, std::vector<sptr<UnreliableWindowInfo>>& infos)
100 {
101 return WMError::WM_OK;
102 }
GetVisibilityWindowInfo(std::vector<sptr<WindowVisibilityInfo>> & infos)103 WMError GetVisibilityWindowInfo(std::vector<sptr<WindowVisibilityInfo>>& infos)
104 {
105 return WMError::WM_OK;
106 };
SetWindowAnimationController(const sptr<RSIWindowAnimationController> & controller)107 WMError SetWindowAnimationController(const sptr<RSIWindowAnimationController>& controller)
108 {
109 return WMError::WM_OK;
110 };
GetSystemConfig(SystemConfig & systemConfig)111 WMError GetSystemConfig(SystemConfig& systemConfig)
112 {
113 return WMError::WM_OK;
114 };
115 WMError NotifyWindowTransition(sptr<WindowTransitionInfo>& from, sptr<WindowTransitionInfo>& to,
116 bool isFromClient = false)
117 {
118 return WMError::WM_OK;
119 };
GetModeChangeHotZones(DisplayId displayId,ModeChangeHotZones & hotZones)120 WMError GetModeChangeHotZones(DisplayId displayId, ModeChangeHotZones& hotZones)
121 {
122 return WMError::WM_OK;
123 };
MinimizeWindowsByLauncher(std::vector<uint32_t> windowIds,bool isAnimated,sptr<RSIWindowAnimationFinishedCallback> & finishCallback)124 void MinimizeWindowsByLauncher(std::vector<uint32_t> windowIds, bool isAnimated,
125 sptr<RSIWindowAnimationFinishedCallback>& finishCallback){};
UpdateAvoidAreaListener(uint32_t windowId,bool haveListener)126 WMError UpdateAvoidAreaListener(uint32_t windowId, bool haveListener)
127 {
128 return WMError::WM_OK;
129 };
UpdateRsTree(uint32_t windowId,bool isAdd)130 WMError UpdateRsTree(uint32_t windowId, bool isAdd)
131 {
132 return WMError::WM_OK;
133 };
BindDialogTarget(uint32_t & windowId,sptr<IRemoteObject> targetToken)134 WMError BindDialogTarget(uint32_t& windowId, sptr<IRemoteObject> targetToken)
135 {
136 return WMError::WM_OK;
137 };
SetAnchorAndScale(int32_t x,int32_t y,float scale)138 void SetAnchorAndScale(int32_t x, int32_t y, float scale){};
SetAnchorOffset(int32_t deltaX,int32_t deltaY)139 void SetAnchorOffset(int32_t deltaX, int32_t deltaY){};
OffWindowZoom()140 void OffWindowZoom(){};
RaiseToAppTop(uint32_t windowId)141 WMError RaiseToAppTop(uint32_t windowId)
142 {
143 return WMError::WM_OK;
144 };
GetSnapshot(int32_t windowId)145 std::shared_ptr<Media::PixelMap> GetSnapshot(int32_t windowId) override
146 {
147 return nullptr;
148 }
SetGestureNavigationEnabled(bool enable)149 WMError SetGestureNavigationEnabled(bool enable) override
150 {
151 return WMError::WM_OK;
152 }
DispatchKeyEvent(uint32_t windowId,std::shared_ptr<MMI::KeyEvent> event)153 void DispatchKeyEvent(uint32_t windowId, std::shared_ptr<MMI::KeyEvent> event) override {}
GetWindowAnimationTargets(std::vector<uint32_t> missionIds,std::vector<sptr<RSWindowAnimationTarget>> & targets)154 WMError GetWindowAnimationTargets(std::vector<uint32_t> missionIds,
155 std::vector<sptr<RSWindowAnimationTarget>>& targets) override
156 {
157 return WMError::WM_OK;
158 }
SetMaximizeMode(MaximizeMode maximizeMode)159 void SetMaximizeMode(MaximizeMode maximizeMode) override {}
GetMaximizeMode()160 MaximizeMode GetMaximizeMode() override
161 {
162 return MaximizeMode::MODE_FULL_FILL;
163 }
164 void GetFocusWindowInfo(FocusChangeInfo& focusInfo, DisplayId displayId = DEFAULT_DISPLAY_ID) override {}
165 };
166 }
167 }
168