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 TerminateSession(const sptr<AAFwk::SessionInfo> abilitySessionInfo) override; 46 WSError NotifySessionException( 47 const sptr<AAFwk::SessionInfo> abilitySessionInfo, const ExceptionInfo& exceptionInfo) 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, bool isSaveBySpecifiedFlag) override; 56 WSError RaiseToAppTop() override; 57 WSError UpdateSessionRect(const WSRect& rect, SizeChangeReason reason, bool isGlobal = false, 58 bool isFromMoveToGlobal = false, const MoveConfiguration& moveConfiguration = {}, 59 const RectAnimationConfig& rectAnimationConfig = {}) override; 60 WMError GetGlobalScaledRect(Rect& globalScaledRect) override; 61 WSError UpdateClientRect(const WSRect& rect) override; 62 WSError OnNeedAvoid(bool status) override; 63 AvoidArea GetAvoidAreaByType(AvoidAreaType type, const WSRect& rect = WSRect::EMPTY_RECT, 64 int32_t apiVersion = API_VERSION_INVALID) override; 65 WSError GetAllAvoidAreas(std::map<AvoidAreaType, AvoidArea>& avoidAreas) override; 66 WSError RequestSessionBack(bool needMoveToBackground) override; 67 WSError MarkProcessed(int32_t eventId) override; 68 WSError SetGlobalMaximizeMode(MaximizeMode mode) override; 69 WSError GetGlobalMaximizeMode(MaximizeMode& mode) override; 70 WSError SetAspectRatio(float ratio) override; 71 WSError UpdateWindowAnimationFlag(bool needDefaultAnimationFlag) override; 72 WSError SetLandscapeMultiWindow(bool isLandscapeMultiWindow) override; 73 WSError GetIsMidScene(bool& isMidScene) override; 74 WSError UpdateWindowSceneAfterCustomAnimation(bool isAdd) override; 75 WSError RaiseAboveTarget(int32_t subWindowId) override; 76 WSError RaiseAppMainWindowToTop() override; 77 WSError SetSessionLabelAndIcon(const std::string& label, 78 const std::shared_ptr<Media::PixelMap>& icon) override; 79 80 /* 81 * UIExtension 82 */ 83 WSError TransferAbilityResult(uint32_t resultCode, const AAFwk::Want& want) override; 84 WSError TransferExtensionData(const AAFwk::WantParams& wantParams) override; 85 WSError TransferAccessibilityEvent(const Accessibility::AccessibilityEventInfo& info, 86 int64_t uiExtensionIdLevel) override; 87 void NotifySyncOn() override; 88 void NotifyAsyncOn() override; 89 void NotifyExtensionDied() override; 90 void NotifyExtensionTimeout(int32_t errorCode) override; 91 void TriggerBindModalUIExtension() override; 92 void NotifyExtensionEventAsync(uint32_t notifyEvent) override; 93 WSError SendExtensionData(MessageParcel& data, MessageParcel& reply, MessageOption& option) override; 94 95 void NotifyPiPWindowPrepareClose() override; 96 WSError UpdatePiPRect(const Rect& rect, SizeChangeReason reason) override; 97 WSError UpdatePiPControlStatus(WsPiPControlType controlType, WsPiPControlStatus status) override; 98 WSError SetAutoStartPiP(bool isAutoStart, uint32_t priority, uint32_t width, uint32_t height) override; 99 100 WSError ProcessPointDownSession(int32_t posX, int32_t posY) override; 101 WSError SendPointEventForMoveDrag(const std::shared_ptr<MMI::PointerEvent>& pointerEvent, 102 bool isExecuteDelayRaise = false) override; 103 bool IsStartMoving() override; 104 WSError UpdateRectChangeListenerRegistered(bool isRegister) override; 105 void SetCallingSessionId(uint32_t callingSessionId) override; 106 void NotifyKeyboardDidShowRegistered(bool registered) override; 107 void NotifyKeyboardDidHideRegistered(bool registered) override; 108 void SetCustomDecorHeight(int32_t height) override; 109 WSError AdjustKeyboardLayout(const KeyboardLayoutParams& params) override; 110 WSError ChangeKeyboardViewMode(KeyboardViewMode mode) override; 111 WMError UpdateSessionPropertyByAction(const sptr<WindowSessionProperty>& property, 112 WSPropertyChangeAction action) override; 113 WMError GetAppForceLandscapeConfig(AppForceLandscapeConfig& config) override; 114 WSError NotifyFrameLayoutFinishFromApp(bool notifyListener, const WSRect& rect) override; 115 WSError SetDialogSessionBackGestureEnabled(bool isEnabled) override; 116 int32_t GetStatusBarHeight() override; 117 WMError SetSystemWindowEnableDrag(bool enableDrag) override; 118 void NotifyExtensionDetachToDisplay() override; 119 120 /* 121 * Gesture Back 122 */ 123 WMError SetGestureBackEnabled(bool isEnabled) override; 124 125 WSError NotifySubModalTypeChange(SubWindowModalType subWindowModalType) override; 126 WSError NotifyMainModalTypeChange(bool isModal) override; 127 128 /* 129 * Starting Window 130 */ 131 WSError RemoveStartingWindow() override; 132 133 /* 134 * Window Property 135 */ 136 WSError SetWindowCornerRadius(float cornerRadius) override; 137 138 WSError NotifySupportWindowModesChange( 139 const std::vector<AppExecFwk::SupportWindowMode>& supportedWindowModes) override; 140 WSError GetCrossAxisState(CrossAxisState& state) override; 141 142 /* 143 * PC Window 144 */ 145 WSError StartMovingWithCoordinate(int32_t offsetX, int32_t offsetY, 146 int32_t pointerPosX, int32_t pointerPosY) override; 147 WSError OnContainerModalEvent(const std::string& eventName, const std::string& eventValue) override; 148 WSError NotifyFollowParentMultiScreenPolicy(bool enabled) override; 149 WSError UpdateFlag(const std::string& flag) override; 150 151 /* 152 * Window Pattern 153 */ 154 void NotifyWindowAttachStateListenerRegistered(bool registered) override; 155 156 /** 157 * Window layout 158 */ 159 WSError SetFollowParentWindowLayoutEnabled(bool isFollow) override; 160 161 /* 162 * window focus 163 */ 164 WSError RequestFocus(bool isFocused) override; 165 WSError GetIsHighlighted(bool& isHighlighted) override; 166 167 private: 168 static inline BrokerDelegator<SessionProxy> delegator_; 169 }; 170 } // namespace OHOS::Rosen 171 172 #endif // OHOS_ROSEN_WINDOW_SCENE_SESSION_PROXY_H 173