From 669b6414f78d71724e48b52153deed99f0f87c3c Mon Sep 17 00:00:00 2001 From: Axi_Beft Date: Mon, 28 Apr 2025 19:08:15 +0800 Subject: [PATCH 1/2] =?UTF-8?q?!2778=20=E4=BB=A3=E7=A0=81=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=20Merge=20pull=20request=20!2778=20from=20Wanxiaoqing?= =?UTF-8?q?/OpenHarmony-5.0.3-Release?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/test/udmf_run_time_store_test.cpp | 7 +++--- .../service/udmf/store/runtime_store.cpp | 2 +- .../service/udmf/udmf_service_impl.cpp | 23 +------------------ .../service/udmf/udmf_service_impl.h | 3 +-- .../service/udmf/udmf_service_stub.cpp | 22 ------------------ .../service/udmf/udmf_service_stub.h | 4 +--- 6 files changed, 7 insertions(+), 54 deletions(-) diff --git a/services/distributeddataservice/service/test/udmf_run_time_store_test.cpp b/services/distributeddataservice/service/test/udmf_run_time_store_test.cpp index 3a7ef0488..be8f3fce7 100644 --- a/services/distributeddataservice/service/test/udmf_run_time_store_test.cpp +++ b/services/distributeddataservice/service/test/udmf_run_time_store_test.cpp @@ -564,10 +564,9 @@ HWTEST_F(UdmfRunTimeStoreTest, GetSummary, TestSize.Level1) UnifiedData data; UDDetails details; details.insert({ "udmf_key", "udmf_value" }); - Text text; - text.SetDetails(details); - std::shared_ptr record1 = std::make_shared(text); - data.AddRecord(record1); + auto text = std::make_shared(); + text->SetDetails(details); + data.AddRecord(text); Summary summary; auto status = store->GetSummary(KEY_PREFIX, summary); diff --git a/services/distributeddataservice/service/udmf/store/runtime_store.cpp b/services/distributeddataservice/service/udmf/store/runtime_store.cpp index 62e852f82..095c0ca74 100644 --- a/services/distributeddataservice/service/udmf/store/runtime_store.cpp +++ b/services/distributeddataservice/service/udmf/store/runtime_store.cpp @@ -257,7 +257,7 @@ Status RuntimeStore::Sync(const std::vector &devices) } if (dbStatus != DBStatus::OK) { RadarReporterAdapter::ReportFail(std::string(__FUNCTION__), - BizScene::SYNC_DATA, SyncDataStage::SYNC_END, StageRes::FAILED, dbStatus, BizState::DFX_END); + BizScene::SYNC_DATA, SyncDataStage::SYNC_END, StageRes::FAILED, dbStatus); } else { RadarReporterAdapter::ReportNormal(std::string(__FUNCTION__), BizScene::SYNC_DATA, SyncDataStage::SYNC_END, StageRes::SUCCESS, BizState::DFX_END); diff --git a/services/distributeddataservice/service/udmf/udmf_service_impl.cpp b/services/distributeddataservice/service/udmf/udmf_service_impl.cpp index c394e85ce..75da80ecc 100644 --- a/services/distributeddataservice/service/udmf/udmf_service_impl.cpp +++ b/services/distributeddataservice/service/udmf/udmf_service_impl.cpp @@ -33,12 +33,11 @@ #include "uri.h" #include "udmf_conversion.h" #include "udmf_radar_reporter.h" -#include "device_manager_adapter.h" #include "utils/anonymous.h" #include "bootstrap.h" #include "metadata/store_meta_data.h" #include "metadata/meta_data_manager.h" -#include "udmf_dialog.h" +#include "device_manager_adapter.h" namespace OHOS { namespace UDMF { @@ -96,7 +95,6 @@ int32_t UdmfServiceImpl::SetData(CustomOption &option, UnifiedData &unifiedData, } auto errFind = ERROR_MAP.find(res); msg.result = errFind == ERROR_MAP.end() ? "E_ERROR" : errFind->second; - for (const auto &record : unifiedData.GetRecords()) { for (const auto &type : record->GetUtdIds()) { types.append("-").append(type); @@ -832,24 +830,5 @@ void UdmfServiceImpl::RegisterAsyncProcessInfo(const std::string &businessUdKey) asyncProcessInfoMap_.insert_or_assign(businessUdKey, std::move(info)); } -int32_t UdmfServiceImpl::InvokeHap(const std::string &progressKey, const sptr &observer) -{ - ProgressDialog::ProgressMessageInfo message; - message.promptText = "PromptText_PasteBoard_Local"; - message.remoteDeviceName = ""; - message.isRemote = false; - message.progressKey = progressKey; - message.clientCallback = observer; - - ProgressDialog::FocusedAppInfo appInfo = ProgressDialog::GetInstance().GetFocusedAppInfo(); - message.windowId = appInfo.windowId; - message.callerToken = appInfo.abilityToken; - auto status = ProgressDialog::GetInstance().ShowProgress(message); - if (status != E_OK) { - ZLOGE("ShowProgress fail, status:%{public}d", status); - } - return E_OK; -} - } // namespace UDMF } // namespace OHOS \ No newline at end of file diff --git a/services/distributeddataservice/service/udmf/udmf_service_impl.h b/services/distributeddataservice/service/udmf/udmf_service_impl.h index a499ef28d..4b6096f51 100644 --- a/services/distributeddataservice/service/udmf/udmf_service_impl.h +++ b/services/distributeddataservice/service/udmf/udmf_service_impl.h @@ -56,7 +56,6 @@ public: int32_t ObtainAsynProcess(AsyncProcessInfo &processInfo) override; int32_t ClearAsynProcessByKey(const std::string &businessUdKey) override; int32_t ResolveAutoLaunch(const std::string &identifier, DBLaunchParam ¶m) override; - int32_t InvokeHap(const std::string &progressKey, const sptr &observer) override; private: int32_t SaveData(CustomOption &option, UnifiedData &unifiedData, std::string &key); int32_t RetrieveData(const QueryOption &query, UnifiedData &unifiedData); @@ -64,10 +63,10 @@ private: int32_t ProcessUri(const QueryOption &query, UnifiedData &unifiedData); bool IsPermissionInCache(const QueryOption &query); bool IsReadAndKeep(const std::vector &privileges, const QueryOption &query); - int32_t ProcessCrossDeviceData(UnifiedData &unifiedData, std::vector &uris); bool VerifyPermission(const std::string &permission, uint32_t callerTokenId); bool HasDatahubPriviledge(const std::string &bundleName); void RegisterAsyncProcessInfo(const std::string &businessUdKey); + int32_t ProcessCrossDeviceData(UnifiedData &unifiedData, std::vector &uris); class Factory { public: diff --git a/services/distributeddataservice/service/udmf/udmf_service_stub.cpp b/services/distributeddataservice/service/udmf/udmf_service_stub.cpp index 32651fa73..553d770e3 100644 --- a/services/distributeddataservice/service/udmf/udmf_service_stub.cpp +++ b/services/distributeddataservice/service/udmf/udmf_service_stub.cpp @@ -297,27 +297,5 @@ int32_t UdmfServiceStub::OnClearAsynProcessByKey(MessageParcel &data, MessagePar } return E_OK; } - -int32_t UdmfServiceStub::OnInvokeHap(MessageParcel &data, MessageParcel &reply) -{ - ZLOGD("start"); - std::string progressKey; - sptr callback = nullptr; - if (!ITypesUtil::Unmarshal(data, progressKey, callback)) { - ZLOGE("Unmarshal failed"); - return E_READ_PARCEL_ERROR; - } - if (callback == nullptr) { - ZLOGE("Callback is null"); - return E_ERROR; - } - int32_t status = InvokeHap(progressKey, callback); - if (!ITypesUtil::Marshal(reply, status)) { - ZLOGE("Marshal status failed, status: %{public}d", status); - return E_WRITE_PARCEL_ERROR; - } - return E_OK; -} - } // namespace UDMF } // namespace OHOS \ No newline at end of file diff --git a/services/distributeddataservice/service/udmf/udmf_service_stub.h b/services/distributeddataservice/service/udmf/udmf_service_stub.h index fddcaba3d..b027b1184 100644 --- a/services/distributeddataservice/service/udmf/udmf_service_stub.h +++ b/services/distributeddataservice/service/udmf/udmf_service_stub.h @@ -50,7 +50,6 @@ private: int32_t OnRemoveAppShareOption(MessageParcel &data, MessageParcel &reply); int32_t OnObtainAsynProcess(MessageParcel &data, MessageParcel &reply); int32_t OnClearAsynProcessByKey(MessageParcel &data, MessageParcel &reply); - int32_t OnInvokeHap(MessageParcel &data, MessageParcel &reply); using Handler = int32_t (UdmfServiceStub::*)(MessageParcel &data, MessageParcel &reply); static constexpr Handler HANDLERS[static_cast(UdmfServiceInterfaceCode::CODE_BUTT)] = { @@ -67,8 +66,7 @@ private: &UdmfServiceStub::OnGetAppShareOption, &UdmfServiceStub::OnRemoveAppShareOption, &UdmfServiceStub::OnObtainAsynProcess, - &UdmfServiceStub::OnClearAsynProcessByKey, - &UdmfServiceStub::OnInvokeHap + &UdmfServiceStub::OnClearAsynProcessByKey }; }; } // namespace UDMF -- Gitee From a645bff5dcfab8b7d20940753a3a111891c27581 Mon Sep 17 00:00:00 2001 From: Axi_Beft Date: Mon, 28 Apr 2025 19:16:11 +0800 Subject: [PATCH 2/2] data_share add qos Signed-off-by: Axi_Beft --- bundle.json | 1 + .../app/src/kvstore_data_service.cpp | 1 + .../service/data_share/BUILD.gn | 2 ++ .../data_share/data_share_service_impl.cpp | 29 +++++++++++++++---- .../data_share/data_share_service_impl.h | 1 + .../data_share/data_share_service_stub.cpp | 24 ++++++++++++++- .../data_share/data_share_service_stub.h | 1 + .../service/test/BUILD.gn | 2 ++ .../datashareservicestub_fuzzer/BUILD.gn | 2 ++ .../service/test/udmf_run_time_store_test.cpp | 7 +++-- .../service/udmf/store/runtime_store.cpp | 2 +- .../service/udmf/udmf_service_impl.cpp | 22 +++++++++++++- .../service/udmf/udmf_service_impl.h | 3 +- .../service/udmf/udmf_service_stub.cpp | 22 ++++++++++++++ .../service/udmf/udmf_service_stub.h | 4 ++- 15 files changed, 110 insertions(+), 13 deletions(-) diff --git a/bundle.json b/bundle.json index a8a25194b..55196f9c9 100644 --- a/bundle.json +++ b/bundle.json @@ -75,6 +75,7 @@ "napi", "netmanager_base", "os_account", + "qos_manager", "relational_store", "resource_management", "safwk", diff --git a/services/distributeddataservice/app/src/kvstore_data_service.cpp b/services/distributeddataservice/app/src/kvstore_data_service.cpp index e3a753dd8..dbf749a14 100644 --- a/services/distributeddataservice/app/src/kvstore_data_service.cpp +++ b/services/distributeddataservice/app/src/kvstore_data_service.cpp @@ -296,6 +296,7 @@ void KvStoreDataService::OnStart() } AddSystemAbilityListener(COMMON_EVENT_SERVICE_ID); AddSystemAbilityListener(MEMORY_MANAGER_SA_ID); + AddSystemAbilityListener(CONCURREN_TASK_SERVICE_ID); RegisterStoreInfo(); Handler handlerStoreInfo = std::bind(&KvStoreDataService::DumpStoreInfo, this, std::placeholders::_1, std::placeholders::_2); diff --git a/services/distributeddataservice/service/data_share/BUILD.gn b/services/distributeddataservice/service/data_share/BUILD.gn index 17b71aaba..2aadc92be 100644 --- a/services/distributeddataservice/service/data_share/BUILD.gn +++ b/services/distributeddataservice/service/data_share/BUILD.gn @@ -127,6 +127,8 @@ ohos_shared_library("data_share_service") { "ipc:ipc_core", "json:nlohmann_json_static", "kv_store:distributeddb", + "qos_manager:concurrent_task_client", + "qos_manager:qos", "relational_store:native_rdb", "relational_store:rdb_data_share_adapter", "resource_management:global_resmgr", diff --git a/services/distributeddataservice/service/data_share/data_share_service_impl.cpp b/services/distributeddataservice/service/data_share/data_share_service_impl.cpp index 54c7504ac..4bc9f24cc 100644 --- a/services/distributeddataservice/service/data_share/data_share_service_impl.cpp +++ b/services/distributeddataservice/service/data_share/data_share_service_impl.cpp @@ -25,6 +25,7 @@ #include "app_connect_manager.h" #include "common_event_manager.h" #include "common_event_support.h" +#include "concurrent_task_client.h" #include "data_ability_observer_interface.h" #include "data_share_profile_config.h" #include "dataobs_mgr_client.h" @@ -80,11 +81,17 @@ public: void DataShareServiceImpl::SystemAbilityStatusChangeListener::OnAddSystemAbility( int32_t systemAbilityId, const std::string &deviceId) { - if (systemAbilityId != COMMON_EVENT_SERVICE_ID) { - return; - } - ZLOGI("Common event service start. saId:%{public}d", systemAbilityId); - InitSubEvent(); + ZLOGI("saId:%{public}d", systemAbilityId); + if (systemAbilityId == COMMON_EVENT_SERVICE_ID) { + InitSubEvent(); + } else if (systemAbilityId == CONCURRENT_TASK_SERVICE_ID) { + std::unordered_map payload; + // get current thread pid + payload["pid"] = std::to_string(getpid()); + // request qos auth for current pid + OHOS::ConcurrentTask::ConcurrentTaskClient::GetInstance().RequestAuth(payload); + } + return; } DataShareServiceImpl::Factory::Factory() @@ -625,6 +632,7 @@ int32_t DataShareServiceImpl::OnBind(const BindInfo &binderInfo) DBDelegate::SetExecutorPool(binderInfo.executors); HiViewAdapter::GetInstance().SetThreadPool(binderInfo.executors); SubscribeCommonEvent(); + SubscribeConcurrentTask(); SubscribeTimeChanged(); SubscribeChange(); ZLOGI("end"); @@ -642,6 +650,17 @@ void DataShareServiceImpl::SubscribeCommonEvent() systemManager->SubscribeSystemAbility(COMMON_EVENT_SERVICE_ID, callback); } +void DataShareServiceImpl::SubscribeConcurrentTask() +{ + sptr systemManager = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); + if (systemManager == nullptr) { + ZLOGE("System mgr is nullptr"); + return; + } + sptr callback(new SystemAbilityStatusChangeListener()); + systemManager->SubscribeSystemAbility(CONCURRENT_TASK_SERVICE_ID, callback); +} + void DataShareServiceImpl::SubscribeChange() { EventCenter::GetInstance().Subscribe(RemoteChangeEvent::RDB_META_SAVE, [this](const Event &event) { diff --git a/services/distributeddataservice/service/data_share/data_share_service_impl.h b/services/distributeddataservice/service/data_share/data_share_service_impl.h index 0282591b3..8bba804e1 100644 --- a/services/distributeddataservice/service/data_share/data_share_service_impl.h +++ b/services/distributeddataservice/service/data_share/data_share_service_impl.h @@ -130,6 +130,7 @@ private: bool isRead, ExecuteCallbackEx callback); int32_t GetBMSAndMetaDataStatus(const std::string &uri, const int32_t tokenId); void SubscribeCommonEvent(); + void SubscribeConcurrentTask(); static void InitSubEvent(); void AutoLaunch(const DistributedData::Event &event); void SubscribeChange(); diff --git a/services/distributeddataservice/service/data_share/data_share_service_stub.cpp b/services/distributeddataservice/service/data_share/data_share_service_stub.cpp index cf353dcde..f9e30e806 100644 --- a/services/distributeddataservice/service/data_share/data_share_service_stub.cpp +++ b/services/distributeddataservice/service/data_share/data_share_service_stub.cpp @@ -25,10 +25,25 @@ #include "ishared_result_set.h" #include "itypes_util.h" #include "log_print.h" +#include "qos.h" #include "utils/anonymous.h" namespace OHOS { namespace DataShare { + +class DataShareServiceStub::QosManager { +public: + QosManager() + { + // set thread qos QOS_USER_INTERACTIVE + QOS::SetThreadQos(QOS::QosLevel::QOS_USER_INTERACTIVE); + } + ~QosManager() + { + QOS::ResetThreadQos(); + } +}; + bool DataShareServiceStub::CheckInterfaceToken(MessageParcel &data) { auto localDescriptor = IDataShareService::GetDescriptor(); @@ -378,6 +393,12 @@ int32_t DataShareServiceStub::OnNotifyConnectDone(MessageParcel &data, MessagePa int DataShareServiceStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply) { + // set thread qos + DataShareServiceStub::QosManager qos; + // check thread qos + QOS::QosLevel curLevel; + int qosRet = QOS::GetThreadQos(curLevel); + int tryTimes = TRY_TIMES; while (!isReady_.load() && tryTimes > 0) { tryTimes--; @@ -385,7 +406,8 @@ int DataShareServiceStub::OnRemoteRequest(uint32_t code, MessageParcel &data, Me } auto callingPid = IPCSkeleton::GetCallingPid(); if (code != DATA_SHARE_SERVICE_CMD_QUERY && code != DATA_SHARE_SERVICE_CMD_GET_SILENT_PROXY_STATUS) { - ZLOGI("code:%{public}u, callingPid:%{public}d", code, callingPid); + ZLOGI("code:%{public}u, callingPid:%{public}d, qosRet:%{public}d, curLevel:%{public}d", + code, callingPid, qosRet, curLevel); } if (!CheckInterfaceToken(data)) { return DATA_SHARE_ERROR; diff --git a/services/distributeddataservice/service/data_share/data_share_service_stub.h b/services/distributeddataservice/service/data_share/data_share_service_stub.h index 3a92d14b1..71499d1fa 100644 --- a/services/distributeddataservice/service/data_share/data_share_service_stub.h +++ b/services/distributeddataservice/service/data_share/data_share_service_stub.h @@ -27,6 +27,7 @@ public: void SetServiceReady(); private: + class QosManager; static constexpr std::chrono::milliseconds TIME_THRESHOLD = std::chrono::milliseconds(500); static bool CheckInterfaceToken(MessageParcel& data); int32_t OnInsert(MessageParcel& data, MessageParcel& reply); diff --git a/services/distributeddataservice/service/test/BUILD.gn b/services/distributeddataservice/service/test/BUILD.gn index 1168f3153..d2f289a0f 100644 --- a/services/distributeddataservice/service/test/BUILD.gn +++ b/services/distributeddataservice/service/test/BUILD.gn @@ -930,6 +930,8 @@ ohos_unittest("DataShareServiceImplTest") { "huks:libhukssdk", "ipc:ipc_core", "kv_store:distributeddb", + "qos_manager:concurrent_task_client", + "qos_manager:qos", "relational_store:native_rdb", "relational_store:rdb_data_share_adapter", "resource_management:global_resmgr", diff --git a/services/distributeddataservice/service/test/fuzztest/datashareservicestub_fuzzer/BUILD.gn b/services/distributeddataservice/service/test/fuzztest/datashareservicestub_fuzzer/BUILD.gn index 32424a728..8858be69c 100644 --- a/services/distributeddataservice/service/test/fuzztest/datashareservicestub_fuzzer/BUILD.gn +++ b/services/distributeddataservice/service/test/fuzztest/datashareservicestub_fuzzer/BUILD.gn @@ -127,6 +127,8 @@ ohos_fuzztest("DataShareServiceStubFuzzTest") { "huks:libhukssdk", "ipc:ipc_core", "kv_store:distributeddb", + "qos_manager:concurrent_task_client", + "qos_manager:qos", "relational_store:native_rdb", "relational_store:rdb_data_share_adapter", "resource_management:global_resmgr", diff --git a/services/distributeddataservice/service/test/udmf_run_time_store_test.cpp b/services/distributeddataservice/service/test/udmf_run_time_store_test.cpp index be8f3fce7..3a7ef0488 100644 --- a/services/distributeddataservice/service/test/udmf_run_time_store_test.cpp +++ b/services/distributeddataservice/service/test/udmf_run_time_store_test.cpp @@ -564,9 +564,10 @@ HWTEST_F(UdmfRunTimeStoreTest, GetSummary, TestSize.Level1) UnifiedData data; UDDetails details; details.insert({ "udmf_key", "udmf_value" }); - auto text = std::make_shared(); - text->SetDetails(details); - data.AddRecord(text); + Text text; + text.SetDetails(details); + std::shared_ptr record1 = std::make_shared(text); + data.AddRecord(record1); Summary summary; auto status = store->GetSummary(KEY_PREFIX, summary); diff --git a/services/distributeddataservice/service/udmf/store/runtime_store.cpp b/services/distributeddataservice/service/udmf/store/runtime_store.cpp index 095c0ca74..62e852f82 100644 --- a/services/distributeddataservice/service/udmf/store/runtime_store.cpp +++ b/services/distributeddataservice/service/udmf/store/runtime_store.cpp @@ -257,7 +257,7 @@ Status RuntimeStore::Sync(const std::vector &devices) } if (dbStatus != DBStatus::OK) { RadarReporterAdapter::ReportFail(std::string(__FUNCTION__), - BizScene::SYNC_DATA, SyncDataStage::SYNC_END, StageRes::FAILED, dbStatus); + BizScene::SYNC_DATA, SyncDataStage::SYNC_END, StageRes::FAILED, dbStatus, BizState::DFX_END); } else { RadarReporterAdapter::ReportNormal(std::string(__FUNCTION__), BizScene::SYNC_DATA, SyncDataStage::SYNC_END, StageRes::SUCCESS, BizState::DFX_END); diff --git a/services/distributeddataservice/service/udmf/udmf_service_impl.cpp b/services/distributeddataservice/service/udmf/udmf_service_impl.cpp index 75da80ecc..c58e86c6f 100644 --- a/services/distributeddataservice/service/udmf/udmf_service_impl.cpp +++ b/services/distributeddataservice/service/udmf/udmf_service_impl.cpp @@ -33,11 +33,12 @@ #include "uri.h" #include "udmf_conversion.h" #include "udmf_radar_reporter.h" +#include "device_manager_adapter.h" #include "utils/anonymous.h" #include "bootstrap.h" #include "metadata/store_meta_data.h" #include "metadata/meta_data_manager.h" -#include "device_manager_adapter.h" +#include "udmf_dialog.h" namespace OHOS { namespace UDMF { @@ -830,5 +831,24 @@ void UdmfServiceImpl::RegisterAsyncProcessInfo(const std::string &businessUdKey) asyncProcessInfoMap_.insert_or_assign(businessUdKey, std::move(info)); } +int32_t UdmfServiceImpl::InvokeHap(const std::string &progressKey, const sptr &observer) +{ + ProgressDialog::ProgressMessageInfo message; + message.promptText = "PromptText_PasteBoard_Local"; + message.remoteDeviceName = ""; + message.isRemote = false; + message.progressKey = progressKey; + message.clientCallback = observer; + + ProgressDialog::FocusedAppInfo appInfo = ProgressDialog::GetInstance().GetFocusedAppInfo(); + message.windowId = appInfo.windowId; + message.callerToken = appInfo.abilityToken; + auto status = ProgressDialog::GetInstance().ShowProgress(message); + if (status != E_OK) { + ZLOGE("ShowProgress fail, status:%{public}d", status); + } + return E_OK; +} + } // namespace UDMF } // namespace OHOS \ No newline at end of file diff --git a/services/distributeddataservice/service/udmf/udmf_service_impl.h b/services/distributeddataservice/service/udmf/udmf_service_impl.h index 4b6096f51..a499ef28d 100644 --- a/services/distributeddataservice/service/udmf/udmf_service_impl.h +++ b/services/distributeddataservice/service/udmf/udmf_service_impl.h @@ -56,6 +56,7 @@ public: int32_t ObtainAsynProcess(AsyncProcessInfo &processInfo) override; int32_t ClearAsynProcessByKey(const std::string &businessUdKey) override; int32_t ResolveAutoLaunch(const std::string &identifier, DBLaunchParam ¶m) override; + int32_t InvokeHap(const std::string &progressKey, const sptr &observer) override; private: int32_t SaveData(CustomOption &option, UnifiedData &unifiedData, std::string &key); int32_t RetrieveData(const QueryOption &query, UnifiedData &unifiedData); @@ -63,10 +64,10 @@ private: int32_t ProcessUri(const QueryOption &query, UnifiedData &unifiedData); bool IsPermissionInCache(const QueryOption &query); bool IsReadAndKeep(const std::vector &privileges, const QueryOption &query); + int32_t ProcessCrossDeviceData(UnifiedData &unifiedData, std::vector &uris); bool VerifyPermission(const std::string &permission, uint32_t callerTokenId); bool HasDatahubPriviledge(const std::string &bundleName); void RegisterAsyncProcessInfo(const std::string &businessUdKey); - int32_t ProcessCrossDeviceData(UnifiedData &unifiedData, std::vector &uris); class Factory { public: diff --git a/services/distributeddataservice/service/udmf/udmf_service_stub.cpp b/services/distributeddataservice/service/udmf/udmf_service_stub.cpp index 553d770e3..32651fa73 100644 --- a/services/distributeddataservice/service/udmf/udmf_service_stub.cpp +++ b/services/distributeddataservice/service/udmf/udmf_service_stub.cpp @@ -297,5 +297,27 @@ int32_t UdmfServiceStub::OnClearAsynProcessByKey(MessageParcel &data, MessagePar } return E_OK; } + +int32_t UdmfServiceStub::OnInvokeHap(MessageParcel &data, MessageParcel &reply) +{ + ZLOGD("start"); + std::string progressKey; + sptr callback = nullptr; + if (!ITypesUtil::Unmarshal(data, progressKey, callback)) { + ZLOGE("Unmarshal failed"); + return E_READ_PARCEL_ERROR; + } + if (callback == nullptr) { + ZLOGE("Callback is null"); + return E_ERROR; + } + int32_t status = InvokeHap(progressKey, callback); + if (!ITypesUtil::Marshal(reply, status)) { + ZLOGE("Marshal status failed, status: %{public}d", status); + return E_WRITE_PARCEL_ERROR; + } + return E_OK; +} + } // namespace UDMF } // namespace OHOS \ No newline at end of file diff --git a/services/distributeddataservice/service/udmf/udmf_service_stub.h b/services/distributeddataservice/service/udmf/udmf_service_stub.h index b027b1184..fddcaba3d 100644 --- a/services/distributeddataservice/service/udmf/udmf_service_stub.h +++ b/services/distributeddataservice/service/udmf/udmf_service_stub.h @@ -50,6 +50,7 @@ private: int32_t OnRemoveAppShareOption(MessageParcel &data, MessageParcel &reply); int32_t OnObtainAsynProcess(MessageParcel &data, MessageParcel &reply); int32_t OnClearAsynProcessByKey(MessageParcel &data, MessageParcel &reply); + int32_t OnInvokeHap(MessageParcel &data, MessageParcel &reply); using Handler = int32_t (UdmfServiceStub::*)(MessageParcel &data, MessageParcel &reply); static constexpr Handler HANDLERS[static_cast(UdmfServiceInterfaceCode::CODE_BUTT)] = { @@ -66,7 +67,8 @@ private: &UdmfServiceStub::OnGetAppShareOption, &UdmfServiceStub::OnRemoveAppShareOption, &UdmfServiceStub::OnObtainAsynProcess, - &UdmfServiceStub::OnClearAsynProcessByKey + &UdmfServiceStub::OnClearAsynProcessByKey, + &UdmfServiceStub::OnInvokeHap }; }; } // namespace UDMF -- Gitee