1 /*
2  * Copyright (c) 2021-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 #ifndef OHOS_WINDOW_MANAGER_PROXY_H
17 #define OHOS_WINDOW_MANAGER_PROXY_H
18 
19 #include <iremote_proxy.h>
20 #include "window_manager_interface.h"
21 #include <transaction/rs_transaction.h>
22 #include <ui/rs_surface_node.h>
23 
24 namespace OHOS {
25 namespace Rosen {
26 class WindowManagerProxy : public IRemoteProxy<IWindowManager> {
27 public:
WindowManagerProxy(const sptr<IRemoteObject> & impl)28     explicit WindowManagerProxy(const sptr<IRemoteObject>& impl) : IRemoteProxy<IWindowManager>(impl) {};
29 
~WindowManagerProxy()30     ~WindowManagerProxy() {};
31 
32     WMError CreateWindow(sptr<IWindow>& window, sptr<WindowProperty>& property,
33         const std::shared_ptr<RSSurfaceNode>& surfaceNode,
34         uint32_t& windowId, sptr<IRemoteObject> token) override;
35     WMError AddWindow(sptr<WindowProperty>& property) override;
36     WMError RemoveWindow(uint32_t windowId, bool isFromInnerkits) override;
37     WMError NotifyWindowTransition(sptr<WindowTransitionInfo>& from, sptr<WindowTransitionInfo>& to,
38         bool isFromClient = false) override;
39     WMError DestroyWindow(uint32_t windowId, bool onlySelf = false) override;
40     WMError RequestFocus(uint32_t windowId) override;
41     AvoidArea GetAvoidAreaByType(uint32_t windowId, AvoidAreaType type) override;
42     WMError GetTopWindowId(uint32_t mainWinId, uint32_t& topWinId) override;
43     void NotifyServerReadyToMoveOrDrag(uint32_t windowId, sptr<WindowProperty>& windowProperty,
44         sptr<MoveDragProperty>& moveDragProperty) override;
45     void ProcessPointDown(uint32_t windowId, bool isPointDown) override;
46     void ProcessPointUp(uint32_t windowId) override;
47     WMError MinimizeAllAppWindows(DisplayId displayId) override;
48     WMError ToggleShownStateForAllAppWindows() override;
49     WMError SetWindowLayoutMode(WindowLayoutMode mode) override;
50     WMError UpdateProperty(sptr<WindowProperty>& windowProperty, PropertyChangeAction action,
51         bool isAsyncTask = false) override;
52     WMError SetWindowGravity(uint32_t windowId, WindowGravity gravity, uint32_t percent) override;
53     WMError RegisterWindowManagerAgent(WindowManagerAgentType type,
54         const sptr<IWindowManagerAgent>& windowManagerAgent) override;
55     WMError UnregisterWindowManagerAgent(WindowManagerAgentType type,
56         const sptr<IWindowManagerAgent>& windowManagerAgent) override;
57     WMError SetWindowAnimationController(const sptr<RSIWindowAnimationController>& controller) override;
58 
59     WMError GetAccessibilityWindowInfo(std::vector<sptr<AccessibilityWindowInfo>>& infos) override;
60     WMError GetUnreliableWindowInfo(int32_t windowId, std::vector<sptr<UnreliableWindowInfo>>& infos) override;
61     WMError GetVisibilityWindowInfo(std::vector<sptr<WindowVisibilityInfo>>& infos) override;
62     WMError GetSystemConfig(SystemConfig& systemConfig) override;
63     WMError GetModeChangeHotZones(DisplayId displayId, ModeChangeHotZones& hotZones) override;
64     void MinimizeWindowsByLauncher(std::vector<uint32_t> windowIds, bool isAnimated,
65         sptr<RSIWindowAnimationFinishedCallback>& finishCallback) override;
66     WMError UpdateAvoidAreaListener(uint32_t windowId, bool haveListener) override;
67     WMError UpdateRsTree(uint32_t windowId, bool isAdd) override;
68     WMError BindDialogTarget(uint32_t& windowId, sptr<IRemoteObject> targetToken) override;
69     WMError GetSnapshotByWindowId(int32_t persistentId, std::shared_ptr<Media::PixelMap>& pixelMap) override;
70     void SetAnchorAndScale(int32_t x, int32_t y, float scale) override;
71     void SetAnchorOffset(int32_t deltaX, int32_t deltaY) override;
72     void OffWindowZoom() override;
73     WMError RaiseToAppTop(uint32_t windowId) override;
74     std::shared_ptr<Media::PixelMap> GetSnapshot(int32_t windowId) override;
75     WMError SetGestureNavigaionEnabled(bool enable) override;
76     void DispatchKeyEvent(uint32_t windowId, std::shared_ptr<MMI::KeyEvent> event) override;
77     void NotifyDumpInfoResult(const std::vector<std::string>& info) override;
78     WMError GetWindowAnimationTargets(std::vector<uint32_t> missionIds,
79         std::vector<sptr<RSWindowAnimationTarget>>& targets) override;
80     void SetMaximizeMode(MaximizeMode maximizeMode) override;
81     MaximizeMode GetMaximizeMode() override;
82     void GetFocusWindowInfo(FocusChangeInfo& focusInfo) override;
83 private:
84     static inline BrokerDelegator<WindowManagerProxy> delegator_;
85 };
86 }
87 }
88 #endif // OHOS_WINDOW_MANAGER_PROXY_H
89