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 "session_listener_interface.h" 28 #include "window_manager.h" 29 #include "zidl/window_manager_interface.h" 30 #include "session_info.h" 31 #include "mission_listener_interface.h" 32 #include "mission_info.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 class ISceneSessionManager : public IWindowManager { 44 public: 45 DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.ISceneSessionManager"); 46 47 enum class SceneSessionManagerMessage : uint32_t { 48 TRANS_ID_CREATE_AND_CONNECT_SPECIFIC_SESSION, 49 TRANS_ID_DESTROY_AND_DISCONNECT_SPECIFIC_SESSION, 50 TRANS_ID_UPDATE_PROPERTY, 51 TRANS_ID_REGISTER_WINDOW_MANAGER_AGENT, 52 TRANS_ID_UNREGISTER_WINDOW_MANAGER_AGENT, 53 TRANS_ID_BIND_DIALOG_TARGET, 54 TRANS_ID_GET_FOCUS_SESSION_INFO, 55 TRANS_ID_SET_SESSION_GRAVITY, 56 TRANS_ID_SET_GESTURE_NAVIGATION_ENABLED, 57 TRANS_ID_SET_SESSION_LABEL, 58 TRANS_ID_SET_SESSION_ICON, 59 TRANS_ID_IS_VALID_SESSION_IDS, 60 TRANS_ID_REGISTER_SESSION_CHANGE_LISTENER, 61 TRANS_ID_UNREGISTER_SESSION_CHANGE_LISTENER, 62 TRANS_ID_GET_WINDOW_INFO, 63 TRANS_ID_PENDING_SESSION_TO_FOREGROUND, 64 TRANS_ID_PENDING_SESSION_TO_BACKGROUND_FOR_DELEGATOR, 65 TRANS_ID_GET_FOCUS_SESSION_TOKEN, 66 TRANS_ID_REGISTER_SESSION_LISTENER, 67 TRANS_ID_UNREGISTER_SESSION_LISTENER, 68 TRANS_ID_GET_MISSION_INFOS, 69 TRANS_ID_GET_MISSION_INFO_BY_ID, 70 TRANS_ID_TERMINATE_SESSION_NEW, 71 TRANS_ID_GET_SESSION_DUMP_INFO, 72 TRANS_ID_UPDATE_AVOIDAREA_LISTENER, 73 TRANS_ID_GET_SESSION_SNAPSHOT, 74 TRANS_ID_SET_SESSION_CONTINUE_STATE, 75 TRANS_ID_NOTIFY_DUMP_INFO_RESULT, 76 TRANS_ID_CLEAR_SESSION, 77 TRANS_ID_CLEAR_ALL_SESSIONS, 78 TRANS_ID_REGISTER_COLLABORATOR, 79 TRANS_ID_UNREGISTER_COLLABORATOR, 80 }; 81 82 virtual WSError CreateAndConnectSpecificSession(const sptr<ISessionStage>& sessionStage, 83 const sptr<IWindowEventChannel>& eventChannel, const std::shared_ptr<RSSurfaceNode>& surfaceNode, 84 sptr<WindowSessionProperty> property, int32_t& persistentId, sptr<ISession>& session, 85 sptr<IRemoteObject> token = nullptr) = 0; 86 virtual WSError DestroyAndDisconnectSpecificSession(const int32_t& persistentId) = 0; 87 virtual WMError UpdateProperty(sptr<WindowSessionProperty>& property, WSPropertyChangeAction action) = 0; 88 virtual WSError BindDialogTarget(uint64_t persistentId, sptr<IRemoteObject> targetToken) = 0; 89 virtual WSError SetSessionGravity(int32_t persistentId, SessionGravity gravity, uint32_t percent) = 0; 90 virtual WSError SetSessionLabel(const sptr<IRemoteObject> &token, const std::string &label) = 0; 91 virtual WSError SetSessionIcon(const sptr<IRemoteObject> &token, const std::shared_ptr<Media::PixelMap> &icon) = 0; 92 virtual WSError IsValidSessionIds(const std::vector<int32_t> &sessionIds, std::vector<bool> &results) = 0; 93 virtual WSError RegisterSessionListener(const sptr<ISessionChangeListener> sessionListener) = 0; 94 virtual void UnregisterSessionListener() = 0; 95 virtual WSError PendingSessionToForeground(const sptr<IRemoteObject> &token) = 0; 96 virtual WSError PendingSessionToBackgroundForDelegator(const sptr<IRemoteObject> &token) = 0; 97 virtual WSError GetFocusSessionToken(sptr<IRemoteObject> &token) = 0; 98 99 virtual WSError RegisterSessionListener(const sptr<ISessionListener>& listener) = 0; 100 virtual WSError UnRegisterSessionListener(const sptr<ISessionListener>& listener) = 0; 101 virtual WSError GetSessionInfos(const std::string& deviceId, 102 int32_t numMax, std::vector<SessionInfoBean>& sessionInfos) = 0; 103 virtual WSError GetSessionInfo(const std::string& deviceId, int32_t persistentId, SessionInfoBean& sessionInfo) = 0; 104 virtual WSError SetSessionContinueState(const sptr<IRemoteObject> &token, const ContinueState& continueState) = 0; 105 106 virtual WSError TerminateSessionNew(const sptr<AAFwk::SessionInfo> info, bool needStartCaller) = 0; 107 virtual WSError GetSessionDumpInfo(const std::vector<std::string>& params, std::string& info) = 0; 108 virtual WSError GetSessionSnapshot(const std::string& deviceId, int32_t persistentId, 109 std::shared_ptr<Media::PixelMap> &snapshot, bool isLowResolution) = 0; 110 virtual WSError ClearSession(int32_t persistentId) = 0; 111 virtual WSError ClearAllSessions() = 0; 112 113 virtual WSError RegisterIAbilityManagerCollaborator(int32_t type, const sptr<AAFwk::IAbilityManagerCollaborator> &impl) = 0; 114 virtual WSError UnregisterIAbilityManagerCollaborator(int32_t type) = 0; 115 // interfaces of IWindowManager CreateWindow(sptr<IWindow> & window,sptr<WindowProperty> & property,const std::shared_ptr<RSSurfaceNode> & surfaceNode,uint32_t & windowId,sptr<IRemoteObject> token)116 WMError CreateWindow(sptr<IWindow>& window, sptr<WindowProperty>& property, 117 const std::shared_ptr<RSSurfaceNode>& surfaceNode, 118 uint32_t& windowId, sptr<IRemoteObject> token) override { return WMError::WM_OK; } AddWindow(sptr<WindowProperty> & property)119 WMError AddWindow(sptr<WindowProperty>& property) override { return WMError::WM_OK; } RemoveWindow(uint32_t windowId,bool isFromInnerkits)120 WMError RemoveWindow(uint32_t windowId, bool isFromInnerkits) override { return WMError::WM_OK; } 121 WMError DestroyWindow(uint32_t windowId, bool onlySelf = false) override { return WMError::WM_OK; } RequestFocus(uint32_t windowId)122 WMError RequestFocus(uint32_t windowId) override { return WMError::WM_OK; } GetAvoidAreaByType(uint32_t windowId,AvoidAreaType type)123 AvoidArea GetAvoidAreaByType(uint32_t windowId, AvoidAreaType type) override { return {}; } GetTopWindowId(uint32_t mainWinId,uint32_t & topWinId)124 WMError GetTopWindowId(uint32_t mainWinId, uint32_t& topWinId) override { return WMError::WM_OK; } NotifyServerReadyToMoveOrDrag(uint32_t windowId,sptr<WindowProperty> & windowProperty,sptr<MoveDragProperty> & moveDragProperty)125 void NotifyServerReadyToMoveOrDrag(uint32_t windowId, sptr<WindowProperty>& windowProperty, 126 sptr<MoveDragProperty>& moveDragProperty) override {} ProcessPointDown(uint32_t windowId,bool isPointDown)127 void ProcessPointDown(uint32_t windowId, bool isPointDown) override {} ProcessPointUp(uint32_t windowId)128 void ProcessPointUp(uint32_t windowId) override {} MinimizeAllAppWindows(DisplayId displayId)129 WMError MinimizeAllAppWindows(DisplayId displayId) override { return WMError::WM_OK; } ToggleShownStateForAllAppWindows()130 WMError ToggleShownStateForAllAppWindows() override { return WMError::WM_OK; } SetWindowLayoutMode(WindowLayoutMode mode)131 WMError SetWindowLayoutMode(WindowLayoutMode mode) override { return WMError::WM_OK; } 132 WMError UpdateProperty(sptr<WindowProperty>& windowProperty, PropertyChangeAction action, 133 bool isAsyncTask = false) override { return WMError::WM_OK; } SetWindowGravity(uint32_t windowId,WindowGravity gravity,uint32_t percent)134 WMError SetWindowGravity(uint32_t windowId, WindowGravity gravity, uint32_t percent) override 135 { 136 return WMError::WM_OK; 137 } RegisterWindowManagerAgent(WindowManagerAgentType type,const sptr<IWindowManagerAgent> & windowManagerAgent)138 WMError RegisterWindowManagerAgent(WindowManagerAgentType type, 139 const sptr<IWindowManagerAgent>& windowManagerAgent) override { return WMError::WM_OK; } UnregisterWindowManagerAgent(WindowManagerAgentType type,const sptr<IWindowManagerAgent> & windowManagerAgent)140 WMError UnregisterWindowManagerAgent(WindowManagerAgentType type, 141 const sptr<IWindowManagerAgent>& windowManagerAgent) override { return WMError::WM_OK; } GetAccessibilityWindowInfo(std::vector<sptr<AccessibilityWindowInfo>> & infos)142 WMError GetAccessibilityWindowInfo(std::vector<sptr<AccessibilityWindowInfo>>& infos) override 143 { 144 return WMError::WM_OK; 145 } GetVisibilityWindowInfo(std::vector<sptr<WindowVisibilityInfo>> & infos)146 WMError GetVisibilityWindowInfo(std::vector<sptr<WindowVisibilityInfo>>& infos) override { return WMError::WM_OK; } SetWindowAnimationController(const sptr<RSIWindowAnimationController> & controller)147 WMError SetWindowAnimationController(const sptr<RSIWindowAnimationController>& controller) override 148 { 149 return WMError::WM_OK; 150 } GetSystemConfig(SystemConfig & systemConfig)151 WMError GetSystemConfig(SystemConfig& systemConfig) override { return WMError::WM_OK; } 152 WMError NotifyWindowTransition(sptr<WindowTransitionInfo>& from, sptr<WindowTransitionInfo>& to, 153 bool isFromClient = false) override { return WMError::WM_OK; } GetModeChangeHotZones(DisplayId displayId,ModeChangeHotZones & hotZones)154 WMError GetModeChangeHotZones(DisplayId displayId, ModeChangeHotZones& hotZones) override { return WMError::WM_OK; } MinimizeWindowsByLauncher(std::vector<uint32_t> windowIds,bool isAnimated,sptr<RSIWindowAnimationFinishedCallback> & finishCallback)155 void MinimizeWindowsByLauncher(std::vector<uint32_t> windowIds, bool isAnimated, 156 sptr<RSIWindowAnimationFinishedCallback>& finishCallback) override {} UpdateAvoidAreaListener(uint32_t windowId,bool haveListener)157 WMError UpdateAvoidAreaListener(uint32_t windowId, bool haveListener) override { return WMError::WM_OK; } UpdateRsTree(uint32_t windowId,bool isAdd)158 WMError UpdateRsTree(uint32_t windowId, bool isAdd) override { return WMError::WM_OK; } BindDialogTarget(uint32_t & windowId,sptr<IRemoteObject> targetToken)159 WMError BindDialogTarget(uint32_t& windowId, sptr<IRemoteObject> targetToken) override { return WMError::WM_OK; } SetAnchorAndScale(int32_t x,int32_t y,float scale)160 void SetAnchorAndScale(int32_t x, int32_t y, float scale) override {} SetAnchorOffset(int32_t deltaX,int32_t deltaY)161 void SetAnchorOffset(int32_t deltaX, int32_t deltaY) override {} OffWindowZoom()162 void OffWindowZoom() override {} RaiseToAppTop(uint32_t windowId)163 WmErrorCode RaiseToAppTop(uint32_t windowId) override { return WmErrorCode::WM_OK; } GetSnapshot(int32_t windowId)164 std::shared_ptr<Media::PixelMap> GetSnapshot(int32_t windowId) override { return nullptr; } SetGestureNavigaionEnabled(bool enable)165 WMError SetGestureNavigaionEnabled(bool enable) override { return WMError::WM_OK; } DispatchKeyEvent(uint32_t windowId,std::shared_ptr<MMI::KeyEvent> event)166 void DispatchKeyEvent(uint32_t windowId, std::shared_ptr<MMI::KeyEvent> event) override {} NotifyDumpInfoResult(const std::vector<std::string> & info)167 void NotifyDumpInfoResult(const std::vector<std::string>& info) override {}; GetWindowAnimationTargets(std::vector<uint32_t> missionIds,std::vector<sptr<RSWindowAnimationTarget>> & targets)168 WMError GetWindowAnimationTargets(std::vector<uint32_t> missionIds, 169 std::vector<sptr<RSWindowAnimationTarget>>& targets) override { return WMError::WM_OK; } SetMaximizeMode(MaximizeMode maximizeMode)170 void SetMaximizeMode(MaximizeMode maximizeMode) override {} GetMaximizeMode()171 MaximizeMode GetMaximizeMode() override { return MaximizeMode::MODE_AVOID_SYSTEM_BAR; } GetFocusWindowInfo(FocusChangeInfo & focusInfo)172 void GetFocusWindowInfo(FocusChangeInfo& focusInfo) override {} 173 }; 174 } // namespace OHOS::Rosen 175 #endif // OHOS_ROSEN_WINDOW_SCENE_SESSION_MANAGER_INTERFACE_H 176