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 23 namespace OHOS::Rosen { 24 class SessionProxy : public IRemoteProxy<ISession> { 25 public: SessionProxy(const sptr<IRemoteObject> & impl)26 explicit SessionProxy(const sptr<IRemoteObject>& impl) : IRemoteProxy<ISession>(impl) {} 27 virtual ~SessionProxy() = default; 28 29 WSError Foreground(sptr<WindowSessionProperty> property) override; 30 WSError Background() override; 31 WSError Disconnect(bool isFromClient = false) override; 32 WSError Show(sptr<WindowSessionProperty> property) override; 33 WSError Hide() override; 34 WSError Connect(const sptr<ISessionStage>& sessionStage, const sptr<IWindowEventChannel>& eventChannel, 35 const std::shared_ptr<RSSurfaceNode>& surfaceNode, SystemSessionConfig& systemConfig, 36 sptr<WindowSessionProperty> property = nullptr, sptr<IRemoteObject> token = nullptr, 37 int32_t pid = -1, int32_t uid = -1) override; 38 WSError UpdateActiveStatus(bool isActive) override; 39 WSError PendingSessionActivation(const sptr<AAFwk::SessionInfo> abilitySessionInfo) override; 40 bool WriteAbilitySessionInfoBasic(MessageParcel& data, const sptr<AAFwk::SessionInfo> abilitySessionInfo); 41 WSError TerminateSession(const sptr<AAFwk::SessionInfo> abilitySessionInfo) override; 42 WSError NotifySessionException( 43 const sptr<AAFwk::SessionInfo> abilitySessionInfo, bool needRemoveSession = false) override; 44 WSError OnSessionEvent(SessionEvent event) override; 45 WSError RaiseToAppTop() override; 46 WSError UpdateSessionRect(const WSRect& rect, const SizeChangeReason& reason) override; 47 WSError OnNeedAvoid(bool status) override; 48 AvoidArea GetAvoidAreaByType(AvoidAreaType type) override; 49 WSError RequestSessionBack(bool needMoveToBackground) override; 50 WSError MarkProcessed(int32_t eventId) override; 51 WSError SetGlobalMaximizeMode(MaximizeMode mode) override; 52 WSError GetGlobalMaximizeMode(MaximizeMode& mode) override; 53 WSError SetSessionProperty(const sptr<WindowSessionProperty>& property) override; 54 WSError SetAspectRatio(float ratio) override; 55 WSError UpdateWindowAnimationFlag(bool needDefaultAnimationFlag) override; 56 WSError UpdateWindowSceneAfterCustomAnimation(bool isAdd) override; 57 WSError RaiseAboveTarget(int32_t subWindowId) override; 58 WSError RaiseAppMainWindowToTop() override; 59 60 WSError TransferAbilityResult(uint32_t resultCode, const AAFwk::Want& want) override; 61 WSError TransferExtensionData(const AAFwk::WantParams& wantParams) override; 62 WSError TransferAccessibilityEvent(const Accessibility::AccessibilityEventInfo& info, 63 int64_t uiExtensionIdLevel) override; 64 void NotifyRemoteReady() override; 65 void NotifySyncOn() override; 66 void NotifyAsyncOn() override; 67 void NotifyExtensionDied() override; 68 void TriggerBindModalUIExtension() override; 69 70 void NotifyPiPWindowPrepareClose() override; 71 WSError UpdatePiPRect(const uint32_t width, const uint32_t height, PiPRectUpdateReason reason) override; 72 WSError RecoveryPullPiPMainWindow(int32_t persistentId, const Rect& rect) override; 73 WSError ProcessPointDownSession(int32_t posX, int32_t posY) override; 74 WSError SendPointEventForMoveDrag(const std::shared_ptr<MMI::PointerEvent>& pointerEvent) override; 75 private: 76 static inline BrokerDelegator<SessionProxy> delegator_; 77 }; 78 } // namespace OHOS::Rosen 79 80 #endif // OHOS_ROSEN_WINDOW_SCENE_SESSION_PROXY_H 81