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 #ifndef NDEF_HAR_DISPATCH_H 16 #define NDEF_HAR_DISPATCH_H 17 18 #include <shared_mutex> 19 #include <string> 20 #include "app_data_parser.h" 21 #include "if_system_ability_manager.h" 22 #include "taginfo.h" 23 #include "inci_nfcc_interface.h" 24 #include "iremote_object.h" 25 #ifdef NFC_HANDLE_SCREEN_LOCK 26 #include "screenlock_manager.h" 27 #include "screenlock_common.h" 28 #include "screenlock_callback_stub.h" 29 #endif 30 namespace OHOS { 31 namespace NFC { 32 namespace TAG { 33 class NdefHarDispatch { 34 public: 35 NdefHarDispatch(std::weak_ptr<NCI::INciNfccInterface> nciNfccProxy); ~NdefHarDispatch()36 ~NdefHarDispatch() {} 37 bool DispatchBundleAbility(const std::string &harPackage, const std::shared_ptr<KITS::TagInfo> &tagInfo, 38 const std::string &mimeType, const std::string &uri, OHOS::sptr<IRemoteObject> tagServiceIface); 39 bool DispatchBundleExtensionAbility(const std::string &harPackage, const std::shared_ptr<KITS::TagInfo> &tagInfo, 40 const std::string &mimeType, const std::string &uri); 41 bool DispatchUriToBundleAbility(const std::string &uri); 42 bool DispatchMimeType(const std::string &type, const std::shared_ptr<KITS::TagInfo> &tagInfo); 43 bool DispatchByAppLinkMode(const std::string &uriSchemeValue, const std::shared_ptr<KITS::TagInfo> &tagInfo, 44 OHOS::sptr<IRemoteObject> tagServiceIface); 45 #ifdef NFC_HANDLE_SCREEN_LOCK 46 static void HandleCarrierReport(); 47 #endif 48 49 private: 50 static sptr<AppExecFwk::IBundleMgr> GetBundleMgrProxy(); 51 std::shared_mutex mutex_ {}; 52 std::weak_ptr<NCI::INciNfccInterface> nciNfccProxy_ {}; 53 }; 54 #ifdef NFC_HANDLE_SCREEN_LOCK 55 class NfcUnlockScreenCallback : public ScreenLock::ScreenLockCallbackStub { 56 public: 57 explicit NfcUnlockScreenCallback(); 58 ~NfcUnlockScreenCallback() override; 59 void OnCallBack(const int32_t screenLockResult) override; 60 }; 61 #endif 62 } // namespace TAG 63 } // namespace NFC 64 } // namespace OHOS 65 #endif // NDEF_HAR_DISPATCH_H