• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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_ROSEN_WINDOW_SCENE_SESSION_MANAGER_PROXY_H
17 #define OHOS_ROSEN_WINDOW_SCENE_SESSION_MANAGER_PROXY_H
18 
19 #include <iremote_proxy.h>
20 
21 #include "session_manager/include/zidl/scene_session_manager_interface.h"
22 
23 namespace OHOS::Rosen {
24 class SceneSessionManagerProxy : public IRemoteProxy<ISceneSessionManager> {
25 public:
SceneSessionManagerProxy(const sptr<IRemoteObject> & impl)26     explicit SceneSessionManagerProxy(const sptr<IRemoteObject>& impl)
27         : IRemoteProxy<ISceneSessionManager>(impl) {}
28     virtual ~SceneSessionManagerProxy() = default;
29 
30     WSError CreateAndConnectSpecificSession(const sptr<ISessionStage>& sessionStage,
31         const sptr<IWindowEventChannel>& eventChannel, const std::shared_ptr<RSSurfaceNode>& surfaceNode,
32         sptr<WindowSessionProperty> property, int32_t& persistentId, sptr<ISession>& session,
33         SystemSessionConfig& systemConfig, sptr<IRemoteObject> token = nullptr) override;
34     WSError RecoverAndConnectSpecificSession(const sptr<ISessionStage>& sessionStage,
35         const sptr<IWindowEventChannel>& eventChannel, const std::shared_ptr<RSSurfaceNode>& surfaceNode,
36         sptr<WindowSessionProperty> property, sptr<ISession>& session, sptr<IRemoteObject> token = nullptr) override;
37     WSError RecoverAndReconnectSceneSession(const sptr<ISessionStage>& sessionStage,
38         const sptr<IWindowEventChannel>& eventChannel, const std::shared_ptr<RSSurfaceNode>& surfaceNode,
39         sptr<ISession>& session, sptr<WindowSessionProperty> property = nullptr,
40         sptr<IRemoteObject> token = nullptr) override;
41     WSError DestroyAndDisconnectSpecificSession(const int32_t persistentId) override;
42     WSError DestroyAndDisconnectSpecificSessionWithDetachCallback(const int32_t persistentId,
43         const sptr<IRemoteObject>& callback) override;
44     WSError BindDialogSessionTarget(uint64_t persistentId, sptr<IRemoteObject> targetToken) override;
45     WMError RequestFocusStatus(int32_t persistentId, bool isFocused, bool byForeground = true,
46         FocusChangeReason reason = FocusChangeReason::DEFAULT) override;
47     WMError RequestFocusStatusBySA(int32_t persistentId, bool isFocused = true,
48         bool byForeground = true, FocusChangeReason reason = FocusChangeReason::SA_REQUEST) override;
49     WSError RaiseWindowToTop(int32_t persistentId) override;
50 
51     /*
52      * Sub Window
53      */
54     WMError SetParentWindow(int32_t subWindowId, int32_t newParentWindowId) override;
55 
56     WMError RegisterWindowManagerAgent(WindowManagerAgentType type,
57         const sptr<IWindowManagerAgent>& windowManagerAgent) override;
58     WMError UnregisterWindowManagerAgent(WindowManagerAgentType type,
59         const sptr<IWindowManagerAgent>& windowManagerAgent) override;
60     WMError SetGestureNavigationEnabled(bool enable) override;
61     void GetFocusWindowInfo(FocusChangeInfo& focusInfo, DisplayId displayId = DEFAULT_DISPLAY_ID) override;
62     WSError SetSessionLabel(const sptr<IRemoteObject>& token, const std::string& label) override;
63     WSError SetSessionIcon(const sptr<IRemoteObject>& token, const std::shared_ptr<Media::PixelMap>& icon) override;
64     WSError IsValidSessionIds(const std::vector<int32_t>& sessionIds, std::vector<bool>& results) override;
65     WMError GetAccessibilityWindowInfo(std::vector<sptr<AccessibilityWindowInfo>>& infos) override;
66     WMError GetUnreliableWindowInfo(int32_t windowId, std::vector<sptr<UnreliableWindowInfo>>& infos) override;
67     WSError PendingSessionToForeground(const sptr<IRemoteObject>& token) override;
68     WSError PendingSessionToBackgroundForDelegator(const sptr<IRemoteObject>& token,
69         bool shouldBackToCaller = true) override;
70     WMError GetSessionSnapshotById(int32_t persistentId, SessionSnapshot& snapshot) override;
71     WMError GetSnapshotByWindowId(int32_t persistentId, std::shared_ptr<Media::PixelMap>& pixelMap) override;
72     WSError GetFocusSessionToken(sptr<IRemoteObject>& token, DisplayId displayId = DEFAULT_DISPLAY_ID) override;
73     WSError GetFocusSessionElement(AppExecFwk::ElementName& element, DisplayId displayId = DEFAULT_DISPLAY_ID) override;
74     WMError CheckWindowId(int32_t windowId, int32_t& pid) override;
75 
76     WSError RegisterSessionListener(const sptr<ISessionListener>& listener) override;
77     WSError UnRegisterSessionListener(const sptr<ISessionListener>& listener) override;
78     WSError GetSessionInfos(const std::string& deviceId, int32_t numMax,
79                             std::vector<SessionInfoBean>& sessionInfos) override;
80     WSError GetSessionInfo(const std::string& deviceId, int32_t persistentId, SessionInfoBean& sessionInfo) override;
81     WSError GetSessionInfoByContinueSessionId(const std::string& continueSessionId,
82         SessionInfoBean& sessionInfo) override;
83 
84     WSError DumpSessionAll(std::vector<std::string>& infos) override;
85     WSError DumpSessionWithId(int32_t persistentId, std::vector<std::string>& infos) override;
86     WSError SetSessionContinueState(const sptr<IRemoteObject>& token, const ContinueState& continueState) override;
87     WSError TerminateSessionNew(
88         const sptr<AAFwk::SessionInfo> info, bool needStartCaller, bool isFromBroker = false) override;
89     WSError GetSessionDumpInfo(const std::vector<std::string>& params, std::string& info) override;
90     void NotifyDumpInfoResult(const std::vector<std::string>& info) override;
91     WSError UpdateSessionAvoidAreaListener(int32_t persistentId, bool haveListener) override;
92     WSError UpdateSessionTouchOutsideListener(int32_t& persistentId, bool haveListener) override;
93     WSError UpdateSessionWindowVisibilityListener(int32_t persistentId, bool haveListener) override;
94     WSError GetSessionSnapshot(const std::string& deviceId, int32_t persistentId,
95                                SessionSnapshot& snapshot, bool isLowResolution) override;
96     WSError GetUIContentRemoteObj(int32_t persistentId, sptr<IRemoteObject>& uiContentRemoteObj) override;
97     WSError LockSession(int32_t persistentId) override;
98     WSError UnlockSession(int32_t persistentId) override;
99     WSError MoveSessionsToForeground(const std::vector<int32_t>& sessionIds, int32_t topSessionId) override;
100     WSError MoveSessionsToBackground(const std::vector<int32_t>& sessionIds, std::vector<int32_t>& result) override;
101     WSError ClearSession(int32_t persistentId) override;
102     WSError ClearAllSessions() override;
103     WSError RegisterIAbilityManagerCollaborator(int32_t type,
104         const sptr<AAFwk::IAbilityManagerCollaborator>& impl) override;
105     WSError UnregisterIAbilityManagerCollaborator(int32_t type) override;
106     WSError NotifyWindowExtensionVisibilityChange(int32_t pid, int32_t uid, bool visible) override;
107     WMError GetTopWindowId(uint32_t mainWinId, uint32_t& topWinId) override;
108     WMError NotifyWatchGestureConsumeResult(int32_t keyCode, bool isConsumed) override;
109     WMError NotifyWatchFocusActiveChange(bool isActive) override;
110     WMError GetParentMainWindowId(int32_t windowId, int32_t& mainWindowId) override;
111     WMError ListWindowInfo(const WindowInfoOption& windowInfoOption, std::vector<sptr<WindowInfo>>& infos) override;
112     WMError GetAllWindowLayoutInfo(DisplayId displayId, std::vector<sptr<WindowLayoutInfo>>& infos) override;
113     WMError GetGlobalWindowMode(DisplayId displayId, GlobalWindowMode& globalWinMode) override;
114     WMError GetTopNavDestinationName(int32_t windowId, std::string& topNavDestName) override;
115     WMError GetVisibilityWindowInfo(std::vector<sptr<WindowVisibilityInfo>>& infos) override;
116     WSError ShiftAppWindowFocus(int32_t sourcePersistentId, int32_t targetPersistentId) override;
117     void AddExtensionWindowStageToSCB(const sptr<ISessionStage>& sessionStage,
118         const sptr<IRemoteObject>& token, uint64_t surfaceNodeId, bool isConstrainedModal = false) override;
119     void RemoveExtensionWindowStageFromSCB(const sptr<ISessionStage>& sessionStage,
120         const sptr<IRemoteObject>& token, bool isConstrainedModal = false) override;
121     void UpdateModalExtensionRect(const sptr<IRemoteObject>& token, Rect rect) override;
122     void ProcessModalExtensionPointDown(const sptr<IRemoteObject>& token, int32_t posX, int32_t posY) override;
123     WSError AddOrRemoveSecureSession(int32_t persistentId, bool shouldHide) override;
124     WSError UpdateExtWindowFlags(const sptr<IRemoteObject>& token, uint32_t extWindowFlags,
125         uint32_t extWindowActions) override;
126     WSError GetHostWindowRect(int32_t hostWindowId, Rect& rect) override;
127     WSError GetHostGlobalScaledRect(int32_t hostWindowId, Rect& globalScaledRect) override;
128     WSError GetFreeMultiWindowEnableState(bool& enable) override;
129     WMError GetCallingWindowWindowStatus(int32_t persistentId, WindowStatus& windowStatus) override;
130     WMError GetCallingWindowRect(int32_t persistentId, Rect& rect) override;
131     WMError MinimizeAllAppWindows(DisplayId displayId) override;
132     WMError ToggleShownStateForAllAppWindows() override;
133     WMError GetWindowModeType(WindowModeType& windowModeType) override;
134     WMError GetWindowStyleType(WindowStyleType& windowStyleType) override;
135     WMError GetProcessSurfaceNodeIdByPersistentId(const int32_t pid,
136         const std::vector<int32_t>& persistentIds, std::vector<uint64_t>& surfaceNodeIds) override;
137     WMError SkipSnapshotForAppProcess(int32_t pid, bool skip) override;
138     WMError SkipSnapshotByUserIdAndBundleNames(int32_t userId,
139         const std::vector<std::string>& bundleNameList) override;
140     WMError SetProcessWatermark(int32_t pid, const std::string& watermarkName, bool isEnabled) override;
141     WMError GetWindowIdsByCoordinate(DisplayId displayId, int32_t windowNumber,
142         int32_t x, int32_t y, std::vector<int32_t>& windowIds) override;
143     WMError UpdateScreenLockStatusForApp(const std::string& bundleName, bool isRelease) override;
144     WMError AddSkipSelfWhenShowOnVirtualScreenList(const std::vector<int32_t>& persistentIds) override;
145     WMError RemoveSkipSelfWhenShowOnVirtualScreenList(const std::vector<int32_t>& persistentIds) override;
146     WMError SetScreenPrivacyWindowTagSwitch(
147         uint64_t screenId, const std::vector<std::string>& privacyWindowTags, bool enable) override;
148     WMError IsPcWindow(bool& isPcWindow) override;
149     WMError IsFreeMultiWindow(bool& isPcWindow) override;
150     WMError IsPcOrPadFreeMultiWindowMode(bool& isPcOrPadFreeMultiWindowMode) override;
151     WMError IsWindowRectAutoSave(const std::string& key, bool& enabled, int persistentId) override;
152     WMError SetImageForRecent(uint32_t imgResourceId, ImageFit ImageFit, int32_t persistentId) override;
153     WMError GetDisplayIdByWindowId(const std::vector<uint64_t>& windowIds,
154         std::unordered_map<uint64_t, DisplayId>& windowDisplayIdMap) override;
155     WMError SetGlobalDragResizeType(DragResizeType dragResizeType) override;
156     WMError GetGlobalDragResizeType(DragResizeType& dragResizeType) override;
157     WMError SetAppDragResizeType(const std::string& bundleName, DragResizeType dragResizeType) override;
158     WMError GetAppDragResizeType(const std::string& bundleName, DragResizeType& dragResizeType) override;
159     WMError SetAppKeyFramePolicy(const std::string& bundleName, const KeyFramePolicy& keyFramePolicy) override;
160     WMError ShiftAppWindowPointerEvent(int32_t sourcePersistentId, int32_t targetPersistentId,
161         int32_t fingerId) override;
162     WMError NotifyScreenshotEvent(ScreenshotEventType type) override;
163     WMError SetStartWindowBackgroundColor(
164         const std::string& moduleName, const std::string& abilityName, uint32_t color, int32_t uid) override;
165     WMError MinimizeByWindowId(const std::vector<int32_t>& windowIds) override;
166     WMError SetForegroundWindowNum(uint32_t windowNum) override;
167     WSError UseImplicitAnimation(int32_t hostWindowId, bool useImplicit) override;
168     WMError RegisterWindowPropertyChangeAgent(WindowInfoKey windowInfoKey, uint32_t interestInfo,
169         const sptr<IWindowManagerAgent>& windowManagerAgent) override;
170     WMError UnregisterWindowPropertyChangeAgent(WindowInfoKey windowInfoKey, uint32_t interestInfo,
171         const sptr<IWindowManagerAgent>& windowManagerAgent) override;
172     WMError RecoverWindowPropertyChangeFlag(uint32_t observedFlags, uint32_t interestedFlags) override;
173     WMError AnimateTo(int32_t windowId, const WindowAnimationProperty& animationProperty,
174         const WindowAnimationOption& animationOption) override;
175     WMError CreateUIEffectController(const sptr<IUIEffectControllerClient>& controllerClient,
176         sptr<IUIEffectController>& controller, int32_t& controllerId) override;
177     WMError AddSessionBlackList(const std::unordered_set<std::string>& bundleNames,
178         const std::unordered_set<std::string>& privacyWindowTags) override;
179     WMError RemoveSessionBlackList(const std::unordered_set<std::string>& bundleNames,
180         const std::unordered_set<std::string>& privacyWindowTags) override;
181     WMError GetPiPSettingSwitchStatus(bool& switchStatus) override;
182 
183 private:
184     template<typename T>
185     WSError GetParcelableInfos(MessageParcel& reply, std::vector<T>& parcelableInfos);
186     static inline BrokerDelegator<SceneSessionManagerProxy> delegator_;
187 };
188 } // namespace OHOS::Rosen
189 
190 #endif // OHOS_ROSEN_WINDOW_SCENE_SESSION_MANAGER_PROXY_H
191