• 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 OnLayoutFullScreenChange(bool isLayoutFullScreen) override;
50     WSError OnDefaultDensityEnabled(bool isDefaultDensityEnabled) override;
51     WSError RaiseToAppTop() override;
52     WSError UpdateSessionRect(const WSRect& rect, const SizeChangeReason reason, bool isGlobal = false,
53         bool isFromMoveToGlobal = false) override;
54     WMError GetGlobalScaledRect(Rect& globalScaledRect) override;
55     WSError UpdateClientRect(const WSRect& rect) override;
56     WSError OnNeedAvoid(bool status) override;
57     AvoidArea GetAvoidAreaByType(AvoidAreaType type) override;
58     WSError GetAllAvoidAreas(std::map<AvoidAreaType, AvoidArea>& avoidAreas) override;
59     WSError RequestSessionBack(bool needMoveToBackground) override;
60     WSError MarkProcessed(int32_t eventId) override;
61     WSError SetGlobalMaximizeMode(MaximizeMode mode) override;
62     WSError GetGlobalMaximizeMode(MaximizeMode& mode) override;
63     WSError SetAspectRatio(float ratio) override;
64     WSError UpdateWindowAnimationFlag(bool needDefaultAnimationFlag) override;
65     WSError SetLandscapeMultiWindow(bool isLandscapeMultiWindow) override;
66     WSError UpdateWindowSceneAfterCustomAnimation(bool isAdd) override;
67     WSError RaiseAboveTarget(int32_t subWindowId) override;
68     WSError RaiseAppMainWindowToTop() override;
69 
70     WSError TransferAbilityResult(uint32_t resultCode, const AAFwk::Want& want) override;
71     WSError TransferExtensionData(const AAFwk::WantParams& wantParams) override;
72     WSError TransferAccessibilityEvent(const Accessibility::AccessibilityEventInfo& info,
73         int64_t uiExtensionIdLevel) override;
74     void NotifySyncOn() override;
75     void NotifyAsyncOn() override;
76     void NotifyExtensionDied() override;
77     void NotifyExtensionTimeout(int32_t errorCode) override;
78     void TriggerBindModalUIExtension() override;
79 
80     void NotifyPiPWindowPrepareClose() override;
81     WSError UpdatePiPRect(const Rect& rect, SizeChangeReason reason) override;
82     WSError UpdatePiPControlStatus(WsPiPControlType controlType, WsPiPControlStatus status) override;
83     WSError SetAutoStartPiP(bool isAutoStart, uint32_t priority) override;
84 
85     WSError ProcessPointDownSession(int32_t posX, int32_t posY) override;
86     WSError SendPointEventForMoveDrag(const std::shared_ptr<MMI::PointerEvent>& pointerEvent) override;
87     WSError UpdateRectChangeListenerRegistered(bool isRegister) override;
88     WSError SetKeyboardSessionGravity(SessionGravity gravity, uint32_t percent) override;
89     void SetCallingSessionId(uint32_t callingSessionId) override;
90     void SetCustomDecorHeight(int32_t height) override;
91     WSError AdjustKeyboardLayout(const KeyboardLayoutParams& params) override;
92     WMError UpdateSessionPropertyByAction(const sptr<WindowSessionProperty>& property,
93         WSPropertyChangeAction action) override;
94     WMError GetAppForceLandscapeConfig(AppForceLandscapeConfig& config) override;
95     WSError NotifyFrameLayoutFinishFromApp(bool notifyListener, const WSRect& rect) override;
96     WSError SetDialogSessionBackGestureEnabled(bool isEnabled) override;
97     WSError RequestFocus(bool isFocused) override;
98 
99     /*
100      * Gesture Back
101      */
102     WMError SetGestureBackEnabled(bool isEnabled) override;
103 
104 private:
105     static inline BrokerDelegator<SessionProxy> delegator_;
106 };
107 } // namespace OHOS::Rosen
108 
109 #endif // OHOS_ROSEN_WINDOW_SCENE_SESSION_PROXY_H
110