1 /*
2 * Copyright (c) 2024 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_EVENT_CHANNEL_BASE_H
17 #define OHOS_ROSEN_WINDOW_EVENT_CHANNEL_BASE_H
18
19 #include "common/include/session_permission.h"
20 #include "key_event.h"
21
22 #include "session/host/include/session.h"
23 #include "session/host/include/system_session.h"
24 #include <ui/rs_surface_node.h>
25 #include "window_helper.h"
26
27 namespace OHOS {
28 namespace Rosen {
29 class TestWindowEventChannel : public IWindowEventChannel {
30 public:
31 WSError TransferKeyEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent) override;
32 WSError TransferPointerEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent) override;
33 WSError TransferFocusActiveEvent(bool isFocusActive) override;
34 WSError TransferKeyEventForConsumed(const std::shared_ptr<MMI::KeyEvent>& keyEvent, bool& isConsumed,
35 bool isPreImeEvent = false) override;
36 WSError TransferKeyEventForConsumedAsync(const std::shared_ptr<MMI::KeyEvent>& keyEvent, bool isPreImeEvent,
37 const sptr<IRemoteObject>& listener) override;
38 WSError TransferFocusState(bool focusState) override;
39 WSError TransferBackpressedEventForConsumed(bool& isConsumed) override;
40 WSError TransferAccessibilityHoverEvent(float pointX, float pointY, int32_t sourceType, int32_t eventType,
41 int64_t timeMs) override;
42 WSError TransferAccessibilityChildTreeRegister(
43 uint32_t windowId, int32_t treeId, int64_t accessibilityId) override;
44 WSError TransferAccessibilityChildTreeUnregister() override;
45 WSError TransferAccessibilityDumpChildInfo(
46 const std::vector<std::string>& params, std::vector<std::string>& info) override;
47
AsObject()48 sptr<IRemoteObject> AsObject() override
49 {
50 return nullptr;
51 }
52 };
53
TransferKeyEvent(const std::shared_ptr<MMI::KeyEvent> & keyEvent)54 WSError TestWindowEventChannel::TransferKeyEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent)
55 {
56 return WSError::WS_OK;
57 }
58
TransferPointerEvent(const std::shared_ptr<MMI::PointerEvent> & pointerEvent)59 WSError TestWindowEventChannel::TransferPointerEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent)
60 {
61 return WSError::WS_OK;
62 }
63
TransferFocusActiveEvent(bool isFocusActive)64 WSError TestWindowEventChannel::TransferFocusActiveEvent(bool isFocusActive)
65 {
66 return WSError::WS_OK;
67 }
68
TransferKeyEventForConsumed(const std::shared_ptr<MMI::KeyEvent> & keyEvent,bool & isConsumed,bool isPreImeEvent)69 WSError TestWindowEventChannel::TransferKeyEventForConsumed(
70 const std::shared_ptr<MMI::KeyEvent>& keyEvent, bool& isConsumed, bool isPreImeEvent)
71 {
72 return WSError::WS_OK;
73 }
74
TransferKeyEventForConsumedAsync(const std::shared_ptr<MMI::KeyEvent> & keyEvent,bool isPreImeEvent,const sptr<IRemoteObject> & listener)75 WSError TestWindowEventChannel::TransferKeyEventForConsumedAsync(const std::shared_ptr<MMI::KeyEvent>& keyEvent,
76 bool isPreImeEvent, const sptr<IRemoteObject>& listener)
77 {
78 return WSError::WS_OK;
79 }
80
TransferFocusState(bool foucsState)81 WSError TestWindowEventChannel::TransferFocusState(bool foucsState)
82 {
83 return WSError::WS_OK;
84 }
85
TransferBackpressedEventForConsumed(bool & isConsumed)86 WSError TestWindowEventChannel::TransferBackpressedEventForConsumed(bool& isConsumed)
87 {
88 return WSError::WS_OK;
89 }
90
TransferAccessibilityChildTreeRegister(uint32_t windowId,int32_t treeId,int64_t accessibilityId)91 WSError TestWindowEventChannel::TransferAccessibilityChildTreeRegister(
92 uint32_t windowId, int32_t treeId, int64_t accessibilityId)
93 {
94 return WSError::WS_OK;
95 }
96
TransferAccessibilityChildTreeUnregister()97 WSError TestWindowEventChannel::TransferAccessibilityChildTreeUnregister()
98 {
99 return WSError::WS_OK;
100 }
101
TransferAccessibilityDumpChildInfo(const std::vector<std::string> & params,std::vector<std::string> & info)102 WSError TestWindowEventChannel::TransferAccessibilityDumpChildInfo(
103 const std::vector<std::string>& params, std::vector<std::string>& info)
104 {
105 return WSError::WS_OK;
106 }
107
TransferAccessibilityHoverEvent(float pointX,float pointY,int32_t sourceType,int32_t eventType,int64_t timeMs)108 WSError TestWindowEventChannel::TransferAccessibilityHoverEvent(float pointX, float pointY, int32_t sourceType,
109 int32_t eventType, int64_t timeMs)
110 {
111 return WSError::WS_OK;
112 }
113 } // namespace Rosen
114 } // namespace OHOS
115 #endif // OHOS_ROSEN_WINDOW_EVENT_CHANNEL_BASE_H