diff --git a/interfaces/innerkits/src/ecological_rule_mgr_service_proxy.cpp b/interfaces/innerkits/src/ecological_rule_mgr_service_proxy.cpp index 9e17eaf..c2dbf41 100644 --- a/interfaces/innerkits/src/ecological_rule_mgr_service_proxy.cpp +++ b/interfaces/innerkits/src/ecological_rule_mgr_service_proxy.cpp @@ -30,154 +30,24 @@ EcologicalRuleMgrServiceProxy::EcologicalRuleMgrServiceProxy(const sptrSendRequest(QUERY_FREE_INSTALL_EXPERIENCE_CMD, data, reply, option); - if (ret != ERR_NONE) { - LOG_ERROR("SendRequest error, ret = %{public}d", ret); - return ERR_FAILED; - } - sptr sptrRule = reply.ReadParcelable(); - if (sptrRule == nullptr) { - LOG_ERROR("readParcelable sptrRule error"); - return ERR_FAILED; - } - rule.replaceWant = sptrRule->replaceWant; - LOG_INFO("QueryFreeInstallExperience end"); return ERR_OK; } int32_t EcologicalRuleMgrServiceProxy::EvaluateResolveInfos(const Want &want, const CallerInfo &callerInfo, int32_t type, std::vector &abilityInfos) { - LOG_INFO("EvaluateResolveInfos called"); - MessageParcel data; - if (!data.WriteInterfaceToken(ERMS_INTERFACE_TOKEN)) { - LOG_ERROR("write token failed"); - return ERR_FAILED; - } - bool res = data.WriteParcelable(&want) && data.WriteInt32(type) && - data.WriteInt32(abilityInfos.size()); - if (!res) { - LOG_ERROR("write data failed"); - return ERR_FAILED; - } - for (auto &abilityInfo : abilityInfos) { - if (!data.WriteParcelable(&abilityInfo)) { - LOG_ERROR("write abilityInfo failed"); - return ERR_FAILED; - } - } - if (!data.WriteParcelable(&callerInfo)) { - LOG_ERROR("write callerInfo failed"); - return ERR_FAILED; - } - MessageOption option = { MessageOption::TF_SYNC }; - MessageParcel reply; - auto remote = Remote(); - if (remote == nullptr) { - LOG_ERROR("get Remote failed."); - return ERR_FAILED; - } - int32_t ret = remote->SendRequest(EVALUATE_RESOLVE_INFO_CMD, data, reply, option); - if (ret != ERR_NONE) { - LOG_ERROR("SendRequest error, ret = %{public}d", ret); - return ERR_FAILED; - } - LOG_INFO("EvaluateResolveInfos end"); return ERR_OK; } int32_t EcologicalRuleMgrServiceProxy::QueryStartExperience(const Want &want, const CallerInfo &callerInfo, ExperienceRule &rule) { - LOG_INFO("QueryStartExperience called"); - MessageParcel data; - if (!data.WriteInterfaceToken(ERMS_INTERFACE_TOKEN)) { - LOG_ERROR("write token failed"); - return ERR_FAILED; - } - bool res = data.WriteParcelable(&want) && data.WriteParcelable(&callerInfo); - if (!res) { - LOG_ERROR("write data failed"); - return ERR_FAILED; - } - MessageOption option = { MessageOption::TF_SYNC }; - MessageParcel reply; - auto remote = Remote(); - if (remote == nullptr) { - LOG_ERROR("get Remote failed"); - return ERR_FAILED; - } - int32_t ret = remote->SendRequest(QUERY_START_EXPERIENCE_CMD, data, reply, option); - if (ret != ERR_NONE) { - LOG_ERROR("SendRequest error, ret = %{public}d", ret); - return ERR_FAILED; - } - sptr sptrRule = reply.ReadParcelable(); - if (sptrRule == nullptr) { - LOG_ERROR("ReadParcelable sptrRule error"); - return ERR_FAILED; - } - rule.resultCode = sptrRule->resultCode; - rule.replaceWant = sptrRule->replaceWant; - LOG_INFO("QueryStartExperience end"); return ERR_OK; } int32_t EcologicalRuleMgrServiceProxy::IsSupportPublishForm(const std::vector &wants, const CallerInfo &callerInfo, bool &bSupport) { - LOG_INFO("IsSupportPublishForm called"); - MessageParcel data; - if (!data.WriteInterfaceToken(ERMS_INTERFACE_TOKEN)) { - LOG_ERROR("write token failed"); - return ERR_FAILED; - } - if (!data.WriteInt32(wants.size())) { - LOG_ERROR("write wants size failed"); - return ERR_FAILED; - } - for (auto &want : wants) { - if (!data.WriteParcelable(&want)) { - LOG_ERROR("write want failed"); - return ERR_FAILED; - } - } - if (!data.WriteParcelable(&callerInfo)) { - LOG_ERROR("write callerInfo failed"); - return ERR_FAILED; - } - MessageOption option = { MessageOption::TF_SYNC }; - MessageParcel reply; - auto remote = Remote(); - if (remote == nullptr) { - LOG_ERROR("get Remote failed"); - return ERR_FAILED; - } - int32_t ret = remote->SendRequest(IS_SUPPORT_PUBLISH_FORM_CMD, data, reply, option); - if (ret != ERR_NONE) { - LOG_ERROR("SendRequest error, ret = %{public}d", ret); - return ERR_FAILED; - } - bSupport = reply.ReadBool(); - LOG_INFO("IsSupportPublishForm end, bSupport=%{public}d", bSupport); return ERR_OK; }