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 enum class SessionInterfaceCode; 26 class SessionProxy : public IRemoteProxy<ISession> { 27 public: SessionProxy(const sptr<IRemoteObject> & impl)28 explicit SessionProxy(const sptr<IRemoteObject>& impl) : IRemoteProxy<ISession>(impl) {} 29 virtual ~SessionProxy() = default; 30 31 WSError Foreground(sptr<WindowSessionProperty> property, bool isFromClient = false, 32 const std::string& identityToken = "") override; 33 WSError Background(bool isFromClient = false, const std::string& identityToken = "") override; 34 WSError Disconnect(bool isFromClient = false, const std::string& identityToken = "") override; 35 WSError Show(sptr<WindowSessionProperty> property) override; 36 WSError Hide() override; 37 WSError Connect(const sptr<ISessionStage>& sessionStage, const sptr<IWindowEventChannel>& eventChannel, 38 const std::shared_ptr<RSSurfaceNode>& surfaceNode, SystemSessionConfig& systemConfig, 39 sptr<WindowSessionProperty> property = nullptr, sptr<IRemoteObject> token = nullptr, 40 const std::string& identityToken = "") override; 41 WSError DrawingCompleted() override; 42 WSError ChangeSessionVisibilityWithStatusBar(const sptr<AAFwk::SessionInfo> abilitySessionInfo, 43 bool visible) override; 44 WSError PendingSessionActivation(const sptr<AAFwk::SessionInfo> abilitySessionInfo) override; 45 WSError BatchPendingSessionsActivation(const std::vector<sptr<AAFwk::SessionInfo>>& abilitySessionInfos) override; 46 WSError TerminateSession(const sptr<AAFwk::SessionInfo> abilitySessionInfo) override; 47 WSError NotifySessionException( 48 const sptr<AAFwk::SessionInfo> abilitySessionInfo, const ExceptionInfo& exceptionInfo) override; 49 WSError OnSessionEvent(SessionEvent event) override; 50 WSError SyncSessionEvent(SessionEvent event) override; 51 WSError OnLayoutFullScreenChange(bool isLayoutFullScreen) override; 52 WSError OnDefaultDensityEnabled(bool isDefaultDensityEnabled) override; 53 WSError OnTitleAndDockHoverShowChange(bool isTitleHoverShown = true, 54 bool isDockHoverShown = true) override; 55 WSError OnRestoreMainWindow() override; 56 WSError OnSetWindowRectAutoSave(bool enabled, bool isSaveBySpecifiedFlag) override; 57 WSError RaiseToAppTop() override; 58 WSError UpdateSessionRect(const WSRect& rect, SizeChangeReason reason, bool isGlobal = false, 59 bool isFromMoveToGlobal = false, const MoveConfiguration& moveConfiguration = {}, 60 const RectAnimationConfig& rectAnimationConfig = {}) override; 61 WSError UpdateGlobalDisplayRectFromClient(const WSRect& rect, SizeChangeReason reason) override; 62 WMError GetGlobalScaledRect(Rect& globalScaledRect) override; 63 WSError UpdateClientRect(const WSRect& rect) override; 64 WSError OnNeedAvoid(bool status) override; 65 AvoidArea GetAvoidAreaByType(AvoidAreaType type, const WSRect& rect = WSRect::EMPTY_RECT, 66 int32_t apiVersion = API_VERSION_INVALID) override; 67 WSError GetAllAvoidAreas(std::map<AvoidAreaType, AvoidArea>& avoidAreas) override; 68 WSError GetTargetOrientationConfigInfo(Orientation targetOrientation, 69 const std::map<Rosen::WindowType, Rosen::SystemBarProperty>& properties) override; 70 WSError RequestSessionBack(bool needMoveToBackground) override; 71 WSError MarkProcessed(int32_t eventId) override; 72 WSError SetGlobalMaximizeMode(MaximizeMode mode) override; 73 WSError GetGlobalMaximizeMode(MaximizeMode& mode) override; 74 WSError SetAspectRatio(float ratio) override; 75 WSError UpdateWindowAnimationFlag(bool needDefaultAnimationFlag) override; 76 WSError SetLandscapeMultiWindow(bool isLandscapeMultiWindow) override; 77 WSError GetIsMidScene(bool& isMidScene) override; 78 WSError UpdateWindowSceneAfterCustomAnimation(bool isAdd) override; 79 WSError RaiseAboveTarget(int32_t subWindowId) override; 80 WSError RaiseMainWindowAboveTarget(int32_t targetId) override; 81 WSError RaiseAppMainWindowToTop() override; 82 WSError SetSessionLabelAndIcon(const std::string& label, 83 const std::shared_ptr<Media::PixelMap>& icon) override; 84 WSError SetSubWindowSource(SubWindowSource source) override; 85 WSError WriteOneSessionInfo(MessageParcel& data, const sptr<AAFwk::SessionInfo>& abilitySessionInfo); 86 WSError WriteOneSessionInfoPart(MessageParcel& data, const sptr<AAFwk::SessionInfo>& abilitySessionInfo); 87 88 /* 89 * UIExtension 90 */ 91 WSError TransferAbilityResult(uint32_t resultCode, const AAFwk::Want& want) override; 92 int32_t TransferExtensionData(const AAFwk::WantParams& wantParams) override; 93 WSError TransferAccessibilityEvent(const Accessibility::AccessibilityEventInfo& info, 94 int64_t uiExtensionIdLevel) override; 95 void NotifySyncOn() override; 96 void NotifyAsyncOn() override; 97 void NotifyExtensionDied() override; 98 void NotifyExtensionTimeout(int32_t errorCode) override; 99 void TriggerBindModalUIExtension() override; 100 void NotifyExtensionEventAsync(uint32_t notifyEvent) override; 101 WSError SendExtensionData(MessageParcel& data, MessageParcel& reply, MessageOption& option) override; 102 103 void NotifyPiPWindowPrepareClose() override; 104 WSError UpdatePiPRect(const Rect& rect, SizeChangeReason reason) override; 105 WSError UpdatePiPControlStatus(WsPiPControlType controlType, WsPiPControlStatus status) override; 106 WSError SetAutoStartPiP(bool isAutoStart, uint32_t priority, uint32_t width, uint32_t height) override; 107 WSError UpdatePiPTemplateInfo(PiPTemplateInfo& pipTemplateInfo) override; 108 109 WMError UpdateFloatingBall(const FloatingBallTemplateInfo& fbTemplateInfo) override; 110 WMError RestoreFbMainWindow(const std::shared_ptr<AAFwk::Want>& want) override; 111 WMError GetFloatingBallWindowId(uint32_t& windowId) override; 112 void NotifyFloatingBallPrepareClose() override; 113 114 WSError ProcessPointDownSession(int32_t posX, int32_t posY) override; 115 WSError SendPointEventForMoveDrag(const std::shared_ptr<MMI::PointerEvent>& pointerEvent, 116 bool isExecuteDelayRaise = false) override; 117 bool IsStartMoving() override; 118 WSError UpdateRectChangeListenerRegistered(bool isRegister) override; 119 void SetCallingSessionId(uint32_t callingSessionId) override; 120 void NotifyKeyboardWillShowRegistered(bool registered) override; 121 void NotifyKeyboardWillHideRegistered(bool registered) override; 122 void NotifyKeyboardDidShowRegistered(bool registered) override; 123 void NotifyKeyboardDidHideRegistered(bool registered) override; 124 void SetCustomDecorHeight(int32_t height) override; 125 WSError AdjustKeyboardLayout(const KeyboardLayoutParams& params) override; 126 WSError ChangeKeyboardEffectOption(const KeyboardEffectOption& effectOption) override; 127 WMError UpdateSessionPropertyByAction(const sptr<WindowSessionProperty>& property, 128 WSPropertyChangeAction action) override; 129 WMError GetAppForceLandscapeConfig(AppForceLandscapeConfig& config) override; 130 WSError NotifyFrameLayoutFinishFromApp(bool notifyListener, const WSRect& rect) override; 131 WMError NotifySnapshotUpdate() override; 132 WSError SetDialogSessionBackGestureEnabled(bool isEnabled) override; 133 int32_t GetStatusBarHeight() override; 134 WMError SetSystemWindowEnableDrag(bool enableDrag) override; 135 void NotifyExtensionDetachToDisplay() override; 136 137 /* 138 * Gesture Back 139 */ 140 WMError SetGestureBackEnabled(bool isEnabled) override; 141 142 WSError NotifySubModalTypeChange(SubWindowModalType subWindowModalType) override; 143 WSError NotifyMainModalTypeChange(bool isModal) override; 144 145 /* 146 * Starting Window 147 */ 148 WSError RemoveStartingWindow() override; 149 150 /* 151 * Window Property 152 */ 153 WSError SetWindowCornerRadius(float cornerRadius) override; 154 WSError SetWindowShadows(const ShadowsInfo& shadowsInfo) override; 155 156 WSError NotifySupportWindowModesChange( 157 const std::vector<AppExecFwk::SupportWindowMode>& supportedWindowModes) override; 158 WSError GetCrossAxisState(CrossAxisState& state) override; 159 WMError UpdateScreenshotAppEventRegistered(int32_t persistentId, bool isRegister) override; 160 WMError UpdateAcrossDisplaysChangeRegistered(bool isRegister) override; 161 162 /* 163 * PC Fold Screen 164 */ 165 WSError GetWaterfallMode(bool& isWaterfallMode) override; 166 WMError IsMainWindowFullScreenAcrossDisplays(bool& isWaterfallMode) override; 167 168 /* 169 * PC Window 170 */ 171 WSError StartMovingWithCoordinate(int32_t offsetX, int32_t offsetY, 172 int32_t pointerPosX, int32_t pointerPosY, DisplayId displayId) override; 173 WSError OnContainerModalEvent(const std::string& eventName, const std::string& eventValue) override; 174 WSError NotifyFollowParentMultiScreenPolicy(bool enabled) override; 175 WSError UpdateFlag(const std::string& flag) override; 176 WSError UseImplicitAnimation(bool useImplicit) override; 177 178 /* 179 * Window Pattern 180 */ 181 void NotifyWindowAttachStateListenerRegistered(bool registered) override; 182 183 /** 184 * Window layout 185 */ 186 WSError SetFollowParentWindowLayoutEnabled(bool isFollow) override; 187 WSError SetWindowAnchorInfo(const WindowAnchorInfo& windowAnchorInfo) override; 188 WSError KeyFrameAnimateEnd() override; 189 WSError UpdateKeyFrameCloneNode(std::shared_ptr<RSCanvasNode>& rsCanvasNode, 190 std::shared_ptr<RSTransaction>& rsTransaction) override; 191 WSError SetDragKeyFramePolicy(const KeyFramePolicy& keyFramePolicy) override; 192 WMError GetAppHookWindowInfoFromServer(HookWindowInfo& hookWindowInfo) override; 193 194 /** 195 * Window Transition Animation For PC 196 */ 197 WSError SetWindowTransitionAnimation(WindowTransitionType transitionType, 198 const TransitionAnimation& animation) override; 199 200 /** 201 * window rotation 202 */ 203 WSError UpdateRotationChangeRegistered(int32_t persistentId, bool isRegister) override; 204 205 /* 206 * window focus 207 */ 208 WSError RequestFocus(bool isFocused) override; 209 WSError GetIsHighlighted(bool& isHighlighted) override; 210 WMError NotifyDisableDelegatorChange() override; 211 212 /** 213 * window animation 214 */ 215 WSError SetFrameRectForPartialZoomIn(const Rect& frameRect) override; 216 private: 217 static inline BrokerDelegator<SessionProxy> delegator_; 218 }; 219 } // namespace OHOS::Rosen 220 221 #endif // OHOS_ROSEN_WINDOW_SCENE_SESSION_PROXY_H 222