1 /*
2  * Copyright (C) 2022 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 #include "nfc_event_handler.h"
16 
17 #include "ce_service.h"
18 #include "common_event_support.h"
19 #include "loghelper.h"
20 #include "nfc_service.h"
21 #include "nfc_polling_manager.h"
22 #include "nfc_routing_manager.h"
23 #include "want.h"
24 #include "screenlock_manager.h"
25 #include "power_mgr_client.h"
26 #include "nfc_watch_dog.h"
27 
28 #ifdef NDEF_WIFI_ENABLED
29 #include "wifi_connection_manager.h"
30 #endif
31 #ifdef NDEF_BT_ENABLED
32 #include "bt_connection_manager.h"
33 #endif
34 
35 namespace OHOS {
36 namespace NFC {
37 const std::string EVENT_DATA_SHARE_READY = "usual.event.DATA_SHARE_READY";
38 
39 class NfcEventHandler::ScreenChangedReceiver : public EventFwk::CommonEventSubscriber {
40 public:
41     explicit ScreenChangedReceiver(std::weak_ptr<NfcService> nfcService,
42         const EventFwk::CommonEventSubscribeInfo& subscribeInfo);
~ScreenChangedReceiver()43     ~ScreenChangedReceiver()
44     {
45     }
46     void OnReceiveEvent(const EventFwk::CommonEventData& data) override;
47 
48 private:
49     std::weak_ptr<NfcService> nfcService_ {};
50     std::weak_ptr<NfcEventHandler> eventHandler_ {};
51 };
52 
ScreenChangedReceiver(std::weak_ptr<NfcService> nfcService,const EventFwk::CommonEventSubscribeInfo & subscribeInfo)53 NfcEventHandler::ScreenChangedReceiver::ScreenChangedReceiver(std::weak_ptr<NfcService> nfcService,
54     const EventFwk::CommonEventSubscribeInfo& subscribeInfo)
55     : EventFwk::CommonEventSubscriber(subscribeInfo),
56     nfcService_(nfcService),
57     eventHandler_(nfcService.lock()->eventHandler_)
58 {
59 }
60 
IsScreenOn()61 bool NfcEventHandler::IsScreenOn()
62 {
63     return PowerMgr::PowerMgrClient::GetInstance().IsScreenOn();
64 }
65 
IsScreenLocked()66 bool NfcEventHandler::IsScreenLocked()
67 {
68     return OHOS::ScreenLock::ScreenLockManager::GetInstance()->IsScreenLocked();
69 }
70 
CheckScreenState()71 ScreenState NfcEventHandler::CheckScreenState()
72 {
73     bool isScreenOn = IsScreenOn();
74     bool isScreenLocked = IsScreenLocked();
75     if (isScreenOn && isScreenLocked) {
76         return ScreenState::SCREEN_STATE_ON_LOCKED;
77     } else if (!isScreenOn && !isScreenLocked) {
78         return ScreenState::SCREEN_STATE_OFF_UNLOCKED;
79     } else if (!isScreenOn && isScreenLocked) {
80         return ScreenState::SCREEN_STATE_OFF_LOCKED;
81     } else if (isScreenOn && !isScreenLocked) {
82         return ScreenState::SCREEN_STATE_ON_UNLOCKED;
83     }
84     return ScreenState::SCREEN_STATE_UNKNOWN;
85 }
86 
OnReceiveEvent(const EventFwk::CommonEventData & data)87 void NfcEventHandler::ScreenChangedReceiver::OnReceiveEvent(const EventFwk::CommonEventData& data)
88 {
89     std::string action = data.GetWant().GetAction();
90     if (action.empty()) {
91         ErrorLog("action is empty");
92         return;
93     }
94     InfoLog("OnScreenChanged: action: %{public}s", action.c_str());
95     ScreenState screenState = ScreenState::SCREEN_STATE_UNKNOWN;
96     if (action.compare(EventFwk::CommonEventSupport::COMMON_EVENT_SCREEN_ON) == 0) {
97         screenState = eventHandler_.lock()->IsScreenLocked() ?
98             ScreenState::SCREEN_STATE_ON_LOCKED : ScreenState::SCREEN_STATE_ON_UNLOCKED;
99     } else if (action.compare(EventFwk::CommonEventSupport::COMMON_EVENT_SCREEN_OFF) == 0) {
100         screenState = eventHandler_.lock()->IsScreenLocked() ?
101             ScreenState::SCREEN_STATE_OFF_LOCKED : ScreenState::SCREEN_STATE_OFF_UNLOCKED;
102     } else if (action.compare(EventFwk::CommonEventSupport::COMMON_EVENT_SCREEN_UNLOCKED) == 0) {
103         screenState = eventHandler_.lock()->IsScreenOn() ?
104             ScreenState::SCREEN_STATE_ON_UNLOCKED : ScreenState::SCREEN_STATE_OFF_UNLOCKED;
105     } else {
106         ErrorLog("Screen changed receiver event:unknown");
107         return;
108     }
109     eventHandler_.lock()->SendEvent(static_cast<uint32_t>(NfcCommonEvent::MSG_SCREEN_CHANGED),
110         static_cast<int64_t>(screenState), static_cast<int64_t>(0));
111 }
112 
113 class NfcEventHandler::PackageChangedReceiver : public EventFwk::CommonEventSubscriber {
114 public:
115     explicit PackageChangedReceiver(std::weak_ptr<NfcService> nfcService,
116         const EventFwk::CommonEventSubscribeInfo& subscribeInfo);
~PackageChangedReceiver()117     ~PackageChangedReceiver()
118     {
119     }
120     void OnReceiveEvent(const EventFwk::CommonEventData& data) override;
121 
122 private:
123     std::weak_ptr<NfcService> nfcService_ {};
124     std::weak_ptr<AppExecFwk::EventHandler> eventHandler_ {};
125 };
126 
PackageChangedReceiver(std::weak_ptr<NfcService> nfcService,const EventFwk::CommonEventSubscribeInfo & subscribeInfo)127 NfcEventHandler::PackageChangedReceiver::PackageChangedReceiver(std::weak_ptr<NfcService> nfcService,
128     const EventFwk::CommonEventSubscribeInfo& subscribeInfo)
129     : EventFwk::CommonEventSubscriber(subscribeInfo),
130     nfcService_(nfcService),
131     eventHandler_(nfcService.lock()->eventHandler_)
132 {
133 }
134 
OnReceiveEvent(const EventFwk::CommonEventData & data)135 void NfcEventHandler::PackageChangedReceiver::OnReceiveEvent(const EventFwk::CommonEventData& data)
136 {
137     DebugLog("NfcEventHandler::PackageChangedReceiver");
138     std::string action = data.GetWant().GetAction();
139     if (action.empty()) {
140         ErrorLog("action is empty");
141         return;
142     }
143     const std::shared_ptr<EventFwk::CommonEventData> mdata =
144         std::make_shared<EventFwk::CommonEventData> (data);
145     if (action.compare(EventFwk::CommonEventSupport::COMMON_EVENT_PACKAGE_ADDED) == 0 ||
146         action.compare(EventFwk::CommonEventSupport::COMMON_EVENT_PACKAGE_REMOVED) == 0 ||
147         action.compare(EventFwk::CommonEventSupport::COMMON_EVENT_PACKAGE_CHANGED) == 0) {
148         eventHandler_.lock()->SendEvent(static_cast<uint32_t>(NfcCommonEvent::MSG_PACKAGE_UPDATED),
149             mdata, static_cast<int64_t>(0));
150     }
151 }
152 
153 class NfcEventHandler::ShutdownEventReceiver : public EventFwk::CommonEventSubscriber {
154 public:
155     explicit ShutdownEventReceiver(std::weak_ptr<NfcService> nfcService,
156         const EventFwk::CommonEventSubscribeInfo& subscribeInfo);
~ShutdownEventReceiver()157     ~ShutdownEventReceiver()
158     {
159     }
160     void OnReceiveEvent(const EventFwk::CommonEventData& data) override;
161 
162 private:
163     std::weak_ptr<NfcService> nfcService_ {};
164     std::weak_ptr<AppExecFwk::EventHandler> eventHandler_ {};
165 };
166 
ShutdownEventReceiver(std::weak_ptr<NfcService> nfcService,const EventFwk::CommonEventSubscribeInfo & subscribeInfo)167 NfcEventHandler::ShutdownEventReceiver::ShutdownEventReceiver(std::weak_ptr<NfcService> nfcService,
168     const EventFwk::CommonEventSubscribeInfo& subscribeInfo)
169     : EventFwk::CommonEventSubscriber(subscribeInfo),
170     nfcService_(nfcService),
171     eventHandler_(nfcService.lock()->eventHandler_)
172 {
173 }
174 
OnReceiveEvent(const EventFwk::CommonEventData & data)175 void NfcEventHandler::ShutdownEventReceiver::OnReceiveEvent(const EventFwk::CommonEventData& data)
176 {
177     DebugLog("NfcEventHandler::ShutdownEventReceiver");
178     std::string action = data.GetWant().GetAction();
179     if (action.empty()) {
180         ErrorLog("action is empty");
181         return;
182     }
183     if (action.compare(EventFwk::CommonEventSupport::COMMON_EVENT_SHUTDOWN) == 0) {
184         eventHandler_.lock()->SendEvent(static_cast<uint32_t>(NfcCommonEvent::MSG_SHUTDOWN),
185                                         static_cast<int64_t>(0));
186     }
187 }
188 
189 class NfcEventHandler::DataShareChangedReceiver : public EventFwk::CommonEventSubscriber {
190 public:
191     explicit DataShareChangedReceiver(std::weak_ptr<NfcService> nfcService,
192         const EventFwk::CommonEventSubscribeInfo& subscribeInfo);
~DataShareChangedReceiver()193     ~DataShareChangedReceiver()
194     {
195     }
196     void OnReceiveEvent(const EventFwk::CommonEventData& data) override;
197 
198 private:
199     std::weak_ptr<NfcService> nfcService_ {};
200     std::weak_ptr<AppExecFwk::EventHandler> eventHandler_ {};
201 };
202 
DataShareChangedReceiver(std::weak_ptr<NfcService> nfcService,const EventFwk::CommonEventSubscribeInfo & subscribeInfo)203 NfcEventHandler::DataShareChangedReceiver::DataShareChangedReceiver(std::weak_ptr<NfcService> nfcService,
204     const EventFwk::CommonEventSubscribeInfo& subscribeInfo)
205     : EventFwk::CommonEventSubscriber(subscribeInfo),
206     nfcService_(nfcService),
207     eventHandler_(nfcService.lock()->eventHandler_)
208 {
209 }
210 
OnReceiveEvent(const EventFwk::CommonEventData & data)211 void NfcEventHandler::DataShareChangedReceiver::OnReceiveEvent(const EventFwk::CommonEventData& data)
212 {
213     DebugLog("NfcEventHandler::DataShareChangedReceiver");
214     std::string action = data.GetWant().GetAction();
215     if (action.empty()) {
216         ErrorLog("action is empty");
217         return;
218     }
219     InfoLog("DataShareChangedReceiver: action = %{public}s", action.c_str());
220     if (action.compare(EVENT_DATA_SHARE_READY) == 0 && !eventHandler_.expired()) {
221         eventHandler_.lock()->SendEvent(static_cast<uint32_t>(NfcCommonEvent::MSG_DATA_SHARE_READY),
222                                         static_cast<int64_t>(0));
223     }
224 }
225 
NfcEventHandler(const std::shared_ptr<AppExecFwk::EventRunner> & runner,std::weak_ptr<NfcService> service)226 NfcEventHandler::NfcEventHandler(const std::shared_ptr<AppExecFwk::EventRunner> &runner,
227                                  std::weak_ptr<NfcService> service)
228     : EventHandler(runner), nfcService_(service)
229 {
230 }
231 
~NfcEventHandler()232 NfcEventHandler::~NfcEventHandler()
233 {
234     EventFwk::CommonEventManager::UnSubscribeCommonEvent(screenSubscriber_);
235     EventFwk::CommonEventManager::UnSubscribeCommonEvent(pkgSubscriber_);
236     EventFwk::CommonEventManager::UnSubscribeCommonEvent(shutdownSubscriber_);
237     EventFwk::CommonEventManager::UnSubscribeCommonEvent(dataShareSubscriber_);
238 }
239 
Intialize(std::weak_ptr<TAG::TagDispatcher> tagDispatcher,std::weak_ptr<CeService> ceService,std::weak_ptr<NfcPollingManager> nfcPollingManager,std::weak_ptr<NfcRoutingManager> nfcRoutingManager,std::weak_ptr<NCI::INciNfccInterface> nciNfccProxy)240 void NfcEventHandler::Intialize(std::weak_ptr<TAG::TagDispatcher> tagDispatcher,
241                                 std::weak_ptr<CeService> ceService,
242                                 std::weak_ptr<NfcPollingManager> nfcPollingManager,
243                                 std::weak_ptr<NfcRoutingManager> nfcRoutingManager,
244                                 std::weak_ptr<NCI::INciNfccInterface> nciNfccProxy)
245 {
246     DebugLog("NfcEventHandler::Intialize");
247     tagDispatcher_ = tagDispatcher;
248     ceService_ = ceService;
249     nfcPollingManager_ = nfcPollingManager;
250     nfcRoutingManager_ = nfcRoutingManager;
251     nciNfccProxy_ = nciNfccProxy;
252 
253     SubscribeScreenChangedEvent();
254     SubscribePackageChangedEvent();
255     SubscribeShutdownEvent();
256     SubscribeDataShareChangedEvent();
257 }
258 
SubscribeScreenChangedEvent()259 void NfcEventHandler::SubscribeScreenChangedEvent()
260 {
261     std::lock_guard<std::mutex> guard(commonEventMutex_);
262     if (screenSubscriber_ != nullptr) {
263         InfoLog("Screen changed event is subscribed, skip");
264         return;
265     }
266     EventFwk::MatchingSkills matchingSkills;
267     matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_SCREEN_ON);
268     matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_SCREEN_OFF);
269     matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_SCREEN_UNLOCKED);
270     EventFwk::CommonEventSubscribeInfo subscribeInfo(matchingSkills);
271     screenSubscriber_ = std::make_shared<ScreenChangedReceiver>(nfcService_, subscribeInfo);
272     if (screenSubscriber_ == nullptr) {
273         ErrorLog("Create screen changed subscriber failed");
274         return;
275     }
276 
277     if (!EventFwk::CommonEventManager::SubscribeCommonEvent(screenSubscriber_)) {
278         ErrorLog("Subscribe screen changed event fail");
279     }
280 }
281 
SubscribePackageChangedEvent()282 void NfcEventHandler::SubscribePackageChangedEvent()
283 {
284     std::lock_guard<std::mutex> guard(commonEventMutex_);
285     if (pkgSubscriber_ != nullptr) {
286         InfoLog("Package changed subscriber is subscribed, skip");
287         return;
288     }
289     EventFwk::MatchingSkills matchingSkills;
290     matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_PACKAGE_ADDED);
291     matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_PACKAGE_REMOVED);
292     matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_PACKAGE_CHANGED);
293     EventFwk::CommonEventSubscribeInfo subscribeInfo(matchingSkills);
294     pkgSubscriber_ = std::make_shared<PackageChangedReceiver>(nfcService_, subscribeInfo);
295     if (pkgSubscriber_ == nullptr) {
296         ErrorLog("Create package changed subscriber failed");
297         return;
298     }
299 
300     if (!EventFwk::CommonEventManager::SubscribeCommonEvent(pkgSubscriber_)) {
301         ErrorLog("Subscribe package changed event fail");
302     }
303 }
304 
SubscribeShutdownEvent()305 void NfcEventHandler::SubscribeShutdownEvent()
306 {
307     std::lock_guard<std::mutex> guard(commonEventMutex_);
308     if (shutdownSubscriber_ != nullptr) {
309         InfoLog("Shutdown event is subscribed, skip");
310         return;
311     }
312     EventFwk::MatchingSkills matchingSkills;
313     matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_SHUTDOWN);
314     EventFwk::CommonEventSubscribeInfo subscribeInfo(matchingSkills);
315     shutdownSubscriber_ = std::make_shared<ShutdownEventReceiver>(nfcService_, subscribeInfo);
316     if (shutdownSubscriber_ == nullptr) {
317         ErrorLog("Create shutdown subscriber failed");
318         return;
319     }
320 
321     if (!EventFwk::CommonEventManager::SubscribeCommonEvent(shutdownSubscriber_)) {
322         ErrorLog("Subscribe shutdown event fail");
323     }
324 }
325 
SubscribeDataShareChangedEvent()326 void NfcEventHandler::SubscribeDataShareChangedEvent()
327 {
328     std::lock_guard<std::mutex> guard(commonEventMutex_);
329     if (dataShareSubscriber_ != nullptr) {
330         InfoLog("DataShare changed event is subscribed, skip");
331         return;
332     }
333     EventFwk::MatchingSkills matchingSkills;
334     matchingSkills.AddEvent(EVENT_DATA_SHARE_READY);
335     EventFwk::CommonEventSubscribeInfo subscribeInfo(matchingSkills);
336     dataShareSubscriber_ = std::make_shared<DataShareChangedReceiver>(nfcService_, subscribeInfo);
337     if (dataShareSubscriber_ == nullptr) {
338         ErrorLog("dataShareSubscriber_ failed");
339         return;
340     }
341 
342     if (!EventFwk::CommonEventManager::SubscribeCommonEvent(dataShareSubscriber_)) {
343         ErrorLog("Subscribe dataShareSubscriber_ fail");
344     }
345 }
346 
ProcessEvent(const AppExecFwk::InnerEvent::Pointer & event)347 void NfcEventHandler::ProcessEvent(const AppExecFwk::InnerEvent::Pointer& event)
348 {
349     if (event == nullptr) {
350         ErrorLog("event is nullptr");
351         return;
352     }
353     NfcCommonEvent eventId = static_cast<NfcCommonEvent>(event->GetInnerEventId());
354     if (eventId != NfcCommonEvent::MSG_NOTIFY_FIELD_OFF &&
355         eventId != NfcCommonEvent::MSG_NOTIFY_FIELD_ON) {
356         InfoLog("NFC common event handler receive a message of %{public}d", eventId);
357     }
358     NfcWatchDog nfcProcessEventDog("nfcProcessEvent", WAIT_PROCESS_EVENT_TIMES, nciNfccProxy_);
359     nfcProcessEventDog.Run();
360     switch (eventId) {
361         case NfcCommonEvent::MSG_TAG_FOUND:
362             tagDispatcher_.lock()->HandleTagFound(event->GetParam());
363             break;
364         case NfcCommonEvent::MSG_TAG_DEBOUNCE:
365             tagDispatcher_.lock()->HandleTagDebounce();
366             break;
367         case NfcCommonEvent::MSG_TAG_LOST:
368             tagDispatcher_.lock()->HandleTagLost(event->GetParam());
369             break;
370         case NfcCommonEvent::MSG_SCREEN_CHANGED: {
371             nfcPollingManager_.lock()->HandleScreenChanged(event->GetParam());
372             break;
373         }
374         case NfcCommonEvent::MSG_PACKAGE_UPDATED: {
375             bool updated = nfcPollingManager_.lock()->HandlePackageUpdated(
376                 event->GetSharedObject<EventFwk::CommonEventData>());
377             if (updated) {
378                 ceService_.lock()->OnAppAddOrChangeOrRemove(event->GetSharedObject<EventFwk::CommonEventData>());
379             }
380             break;
381         }
382         case NfcCommonEvent::MSG_COMMIT_ROUTING: {
383             nfcRoutingManager_.lock()->HandleCommitRouting();
384             break;
385         }
386         case NfcCommonEvent::MSG_COMPUTE_ROUTING_PARAMS: {
387             int defaultPaymentType = event->GetParam();
388             nfcRoutingManager_.lock()->HandleComputeRoutingParams(defaultPaymentType);
389             break;
390         }
391         case NfcCommonEvent::MSG_FIELD_ACTIVATED: {
392             ceService_.lock()->HandleFieldActivated();
393             break;
394         }
395         case NfcCommonEvent::MSG_FIELD_DEACTIVATED: {
396             ceService_.lock()->HandleFieldDeactivated();
397             break;
398         }
399         case NfcCommonEvent::MSG_NOTIFY_FIELD_ON: {
400             ceService_.lock()->PublishFieldOnOrOffCommonEvent(true);
401             break;
402         }
403         case NfcCommonEvent::MSG_NOTIFY_FIELD_OFF: {
404             ceService_.lock()->PublishFieldOnOrOffCommonEvent(false);
405             break;
406         }
407         case NfcCommonEvent::MSG_NOTIFY_FIELD_OFF_TIMEOUT: {
408             ceService_.lock()->PublishFieldOnOrOffCommonEvent(false);
409             break;
410         }
411         case NfcCommonEvent::MSG_SHUTDOWN: {
412             nfcService_.lock()->HandleShutdown();
413             break;
414         }
415         case NfcCommonEvent::MSG_DATA_SHARE_READY: {
416             ceService_.lock()->HandleDataShareReady();
417             break;
418         }
419 #ifdef VENDOR_APPLICATIONS_ENABLED
420         case NfcCommonEvent::MSG_VENDOR_EVENT: {
421             int eventType = event->GetParam();
422             if (eventType == KITS::VENDOR_APP_INIT_DONE || eventType == KITS::VENDOR_APP_CHANGE) {
423                 ceService_.lock()->ConfigRoutingAndCommit();
424             }
425             break;
426         }
427 #endif
428 #ifdef NDEF_WIFI_ENABLED
429         case NfcCommonEvent::MSG_WIFI_ENABLE_TIMEOUT: {
430             TAG::WifiConnectionManager::GetInstance().HandleWifiEnableFailed();
431             break;
432         }
433         case NfcCommonEvent::MSG_WIFI_CONNECT_TIMEOUT: {
434             TAG::WifiConnectionManager::GetInstance().HandleWifiConnectFailed();
435             break;
436         }
437         case NfcCommonEvent::MSG_WIFI_ENABLED: {
438             TAG::WifiConnectionManager::GetInstance().OnWifiEnabled();
439             break;
440         }
441         case NfcCommonEvent::MSG_WIFI_CONNECTED: {
442             TAG::WifiConnectionManager::GetInstance().OnWifiConnected();
443             break;
444         }
445         case NfcCommonEvent::MSG_WIFI_NTF_CLICKED: {
446             TAG::WifiConnectionManager::GetInstance().OnWifiNtfClicked();
447             break;
448         }
449 #endif
450 #ifdef NDEF_BT_ENABLED
451         case NfcCommonEvent::MSG_BT_ENABLE_TIMEOUT: {
452             TAG::BtConnectionManager::GetInstance().HandleBtEnableFailed();
453             break;
454         }
455         case NfcCommonEvent::MSG_BT_PAIR_TIMEOUT: {
456             TAG::BtConnectionManager::GetInstance().HandleBtPairFailed();
457             break;
458         }
459         case NfcCommonEvent::MSG_BT_CONNECT_TIMEOUT: {
460             TAG::BtConnectionManager::GetInstance().HandleBtConnectFailed();
461             break;
462         }
463         case NfcCommonEvent::MSG_BT_ENABLED: {
464             TAG::BtConnectionManager::GetInstance().OnBtEnabled();
465             break;
466         }
467         case NfcCommonEvent::MSG_BT_PAIR_STATUS_CHANGED: {
468             TAG::BtConnectionManager::GetInstance().OnPairStatusChanged(
469                 event->GetSharedObject<TAG::BtConnectionInfo>());
470             break;
471         }
472         case NfcCommonEvent::MSG_BT_CONNECT_STATUS_CHANGED: {
473             TAG::BtConnectionManager::GetInstance().OnConnectionStateChanged(
474                 event->GetSharedObject<TAG::BtConnectionInfo>());
475             break;
476         }
477         case NfcCommonEvent::MSG_BT_NTF_CLICKED: {
478             TAG::BtConnectionManager::GetInstance().OnBtNtfClicked();
479             break;
480         }
481 #endif
482         default:
483             ErrorLog("Unknown message received: id %{public}d", eventId);
484             break;
485     }
486     nfcProcessEventDog.Cancel();
487 }
488 }  // namespace NFC
489 }  // namespace OHOS
490