• 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_LITE_PROXY_H
17 #define OHOS_ROSEN_WINDOW_SCENE_SESSION_MANAGER_LITE_PROXY_H
18 
19 #include <iremote_proxy.h>
20 
21 #include "session_manager/include/zidl/scene_session_manager_lite_interface.h"
22 
23 namespace OHOS::Rosen {
24 class SceneSessionManagerLiteProxy : public IRemoteProxy<ISceneSessionManagerLite> {
25 public:
SceneSessionManagerLiteProxy(const sptr<IRemoteObject> & impl)26     explicit SceneSessionManagerLiteProxy(const sptr<IRemoteObject>& impl)
27         : IRemoteProxy<ISceneSessionManagerLite>(impl) {}
28     virtual ~SceneSessionManagerLiteProxy() = default;
29 
30     WSError SetSessionLabel(const sptr<IRemoteObject>& token, const std::string& label) override;
31     WSError SetSessionIcon(const sptr<IRemoteObject>& token, const std::shared_ptr<Media::PixelMap>& icon) override;
32     WSError IsValidSessionIds(const std::vector<int32_t>& sessionIds, std::vector<bool>& results) override;
33     WSError PendingSessionToForeground(const sptr<IRemoteObject>& token) override;
34     WSError PendingSessionToBackground(const sptr<IRemoteObject>& token, const BackgroundParams& params) override;
35     WSError PendingSessionToBackgroundForDelegator(const sptr<IRemoteObject>& token,
36         bool shouldBackToCaller = true) override;
37     WSError GetFocusSessionToken(sptr<IRemoteObject>& token, DisplayId displayId = DEFAULT_DISPLAY_ID) override;
38     WSError GetFocusSessionElement(AppExecFwk::ElementName& element, DisplayId displayId = DEFAULT_DISPLAY_ID) override;
39     WSError IsFocusWindowParent(const sptr<IRemoteObject>& token, bool& isParent) override;
40     WSError RegisterSessionListener(const sptr<ISessionListener>& listener, bool isRecover = false) override;
41     WSError UnRegisterSessionListener(const sptr<ISessionListener>& listener) override;
42     WSError GetSessionInfos(const std::string& deviceId, int32_t numMax,
43                             std::vector<SessionInfoBean>& sessionInfos) override;
44     /**
45      * @brief Obtains main window state list by pid
46      * @caller SA
47      * @permission SA permission
48      *
49      * @param pid Target pid
50      * @param windowStates Window state list
51      */
52     WSError GetMainWindowStatesByPid(int32_t pid, std::vector<MainWindowState>& windowStates) override;
53     WSError GetSessionInfo(const std::string& deviceId, int32_t persistentId, SessionInfoBean& sessionInfo) override;
54     WSError GetSessionInfoByContinueSessionId(const std::string& continueSessionId,
55         SessionInfoBean& sessionInfo) override;
56     WSError SetSessionContinueState(const sptr<IRemoteObject>& token, const ContinueState& continueState) override;
57     WSError TerminateSessionNew(
58         const sptr<AAFwk::SessionInfo> info, bool needStartCaller, bool isFromBroker = false) override;
59     WSError GetSessionSnapshot(const std::string& deviceId, int32_t persistentId,
60                                SessionSnapshot& snapshot, bool isLowResolution) override;
61     WSError LockSession(int32_t persistentId) override;
62     WSError UnlockSession(int32_t persistentId) override;
63     WSError MoveSessionsToForeground(const std::vector<int32_t>& sessionIds, int32_t topSessionId) override;
64     WSError MoveSessionsToBackground(const std::vector<int32_t>& sessionIds, std::vector<int32_t>& result) override;
65     WSError ClearSession(int32_t persistentId) override;
66     WSError ClearAllSessions() override;
67     WMError UpdateWindowModeByIdForUITest(int32_t windowId, int32_t updateMode) override;
68     void GetFocusWindowInfo(FocusChangeInfo& focusInfo, DisplayId displayId = DEFAULT_DISPLAY_ID) override;
69     WMError RegisterWindowManagerAgent(WindowManagerAgentType type,
70         const sptr<IWindowManagerAgent>& windowManagerAgent) override;
71     WMError UnregisterWindowManagerAgent(WindowManagerAgentType type,
72         const sptr<IWindowManagerAgent>& windowManagerAgent) override;
73     WMError CheckWindowId(int32_t windowId, int32_t& pid) override;
74     WMError CheckUIExtensionCreation(int32_t windowId, uint32_t tokenId, const AppExecFwk::ElementName& element,
75         AppExecFwk::ExtensionAbilityType extensionAbilityType, int32_t& pid) override;
76     WMError ListWindowInfo(const WindowInfoOption& windowInfoOption, std::vector<sptr<WindowInfo>>& infos) override;
77     WMError GetVisibilityWindowInfo(std::vector<sptr<WindowVisibilityInfo>>& infos) override;
78     WMError GetWindowModeType(WindowModeType& windowModeType) override;
79     WMError GetMainWindowInfos(int32_t topNum, std::vector<MainWindowInfo>& topNInfo) override;
80     WMError GetCallingWindowInfo(CallingWindowInfo& callingWindowInfo) override;
81     WMError GetAllMainWindowInfos(std::vector<MainWindowInfo>& infos) override;
82     WMError ClearMainSessions(const std::vector<int32_t>& persistentIds, std::vector<int32_t>& clearFailedIds) override;
83     WSError RaiseWindowToTop(int32_t persistentId) override;
84     WSError RegisterIAbilityManagerCollaborator(int32_t type,
85         const sptr<AAFwk::IAbilityManagerCollaborator>& impl) override;
86     WSError UnregisterIAbilityManagerCollaborator(int32_t type) override;
87     WMError GetWindowStyleType(WindowStyleType& windowModeType) override;
88     WMError TerminateSessionByPersistentId(int32_t persistentId) override;
89     WMError CloseTargetFloatWindow(const std::string& bundleName) override;
90     WMError CloseTargetPiPWindow(const std::string& bundleName) override;
91     WMError GetCurrentPiPWindowInfo(std::string& bundleName) override;
92     WMError GetRootMainWindowId(int32_t persistentId, int32_t& hostWindowId) override;
93     WMError GetAccessibilityWindowInfo(std::vector<sptr<AccessibilityWindowInfo>>& infos) override;
94     WSError NotifyAppUseControlList(ControlAppType type, int32_t userId,
95         const std::vector<AppUseControlInfo>& controlList) override;
96     WMError MinimizeMainSession(const std::string& bundleName, int32_t appIndex, int32_t userId) override;
97     WMError LockSessionByAbilityInfo(const AbilityInfoBase& abilityInfo, bool isLock) override;
98     WMError HasFloatingWindowForeground(const sptr<IRemoteObject>& abilityToken,
99         bool& hasOrNot) override;
100     WMError RegisterSessionLifecycleListenerByIds(const sptr<ISessionLifecycleListener>& listener,
101         const std::vector<int32_t>& persistentIdList) override;
102     WMError RegisterSessionLifecycleListenerByBundles(const sptr<ISessionLifecycleListener>& listener,
103         const std::vector<std::string>& bundleNameList) override;
104     WMError UnregisterSessionLifecycleListener(const sptr<ISessionLifecycleListener>& listener) override;
105     WSError GetRecentMainSessionInfoList(std::vector<RecentSessionInfo>& recentSessionInfoList) override;
106     WMError GetRouterStackInfo(int32_t persistentId, const sptr<ISessionRouterStackListener>& listener) override;
107     WSError PendingSessionToBackgroundByPersistentId(const int32_t persistentId,
108         bool shouldBackToCaller = true) override;
109     WMError CreateNewInstanceKey(const std::string& bundleName, std::string& instanceKey) override;
110     WMError RemoveInstanceKey(const std::string& bundleName, const std::string& instanceKey) override;
111     WMError TransferSessionToTargetScreen(const TransferSessionInfo& info) override;
112 
113     WMError UpdateKioskAppList(const std::vector<std::string>& kioskAppList) override;
114     WMError EnterKioskMode(const sptr<IRemoteObject>& token) override;
115     WMError ExitKioskMode(const sptr<IRemoteObject>& token) override;
116     WSError SendPointerEventForHover(const std::shared_ptr<MMI::PointerEvent>& pointerEvent) override;
117 private:
118     template<typename T>
119     WSError GetParcelableInfos(MessageParcel& reply, std::vector<T>& parcelableInfos);
120 };
121 } // namespace OHOS::Rosen
122 
123 #endif // OHOS_ROSEN_WINDOW_SCENE_SESSION_MANAGER_LITE_PROXY_H
124