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)47 AvoidArea GetAvoidAreaByType(uint32_t windowId, AvoidAreaType type)
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 };
72 WMError UpdateProperty(sptr<WindowProperty>& windowProperty, PropertyChangeAction action,
73     bool isAsyncTask = false)
74 {
75     return WMError::WM_OK;
76 };
SetWindowGravity(uint32_t windowId,WindowGravity gravity,uint32_t percent)77 WMError SetWindowGravity(uint32_t windowId, WindowGravity gravity, uint32_t percent)
78 {
79     return WMError::WM_OK;
80 };
RegisterWindowManagerAgent(WindowManagerAgentType type,const sptr<IWindowManagerAgent> & windowManagerAgent)81 WMError RegisterWindowManagerAgent(WindowManagerAgentType type,
82     const sptr<IWindowManagerAgent>& windowManagerAgent)
83 {
84     return WMError::WM_OK;
85 };
UnregisterWindowManagerAgent(WindowManagerAgentType type,const sptr<IWindowManagerAgent> & windowManagerAgent)86 WMError UnregisterWindowManagerAgent(WindowManagerAgentType type,
87     const sptr<IWindowManagerAgent>& windowManagerAgent)
88 {
89     return WMError::WM_OK;
90 };
GetAccessibilityWindowInfo(std::vector<sptr<AccessibilityWindowInfo>> & infos)91 WMError GetAccessibilityWindowInfo(std::vector<sptr<AccessibilityWindowInfo>>& infos)
92 {
93     return WMError::WM_OK;
94 };
GetUnreliableWindowInfo(int32_t windowId,std::vector<sptr<UnreliableWindowInfo>> & infos)95 WMError GetUnreliableWindowInfo(int32_t windowId, std::vector<sptr<UnreliableWindowInfo>>& infos)
96 {
97     return WMError::WM_OK;
98 }
GetVisibilityWindowInfo(std::vector<sptr<WindowVisibilityInfo>> & infos)99 WMError GetVisibilityWindowInfo(std::vector<sptr<WindowVisibilityInfo>>& infos)
100 {
101     return WMError::WM_OK;
102 };
SetWindowAnimationController(const sptr<RSIWindowAnimationController> & controller)103 WMError SetWindowAnimationController(const sptr<RSIWindowAnimationController>& controller)
104 {
105     return WMError::WM_OK;
106 };
GetSystemConfig(SystemConfig & systemConfig)107 WMError GetSystemConfig(SystemConfig& systemConfig)
108 {
109     return WMError::WM_OK;
110 };
111 WMError NotifyWindowTransition(sptr<WindowTransitionInfo>& from, sptr<WindowTransitionInfo>& to,
112     bool isFromClient = false)
113 {
114     return WMError::WM_OK;
115 };
GetModeChangeHotZones(DisplayId displayId,ModeChangeHotZones & hotZones)116 WMError GetModeChangeHotZones(DisplayId displayId, ModeChangeHotZones& hotZones)
117 {
118     return WMError::WM_OK;
119 };
MinimizeWindowsByLauncher(std::vector<uint32_t> windowIds,bool isAnimated,sptr<RSIWindowAnimationFinishedCallback> & finishCallback)120 void MinimizeWindowsByLauncher(std::vector<uint32_t> windowIds, bool isAnimated,
121     sptr<RSIWindowAnimationFinishedCallback>& finishCallback){};
UpdateAvoidAreaListener(uint32_t windowId,bool haveListener)122 WMError UpdateAvoidAreaListener(uint32_t windowId, bool haveListener)
123 {
124     return WMError::WM_OK;
125 };
UpdateRsTree(uint32_t windowId,bool isAdd)126 WMError UpdateRsTree(uint32_t windowId, bool isAdd)
127 {
128     return WMError::WM_OK;
129 };
BindDialogTarget(uint32_t & windowId,sptr<IRemoteObject> targetToken)130 WMError BindDialogTarget(uint32_t& windowId, sptr<IRemoteObject> targetToken)
131 {
132     return WMError::WM_OK;
133 };
SetAnchorAndScale(int32_t x,int32_t y,float scale)134 void SetAnchorAndScale(int32_t x, int32_t y, float scale){};
SetAnchorOffset(int32_t deltaX,int32_t deltaY)135 void SetAnchorOffset(int32_t deltaX, int32_t deltaY){};
OffWindowZoom()136 void OffWindowZoom(){};
RaiseToAppTop(uint32_t windowId)137 WMError RaiseToAppTop(uint32_t windowId)
138 {
139     return WMError::WM_OK;
140 };
GetSnapshot(int32_t windowId)141 std::shared_ptr<Media::PixelMap> GetSnapshot(int32_t windowId) override
142 {
143     return nullptr;
144 }
SetGestureNavigaionEnabled(bool enable)145 WMError SetGestureNavigaionEnabled(bool enable) override
146 {
147     return WMError::WM_OK;
148 }
DispatchKeyEvent(uint32_t windowId,std::shared_ptr<MMI::KeyEvent> event)149 void DispatchKeyEvent(uint32_t windowId, std::shared_ptr<MMI::KeyEvent> event) override {}
GetWindowAnimationTargets(std::vector<uint32_t> missionIds,std::vector<sptr<RSWindowAnimationTarget>> & targets)150 WMError GetWindowAnimationTargets(std::vector<uint32_t> missionIds,
151     std::vector<sptr<RSWindowAnimationTarget>>& targets) override
152 {
153     return WMError::WM_OK;
154 }
SetMaximizeMode(MaximizeMode maximizeMode)155 void SetMaximizeMode(MaximizeMode maximizeMode) override {}
GetMaximizeMode()156 MaximizeMode GetMaximizeMode() override
157 {
158     return MaximizeMode::MODE_FULL_FILL;
159 }
GetFocusWindowInfo(FocusChangeInfo & focusInfo)160 void GetFocusWindowInfo(FocusChangeInfo& focusInfo) override {}
161 };
162 }
163 }
164