From efdc119ef63ff56a3346f8106415152a7503ac9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Mon, 24 Jun 2024 15:26:07 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9applynewversion=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=8F=82=E6=95=B0=20Signed-off-by:=20=E9=82=B9?= =?UTF-8?q?=E5=8F=8B=E6=9D=BE=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frameworks/js/napi/update/src/local_updater.cpp | 13 ++++++++++--- .../engine/include/update_service_kits_impl.h | 4 ++-- .../inner_api/engine/include/update_service_proxy.h | 4 ++-- .../engine/src/update_service_kits_impl.cpp | 2 +- .../inner_api/engine/src/update_service_proxy.cpp | 7 +++++-- .../api/local_updater/iservice_local_updater.h | 2 +- interfaces/inner_api/include/update_service_kits.h | 2 +- services/engine/include/update_service.h | 4 ++-- .../engine/include/update_service_local_updater.h | 4 ++-- services/engine/src/update_service.cpp | 2 +- .../engine/src/update_service_local_updater.cpp | 6 ++---- services/engine/src/update_service_stub.cpp | 11 ++++++++++- 12 files changed, 39 insertions(+), 22 deletions(-) diff --git a/frameworks/js/napi/update/src/local_updater.cpp b/frameworks/js/napi/update/src/local_updater.cpp index 16214501..bb913619 100644 --- a/frameworks/js/napi/update/src/local_updater.cpp +++ b/frameworks/js/napi/update/src/local_updater.cpp @@ -127,14 +127,21 @@ napi_value LocalUpdater::ApplyNewVersion(napi_env env, napi_callback_info info) return StartParamErrorSession(env, info, CALLBACK_POSITION_TWO); } + std::vector packageNames; + for(const UpgradeFile &upgradeFile : upgradeFiles) { + packageNames.push_back(upgradeFile.filePath); + } + SessionParams sessionParams(SessionType::SESSION_APPLY_NEW_VERSION, CALLBACK_POSITION_TWO, true); napi_value retValue = StartSession(env, info, sessionParams, - [upgradeFiles](void *context) -> int { - ENGINE_LOGI("ApplyNewVersion %s", upgradeFiles[0].filePath.c_str()); + [packageNames](void *context) -> int { + for (const std::string &packageName : packageNames) { + ENGINE_LOGI("ApplyNewVersion %{public}s", packageName.c_str()); + } BusinessError *businessError = reinterpret_cast(context); UpgradeInfo upgradeInfo; upgradeInfo.upgradeApp = LOCAL_UPGRADE_INFO; - return UpdateServiceKits::GetInstance().ApplyNewVersion(upgradeInfo, MISC_FILE, upgradeFiles[0].filePath, + return UpdateServiceKits::GetInstance().ApplyNewVersion(upgradeInfo, MISC_FILE, packageNames, *businessError); }); PARAM_CHECK(retValue != nullptr, return nullptr, "Failed to ApplyNewVersion"); diff --git a/interfaces/inner_api/engine/include/update_service_kits_impl.h b/interfaces/inner_api/engine/include/update_service_kits_impl.h index 96407977..ec7b9363 100644 --- a/interfaces/inner_api/engine/include/update_service_kits_impl.h +++ b/interfaces/inner_api/engine/include/update_service_kits_impl.h @@ -80,8 +80,8 @@ public: int32_t FactoryReset(BusinessError &businessError) final; - int32_t ApplyNewVersion(const UpgradeInfo &info, const std::string &miscFile, const std::string &packageName, - BusinessError &businessError) final; + int32_t ApplyNewVersion(const UpgradeInfo &info, const std::string &miscFile, + const std::vector &packageName, BusinessError &businessError) final; int32_t VerifyUpgradePackage(const std::string &packagePath, const std::string &keyPath, BusinessError &businessError) final; diff --git a/interfaces/inner_api/engine/include/update_service_proxy.h b/interfaces/inner_api/engine/include/update_service_proxy.h index f77464e8..aa8628a3 100644 --- a/interfaces/inner_api/engine/include/update_service_proxy.h +++ b/interfaces/inner_api/engine/include/update_service_proxy.h @@ -72,8 +72,8 @@ public: int32_t FactoryReset(BusinessError &businessError) override; - int32_t ApplyNewVersion(const UpgradeInfo &info, const std::string &miscFile, const std::string &packageName, - BusinessError &businessError) override; + int32_t ApplyNewVersion(const UpgradeInfo &info, const std::string &miscFile, + const std::vector &packageName, BusinessError &businessError) override; int32_t VerifyUpgradePackage(const std::string &packagePath, const std::string &keyPath, BusinessError &businessError) override; diff --git a/interfaces/inner_api/engine/src/update_service_kits_impl.cpp b/interfaces/inner_api/engine/src/update_service_kits_impl.cpp index dc9cce5d..fcc349ae 100644 --- a/interfaces/inner_api/engine/src/update_service_kits_impl.cpp +++ b/interfaces/inner_api/engine/src/update_service_kits_impl.cpp @@ -242,7 +242,7 @@ int32_t UpdateServiceKitsImpl::FactoryReset(BusinessError &businessError) } int32_t UpdateServiceKitsImpl::ApplyNewVersion(const UpgradeInfo &info, const std::string &miscFile, - const std::string &packageName, BusinessError &businessError) + const std::vector &packageName, BusinessError &businessError) { ENGINE_LOGI("UpdateServiceKitsImpl::ApplyNewVersion"); auto updateService = GetService(); diff --git a/interfaces/inner_api/engine/src/update_service_proxy.cpp b/interfaces/inner_api/engine/src/update_service_proxy.cpp index 4a044238..92b2cb86 100644 --- a/interfaces/inner_api/engine/src/update_service_proxy.cpp +++ b/interfaces/inner_api/engine/src/update_service_proxy.cpp @@ -471,7 +471,7 @@ int32_t UpdateServiceProxy::FactoryReset(BusinessError &businessError) } int32_t UpdateServiceProxy::ApplyNewVersion(const UpgradeInfo &info, const std::string &miscFile, - const std::string &packageName, BusinessError &businessError) + const std::vector &packageName, BusinessError &businessError) { ENGINE_LOGI("UpdateServiceProxy::ApplyNewVersion"); auto remote = Remote(); @@ -481,7 +481,10 @@ int32_t UpdateServiceProxy::ApplyNewVersion(const UpgradeInfo &info, const std:: RETURN_WHEN_TOKEN_WRITE_FAIL(data); MessageParcelHelper::WriteUpgradeInfo(data, info); data.WriteString16(Str8ToStr16(miscFile)); - data.WriteString16(Str8ToStr16(packageName)); + data.WriteInt32(static_cast(packageName.size())); + for (size_t i = 0; i < packageName.size(); i++) { + data.WriteString16(Str8ToStr16(packageName[i])); + } MessageParcel reply; MessageOption option; diff --git a/interfaces/inner_api/feature/update/api/local_updater/iservice_local_updater.h b/interfaces/inner_api/feature/update/api/local_updater/iservice_local_updater.h index 1d98f686..40b7f9dd 100644 --- a/interfaces/inner_api/feature/update/api/local_updater/iservice_local_updater.h +++ b/interfaces/inner_api/feature/update/api/local_updater/iservice_local_updater.h @@ -27,7 +27,7 @@ public: virtual ~IServiceLocalUpdater() = default; virtual int32_t ApplyNewVersion(const UpgradeInfo &info, const std::string &miscFile, - const std::string &packageName, BusinessError &businessError) = 0; + const std::vector &packageName, BusinessError &businessError) = 0; virtual int32_t VerifyUpgradePackage(const std::string &packagePath, const std::string &keyPath, BusinessError &businessError) = 0; diff --git a/interfaces/inner_api/include/update_service_kits.h b/interfaces/inner_api/include/update_service_kits.h index f3c8122a..f3fd4b91 100644 --- a/interfaces/inner_api/include/update_service_kits.h +++ b/interfaces/inner_api/include/update_service_kits.h @@ -99,7 +99,7 @@ public: virtual int32_t FactoryReset(BusinessError &businessError) = 0; virtual int32_t ApplyNewVersion(const UpgradeInfo &info, const std::string &miscFile, - const std::string &packageName, BusinessError &businessError) = 0; + const std::vector &packageName, BusinessError &businessError) = 0; virtual int32_t VerifyUpgradePackage(const std::string &packagePath, const std::string &keyPath, BusinessError &businessError) = 0; diff --git a/services/engine/include/update_service.h b/services/engine/include/update_service.h index 92d70bd6..b1afc1c6 100644 --- a/services/engine/include/update_service.h +++ b/services/engine/include/update_service.h @@ -83,8 +83,8 @@ public: int32_t FactoryReset(BusinessError &businessError) override; - int32_t ApplyNewVersion(const UpgradeInfo &info, const std::string &miscFile, const std::string &packageName, - BusinessError &businessError) override; + int32_t ApplyNewVersion(const UpgradeInfo &info, const std::string &miscFile, + const std::vector &packageName, BusinessError &businessError) override; int32_t VerifyUpgradePackage(const std::string &packagePath, const std::string &keyPath, BusinessError &businessError) override; diff --git a/services/engine/include/update_service_local_updater.h b/services/engine/include/update_service_local_updater.h index 8e8f5e90..a6858ea8 100644 --- a/services/engine/include/update_service_local_updater.h +++ b/services/engine/include/update_service_local_updater.h @@ -30,8 +30,8 @@ public: DISALLOW_COPY_AND_MOVE(UpdateServiceLocalUpdater); - int32_t ApplyNewVersion(const UpgradeInfo &info, const std::string &miscFile, const std::string &packageName, - BusinessError &businessError) final; + int32_t ApplyNewVersion(const UpgradeInfo &info, const std::string &miscFile, + const std::vector &packageName, BusinessError &businessError) final; int32_t VerifyUpgradePackage(const std::string &packagePath, const std::string &keyPath, BusinessError &businessError) final; diff --git a/services/engine/src/update_service.cpp b/services/engine/src/update_service.cpp index 8989779e..df7ec489 100644 --- a/services/engine/src/update_service.cpp +++ b/services/engine/src/update_service.cpp @@ -323,7 +323,7 @@ int32_t UpdateService::FactoryReset(BusinessError &businessError) } int32_t UpdateService::ApplyNewVersion(const UpgradeInfo &info, const std::string &miscFile, - const std::string &packageName, BusinessError &businessError) + const std::vector &packageName, BusinessError &businessError) { sptr localUpdater = new UpdateServiceLocalUpdater(); if (localUpdater == nullptr) { diff --git a/services/engine/src/update_service_local_updater.cpp b/services/engine/src/update_service_local_updater.cpp index 7f290737..fe95fd2e 100644 --- a/services/engine/src/update_service_local_updater.cpp +++ b/services/engine/src/update_service_local_updater.cpp @@ -25,14 +25,12 @@ namespace OHOS { namespace UpdateEngine { int32_t UpdateServiceLocalUpdater::ApplyNewVersion(const UpgradeInfo &info, const std::string &miscFile, - const std::string &packageName, BusinessError &businessError) + const std::vectpr &packageName, BusinessError &businessError) { #ifndef UPDATER_UT SYS_EVENT_SYSTEM_UPGRADE(0, UpdateSystemEvent::UPGRADE_START); businessError.errorNum = CallResult::SUCCESS; - std::vector packageNames; - packageNames.push_back(packageName); - int32_t ret = RebootAndInstallSdcardPackage(miscFile, packageNames) ? INT_CALL_SUCCESS : INT_CALL_FAIL; + int32_t ret = RebootAndInstallSdcardPackage(miscFile, packageName) ? INT_CALL_SUCCESS : INT_CALL_FAIL; ENGINE_LOGI("ApplyNewVersion result : %{public}d", ret); SYS_EVENT_SYSTEM_UPGRADE( 0, ret == INT_CALL_SUCCESS ? UpdateSystemEvent::EVENT_SUCCESS_RESULT : UpdateSystemEvent::EVENT_FAILED_RESULT); diff --git a/services/engine/src/update_service_stub.cpp b/services/engine/src/update_service_stub.cpp index 904837b6..2c11e15d 100644 --- a/services/engine/src/update_service_stub.cpp +++ b/services/engine/src/update_service_stub.cpp @@ -356,7 +356,16 @@ int32_t UpdateServiceStub::ApplyNewVersionStub(UpdateServiceStubPtr service, UpgradeInfo upgradeInfo; MessageParcelHelper::ReadUpgradeInfo(data, upgradeInfo); string miscFile = Str16ToStr8(data.ReadString16()); - string packageName = Str16ToStr8(data.ReadString16()); + + vector packageName; + int32_t size = data.ReadInt32(); + if (size > MAX_VECTOR_SIZE) { + ENGINE_LOGE("ReadComponentDescriptions size is over MAX_VECTOR_SIZE, size=%{public}d", size); + return INT_CALL_SUCCESS; + } + for (size_t i = 0; i < static_cast(size); i++) { + packageName.push_back(Str16ToStr8(data.ReadString16())); + } BusinessError businessError; int32_t ret = service->ApplyNewVersion(upgradeInfo, miscFile, packageName, businessError); ENGINE_CHECK(ret == INT_CALL_SUCCESS, return ret, "Failed to ApplyNewVersion"); -- Gitee From bbba3fcfd6c9005d614b5728eb5b0739796b3e8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Mon, 24 Jun 2024 07:43:32 +0000 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=98=E9=87=8F?= =?UTF-8?q?=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- services/engine/src/update_service_stub.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/services/engine/src/update_service_stub.cpp b/services/engine/src/update_service_stub.cpp index 2c11e15d..ea29ea19 100644 --- a/services/engine/src/update_service_stub.cpp +++ b/services/engine/src/update_service_stub.cpp @@ -34,6 +34,7 @@ namespace OHOS { namespace UpdateEngine { constexpr const pid_t ROOT_UID = 0; constexpr const pid_t EDM_UID = 3057; +static constexpr int32_t MAX_VECTOR_SIZE = 128; #define CALL_RESULT_TO_IPC_RESULT(callResult) ((callResult) + CALL_RESULT_OFFSET) -- Gitee From 8284fe39b3259b794e85e174b2e29d5480199f63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Mon, 24 Jun 2024 08:37:58 +0000 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- services/engine/src/update_service_local_updater.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/engine/src/update_service_local_updater.cpp b/services/engine/src/update_service_local_updater.cpp index fe95fd2e..cc3a9521 100644 --- a/services/engine/src/update_service_local_updater.cpp +++ b/services/engine/src/update_service_local_updater.cpp @@ -25,7 +25,7 @@ namespace OHOS { namespace UpdateEngine { int32_t UpdateServiceLocalUpdater::ApplyNewVersion(const UpgradeInfo &info, const std::string &miscFile, - const std::vectpr &packageName, BusinessError &businessError) + const std::vector &packageName, BusinessError &businessError) { #ifndef UPDATER_UT SYS_EVENT_SYSTEM_UPGRADE(0, UpdateSystemEvent::UPGRADE_START); -- Gitee From 549d507b58c875527d203751d368c63f8d2e5126 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Mon, 24 Jun 2024 09:29:36 +0000 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=84=E5=AE=A1?= =?UTF-8?q?=E6=84=8F=E8=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- frameworks/js/napi/update/src/local_updater.cpp | 4 ++-- .../engine/include/update_service_kits_impl.h | 2 +- .../inner_api/engine/include/update_service_proxy.h | 2 +- .../inner_api/engine/src/update_service_kits_impl.cpp | 4 ++-- .../inner_api/engine/src/update_service_proxy.cpp | 8 ++++---- .../update/api/local_updater/iservice_local_updater.h | 2 +- interfaces/inner_api/include/update_service_kits.h | 2 +- interfaces/inner_api/modulemgr/src/module_manager.cpp | 2 +- services/engine/include/update_service.h | 2 +- services/engine/include/update_service_local_updater.h | 2 +- services/engine/src/update_service.cpp | 4 ++-- services/engine/src/update_service_local_updater.cpp | 4 ++-- services/engine/src/update_service_stub.cpp | 10 +++++----- 13 files changed, 24 insertions(+), 24 deletions(-) diff --git a/frameworks/js/napi/update/src/local_updater.cpp b/frameworks/js/napi/update/src/local_updater.cpp index bb913619..73926866 100644 --- a/frameworks/js/napi/update/src/local_updater.cpp +++ b/frameworks/js/napi/update/src/local_updater.cpp @@ -128,8 +128,8 @@ napi_value LocalUpdater::ApplyNewVersion(napi_env env, napi_callback_info info) } std::vector packageNames; - for(const UpgradeFile &upgradeFile : upgradeFiles) { - packageNames.push_back(upgradeFile.filePath); + for (const UpgradeFile &upgradeFile : upgradeFiles) { + packageNames.emplace_back(upgradeFile.filePath); } SessionParams sessionParams(SessionType::SESSION_APPLY_NEW_VERSION, CALLBACK_POSITION_TWO, true); diff --git a/interfaces/inner_api/engine/include/update_service_kits_impl.h b/interfaces/inner_api/engine/include/update_service_kits_impl.h index ec7b9363..2409f2d0 100644 --- a/interfaces/inner_api/engine/include/update_service_kits_impl.h +++ b/interfaces/inner_api/engine/include/update_service_kits_impl.h @@ -81,7 +81,7 @@ public: int32_t FactoryReset(BusinessError &businessError) final; int32_t ApplyNewVersion(const UpgradeInfo &info, const std::string &miscFile, - const std::vector &packageName, BusinessError &businessError) final; + const std::vector &packageNames, BusinessError &businessError) final; int32_t VerifyUpgradePackage(const std::string &packagePath, const std::string &keyPath, BusinessError &businessError) final; diff --git a/interfaces/inner_api/engine/include/update_service_proxy.h b/interfaces/inner_api/engine/include/update_service_proxy.h index aa8628a3..a0655af8 100644 --- a/interfaces/inner_api/engine/include/update_service_proxy.h +++ b/interfaces/inner_api/engine/include/update_service_proxy.h @@ -73,7 +73,7 @@ public: int32_t FactoryReset(BusinessError &businessError) override; int32_t ApplyNewVersion(const UpgradeInfo &info, const std::string &miscFile, - const std::vector &packageName, BusinessError &businessError) override; + const std::vector &packageNames, BusinessError &businessError) override; int32_t VerifyUpgradePackage(const std::string &packagePath, const std::string &keyPath, BusinessError &businessError) override; diff --git a/interfaces/inner_api/engine/src/update_service_kits_impl.cpp b/interfaces/inner_api/engine/src/update_service_kits_impl.cpp index fcc349ae..ada4fe92 100644 --- a/interfaces/inner_api/engine/src/update_service_kits_impl.cpp +++ b/interfaces/inner_api/engine/src/update_service_kits_impl.cpp @@ -242,12 +242,12 @@ int32_t UpdateServiceKitsImpl::FactoryReset(BusinessError &businessError) } int32_t UpdateServiceKitsImpl::ApplyNewVersion(const UpgradeInfo &info, const std::string &miscFile, - const std::vector &packageName, BusinessError &businessError) + const std::vector &packageNames, BusinessError &businessError) { ENGINE_LOGI("UpdateServiceKitsImpl::ApplyNewVersion"); auto updateService = GetService(); RETURN_FAIL_WHEN_SERVICE_NULL(updateService); - int32_t ret = updateService->ApplyNewVersion(info, miscFile, packageName, businessError); + int32_t ret = updateService->ApplyNewVersion(info, miscFile, packageNames, businessError); ENGINE_CHECK((ret) == INT_CALL_SUCCESS, ResetRemoteService(), "ApplyNewVersion ipc error"); return ret; } diff --git a/interfaces/inner_api/engine/src/update_service_proxy.cpp b/interfaces/inner_api/engine/src/update_service_proxy.cpp index 92b2cb86..cc2f65f9 100644 --- a/interfaces/inner_api/engine/src/update_service_proxy.cpp +++ b/interfaces/inner_api/engine/src/update_service_proxy.cpp @@ -471,7 +471,7 @@ int32_t UpdateServiceProxy::FactoryReset(BusinessError &businessError) } int32_t UpdateServiceProxy::ApplyNewVersion(const UpgradeInfo &info, const std::string &miscFile, - const std::vector &packageName, BusinessError &businessError) + const std::vector &packageNames, BusinessError &businessError) { ENGINE_LOGI("UpdateServiceProxy::ApplyNewVersion"); auto remote = Remote(); @@ -481,9 +481,9 @@ int32_t UpdateServiceProxy::ApplyNewVersion(const UpgradeInfo &info, const std:: RETURN_WHEN_TOKEN_WRITE_FAIL(data); MessageParcelHelper::WriteUpgradeInfo(data, info); data.WriteString16(Str8ToStr16(miscFile)); - data.WriteInt32(static_cast(packageName.size())); - for (size_t i = 0; i < packageName.size(); i++) { - data.WriteString16(Str8ToStr16(packageName[i])); + data.WriteInt32(static_cast(packageNames.size())); + for (size_t i = 0; i < packageNames.size(); i++) { + data.WriteString16(Str8ToStr16(packageNames[i])); } MessageParcel reply; diff --git a/interfaces/inner_api/feature/update/api/local_updater/iservice_local_updater.h b/interfaces/inner_api/feature/update/api/local_updater/iservice_local_updater.h index 40b7f9dd..ed2b03c7 100644 --- a/interfaces/inner_api/feature/update/api/local_updater/iservice_local_updater.h +++ b/interfaces/inner_api/feature/update/api/local_updater/iservice_local_updater.h @@ -27,7 +27,7 @@ public: virtual ~IServiceLocalUpdater() = default; virtual int32_t ApplyNewVersion(const UpgradeInfo &info, const std::string &miscFile, - const std::vector &packageName, BusinessError &businessError) = 0; + const std::vector &packageNames, BusinessError &businessError) = 0; virtual int32_t VerifyUpgradePackage(const std::string &packagePath, const std::string &keyPath, BusinessError &businessError) = 0; diff --git a/interfaces/inner_api/include/update_service_kits.h b/interfaces/inner_api/include/update_service_kits.h index f3fd4b91..39d38b01 100644 --- a/interfaces/inner_api/include/update_service_kits.h +++ b/interfaces/inner_api/include/update_service_kits.h @@ -99,7 +99,7 @@ public: virtual int32_t FactoryReset(BusinessError &businessError) = 0; virtual int32_t ApplyNewVersion(const UpgradeInfo &info, const std::string &miscFile, - const std::vector &packageName, BusinessError &businessError) = 0; + const std::vector &packageNames, BusinessError &businessError) = 0; virtual int32_t VerifyUpgradePackage(const std::string &packagePath, const std::string &keyPath, BusinessError &businessError) = 0; diff --git a/interfaces/inner_api/modulemgr/src/module_manager.cpp b/interfaces/inner_api/modulemgr/src/module_manager.cpp index 985f079c..ad4736b0 100644 --- a/interfaces/inner_api/modulemgr/src/module_manager.cpp +++ b/interfaces/inner_api/modulemgr/src/module_manager.cpp @@ -94,7 +94,7 @@ int32_t ModuleManager::HandleFunc(uint32_t code, MessageParcel &data, MessagePar if (!IsMapFuncExist(code)) { UTILS_LOGI("code %{public}d not exist", code); } else { - UTILS_LOGI("code %{public}d already exist", code); + UTILS_LOGI("code %{public}d called", code); return ((RequestFuncType)onRemoteRequestFuncMap_[code])(code, data, reply, option); } return 0; diff --git a/services/engine/include/update_service.h b/services/engine/include/update_service.h index b1afc1c6..a123318f 100644 --- a/services/engine/include/update_service.h +++ b/services/engine/include/update_service.h @@ -84,7 +84,7 @@ public: int32_t FactoryReset(BusinessError &businessError) override; int32_t ApplyNewVersion(const UpgradeInfo &info, const std::string &miscFile, - const std::vector &packageName, BusinessError &businessError) override; + const std::vector &packageNames, BusinessError &businessError) override; int32_t VerifyUpgradePackage(const std::string &packagePath, const std::string &keyPath, BusinessError &businessError) override; diff --git a/services/engine/include/update_service_local_updater.h b/services/engine/include/update_service_local_updater.h index a6858ea8..84e10259 100644 --- a/services/engine/include/update_service_local_updater.h +++ b/services/engine/include/update_service_local_updater.h @@ -31,7 +31,7 @@ public: DISALLOW_COPY_AND_MOVE(UpdateServiceLocalUpdater); int32_t ApplyNewVersion(const UpgradeInfo &info, const std::string &miscFile, - const std::vector &packageName, BusinessError &businessError) final; + const std::vector &packageNames, BusinessError &businessError) final; int32_t VerifyUpgradePackage(const std::string &packagePath, const std::string &keyPath, BusinessError &businessError) final; diff --git a/services/engine/src/update_service.cpp b/services/engine/src/update_service.cpp index df7ec489..b31582aa 100644 --- a/services/engine/src/update_service.cpp +++ b/services/engine/src/update_service.cpp @@ -323,14 +323,14 @@ int32_t UpdateService::FactoryReset(BusinessError &businessError) } int32_t UpdateService::ApplyNewVersion(const UpgradeInfo &info, const std::string &miscFile, - const std::vector &packageName, BusinessError &businessError) + const std::vector &packageNames, BusinessError &businessError) { sptr localUpdater = new UpdateServiceLocalUpdater(); if (localUpdater == nullptr) { ENGINE_LOGI("FactoryReset localUpdater null"); return INT_CALL_FAIL; } - return localUpdater->ApplyNewVersion(info, miscFile, packageName, businessError); + return localUpdater->ApplyNewVersion(info, miscFile, packageNames, businessError); } int32_t UpdateService::VerifyUpgradePackage(const std::string &packagePath, const std::string &keyPath, diff --git a/services/engine/src/update_service_local_updater.cpp b/services/engine/src/update_service_local_updater.cpp index cc3a9521..1197b872 100644 --- a/services/engine/src/update_service_local_updater.cpp +++ b/services/engine/src/update_service_local_updater.cpp @@ -25,12 +25,12 @@ namespace OHOS { namespace UpdateEngine { int32_t UpdateServiceLocalUpdater::ApplyNewVersion(const UpgradeInfo &info, const std::string &miscFile, - const std::vector &packageName, BusinessError &businessError) + const std::vector &packageNames, BusinessError &businessError) { #ifndef UPDATER_UT SYS_EVENT_SYSTEM_UPGRADE(0, UpdateSystemEvent::UPGRADE_START); businessError.errorNum = CallResult::SUCCESS; - int32_t ret = RebootAndInstallSdcardPackage(miscFile, packageName) ? INT_CALL_SUCCESS : INT_CALL_FAIL; + int32_t ret = RebootAndInstallSdcardPackage(miscFile, packageNames) ? INT_CALL_SUCCESS : INT_CALL_FAIL; ENGINE_LOGI("ApplyNewVersion result : %{public}d", ret); SYS_EVENT_SYSTEM_UPGRADE( 0, ret == INT_CALL_SUCCESS ? UpdateSystemEvent::EVENT_SUCCESS_RESULT : UpdateSystemEvent::EVENT_FAILED_RESULT); diff --git a/services/engine/src/update_service_stub.cpp b/services/engine/src/update_service_stub.cpp index ea29ea19..4e1966af 100644 --- a/services/engine/src/update_service_stub.cpp +++ b/services/engine/src/update_service_stub.cpp @@ -358,17 +358,17 @@ int32_t UpdateServiceStub::ApplyNewVersionStub(UpdateServiceStubPtr service, MessageParcelHelper::ReadUpgradeInfo(data, upgradeInfo); string miscFile = Str16ToStr8(data.ReadString16()); - vector packageName; + vector packageNames; int32_t size = data.ReadInt32(); if (size > MAX_VECTOR_SIZE) { - ENGINE_LOGE("ReadComponentDescriptions size is over MAX_VECTOR_SIZE, size=%{public}d", size); - return INT_CALL_SUCCESS; + ENGINE_LOGE("ReadComponentDescriptions size is over, size=%{public}d", size); + return INT_CALL_FAIL; } for (size_t i = 0; i < static_cast(size); i++) { - packageName.push_back(Str16ToStr8(data.ReadString16())); + packageNames.emplace_back(Str16ToStr8(data.ReadString16())); } BusinessError businessError; - int32_t ret = service->ApplyNewVersion(upgradeInfo, miscFile, packageName, businessError); + int32_t ret = service->ApplyNewVersion(upgradeInfo, miscFile, packageNames, businessError); ENGINE_CHECK(ret == INT_CALL_SUCCESS, return ret, "Failed to ApplyNewVersion"); MessageParcelHelper::WriteBusinessError(reply, businessError); return INT_CALL_SUCCESS; -- Gitee From 46aedb5b2ef0bad5550a272878b3d26745fc52b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Mon, 24 Jun 2024 11:47:00 +0000 Subject: [PATCH 5/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=A9=BA=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- frameworks/js/napi/update/src/local_updater.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/js/napi/update/src/local_updater.cpp b/frameworks/js/napi/update/src/local_updater.cpp index 73926866..b52c026b 100644 --- a/frameworks/js/napi/update/src/local_updater.cpp +++ b/frameworks/js/napi/update/src/local_updater.cpp @@ -134,7 +134,7 @@ napi_value LocalUpdater::ApplyNewVersion(napi_env env, napi_callback_info info) SessionParams sessionParams(SessionType::SESSION_APPLY_NEW_VERSION, CALLBACK_POSITION_TWO, true); napi_value retValue = StartSession(env, info, sessionParams, - [packageNames](void *context) -> int { + [packageNames](void *context) -> int { for (const std::string &packageName : packageNames) { ENGINE_LOGI("ApplyNewVersion %{public}s", packageName.c_str()); } -- Gitee