• 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_INTERFACE_H
17 #define OHOS_ROSEN_WINDOW_SCENE_SESSION_MANAGER_LITE_INTERFACE_H
18 
19 #include <iremote_broker.h>
20 #include "common/include/window_session_property.h"
21 #include "iability_manager_collaborator.h"
22 #include "interfaces/include/ws_common.h"
23 #include "interfaces/include/ws_common_inner.h"
24 #include "mission_info.h"
25 #include "mission_listener_interface.h"
26 #include "mission_snapshot.h"
27 #include "session_info.h"
28 #include "zidl/window_manager_lite_interface.h"
29 namespace OHOS::Media {
30 class PixelMap;
31 } // namespace OHOS::Media
32 
33 namespace OHOS::Rosen {
34 using ISessionListener = AAFwk::IMissionListener;
35 using SessionInfoBean = AAFwk::MissionInfo;
36 using SessionSnapshot = AAFwk::MissionSnapshot;
37 class ISceneSessionManagerLite : public OHOS::Rosen::IWindowManagerLite {
38 public:
39     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.ISceneSessionManagerLite");
40 
41     enum class SceneSessionManagerLiteMessage : uint32_t {
42         TRANS_ID_SET_SESSION_LABEL,
43         TRANS_ID_SET_SESSION_ICON,
44         TRANS_ID_IS_VALID_SESSION_IDS,
45         TRANS_ID_PENDING_SESSION_TO_FOREGROUND,
46         TRANS_ID_PENDING_SESSION_TO_BACKGROUND_FOR_DELEGATOR,
47         TRANS_ID_GET_FOCUS_SESSION_TOKEN,
48         TRANS_ID_GET_FOCUS_SESSION_ELEMENT,
49         TRANS_ID_REGISTER_SESSION_LISTENER,
50         TRANS_ID_UNREGISTER_SESSION_LISTENER,
51         TRANS_ID_GET_MISSION_INFOS,
52         TRANS_ID_GET_MISSION_INFO_BY_ID,
53         TRANS_ID_GET_SESSION_INFO_BY_CONTINUE_SESSION_ID,
54         TRANS_ID_TERMINATE_SESSION_NEW,
55         TRANS_ID_GET_SESSION_SNAPSHOT,
56         TRANS_ID_SET_SESSION_CONTINUE_STATE,
57         TRANS_ID_CLEAR_SESSION,
58         TRANS_ID_CLEAR_ALL_SESSIONS,
59         TRANS_ID_LOCK_SESSION,
60         TRANS_ID_UNLOCK_SESSION,
61         TRANS_ID_MOVE_MISSIONS_TO_FOREGROUND,
62         TRANS_ID_MOVE_MISSIONS_TO_BACKGROUND,
63         //window manager message
64         TRANS_ID_GET_FOCUS_SESSION_INFO,
65         TRANS_ID_REGISTER_WINDOW_MANAGER_AGENT = 22,
66         TRANS_ID_UNREGISTER_WINDOW_MANAGER_AGENT,
67         TRANS_ID_GET_WINDOW_INFO,
68         TRANS_ID_CHECK_WINDOW_ID,
69         TRANS_ID_GET_VISIBILITY_WINDOW_INFO_ID,
70         TRANS_ID_GET_WINDOW_MODE_TYPE,
71         TRANS_ID_RAISE_WINDOW_TO_TOP,
72         TRANS_ID_GET_TOPN_MAIN_WINDOW_INFO,
73         TRANS_ID_REGISTER_COLLABORATOR,
74         TRANS_ID_UNREGISTER_COLLABORATOR,
75         TRANS_ID_GET_ALL_MAIN_WINDOW_INFO,
76         TRANS_ID_CLEAR_MAIN_SESSIONS,
77         TRANS_ID_GET_WINDOW_STYLE_TYPE,
78         TRANS_ID_TERMINATE_SESSION_BY_PERSISTENT_ID,
79         TRANS_ID_GET_MAIN_WINDOW_STATES_BY_PID,
80         TRANS_ID_CLOSE_TARGET_FLOAT_WINDOW,
81         TRANS_ID_CLOSE_TARGET_PIP_WINDOW,
82         TRANS_ID_GET_CURRENT_PIP_WINDOW_INFO,
83     };
84 
85     virtual WSError SetSessionLabel(const sptr<IRemoteObject>& token, const std::string& label) = 0;
86     virtual WSError SetSessionIcon(const sptr<IRemoteObject>& token, const std::shared_ptr<Media::PixelMap>& icon) = 0;
87     virtual WSError IsValidSessionIds(const std::vector<int32_t>& sessionIds, std::vector<bool>& results) = 0;
88     virtual WSError PendingSessionToForeground(const sptr<IRemoteObject>& token) = 0;
89     virtual WSError PendingSessionToBackgroundForDelegator(const sptr<IRemoteObject>& token,
90         bool shouldBackToCaller = true) = 0;
91     virtual WSError GetFocusSessionToken(sptr<IRemoteObject>& token) = 0;
92     virtual WSError GetFocusSessionElement(AppExecFwk::ElementName& element) = 0;
93     virtual WSError RegisterSessionListener(const sptr<ISessionListener>& listener) = 0;
94     virtual WSError UnRegisterSessionListener(const sptr<ISessionListener>& listener) = 0;
95     virtual WSError GetSessionInfos(const std::string& deviceId,
96                                     int32_t numMax, std::vector<SessionInfoBean>& sessionInfos) = 0;
97     virtual WSError GetSessionInfo(const std::string& deviceId, int32_t persistentId, SessionInfoBean& sessionInfo) = 0;
98     virtual WSError GetSessionInfoByContinueSessionId(const std::string& continueSessionId,
99         SessionInfoBean& sessionInfo) = 0;
100     virtual WSError SetSessionContinueState(const sptr<IRemoteObject>& token, const ContinueState& continueState) = 0;
101     virtual WSError TerminateSessionNew(
102         const sptr<AAFwk::SessionInfo> info, bool needStartCaller, bool isFromBroker = false) = 0;
103     virtual WSError GetSessionSnapshot(const std::string& deviceId, int32_t persistentId,
104                                        SessionSnapshot& snapshot, bool isLowResolution) = 0;
105     virtual WSError ClearSession(int32_t persistentId) = 0;
106     virtual WSError ClearAllSessions() = 0;
107     virtual WSError LockSession(int32_t sessionId) = 0;
108     virtual WSError UnlockSession(int32_t sessionId) = 0;
109     virtual WSError MoveSessionsToForeground(const std::vector<std::int32_t>& sessionIds, int32_t topSessionId) = 0;
110     virtual WSError MoveSessionsToBackground(const std::vector<std::int32_t>& sessionIds,
111         std::vector<std::int32_t>& result) = 0;
112     virtual WSError RaiseWindowToTop(int32_t persistentId) = 0;
113     virtual WSError RegisterIAbilityManagerCollaborator(int32_t type,
114         const sptr<AAFwk::IAbilityManagerCollaborator>& impl) = 0;
115     virtual WSError UnregisterIAbilityManagerCollaborator(int32_t type) = 0;
116     virtual WMError GetWindowStyleType(WindowStyleType& windowStyleType) = 0;
117     /**
118      * @brief Obtains main window state list by pid
119      * @caller SA
120      * @permission SA permission
121      *
122      * @param pid Target pid
123      * @param windowStates Window state list
124      */
125     virtual WSError GetMainWindowStatesByPid(int32_t pid, std::vector<MainWindowState>& windowStates) = 0;
126 };
127 } // namespace OHOS::Rosen
128 #endif // OHOS_ROSEN_WINDOW_SCENE_SESSION_MANAGER_LITE_INTERFACE_H
129