• 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_PROXY_H
17 #define OHOS_ROSEN_WINDOW_SCENE_SESSION_PROXY_H
18 
19 #include <iremote_proxy.h>
20 
21 #include "session/host/include/zidl/session_interface.h"
22 #include "ws_common.h"
23 
24 namespace OHOS::Rosen {
25 class SessionProxy : public IRemoteProxy<ISession> {
26 public:
SessionProxy(const sptr<IRemoteObject> & impl)27     explicit SessionProxy(const sptr<IRemoteObject>& impl) : IRemoteProxy<ISession>(impl) {}
28     virtual ~SessionProxy() = default;
29 
30     WSError Foreground(sptr<WindowSessionProperty> property, bool isFromClient = false,
31         const std::string& identityToken = "") override;
32     WSError Background(bool isFromClient = false, const std::string& identityToken = "") override;
33     WSError Disconnect(bool isFromClient = false, const std::string& identityToken = "") override;
34     WSError Show(sptr<WindowSessionProperty> property) override;
35     WSError Hide() override;
36     WSError Connect(const sptr<ISessionStage>& sessionStage, const sptr<IWindowEventChannel>& eventChannel,
37         const std::shared_ptr<RSSurfaceNode>& surfaceNode, SystemSessionConfig& systemConfig,
38         sptr<WindowSessionProperty> property = nullptr, sptr<IRemoteObject> token = nullptr,
39         const std::string& identityToken = "") override;
40     WSError DrawingCompleted() override;
41     WSError ChangeSessionVisibilityWithStatusBar(const sptr<AAFwk::SessionInfo> abilitySessionInfo,
42         bool visible) override;
43     WSError PendingSessionActivation(const sptr<AAFwk::SessionInfo> abilitySessionInfo) override;
44     bool WriteAbilitySessionInfoBasic(MessageParcel& data, const sptr<AAFwk::SessionInfo> abilitySessionInfo);
45     WSError TerminateSession(const sptr<AAFwk::SessionInfo> abilitySessionInfo) override;
46     WSError NotifySessionException(
47         const sptr<AAFwk::SessionInfo> abilitySessionInfo, bool needRemoveSession = false) override;
48     WSError OnSessionEvent(SessionEvent event) override;
49     WSError SyncSessionEvent(SessionEvent event) override;
50     WSError OnLayoutFullScreenChange(bool isLayoutFullScreen) override;
51     WSError OnDefaultDensityEnabled(bool isDefaultDensityEnabled) override;
52     WSError OnTitleAndDockHoverShowChange(bool isTitleHoverShown = true,
53         bool isDockHoverShown = true) override;
54     WSError OnRestoreMainWindow() override;
55     WSError OnSetWindowRectAutoSave(bool enabled) override;
56     WSError RaiseToAppTop() override;
57     WSError UpdateSessionRect(const WSRect& rect, const SizeChangeReason reason, bool isGlobal = false,
58         bool isFromMoveToGlobal = false) override;
59     WMError GetGlobalScaledRect(Rect& globalScaledRect) override;
60     WSError UpdateClientRect(const WSRect& rect) override;
61     WSError OnNeedAvoid(bool status) override;
62     AvoidArea GetAvoidAreaByType(AvoidAreaType type) override;
63     WSError GetAllAvoidAreas(std::map<AvoidAreaType, AvoidArea>& avoidAreas) override;
64     WSError RequestSessionBack(bool needMoveToBackground) override;
65     WSError MarkProcessed(int32_t eventId) override;
66     WSError SetGlobalMaximizeMode(MaximizeMode mode) override;
67     WSError GetGlobalMaximizeMode(MaximizeMode& mode) override;
68     WSError SetAspectRatio(float ratio) override;
69     WSError UpdateWindowAnimationFlag(bool needDefaultAnimationFlag) override;
70     WSError SetLandscapeMultiWindow(bool isLandscapeMultiWindow) override;
71     WSError GetIsMidScene(bool& isMidScene) override;
72     WSError UpdateWindowSceneAfterCustomAnimation(bool isAdd) override;
73     WSError RaiseAboveTarget(int32_t subWindowId) override;
74     WSError RaiseAppMainWindowToTop() override;
75     WSError SetSessionLabelAndIcon(const std::string& label,
76         const std::shared_ptr<Media::PixelMap>& icon) override;
77 
78     /*
79      * UIExtension
80      */
81     WSError TransferAbilityResult(uint32_t resultCode, const AAFwk::Want& want) override;
82     WSError TransferExtensionData(const AAFwk::WantParams& wantParams) override;
83     WSError TransferAccessibilityEvent(const Accessibility::AccessibilityEventInfo& info,
84         int64_t uiExtensionIdLevel) override;
85     void NotifySyncOn() override;
86     void NotifyAsyncOn() override;
87     void NotifyExtensionDied() override;
88     void NotifyExtensionTimeout(int32_t errorCode) override;
89     void TriggerBindModalUIExtension() override;
90     void NotifyExtensionEventAsync(uint32_t notifyEvent) override;
91     WSError SendExtensionData(MessageParcel& data, MessageParcel& reply, MessageOption& option) override;
92 
93     void NotifyPiPWindowPrepareClose() override;
94     WSError UpdatePiPRect(const Rect& rect, SizeChangeReason reason) override;
95     WSError UpdatePiPControlStatus(WsPiPControlType controlType, WsPiPControlStatus status) override;
96     WSError SetAutoStartPiP(bool isAutoStart, uint32_t priority) override;
97 
98     WSError ProcessPointDownSession(int32_t posX, int32_t posY) override;
99     WSError SendPointEventForMoveDrag(const std::shared_ptr<MMI::PointerEvent>& pointerEvent) override;
100     bool IsStartMoving() override;
101     WSError UpdateRectChangeListenerRegistered(bool isRegister) override;
102     void SetCallingSessionId(uint32_t callingSessionId) override;
103     void SetCustomDecorHeight(int32_t height) override;
104     WSError AdjustKeyboardLayout(const KeyboardLayoutParams& params) override;
105     WSError ChangeKeyboardViewMode(KeyboardViewMode mode) override;
106     WMError UpdateSessionPropertyByAction(const sptr<WindowSessionProperty>& property,
107         WSPropertyChangeAction action) override;
108     WMError GetAppForceLandscapeConfig(AppForceLandscapeConfig& config) override;
109     WSError NotifyFrameLayoutFinishFromApp(bool notifyListener, const WSRect& rect) override;
110     WSError SetDialogSessionBackGestureEnabled(bool isEnabled) override;
111     WMError SetSystemWindowEnableDrag(bool enableDrag) override;
112     void NotifyExtensionDetachToDisplay() override;
113     WSError RequestFocus(bool isFocused) override;
114 
115     /*
116      * Gesture Back
117      */
118     WMError SetGestureBackEnabled(bool isEnabled) override;
119 
120     WSError NotifySubModalTypeChange(SubWindowModalType subWindowModalType) override;
121     WSError NotifyMainModalTypeChange(bool isModal) override;
122 
123     /*
124      * Starting Window
125      */
126     WSError RemoveStartingWindow() override;
127 
128     /*
129      * PC Window
130      */
131     WSError StartMovingWithCoordinate(int32_t offsetX, int32_t offsetY,
132         int32_t pointerPosX, int32_t pointerPosY) override;
133     WSError NotifySupportWindowModesChange(
134         const std::vector<AppExecFwk::SupportWindowMode>& supportedWindowModes) override;
135 
136 private:
137     static inline BrokerDelegator<SessionProxy> delegator_;
138 };
139 } // namespace OHOS::Rosen
140 
141 #endif // OHOS_ROSEN_WINDOW_SCENE_SESSION_PROXY_H
142