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 21 #include "interfaces/include/ws_common.h" 22 #include "occupied_area_change_info.h" 23 24 namespace OHOS::MMI { 25 class PointerEvent; 26 class KeyEvent; 27 class AxisEvent; 28 } // namespace MMI 29 30 namespace OHOS::Rosen { 31 class ISessionStage : public IRemoteBroker { 32 public: 33 DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.ISessionStage"); 34 35 enum class SessionStageMessage : uint32_t { 36 TRANS_ID_SET_ACTIVE, 37 TRANS_ID_NOTIFY_SIZE_CHANGE, 38 TRANS_ID_HANDLE_BACK_EVENT, 39 TRANS_ID_NOTIFY_FOCUS_CHANGE, 40 TRANS_ID_NOTIFY_DESTROY, 41 TRANS_ID_NOTIFY_TOUCH_DIALOG_TARGET, 42 TRANS_ID_NOTIFY_TRANSFER_COMPONENT_DATA, 43 TRANS_ID_NOTIFY_OCCUPIED_AREA_CHANGE_INFO, 44 TRANS_ID_UPDATE_AVOID_AREA, 45 TRANS_ID_NOTIFY_SCREEN_SHOT, 46 TRANS_ID_DUMP_SESSSION_ELEMENT_INFO, 47 TRANS_ID_NOTIFY_TOUCH_OUTSIDE, 48 TRANS_ID_NOTIFY_WINDOW_MODE_CHANGE 49 }; 50 NotifyPointerEvent(const std::shared_ptr<MMI::PointerEvent> & pointerEvent)51 virtual void NotifyPointerEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent) {} NotifyKeyEvent(const std::shared_ptr<MMI::KeyEvent> & keyEvent,bool & isConsumed)52 virtual void NotifyKeyEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent, bool& isConsumed) {} NotifyFocusActiveEvent(bool isFocusActive)53 virtual void NotifyFocusActiveEvent(bool isFocusActive) {} GetPersistentId()54 virtual int32_t GetPersistentId() const 55 { 56 return -1; 57 } NotifyFocusStateEvent(bool focusState)58 virtual void NotifyFocusStateEvent(bool focusState) {} NotifyTransferComponentData(const AAFwk::WantParams & wantParams)59 virtual WSError NotifyTransferComponentData(const AAFwk::WantParams& wantParams) 60 { 61 return WSError::WS_OK; 62 } 63 64 virtual WSError SetActive(bool active) = 0; 65 virtual WSError UpdateRect(const WSRect& rect, SizeChangeReason reason) = 0; 66 virtual WSError HandleBackEvent() = 0; 67 virtual WSError MarkProcessed(int32_t eventId) = 0; 68 virtual WSError UpdateFocus(bool isFocused) = 0; 69 virtual WSError NotifyDestroy() = 0; 70 virtual void NotifyTouchDialogTarget() = 0; 71 virtual void NotifyOccupiedAreaChangeInfo(sptr<OccupiedAreaChangeInfo> info) = 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 UpdateWindowMode(WindowMode mode) = 0; 77 }; 78 } // namespace OHOS::Rosen 79 #endif // OHOS_WINDOW_SCENE_SESSION_STAGE_INTERFACE_H 80