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,
35 bool& isConsumed,
36 bool isPreImeEvent = false) override;
37 WSError TransferKeyEventForConsumedAsync(const std::shared_ptr<MMI::KeyEvent>& keyEvent,
38 bool isPreImeEvent,
39 const sptr<IRemoteObject>& listener) override;
40 WSError TransferFocusState(bool focusState) override;
41 WSError TransferBackpressedEventForConsumed(bool& isConsumed) override;
42 WSError TransferAccessibilityHoverEvent(float pointX,
43 float pointY,
44 int32_t sourceType,
45 int32_t eventType,
46 int64_t timeMs) override;
47 WSError TransferAccessibilityChildTreeRegister(uint32_t windowId, int32_t treeId, int64_t accessibilityId) override;
48 WSError TransferAccessibilityChildTreeUnregister() override;
49 WSError TransferAccessibilityDumpChildInfo(const std::vector<std::string>& params,
50 std::vector<std::string>& info) override;
51
AsObject()52 sptr<IRemoteObject> AsObject() override
53 {
54 return nullptr;
55 }
56 };
57
TransferKeyEvent(const std::shared_ptr<MMI::KeyEvent> & keyEvent)58 WSError TestWindowEventChannel::TransferKeyEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent)
59 {
60 return WSError::WS_OK;
61 }
62
TransferPointerEvent(const std::shared_ptr<MMI::PointerEvent> & pointerEvent)63 WSError TestWindowEventChannel::TransferPointerEvent(const std::shared_ptr<MMI::PointerEvent>& pointerEvent)
64 {
65 return WSError::WS_OK;
66 }
67
TransferFocusActiveEvent(bool isFocusActive)68 WSError TestWindowEventChannel::TransferFocusActiveEvent(bool isFocusActive)
69 {
70 return WSError::WS_OK;
71 }
72
TransferKeyEventForConsumed(const std::shared_ptr<MMI::KeyEvent> & keyEvent,bool & isConsumed,bool isPreImeEvent)73 WSError TestWindowEventChannel::TransferKeyEventForConsumed(const std::shared_ptr<MMI::KeyEvent>& keyEvent,
74 bool& isConsumed,
75 bool isPreImeEvent)
76 {
77 return WSError::WS_OK;
78 }
79
TransferKeyEventForConsumedAsync(const std::shared_ptr<MMI::KeyEvent> & keyEvent,bool isPreImeEvent,const sptr<IRemoteObject> & listener)80 WSError TestWindowEventChannel::TransferKeyEventForConsumedAsync(const std::shared_ptr<MMI::KeyEvent>& keyEvent,
81 bool isPreImeEvent,
82 const sptr<IRemoteObject>& listener)
83 {
84 return WSError::WS_OK;
85 }
86
TransferFocusState(bool foucsState)87 WSError TestWindowEventChannel::TransferFocusState(bool foucsState)
88 {
89 return WSError::WS_OK;
90 }
91
TransferBackpressedEventForConsumed(bool & isConsumed)92 WSError TestWindowEventChannel::TransferBackpressedEventForConsumed(bool& isConsumed)
93 {
94 return WSError::WS_OK;
95 }
96
TransferAccessibilityChildTreeRegister(uint32_t windowId,int32_t treeId,int64_t accessibilityId)97 WSError TestWindowEventChannel::TransferAccessibilityChildTreeRegister(uint32_t windowId,
98 int32_t treeId,
99 int64_t accessibilityId)
100 {
101 return WSError::WS_OK;
102 }
103
TransferAccessibilityChildTreeUnregister()104 WSError TestWindowEventChannel::TransferAccessibilityChildTreeUnregister()
105 {
106 return WSError::WS_OK;
107 }
108
TransferAccessibilityDumpChildInfo(const std::vector<std::string> & params,std::vector<std::string> & info)109 WSError TestWindowEventChannel::TransferAccessibilityDumpChildInfo(const std::vector<std::string>& params,
110 std::vector<std::string>& info)
111 {
112 return WSError::WS_OK;
113 }
114
TransferAccessibilityHoverEvent(float pointX,float pointY,int32_t sourceType,int32_t eventType,int64_t timeMs)115 WSError TestWindowEventChannel::TransferAccessibilityHoverEvent(float pointX,
116 float pointY,
117 int32_t sourceType,
118 int32_t eventType,
119 int64_t timeMs)
120 {
121 return WSError::WS_OK;
122 }
123 } // namespace Rosen
124 } // namespace OHOS
125 #endif // OHOS_ROSEN_WINDOW_EVENT_CHANNEL_BASE_H