• 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_INTERFACE_H
17 #define OHOS_ROSEN_WINDOW_SCENE_SESSION_MANAGER_INTERFACE_H
18 
19 #include "common/include/window_session_property.h"
20 #include <iremote_broker.h>
21 #include "interfaces/include/ws_common.h"
22 #include "interfaces/include/ws_common_inner.h"
23 #include "session/container/include/zidl/session_stage_interface.h"
24 #include "session/container/include/zidl/window_event_channel_interface.h"
25 #include "session/host/include/session.h"
26 #include "focus_change_info.h"
27 #include "window_manager.h"
28 #include "zidl/window_manager_interface.h"
29 #include "session_info.h"
30 #include "mission_listener_interface.h"
31 #include "mission_info.h"
32 #include "mission_snapshot.h"
33 #include "iability_manager_collaborator.h"
34 
35 namespace OHOS::Media {
36 class PixelMap;
37 } // namespace OHOS::Media
38 
39 namespace OHOS::Rosen {
40 class RSSurfaceNode;
41 using ISessionListener = AAFwk::IMissionListener;
42 using SessionInfoBean = AAFwk::MissionInfo;
43 using SessionSnapshot = AAFwk::MissionSnapshot;
44 class ISceneSessionManager : public IWindowManager {
45 public:
46     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.ISceneSessionManager");
47 
48     enum class SceneSessionManagerMessage : uint32_t {
49         TRANS_ID_CREATE_AND_CONNECT_SPECIFIC_SESSION,
50         TRANS_ID_DESTROY_AND_DISCONNECT_SPECIFIC_SESSION,
51         TRANS_ID_UPDATE_PROPERTY,
52         TRANS_ID_REQUEST_FOCUS,
53         TRANS_ID_REGISTER_WINDOW_MANAGER_AGENT,
54         TRANS_ID_UNREGISTER_WINDOW_MANAGER_AGENT,
55         TRANS_ID_BIND_DIALOG_TARGET,
56         TRANS_ID_GET_FOCUS_SESSION_INFO,
57         TRANS_ID_SET_SESSION_LABEL,
58         TRANS_ID_SET_SESSION_ICON,
59         TRANS_ID_IS_VALID_SESSION_IDS,
60         TRANS_ID_SET_GESTURE_NAVIGATION_ENABLED,
61         TRANS_ID_GET_WINDOW_INFO,
62         TRANS_ID_PENDING_SESSION_TO_FOREGROUND,
63         TRANS_ID_PENDING_SESSION_TO_BACKGROUND_FOR_DELEGATOR,
64         TRANS_ID_GET_FOCUS_SESSION_TOKEN,
65         TRANS_ID_GET_FOCUS_SESSION_ELEMENT,
66         TRANS_ID_CHECK_WINDOW_ID,
67         TRANS_ID_REGISTER_SESSION_LISTENER,
68         TRANS_ID_UNREGISTER_SESSION_LISTENER,
69         TRANS_ID_GET_MISSION_INFOS,
70         TRANS_ID_GET_MISSION_INFO_BY_ID,
71         TRANS_ID_GET_SESSION_INFO_BY_CONTINUE_SESSION_ID,
72         TRANS_ID_DUMP_SESSION_ALL,
73         TRANS_ID_DUMP_SESSION_WITH_ID,
74         TRANS_ID_TERMINATE_SESSION_NEW,
75         TRANS_ID_GET_SESSION_DUMP_INFO,
76         TRANS_ID_UPDATE_AVOIDAREA_LISTENER,
77         TRANS_ID_GET_SESSION_SNAPSHOT,
78         TRANS_ID_GET_SESSION_SNAPSHOT_BY_ID,
79         TRANS_ID_SET_SESSION_CONTINUE_STATE,
80         TRANS_ID_NOTIFY_DUMP_INFO_RESULT,
81         TRANS_ID_CLEAR_SESSION,
82         TRANS_ID_CLEAR_ALL_SESSIONS,
83         TRANS_ID_LOCK_SESSION,
84         TRANS_ID_UNLOCK_SESSION,
85         TRANS_ID_MOVE_MISSIONS_TO_FOREGROUND,
86         TRANS_ID_MOVE_MISSIONS_TO_BACKGROUND,
87         TRANS_ID_REGISTER_COLLABORATOR,
88         TRANS_ID_UNREGISTER_COLLABORATOR,
89         TRANS_ID_UPDATE_TOUCHOUTSIDE_LISTENER,
90         TRANS_ID_RAISE_WINDOW_TO_TOP,
91         TRANS_ID_NOTIFY_WINDOW_EXTENSION_VISIBILITY_CHANGE,
92         TRANS_ID_RECOVER_AND_RECONNECT_SCENE_SESSION,
93 		TRANS_ID_RECOVER_AND_CONNECT_SPECIFIC_SESSION,
94         TRANS_ID_GET_TOP_WINDOW_ID,
95         TRANS_ID_GET_PARENT_MAIN_WINDOW_ID,
96         TRANS_ID_GET_UI_CONTENT_REMOTE_OBJ,
97         TRANS_ID_UPDATE_WINDOW_VISIBILITY_LISTENER,
98         TRANS_ID_SHIFT_APP_WINDOW_FOCUS,
99         TRANS_ID_GET_VISIBILITY_WINDOW_INFO_ID,
100         TRANS_ID_ADD_EXTENSION_WINDOW_STAGE_TO_SCB,
101         TRANS_ID_REMOVE_EXTENSION_WINDOW_STAGE_FROM_SCB,
102         TRANS_ID_UPDATE_MODALEXTENSION_RECT_TO_SCB,
103         TRANS_ID_PROCESS_MODALEXTENSION_POINTDOWN_TO_SCB,
104         TRANS_ID_ADD_OR_REMOVE_SECURE_SESSION,
105         TRANS_ID_UPDATE_EXTENSION_WINDOW_FLAGS,
106         TRANS_ID_GET_HOST_WINDOW_RECT,
107         TRANS_ID_DESTROY_AND_DISCONNECT_SPECIFIC_SESSION_WITH_DETACH_CALLBACK,
108         TRANS_ID_GET_WINDOW_STATUS,
109         TRANS_ID_GET_WINDOW_RECT,
110         TRANS_ID_GET_WINDOW_MODE_TYPE,
111         TRANS_ID_GET_UNRELIABLE_WINDOW_INFO,
112         TRANS_ID_GET_FREE_MULTI_WINDOW_ENABLE_STATE,
113         TRANS_ID_GET_WINDOW_STYLE_TYPE,
114         TRANS_ID_GET_PROCESS_SURFACENODEID_BY_PERSISTENTID,
115         TRANS_ID_RELEASE_SESSION_SCREEN_LOCK,
116         TRANS_ID_GET_DISPLAYID_BY_WINDOWID,
117     };
118 
119     virtual WSError SetSessionLabel(const sptr<IRemoteObject>& token, const std::string& label) = 0;
120     virtual WSError SetSessionIcon(const sptr<IRemoteObject>& token, const std::shared_ptr<Media::PixelMap>& icon) = 0;
121     virtual WSError IsValidSessionIds(const std::vector<int32_t>& sessionIds, std::vector<bool>& results) = 0;
122     virtual WSError PendingSessionToForeground(const sptr<IRemoteObject>& token) = 0;
123     virtual WSError PendingSessionToBackgroundForDelegator(const sptr<IRemoteObject>& token,
124         bool shouldBackToCaller = true) = 0;
125     virtual WSError GetFocusSessionToken(sptr<IRemoteObject>& token) = 0;
126     virtual WSError GetFocusSessionElement(AppExecFwk::ElementName& element) = 0;
127 
128     virtual WSError RegisterSessionListener(const sptr<ISessionListener>& listener) = 0;
129     virtual WSError UnRegisterSessionListener(const sptr<ISessionListener>& listener) = 0;
130     virtual WSError GetSessionInfos(const std::string& deviceId,
131                                     int32_t numMax, std::vector<SessionInfoBean>& sessionInfos) = 0;
132     virtual WSError GetSessionInfo(const std::string& deviceId, int32_t persistentId, SessionInfoBean& sessionInfo) = 0;
133     virtual WSError GetSessionInfoByContinueSessionId(const std::string& continueSessionId,
134         SessionInfoBean& sessionInfo) = 0;
DumpSessionAll(std::vector<std::string> & infos)135     virtual WSError DumpSessionAll(std::vector<std::string>& infos) override { return WSError::WS_OK; }
DumpSessionWithId(int32_t persistentId,std::vector<std::string> & infos)136     virtual WSError DumpSessionWithId(int32_t persistentId, std::vector<std::string>& infos) override
137     {
138         return WSError::WS_OK;
139     }
140     virtual WSError SetSessionContinueState(const sptr<IRemoteObject>& token, const ContinueState& continueState) = 0;
141 
142     virtual WSError TerminateSessionNew(
143         const sptr<AAFwk::SessionInfo> info, bool needStartCaller, bool isFromBroker = false) = 0;
144     virtual WSError GetSessionDumpInfo(const std::vector<std::string>& params, std::string& info) = 0;
145     virtual WSError GetSessionSnapshot(const std::string& deviceId, int32_t persistentId,
146                                        SessionSnapshot& snapshot, bool isLowResolution) = 0;
147     virtual WSError ClearSession(int32_t persistentId) = 0;
148     virtual WSError ClearAllSessions() = 0;
149     virtual WSError LockSession(int32_t sessionId) = 0;
150     virtual WSError UnlockSession(int32_t sessionId) = 0;
151     virtual WSError MoveSessionsToForeground(const std::vector<std::int32_t>& sessionIds, int32_t topSessionId) = 0;
152     virtual WSError MoveSessionsToBackground(const std::vector<std::int32_t>& sessionIds,
153         std::vector<std::int32_t>& result) = 0;
GetSessionSnapshotById(int32_t persistentId,SessionSnapshot & snapshot)154     virtual WMError GetSessionSnapshotById(int32_t persistentId, SessionSnapshot& snapshot)
155     {
156         return WMError::WM_OK;
157     }
NotifyWindowExtensionVisibilityChange(int32_t pid,int32_t uid,bool visible)158     virtual WSError NotifyWindowExtensionVisibilityChange(int32_t pid, int32_t uid, bool visible) override
159     {
160         return WSError::WS_OK;
161     }
162 
163     virtual WSError RegisterIAbilityManagerCollaborator(int32_t type,
164         const sptr<AAFwk::IAbilityManagerCollaborator>& impl) = 0;
165     virtual WSError UnregisterIAbilityManagerCollaborator(int32_t type) = 0;
166     // interfaces of IWindowManager
CreateWindow(sptr<IWindow> & window,sptr<WindowProperty> & property,const std::shared_ptr<RSSurfaceNode> & surfaceNode,uint32_t & windowId,sptr<IRemoteObject> token)167     WMError CreateWindow(sptr<IWindow>& window, sptr<WindowProperty>& property,
168         const std::shared_ptr<RSSurfaceNode>& surfaceNode,
169         uint32_t& windowId, sptr<IRemoteObject> token) override { return WMError::WM_OK; }
AddWindow(sptr<WindowProperty> & property)170     WMError AddWindow(sptr<WindowProperty>& property) override { return WMError::WM_OK; }
RemoveWindow(uint32_t windowId,bool isFromInnerkits)171     WMError RemoveWindow(uint32_t windowId, bool isFromInnerkits) override { return WMError::WM_OK; }
172     WMError DestroyWindow(uint32_t windowId, bool onlySelf = false) override { return WMError::WM_OK; }
RequestFocus(uint32_t windowId)173     WMError RequestFocus(uint32_t windowId) override { return WMError::WM_OK; }
GetAvoidAreaByType(uint32_t windowId,AvoidAreaType type)174     AvoidArea GetAvoidAreaByType(uint32_t windowId, AvoidAreaType type) override { return {}; }
GetTopWindowId(uint32_t mainWinId,uint32_t & topWinId)175     WMError GetTopWindowId(uint32_t mainWinId, uint32_t& topWinId) override { return WMError::WM_OK; }
176     // only main window,sub window and dialog window can use
GetParentMainWindowId(int32_t windowId,int32_t & mainWindowId)177     WMError GetParentMainWindowId(int32_t windowId, int32_t& mainWindowId) override { return WMError::WM_OK; }
NotifyServerReadyToMoveOrDrag(uint32_t windowId,sptr<WindowProperty> & windowProperty,sptr<MoveDragProperty> & moveDragProperty)178     void NotifyServerReadyToMoveOrDrag(uint32_t windowId, sptr<WindowProperty>& windowProperty,
179         sptr<MoveDragProperty>& moveDragProperty) override {}
ProcessPointDown(uint32_t windowId,bool isPointDown)180     void ProcessPointDown(uint32_t windowId, bool isPointDown) override {}
ProcessPointUp(uint32_t windowId)181     void ProcessPointUp(uint32_t windowId) override {}
MinimizeAllAppWindows(DisplayId displayId)182     WMError MinimizeAllAppWindows(DisplayId displayId) override { return WMError::WM_OK; }
ToggleShownStateForAllAppWindows()183     WMError ToggleShownStateForAllAppWindows() override { return WMError::WM_OK; }
SetWindowLayoutMode(WindowLayoutMode mode)184     WMError SetWindowLayoutMode(WindowLayoutMode mode) override { return WMError::WM_OK; }
185     WMError UpdateProperty(sptr<WindowProperty>& windowProperty, PropertyChangeAction action,
186         bool isAsyncTask = false) override { return WMError::WM_OK; }
SetWindowGravity(uint32_t windowId,WindowGravity gravity,uint32_t percent)187     WMError SetWindowGravity(uint32_t windowId, WindowGravity gravity, uint32_t percent) override
188     {
189         return WMError::WM_OK;
190     }
RegisterWindowManagerAgent(WindowManagerAgentType type,const sptr<IWindowManagerAgent> & windowManagerAgent)191     WMError RegisterWindowManagerAgent(WindowManagerAgentType type,
192         const sptr<IWindowManagerAgent>& windowManagerAgent) override { return WMError::WM_OK; }
UnregisterWindowManagerAgent(WindowManagerAgentType type,const sptr<IWindowManagerAgent> & windowManagerAgent)193     WMError UnregisterWindowManagerAgent(WindowManagerAgentType type,
194         const sptr<IWindowManagerAgent>& windowManagerAgent) override { return WMError::WM_OK; }
GetAccessibilityWindowInfo(std::vector<sptr<AccessibilityWindowInfo>> & infos)195     WMError GetAccessibilityWindowInfo(std::vector<sptr<AccessibilityWindowInfo>>& infos) override
196     {
197         return WMError::WM_OK;
198     }
GetUnreliableWindowInfo(int32_t windowId,std::vector<sptr<UnreliableWindowInfo>> & infos)199     WMError GetUnreliableWindowInfo(int32_t windowId, std::vector<sptr<UnreliableWindowInfo>>& infos) override
200     {
201         return WMError::WM_OK;
202     }
GetVisibilityWindowInfo(std::vector<sptr<WindowVisibilityInfo>> & infos)203     WMError GetVisibilityWindowInfo(std::vector<sptr<WindowVisibilityInfo>>& infos) override { return WMError::WM_OK; }
SetWindowAnimationController(const sptr<RSIWindowAnimationController> & controller)204     WMError SetWindowAnimationController(const sptr<RSIWindowAnimationController>& controller) override
205     {
206         return WMError::WM_OK;
207     }
GetSystemConfig(SystemConfig & systemConfig)208     WMError GetSystemConfig(SystemConfig& systemConfig) override { return WMError::WM_OK; }
209     WMError NotifyWindowTransition(sptr<WindowTransitionInfo>& from, sptr<WindowTransitionInfo>& to,
210         bool isFromClient = false) override { return WMError::WM_OK; }
GetModeChangeHotZones(DisplayId displayId,ModeChangeHotZones & hotZones)211     WMError GetModeChangeHotZones(DisplayId displayId, ModeChangeHotZones& hotZones) override { return WMError::WM_OK; }
MinimizeWindowsByLauncher(std::vector<uint32_t> windowIds,bool isAnimated,sptr<RSIWindowAnimationFinishedCallback> & finishCallback)212     void MinimizeWindowsByLauncher(std::vector<uint32_t> windowIds, bool isAnimated,
213         sptr<RSIWindowAnimationFinishedCallback>& finishCallback) override {}
UpdateAvoidAreaListener(uint32_t windowId,bool haveListener)214     WMError UpdateAvoidAreaListener(uint32_t windowId, bool haveListener) override { return WMError::WM_OK; }
UpdateRsTree(uint32_t windowId,bool isAdd)215     WMError UpdateRsTree(uint32_t windowId, bool isAdd) override { return WMError::WM_OK; }
BindDialogTarget(uint32_t & windowId,sptr<IRemoteObject> targetToken)216     WMError BindDialogTarget(uint32_t& windowId, sptr<IRemoteObject> targetToken) override { return WMError::WM_OK; }
SetAnchorAndScale(int32_t x,int32_t y,float scale)217     void SetAnchorAndScale(int32_t x, int32_t y, float scale) override {}
SetAnchorOffset(int32_t deltaX,int32_t deltaY)218     void SetAnchorOffset(int32_t deltaX, int32_t deltaY) override {}
OffWindowZoom()219     void OffWindowZoom() override {}
RaiseToAppTop(uint32_t windowId)220     WMError RaiseToAppTop(uint32_t windowId) override { return WMError::WM_OK; }
GetSnapshot(int32_t windowId)221     std::shared_ptr<Media::PixelMap> GetSnapshot(int32_t windowId) override { return nullptr; }
SetGestureNavigaionEnabled(bool enable)222     WMError SetGestureNavigaionEnabled(bool enable) override { return WMError::WM_OK; }
DispatchKeyEvent(uint32_t windowId,std::shared_ptr<MMI::KeyEvent> event)223     void DispatchKeyEvent(uint32_t windowId, std::shared_ptr<MMI::KeyEvent> event) override {}
NotifyDumpInfoResult(const std::vector<std::string> & info)224     void NotifyDumpInfoResult(const std::vector<std::string>& info) override {};
GetWindowAnimationTargets(std::vector<uint32_t> missionIds,std::vector<sptr<RSWindowAnimationTarget>> & targets)225     WMError GetWindowAnimationTargets(std::vector<uint32_t> missionIds,
226         std::vector<sptr<RSWindowAnimationTarget>>& targets) override { return WMError::WM_OK; }
SetMaximizeMode(MaximizeMode maximizeMode)227     void SetMaximizeMode(MaximizeMode maximizeMode) override {}
GetMaximizeMode()228     MaximizeMode GetMaximizeMode() override { return MaximizeMode::MODE_AVOID_SYSTEM_BAR; }
GetFocusWindowInfo(FocusChangeInfo & focusInfo)229     void GetFocusWindowInfo(FocusChangeInfo& focusInfo) override {}
RaiseWindowToTop(int32_t persistentId)230     WSError RaiseWindowToTop(int32_t persistentId) override { return WSError::WS_OK; }
ShiftAppWindowFocus(int32_t sourcePersistentId,int32_t targetPersistentId)231     WSError ShiftAppWindowFocus(int32_t sourcePersistentId, int32_t targetPersistentId) override
232     {
233         return WSError::WS_OK;
234     }
AddExtensionWindowStageToSCB(const sptr<ISessionStage> & sessionStage,const sptr<IRemoteObject> & token,uint64_t surfaceNodeId)235     void AddExtensionWindowStageToSCB(const sptr<ISessionStage>& sessionStage,
236         const sptr<IRemoteObject>& token, uint64_t surfaceNodeId) override {}
RemoveExtensionWindowStageFromSCB(const sptr<ISessionStage> & sessionStage,const sptr<IRemoteObject> & token)237     void RemoveExtensionWindowStageFromSCB(const sptr<ISessionStage>& sessionStage,
238         const sptr<IRemoteObject>& token) override {}
UpdateModalExtensionRect(const sptr<IRemoteObject> & token,Rect rect)239     void UpdateModalExtensionRect(const sptr<IRemoteObject>& token, Rect rect) override {}
ProcessModalExtensionPointDown(const sptr<IRemoteObject> & token,int32_t posX,int32_t posY)240     void ProcessModalExtensionPointDown(const sptr<IRemoteObject>& token, int32_t posX, int32_t posY) override {}
AddOrRemoveSecureSession(int32_t persistentId,bool shouldHide)241     WSError AddOrRemoveSecureSession(int32_t persistentId, bool shouldHide) override
242     {
243         return WSError::WS_OK;
244     }
UpdateExtWindowFlags(const sptr<IRemoteObject> & token,uint32_t extWindowFlags,uint32_t extWindowActions)245     WSError UpdateExtWindowFlags(const sptr<IRemoteObject>& token, uint32_t extWindowFlags,
246         uint32_t extWindowActions) override
247     {
248         return WSError::WS_OK;
249     }
GetHostWindowRect(int32_t hostWindowId,Rect & rect)250     WSError GetHostWindowRect(int32_t hostWindowId, Rect& rect) override
251     {
252         return WSError::WS_OK;
253     }
GetFreeMultiWindowEnableState(bool & enable)254     WSError GetFreeMultiWindowEnableState(bool& enable) override
255     {
256         return WSError::WS_OK;
257     }
GetCallingWindowWindowStatus(int32_t persistentId,WindowStatus & windowStatus)258     WMError GetCallingWindowWindowStatus(int32_t persistentId, WindowStatus& windowStatus) override
259     {
260         return WMError::WM_OK;
261     }
GetCallingWindowRect(int32_t persistentId,Rect & rect)262     WMError GetCallingWindowRect(int32_t persistentId, Rect& rect) override
263     {
264         return WMError::WM_OK;
265     }
GetWindowModeType(WindowModeType & windowModeType)266     WMError GetWindowModeType(WindowModeType& windowModeType) override { return WMError::WM_OK; }
267 
GetWindowStyleType(WindowStyleType & windowStyleType)268     WMError GetWindowStyleType(WindowStyleType& windowStyleType) override { return WMError::WM_OK; }
269 
270     virtual WMError GetProcessSurfaceNodeIdByPersistentId(const int32_t pid,
271         const std::vector<int32_t>& persistentIds, std::vector<uint64_t>& surfaceNodeIds) = 0;
272 
ReleaseForegroundSessionScreenLock()273     WMError ReleaseForegroundSessionScreenLock() override { return WMError::WM_OK; }
274 
GetDisplayIdByWindowId(const std::vector<uint64_t> & windowIds,std::unordered_map<uint64_t,DisplayId> & windowDisplayIdMap)275     WMError GetDisplayIdByWindowId(const std::vector<uint64_t>& windowIds,
276         std::unordered_map<uint64_t, DisplayId>& windowDisplayIdMap) override { return WMError::WM_OK; }
277 };
278 } // namespace OHOS::Rosen
279 #endif // OHOS_ROSEN_WINDOW_SCENE_SESSION_MANAGER_INTERFACE_H
280