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 #include "core/common/stylus/stylus_detector_mgr.h"
17 
18 namespace OHOS::Ace {
RequestFocus(int32_t nodeId, RefPtr<TaskExecutor> taskScheduler)19 int32_t StylusDetectorMgr::StylusDetectorCallBack::RequestFocus(int32_t nodeId, RefPtr<TaskExecutor> taskScheduler)
20 {
21     return 0;
22 }
23 
SetText(int32_t nodeId, void* data, RefPtr<TaskExecutor> taskScheduler, std::shared_ptr<IAceStylusCallback> callback)24 int32_t StylusDetectorMgr::StylusDetectorCallBack::SetText(int32_t nodeId, void* data,
25     RefPtr<TaskExecutor> taskScheduler, std::shared_ptr<IAceStylusCallback> callback)
26 {
27     return 0;
28 }
29 
GetText(int32_t nodeId, RefPtr<TaskExecutor> taskScheduler, std::shared_ptr<IAceStylusCallback> callback)30 int32_t StylusDetectorMgr::StylusDetectorCallBack::GetText(int32_t nodeId, RefPtr<TaskExecutor> taskScheduler,
31     std::shared_ptr<IAceStylusCallback> callback)
32 {
33     return 0;
34 }
35 
OnDetector( const CommandType& command, void* data, std::shared_ptr<IAceStylusCallback> callback)36 int32_t StylusDetectorMgr::StylusDetectorCallBack::OnDetector(
37     const CommandType& command, void* data, std::shared_ptr<IAceStylusCallback> callback)
38 {
39     return 0;
40 }
41 
OnDetectorSync(const CommandType& command)42 bool StylusDetectorMgr::StylusDetectorCallBack::OnDetectorSync(const CommandType& command)
43 {
44     return false;
45 }
46 
GetInstance()47 StylusDetectorMgr* StylusDetectorMgr::GetInstance()
48 {
49     static StylusDetectorMgr instance;
50     return &instance;
51 }
52 
IsEnable()53 bool StylusDetectorMgr::IsEnable()
54 {
55     return false;
56 }
57 
RegisterStylusInteractionListener( const std::string& bundleName, const std::shared_ptr<IStylusDetectorCallback>& callback)58 bool StylusDetectorMgr::RegisterStylusInteractionListener(
59     const std::string& bundleName, const std::shared_ptr<IStylusDetectorCallback>& callback)
60 {
61     isRegistered_ = true;
62     return false;
63 }
UnRegisterStylusInteractionListener(const std::string& bundleName)64 void StylusDetectorMgr::UnRegisterStylusInteractionListener(const std::string& bundleName) {}
65 
Notify(const NotifyInfo& notifyInfo)66 bool StylusDetectorMgr::Notify(const NotifyInfo& notifyInfo)
67 {
68     return false;
69 }
70 
FindHitFrameNode( const TouchEvent& touchEvent, const TouchTestResult& touchTestResult)71 RefPtr<NG::FrameNode> StylusDetectorMgr::FindHitFrameNode(
72     const TouchEvent& touchEvent, const TouchTestResult& touchTestResult)
73 {
74     return nullptr;
75 }
76 
IsNeedInterceptedTouchEvent( const TouchEvent& touchEvent, std::unordered_map<size_t, TouchTestResult> touchTestResults)77 bool StylusDetectorMgr::IsNeedInterceptedTouchEvent(
78     const TouchEvent& touchEvent, std::unordered_map<size_t, TouchTestResult> touchTestResults)
79 {
80     return false;
81 }
82 
AddTextFieldFrameNode(const RefPtr<NG::FrameNode>& frameNode, const WeakPtr<NG::LayoutInfoInterface>& layoutInfo)83 void StylusDetectorMgr::AddTextFieldFrameNode(const RefPtr<NG::FrameNode>& frameNode,
84     const WeakPtr<NG::LayoutInfoInterface>& layoutInfo) {}
RemoveTextFieldFrameNode(const int32_t id)85 void StylusDetectorMgr::RemoveTextFieldFrameNode(const int32_t id) {}
86 
StylusDetectorMgr()87 StylusDetectorMgr::StylusDetectorMgr() : engine_(nullptr), isRegistered_(false) {}
88 
IsStylusTouchEvent(const TouchEvent& touchEvent) const89 bool StylusDetectorMgr::IsStylusTouchEvent(const TouchEvent& touchEvent) const
90 {
91     return false;
92 }
93 
IsHitCleanNodeResponseArea( const NG::PointF& point, const RefPtr<NG::FrameNode>& frameNode, uint64_t nanoTimestamp)94 bool StylusDetectorMgr::IsHitCleanNodeResponseArea(
95     const NG::PointF& point, const RefPtr<NG::FrameNode>& frameNode, uint64_t nanoTimestamp)
96 {
97     return false;
98 }
99 } // namespace OHOS::Ace