From 97f6f761300c5304eedc3d806cbff0858f43d108 Mon Sep 17 00:00:00 2001 From: Sven Wang Date: Thu, 23 Sep 2021 16:05:41 +0800 Subject: [PATCH] https://gitee.com/openharmony/distributeddatamgr_appdatamgr/issues/I4BHJY add ipc call to AbsSharedResultSet Signed-off-by: Sven Wang --- .../aafwk/featureAbility/napi_data_ability_helper.cpp | 8 +------- services/abilitymgr/src/ability_scheduler_proxy.cpp | 8 ++------ services/abilitymgr/src/ability_scheduler_stub.cpp | 6 ++++-- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/interfaces/kits/napi/aafwk/featureAbility/napi_data_ability_helper.cpp b/interfaces/kits/napi/aafwk/featureAbility/napi_data_ability_helper.cpp index dd9bbfdf275..5adba9890cb 100644 --- a/interfaces/kits/napi/aafwk/featureAbility/napi_data_ability_helper.cpp +++ b/interfaces/kits/napi/aafwk/featureAbility/napi_data_ability_helper.cpp @@ -2784,18 +2784,12 @@ void QueryAsyncCompleteCB(napi_env env, napi_status status, void *data) napi_value WrapResultSet(napi_env env, const std::shared_ptr &resultSet) { HILOG_INFO("%{public}s,called", __func__); - MessageParcel tempparcel; if (resultSet == nullptr) { HILOG_ERROR("%{public}s, input parameter resultSet is nullptr", __func__); return nullptr; } - if (!resultSet->Marshalling(tempparcel)) { - HILOG_ERROR("%{public}s, tempparcel.WriteParcelable(resultSet) retval false", __func__); - return nullptr; - } - - return RdbJsKit::ResultSetProxy::NewInstance(env, std::make_unique(tempparcel)); + return RdbJsKit::ResultSetProxy::NewInstance(env, resultSet); } napi_value NAPI_Release(napi_env env, napi_callback_info info) diff --git a/services/abilitymgr/src/ability_scheduler_proxy.cpp b/services/abilitymgr/src/ability_scheduler_proxy.cpp index eae1404a38d..aa0657a53ce 100644 --- a/services/abilitymgr/src/ability_scheduler_proxy.cpp +++ b/services/abilitymgr/src/ability_scheduler_proxy.cpp @@ -19,6 +19,7 @@ #include "hilog_wrapper.h" #include "ipc_types.h" +#include "ishared_result_set.h" #include "pac_map.h" #include "want.h" #include "data_ability_observer_interface.h" @@ -500,13 +501,8 @@ std::shared_ptr AbilitySchedulerProxy::Query( return nullptr; } - std::shared_ptr retval(NativeRdb::AbsSharedResultSet::Unmarshalling(reply)); - if (retval == nullptr) { - HILOG_ERROR("AbilitySchedulerProxy::Query retval == nullptr error"); - return nullptr; - } HILOG_INFO("AbilitySchedulerProxy::Query end"); - return retval; + return OHOS::NativeRdb::ISharedResultSet::ReadFromParcel(reply); } /** diff --git a/services/abilitymgr/src/ability_scheduler_stub.cpp b/services/abilitymgr/src/ability_scheduler_stub.cpp index 8af79be7402..8652c73dcdf 100644 --- a/services/abilitymgr/src/ability_scheduler_stub.cpp +++ b/services/abilitymgr/src/ability_scheduler_stub.cpp @@ -20,6 +20,7 @@ #include "hilog_wrapper.h" #include "ipc_types.h" +#include "ishared_result_set.h" #include "pac_map.h" #include "want.h" #include "data_ability_observer_interface.h" @@ -314,12 +315,13 @@ int AbilitySchedulerStub::QueryInner(MessageParcel &data, MessageParcel &reply) HILOG_ERROR("ReadParcelable predicates is nullptr"); return ERR_INVALID_VALUE; } - std::shared_ptr resultSet = Query(*uri, columns, *predicates); + auto resultSet = Query(*uri, columns, *predicates); if (resultSet == nullptr) { HILOG_ERROR("fail to WriteParcelable resultSet"); return ERR_INVALID_VALUE; } - if (!resultSet->Marshalling(reply)){ + auto result = NativeRdb::ISharedResultSet::WriteToParcel(std::move(resultSet), reply); + if (result == nullptr) { HILOG_ERROR("!resultSet->Marshalling(reply)"); return ERR_INVALID_VALUE; } -- Gitee