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_WINDOW_SCENE_SESSION_STAGE_INTERFACE_H 17 #define OHOS_WINDOW_SCENE_SESSION_STAGE_INTERFACE_H 18 19 #include <iremote_broker.h> 20 #include <list> 21 #include <map> 22 23 #include "interfaces/include/ws_common.h" 24 #include "occupied_area_change_info.h" 25 26 namespace OHOS::MMI { 27 class PointerEvent; 28 class KeyEvent; 29 class AxisEvent; 30 } // namespace MMI 31 namespace OHOS::Accessibility { 32 class AccessibilityElementInfo; 33 } 34 namespace OHOS::Rosen { 35 class RSTransaction; 36 37 class ISessionStage : public IRemoteBroker { 38 public: 39 DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.ISessionStage"); 40 41 // IPC interface 42 virtual WSError SetActive(bool active) = 0; 43 virtual WSError UpdateRect(const WSRect& rect, SizeChangeReason reason, 44 const SceneAnimationConfig& config = { nullptr, ROTATE_ANIMATION_DURATION }, 45 const std::map<AvoidAreaType, AvoidArea>& avoidAreas = {}) = 0; 46 virtual void UpdateDensity() = 0; 47 virtual WSError UpdateOrientation() = 0; SendExtensionData(MessageParcel & data,MessageParcel & reply,MessageOption & option)48 virtual WSError SendExtensionData(MessageParcel& data, MessageParcel& reply, MessageOption& option) 49 { 50 return WSError::WS_OK; 51 } 52 virtual WSError HandleBackEvent() = 0; 53 virtual WSError MarkProcessed(int32_t eventId) = 0; 54 virtual WSError UpdateFocus(bool isFocused) = 0; 55 virtual WSError NotifyDestroy() = 0; 56 virtual WSError NotifyHighlightChange(bool isHighlight) = 0; 57 58 /** 59 * @brief Notify client to close the existing pip window. 60 * 61 * Called when starting pip but there is already a pip window foreground. The previous one will be destroyed if 62 * the new starting request has a higher priority. 63 * 64 * @return Returns WSError::WS_OK if called success, otherwise failed. 65 */ 66 virtual WSError NotifyCloseExistPipWindow() = 0; 67 virtual WSError NotifyTransferComponentData(const AAFwk::WantParams& wantParams) = 0; 68 virtual WSErrorCode NotifyTransferComponentDataSync(const AAFwk::WantParams& wantParams, 69 AAFwk::WantParams& reWantParams) = 0; 70 virtual void NotifyOccupiedAreaChangeInfo(sptr<OccupiedAreaChangeInfo> info, 71 const std::shared_ptr<RSTransaction>& rsTransaction = nullptr) = 0; 72 virtual WSError UpdateAvoidArea(const sptr<AvoidArea>& avoidArea, AvoidAreaType type) = 0; 73 virtual void NotifyScreenshot() = 0; 74 virtual void DumpSessionElementInfo(const std::vector<std::string>& params) = 0; 75 virtual WSError NotifyTouchOutside() = 0; 76 virtual WSError NotifyWindowVisibility(bool isVisible) = 0; 77 virtual WSError UpdateWindowMode(WindowMode mode) = 0; 78 virtual void NotifyForegroundInteractiveStatus(bool interactive) = 0; 79 virtual WSError UpdateMaximizeMode(MaximizeMode mode) = 0; 80 virtual void NotifySessionForeground(uint32_t reason, bool withAnimation) = 0; 81 virtual void NotifySessionBackground(uint32_t reason, bool withAnimation, bool isFromInnerkits) = 0; 82 virtual WSError UpdateTitleInTargetPos(bool isShow, int32_t height) = 0; 83 virtual void NotifyTransformChange(const Transform& transform) = 0; 84 virtual WSError NotifyDialogStateChange(bool isForeground) = 0; 85 86 /** 87 * @brief Notify single hand transform. 88 * 89 * Notify singleHandTransform when single hand mode changed. 90 * 91 * @param singleHandTransform transform to change. 92 */ 93 virtual void NotifySingleHandTransformChange(const SingleHandTransform& singleHandTransform) = 0; 94 95 /** 96 * @brief Set pip event to client. 97 * 98 * Set the pip event to client. Such as close, restore, destroy events. 99 * 100 * @param action Indicates the action name. 101 * @param status Indicates the status num. 102 * @return Returns WSError::WS_OK if called success, otherwise failed. 103 */ 104 virtual WSError SetPipActionEvent(const std::string& action, int32_t status) = 0; 105 106 /** 107 * @brief notify pip size to client. 108 * 109 * Notify the pip size to client. including width, height and scale. 110 * 111 * @param width Indicates the size width. 112 * @param height Indicates the size height. 113 * @param scale Indicates the size scale. 114 * @return Returns WSError::WS_OK if called success, otherwise failed. 115 */ 116 virtual WSError NotifyPipWindowSizeChange(uint32_t width, uint32_t height, double scale) = 0; 117 118 /** 119 * @brief Set the media control event to client. 120 * 121 * Set the media control event to client. The event is from pip control panel operation. 122 * 123 * @param controlType Indicates the {@link WsPiPControlType} component in pip control panel. 124 * @param status Indicates the {@link WsPiPControlStatus} required state of specified component. 125 * @return Returns WSError::WS_OK if called success, otherwise failed. 126 */ 127 virtual WSError SetPiPControlEvent(WsPiPControlType controlType, WsPiPControlStatus status) = 0; 128 virtual WSError UpdateDisplayId(uint64_t displayId) = 0; 129 virtual void NotifyDisplayMove(DisplayId from, DisplayId to) = 0; 130 virtual WSError SwitchFreeMultiWindow(bool enable) = 0; NotifyCompatibleModeEnableInPad(bool enable)131 virtual WSError NotifyCompatibleModeEnableInPad(bool enable) 132 { 133 return WSError::WS_OK; 134 } 135 virtual void SetUniqueVirtualPixelRatio(bool useUniqueDensity, float virtualPixelRatio) = 0; NotifySessionFullScreen(bool fullScreen)136 virtual void NotifySessionFullScreen(bool fullScreen) {} 137 virtual WSError GetUIContentRemoteObj(sptr<IRemoteObject>& uiContentRemoteObj) = 0; 138 139 // **Non** IPC interface NotifyBackpressedEvent(bool & isConsumed)140 virtual void NotifyBackpressedEvent(bool& isConsumed) {} NotifyPointerEvent(const std::shared_ptr<MMI::PointerEvent> & pointerEvent)141 virtual void NotifyPointerEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent) {} 142 virtual void NotifyKeyEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent, bool& isConsumed, 143 bool notifyInputMethod = true) {} NotifyFocusActiveEvent(bool isFocusActive)144 virtual void NotifyFocusActiveEvent(bool isFocusActive) {} NotifyFocusStateEvent(bool focusState)145 virtual void NotifyFocusStateEvent(bool focusState) {} NotifyOnKeyPreImeEvent(const std::shared_ptr<MMI::KeyEvent> & keyEvent)146 virtual bool NotifyOnKeyPreImeEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent) {return false;} GetPersistentId()147 virtual int32_t GetPersistentId() const 148 { 149 return -1; 150 } NotifyDensityFollowHost(bool isFollowHost,float densityValue)151 virtual WSError NotifyDensityFollowHost(bool isFollowHost, float densityValue) 152 { 153 return WSError::WS_OK; 154 } NotifyAccessibilityHoverEvent(float pointX,float pointY,int32_t sourceType,int32_t eventType,int64_t timeMs)155 virtual WSError NotifyAccessibilityHoverEvent(float pointX, float pointY, int32_t sourceType, int32_t eventType, 156 int64_t timeMs) 157 { 158 return WSError::WS_OK; 159 } NotifyAccessibilityChildTreeRegister(uint32_t windowId,int32_t treeId,int64_t accessibilityId)160 virtual WSError NotifyAccessibilityChildTreeRegister( 161 uint32_t windowId, int32_t treeId, int64_t accessibilityId) 162 { 163 return WSError::WS_OK; 164 } NotifyAccessibilityChildTreeUnregister()165 virtual WSError NotifyAccessibilityChildTreeUnregister() 166 { 167 return WSError::WS_OK; 168 } NotifyAccessibilityDumpChildInfo(const std::vector<std::string> & params,std::vector<std::string> & info)169 virtual WSError NotifyAccessibilityDumpChildInfo( 170 const std::vector<std::string>& params, std::vector<std::string>& info) 171 { 172 return WSError::WS_OK; 173 } 174 NotifyKeyboardPanelInfoChange(const KeyboardPanelInfo & keyboardPanelInfo)175 virtual void NotifyKeyboardPanelInfoChange(const KeyboardPanelInfo& keyboardPanelInfo) {} NotifyDumpInfo(const std::vector<std::string> & params,std::vector<std::string> & info)176 virtual WSError NotifyDumpInfo(const std::vector<std::string>& params, std::vector<std::string>& info) 177 { 178 return WSError::WS_OK; 179 } 180 virtual WSError SetEnableDragBySystem(bool dragEnable) = 0; 181 virtual WSError SetDragActivated(bool dragActivated) = 0; NotifyWindowAttachStateChange(bool isAttach)182 virtual WSError NotifyWindowAttachStateChange(bool isAttach) { return WSError::WS_DO_NOTHING; } 183 }; 184 } // namespace OHOS::Rosen 185 #endif // OHOS_WINDOW_SCENE_SESSION_STAGE_INTERFACE_H 186