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_SCENE_SESSION_MANAGER_LITE_H 17 #define OHOS_ROSEN_WINDOW_SCENE_SCENE_SESSION_MANAGER_LITE_H 18 19 #include "session_manager/include/zidl/scene_session_manager_lite_stub.h" 20 #include "wm_single_instance.h" 21 22 namespace OHOS::Rosen { 23 24 class SceneSessionManagerLite : public SceneSessionManagerLiteStub { 25 WM_DECLARE_SINGLE_INSTANCE(SceneSessionManagerLite) 26 public: 27 WSError SetSessionLabel(const sptr<IRemoteObject>& token, const std::string& label) override; 28 WSError SetSessionIcon(const sptr<IRemoteObject>& token, const std::shared_ptr<Media::PixelMap>& icon) override; 29 WSError IsValidSessionIds(const std::vector<int32_t>& sessionIds, std::vector<bool>& results) override; 30 WSError PendingSessionToForeground(const sptr<IRemoteObject>& token) override; 31 WSError PendingSessionToBackgroundForDelegator(const sptr<IRemoteObject>& token, 32 bool shouldBackToCaller = true) override; 33 WSError GetFocusSessionToken(sptr<IRemoteObject>& token, DisplayId displayId = DEFAULT_DISPLAY_ID) override; 34 WSError GetFocusSessionElement(AppExecFwk::ElementName& element, DisplayId displayId = DEFAULT_DISPLAY_ID) override; 35 WSError RegisterSessionListener(const sptr<ISessionListener>& listener, bool isRecover = false) override; 36 WSError UnRegisterSessionListener(const sptr<ISessionListener>& listener) override; 37 WSError GetSessionInfos(const std::string& deviceId, int32_t numMax, 38 std::vector<SessionInfoBean>& sessionInfos) override; 39 WSError GetMainWindowStatesByPid(int32_t pid, std::vector<MainWindowState>& windowStates) override; 40 WSError GetSessionInfo(const std::string& deviceId, int32_t persistentId, SessionInfoBean& sessionInfo) override; 41 WSError GetSessionInfoByContinueSessionId(const std::string& continueSessionId, 42 SessionInfoBean& sessionInfo) override; 43 WSError TerminateSessionNew( 44 const sptr<AAFwk::SessionInfo> info, bool needStartCaller, bool isFromBroker = false) override; 45 WSError GetSessionSnapshot(const std::string& deviceId, int32_t persistentId, 46 SessionSnapshot& snapshot, bool isLowResolution) override; 47 WSError SetSessionContinueState(const sptr<IRemoteObject>& token, const ContinueState& continueState) override; 48 WSError ClearSession(int32_t persistentId) override; 49 WSError ClearAllSessions() override; 50 WSError LockSession(int32_t sessionId) override; 51 WSError UnlockSession(int32_t sessionId) override; 52 WSError MoveSessionsToForeground(const std::vector<int32_t>& sessionIds, int32_t topSessionId) override; 53 WSError MoveSessionsToBackground(const std::vector<int32_t>& sessionIds, std::vector<int32_t>& result) override; 54 55 void GetFocusWindowInfo(FocusChangeInfo& focusInfo, DisplayId displayId = DEFAULT_DISPLAY_ID) override; 56 WMError RegisterWindowManagerAgent(WindowManagerAgentType type, 57 const sptr<IWindowManagerAgent>& windowManagerAgent) override; 58 WMError UnregisterWindowManagerAgent(WindowManagerAgentType type, 59 const sptr<IWindowManagerAgent>& windowManagerAgent) override; 60 WMError CheckWindowId(int32_t windowId, int32_t& pid) override; 61 WMError CheckUIExtensionCreation(int32_t windowId, uint32_t tokenId, const AppExecFwk::ElementName& element, 62 AppExecFwk::ExtensionAbilityType extensionAbilityType, int32_t& pid) override; 63 WMError GetVisibilityWindowInfo(std::vector<sptr<WindowVisibilityInfo>>& infos) override; 64 WSError UpdateWindowMode(int32_t persistentId, int32_t windowMode); 65 WMError GetWindowModeType(WindowModeType& windowModeType) override; 66 WMError GetMainWindowInfos(int32_t topNum, std::vector<MainWindowInfo>& topNInfo) override; 67 WMError GetAllMainWindowInfos(std::vector<MainWindowInfo>& infos) override; 68 WMError ClearMainSessions(const std::vector<int32_t>& persistentIds, std::vector<int32_t>& clearFailedIds) override; 69 WSError RaiseWindowToTop(int32_t persistentId) override; 70 WSError RegisterIAbilityManagerCollaborator(int32_t type, 71 const sptr<AAFwk::IAbilityManagerCollaborator>& impl) override; 72 WSError UnregisterIAbilityManagerCollaborator(int32_t type) override; 73 WMError GetWindowStyleType(WindowStyleType& windowStyletype) override; 74 WMError TerminateSessionByPersistentId(int32_t persistentId) override; 75 WMError CloseTargetFloatWindow(const std::string& bundleName) override; 76 WMError CloseTargetPiPWindow(const std::string& bundleName) override; 77 WMError GetCurrentPiPWindowInfo(std::string& bundleName) override; 78 WMError GetRootMainWindowId(int32_t persistentId, int32_t& hostWindowId) override; 79 WMError GetAccessibilityWindowInfo(std::vector<sptr<AccessibilityWindowInfo>>& infos) override; 80 WSError NotifyAppUseControlList(ControlAppType type, int32_t userId, 81 const std::vector<AppUseControlInfo>& controlList) override; 82 WMError MinimizeMainSession(const std::string& bundleName, int32_t appIndex, int32_t userId) override; 83 WMError LockSessionByAbilityInfo(const AbilityInfoBase& abilityInfo, bool isLock) override; 84 WMError HasFloatingWindowForeground(const sptr<IRemoteObject>& abilityToken, 85 bool& hasOrNot) override; 86 WMError GetCallingWindowInfo(CallingWindowInfo& callingWindowInfo) override; 87 WMError RegisterSessionLifecycleListenerByIds(const sptr<ISessionLifecycleListener>& listener, 88 const std::vector<int32_t>& persistentIdList) override; 89 WMError RegisterSessionLifecycleListenerByBundles(const sptr<ISessionLifecycleListener>& listener, 90 const std::vector<std::string>& bundleNameList) override; 91 WMError UnregisterSessionLifecycleListener(const sptr<ISessionLifecycleListener>& listener) override; 92 WMError ListWindowInfo(const WindowInfoOption& windowInfoOption, std::vector<sptr<WindowInfo>>& infos) override; 93 }; 94 } // namespace OHOS::Rosen 95 96 #endif // OHOS_ROSEN_WINDOW_SCENE_SCENE_SESSION_MANAGER_LITE_H 97