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 "mission_snapshot.h" 34 #include "iability_manager_collaborator.h" 35 36 namespace OHOS::Media { 37 class PixelMap; 38 } // namespace OHOS::Media 39 40 namespace OHOS::Rosen { 41 class RSSurfaceNode; 42 using ISessionListener = AAFwk::IMissionListener; 43 using SessionInfoBean = AAFwk::MissionInfo; 44 using SessionSnapshot = AAFwk::MissionSnapshot; 45 class ISceneSessionManager : public IWindowManager { 46 public: 47 DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.ISceneSessionManager"); 48 49 enum class SceneSessionManagerMessage : uint32_t { 50 TRANS_ID_CREATE_AND_CONNECT_SPECIFIC_SESSION, 51 TRANS_ID_DESTROY_AND_DISCONNECT_SPECIFIC_SESSION, 52 TRANS_ID_UPDATE_PROPERTY, 53 TRANS_ID_REQUEST_FOCUS, 54 TRANS_ID_REGISTER_WINDOW_MANAGER_AGENT, 55 TRANS_ID_UNREGISTER_WINDOW_MANAGER_AGENT, 56 TRANS_ID_BIND_DIALOG_TARGET, 57 TRANS_ID_GET_FOCUS_SESSION_INFO, 58 TRANS_ID_SET_SESSION_GRAVITY, 59 TRANS_ID_SET_SESSION_LABEL, 60 TRANS_ID_SET_SESSION_ICON, 61 TRANS_ID_IS_VALID_SESSION_IDS, 62 TRANS_ID_REGISTER_SESSION_CHANGE_LISTENER, 63 TRANS_ID_UNREGISTER_SESSION_CHANGE_LISTENER, 64 TRANS_ID_SET_GESTURE_NAVIGATION_ENABLED, 65 TRANS_ID_GET_WINDOW_INFO, 66 TRANS_ID_PENDING_SESSION_TO_FOREGROUND, 67 TRANS_ID_PENDING_SESSION_TO_BACKGROUND_FOR_DELEGATOR, 68 TRANS_ID_GET_FOCUS_SESSION_TOKEN, 69 TRANS_ID_CHECK_WINDOW_ID, 70 TRANS_ID_REGISTER_SESSION_LISTENER, 71 TRANS_ID_UNREGISTER_SESSION_LISTENER, 72 TRANS_ID_GET_MISSION_INFOS, 73 TRANS_ID_GET_MISSION_INFO_BY_ID, 74 TRANS_ID_DUMP_SESSION_ALL, 75 TRANS_ID_DUMP_SESSION_WITH_ID, 76 TRANS_ID_TERMINATE_SESSION_NEW, 77 TRANS_ID_GET_SESSION_DUMP_INFO, 78 TRANS_ID_UPDATE_AVOIDAREA_LISTENER, 79 TRANS_ID_GET_SESSION_SNAPSHOT, 80 TRANS_ID_SET_SESSION_CONTINUE_STATE, 81 TRANS_ID_NOTIFY_DUMP_INFO_RESULT, 82 TRANS_ID_CLEAR_SESSION, 83 TRANS_ID_CLEAR_ALL_SESSIONS, 84 TRANS_ID_LOCK_SESSION, 85 TRANS_ID_UNLOCK_SESSION, 86 TRANS_ID_MOVE_MISSIONS_TO_FOREGROUND, 87 TRANS_ID_MOVE_MISSIONS_TO_BACKGROUND, 88 TRANS_ID_REGISTER_COLLABORATOR, 89 TRANS_ID_UNREGISTER_COLLABORATOR, 90 TRANS_ID_UPDATE_TOUCHOUTSIDE_LISTENER, 91 TRANS_ID_RAISE_WINDOW_TO_TOP, 92 TRANS_ID_NOTIFY_WINDOW_EXTENSION_VISIBILITY_CHANGE, 93 TRANS_ID_RECOVER_AND_RECONNECT_SCENE_SESSION, 94 TRANS_ID_RECOVER_AND_CONNECT_SPECIFIC_SESSION, 95 TRANS_ID_GET_TOP_WINDOW_ID, 96 TRANS_ID_UPDATE_WINDOW_VISIBILITY_LISTENER, 97 TRANS_ID_SHIFT_APP_WINDOW_FOCUS, 98 TRANS_ID_GET_VISIBILITY_WINDOW_INFO_ID, 99 TRANS_ID_HIDE_NON_SECURE_WINDOWS, 100 }; 101 102 virtual WSError SetSessionLabel(const sptr<IRemoteObject> &token, const std::string &label) = 0; 103 virtual WSError SetSessionIcon(const sptr<IRemoteObject> &token, const std::shared_ptr<Media::PixelMap> &icon) = 0; 104 virtual WSError IsValidSessionIds(const std::vector<int32_t> &sessionIds, std::vector<bool> &results) = 0; 105 virtual WSError RegisterSessionListener(const sptr<ISessionChangeListener> sessionListener) = 0; 106 virtual void UnregisterSessionListener() = 0; 107 virtual WSError PendingSessionToForeground(const sptr<IRemoteObject> &token) = 0; 108 virtual WSError PendingSessionToBackgroundForDelegator(const sptr<IRemoteObject> &token) = 0; 109 virtual WSError GetFocusSessionToken(sptr<IRemoteObject> &token) = 0; 110 111 virtual WSError RegisterSessionListener(const sptr<ISessionListener>& listener) = 0; 112 virtual WSError UnRegisterSessionListener(const sptr<ISessionListener>& listener) = 0; 113 virtual WSError GetSessionInfos(const std::string& deviceId, 114 int32_t numMax, std::vector<SessionInfoBean>& sessionInfos) = 0; 115 virtual WSError GetSessionInfo(const std::string& deviceId, int32_t persistentId, SessionInfoBean& sessionInfo) = 0; DumpSessionAll(std::vector<std::string> & infos)116 virtual WSError DumpSessionAll(std::vector<std::string> &infos) override { return WSError::WS_OK; } DumpSessionWithId(int32_t persistentId,std::vector<std::string> & infos)117 virtual WSError DumpSessionWithId(int32_t persistentId, std::vector<std::string> &infos) override 118 { 119 return WSError::WS_OK; 120 } 121 virtual WSError SetSessionContinueState(const sptr<IRemoteObject> &token, const ContinueState& continueState) = 0; 122 123 virtual WSError TerminateSessionNew(const sptr<AAFwk::SessionInfo> info, bool needStartCaller) = 0; 124 virtual WSError GetSessionDumpInfo(const std::vector<std::string>& params, std::string& info) = 0; 125 virtual WSError GetSessionSnapshot(const std::string& deviceId, int32_t persistentId, 126 SessionSnapshot& snapshot, bool isLowResolution) = 0; 127 virtual WSError ClearSession(int32_t persistentId) = 0; 128 virtual WSError ClearAllSessions() = 0; 129 virtual WSError LockSession(int32_t sessionId) = 0; 130 virtual WSError UnlockSession(int32_t sessionId) = 0; 131 virtual WSError MoveSessionsToForeground(const std::vector<std::int32_t>& sessionIds, int32_t topSessionId) = 0; 132 virtual WSError MoveSessionsToBackground(const std::vector<std::int32_t>& sessionIds, 133 std::vector<std::int32_t>& result) = 0; NotifyWindowExtensionVisibilityChange(int32_t pid,int32_t uid,bool visible)134 virtual WSError NotifyWindowExtensionVisibilityChange(int32_t pid, int32_t uid, bool visible) override 135 { 136 return WSError::WS_OK; 137 } 138 139 virtual WSError RegisterIAbilityManagerCollaborator(int32_t type, 140 const sptr<AAFwk::IAbilityManagerCollaborator> &impl) = 0; 141 virtual WSError UnregisterIAbilityManagerCollaborator(int32_t type) = 0; 142 // interfaces of IWindowManager CreateWindow(sptr<IWindow> & window,sptr<WindowProperty> & property,const std::shared_ptr<RSSurfaceNode> & surfaceNode,uint32_t & windowId,sptr<IRemoteObject> token)143 WMError CreateWindow(sptr<IWindow>& window, sptr<WindowProperty>& property, 144 const std::shared_ptr<RSSurfaceNode>& surfaceNode, 145 uint32_t& windowId, sptr<IRemoteObject> token) override { return WMError::WM_OK; } AddWindow(sptr<WindowProperty> & property)146 WMError AddWindow(sptr<WindowProperty>& property) override { return WMError::WM_OK; } RemoveWindow(uint32_t windowId,bool isFromInnerkits)147 WMError RemoveWindow(uint32_t windowId, bool isFromInnerkits) override { return WMError::WM_OK; } 148 WMError DestroyWindow(uint32_t windowId, bool onlySelf = false) override { return WMError::WM_OK; } RequestFocus(uint32_t windowId)149 WMError RequestFocus(uint32_t windowId) override { return WMError::WM_OK; } GetAvoidAreaByType(uint32_t windowId,AvoidAreaType type)150 AvoidArea GetAvoidAreaByType(uint32_t windowId, AvoidAreaType type) override { return {}; } GetTopWindowId(uint32_t mainWinId,uint32_t & topWinId)151 WMError GetTopWindowId(uint32_t mainWinId, uint32_t& topWinId) override { return WMError::WM_OK; } NotifyServerReadyToMoveOrDrag(uint32_t windowId,sptr<WindowProperty> & windowProperty,sptr<MoveDragProperty> & moveDragProperty)152 void NotifyServerReadyToMoveOrDrag(uint32_t windowId, sptr<WindowProperty>& windowProperty, 153 sptr<MoveDragProperty>& moveDragProperty) override {} ProcessPointDown(uint32_t windowId,bool isPointDown)154 void ProcessPointDown(uint32_t windowId, bool isPointDown) override {} ProcessPointUp(uint32_t windowId)155 void ProcessPointUp(uint32_t windowId) override {} MinimizeAllAppWindows(DisplayId displayId)156 WMError MinimizeAllAppWindows(DisplayId displayId) override { return WMError::WM_OK; } ToggleShownStateForAllAppWindows()157 WMError ToggleShownStateForAllAppWindows() override { return WMError::WM_OK; } SetWindowLayoutMode(WindowLayoutMode mode)158 WMError SetWindowLayoutMode(WindowLayoutMode mode) override { return WMError::WM_OK; } 159 WMError UpdateProperty(sptr<WindowProperty>& windowProperty, PropertyChangeAction action, 160 bool isAsyncTask = false) override { return WMError::WM_OK; } SetWindowGravity(uint32_t windowId,WindowGravity gravity,uint32_t percent)161 WMError SetWindowGravity(uint32_t windowId, WindowGravity gravity, uint32_t percent) override 162 { 163 return WMError::WM_OK; 164 } RegisterWindowManagerAgent(WindowManagerAgentType type,const sptr<IWindowManagerAgent> & windowManagerAgent)165 WMError RegisterWindowManagerAgent(WindowManagerAgentType type, 166 const sptr<IWindowManagerAgent>& windowManagerAgent) override { return WMError::WM_OK; } UnregisterWindowManagerAgent(WindowManagerAgentType type,const sptr<IWindowManagerAgent> & windowManagerAgent)167 WMError UnregisterWindowManagerAgent(WindowManagerAgentType type, 168 const sptr<IWindowManagerAgent>& windowManagerAgent) override { return WMError::WM_OK; } GetAccessibilityWindowInfo(std::vector<sptr<AccessibilityWindowInfo>> & infos)169 WMError GetAccessibilityWindowInfo(std::vector<sptr<AccessibilityWindowInfo>>& infos) override 170 { 171 return WMError::WM_OK; 172 } GetVisibilityWindowInfo(std::vector<sptr<WindowVisibilityInfo>> & infos)173 WMError GetVisibilityWindowInfo(std::vector<sptr<WindowVisibilityInfo>>& infos) override { return WMError::WM_OK; } SetWindowAnimationController(const sptr<RSIWindowAnimationController> & controller)174 WMError SetWindowAnimationController(const sptr<RSIWindowAnimationController>& controller) override 175 { 176 return WMError::WM_OK; 177 } GetSystemConfig(SystemConfig & systemConfig)178 WMError GetSystemConfig(SystemConfig& systemConfig) override { return WMError::WM_OK; } 179 WMError NotifyWindowTransition(sptr<WindowTransitionInfo>& from, sptr<WindowTransitionInfo>& to, 180 bool isFromClient = false) override { return WMError::WM_OK; } GetModeChangeHotZones(DisplayId displayId,ModeChangeHotZones & hotZones)181 WMError GetModeChangeHotZones(DisplayId displayId, ModeChangeHotZones& hotZones) override { return WMError::WM_OK; } MinimizeWindowsByLauncher(std::vector<uint32_t> windowIds,bool isAnimated,sptr<RSIWindowAnimationFinishedCallback> & finishCallback)182 void MinimizeWindowsByLauncher(std::vector<uint32_t> windowIds, bool isAnimated, 183 sptr<RSIWindowAnimationFinishedCallback>& finishCallback) override {} UpdateAvoidAreaListener(uint32_t windowId,bool haveListener)184 WMError UpdateAvoidAreaListener(uint32_t windowId, bool haveListener) override { return WMError::WM_OK; } UpdateRsTree(uint32_t windowId,bool isAdd)185 WMError UpdateRsTree(uint32_t windowId, bool isAdd) override { return WMError::WM_OK; } BindDialogTarget(uint32_t & windowId,sptr<IRemoteObject> targetToken)186 WMError BindDialogTarget(uint32_t& windowId, sptr<IRemoteObject> targetToken) override { return WMError::WM_OK; } SetAnchorAndScale(int32_t x,int32_t y,float scale)187 void SetAnchorAndScale(int32_t x, int32_t y, float scale) override {} SetAnchorOffset(int32_t deltaX,int32_t deltaY)188 void SetAnchorOffset(int32_t deltaX, int32_t deltaY) override {} OffWindowZoom()189 void OffWindowZoom() override {} RaiseToAppTop(uint32_t windowId)190 WmErrorCode RaiseToAppTop(uint32_t windowId) override { return WmErrorCode::WM_OK; } GetSnapshot(int32_t windowId)191 std::shared_ptr<Media::PixelMap> GetSnapshot(int32_t windowId) override { return nullptr; } SetGestureNavigaionEnabled(bool enable)192 WMError SetGestureNavigaionEnabled(bool enable) override { return WMError::WM_OK; } DispatchKeyEvent(uint32_t windowId,std::shared_ptr<MMI::KeyEvent> event)193 void DispatchKeyEvent(uint32_t windowId, std::shared_ptr<MMI::KeyEvent> event) override {} NotifyDumpInfoResult(const std::vector<std::string> & info)194 void NotifyDumpInfoResult(const std::vector<std::string>& info) override {}; GetWindowAnimationTargets(std::vector<uint32_t> missionIds,std::vector<sptr<RSWindowAnimationTarget>> & targets)195 WMError GetWindowAnimationTargets(std::vector<uint32_t> missionIds, 196 std::vector<sptr<RSWindowAnimationTarget>>& targets) override { return WMError::WM_OK; } SetMaximizeMode(MaximizeMode maximizeMode)197 void SetMaximizeMode(MaximizeMode maximizeMode) override {} GetMaximizeMode()198 MaximizeMode GetMaximizeMode() override { return MaximizeMode::MODE_AVOID_SYSTEM_BAR; } GetFocusWindowInfo(FocusChangeInfo & focusInfo)199 void GetFocusWindowInfo(FocusChangeInfo& focusInfo) override {} RaiseWindowToTop(int32_t persistentId)200 WSError RaiseWindowToTop(int32_t persistentId) override { return WSError::WS_OK; } ShiftAppWindowFocus(int32_t sourcePersistentId,int32_t targetPersistentId)201 WSError ShiftAppWindowFocus(int32_t sourcePersistentId, int32_t targetPersistentId) override 202 { 203 return WSError::WS_OK; 204 } HideNonSecureWindows(bool shouldHide)205 WSError HideNonSecureWindows(bool shouldHide) override 206 { 207 return WSError::WS_OK; 208 } 209 }; 210 } // namespace OHOS::Rosen 211 #endif // OHOS_ROSEN_WINDOW_SCENE_SESSION_MANAGER_INTERFACE_H 212