From 230a2b48a8e71e9db9657e9e53354ab707ab73b6 Mon Sep 17 00:00:00 2001 From: ma_nan Date: Thu, 19 Aug 2021 16:27:31 +0800 Subject: [PATCH 1/2] fix verify bug Signed-off-by: ma_nan --- engine/BUILD.gn | 3 +-- engine/src/update_service.cpp | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/engine/BUILD.gn b/engine/BUILD.gn index 769a1b0a..c6275541 100755 --- a/engine/BUILD.gn +++ b/engine/BUILD.gn @@ -26,8 +26,7 @@ ohos_prebuilt_etc("updater_sa.rc") { ohos_shared_library("updateservice") { defines = [ "DUAL_ADAPTER", - "UPDATE_SERVICE", - "UPDATER_UT" + "UPDATE_SERVICE" ] sources = [ "//base/update/updateservice/callback/src/update_callback.cpp", diff --git a/engine/src/update_service.cpp b/engine/src/update_service.cpp index 1a503e11..fa594dfb 100644 --- a/engine/src/update_service.cpp +++ b/engine/src/update_service.cpp @@ -218,7 +218,7 @@ void UpdateService::SearchCallback(const std::string &msg, SearchStatus status) upgradeStatus_ = UPDATE_STATE_CHECK_VERSION_SUCCESS; // Compare the downloaded version with the local version. - std::string loadVersion = OHOS::system::GetParameter("ro.build.id", ""); + std::string loadVersion = OHOS::system::GetParameter("hw_sc.build.os.version", ""); int32_t ret = UpdateHelper::CompareVersion(versionInfo_.result[0].versionCode, loadVersion); if (ret <= 0) { versionInfo_.status = NO_NEW_VERSION; @@ -401,7 +401,7 @@ int32_t UpdateService::ReadCheckVersiondescriptInfo(const cJSON *descriptInfo, V bool UpdateService::VerifyDownloadPkg(const std::string &pkgName, Progress &progress) { // Compare the downloaded version with the local version. Only update is supported. - std::string loadVersion = OHOS::system::GetParameter("ro.build.id", ""); + std::string loadVersion = OHOS::system::GetParameter("hw_sc.build.os.version", ""); int32_t ret = UpdateHelper::CompareVersion(versionInfo_.result[0].versionCode, loadVersion); if (ret <= 0) { progress.endReason = "Update package version earlier than the local version"; @@ -488,7 +488,7 @@ int32_t UpdateService::RebootAndInstall(const std::string &miscFile, const std:: void UpdateService::InitVersionInfo(VersionInfo &versionInfo) const { versionInfo.status = HAS_NEW_VERSION; - std::string versionName = OHOS::system::GetParameter("ro.build.id", ""); + std::string versionName = OHOS::system::GetParameter("hw_sc.build.os.version", ""); if (versionName.empty()) { versionInfo.status = SYSTEM_ERROR; versionInfo.errMsg = "Can not get local version"; -- Gitee From 64abed52b8c9c5f35cf155431d002d16a413ace3 Mon Sep 17 00:00:00 2001 From: ma_nan Date: Thu, 19 Aug 2021 17:01:39 +0800 Subject: [PATCH 2/2] fix verify bug Signed-off-by: ma_nan --- engine/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/BUILD.gn b/engine/BUILD.gn index c6275541..42fc098b 100755 --- a/engine/BUILD.gn +++ b/engine/BUILD.gn @@ -26,7 +26,7 @@ ohos_prebuilt_etc("updater_sa.rc") { ohos_shared_library("updateservice") { defines = [ "DUAL_ADAPTER", - "UPDATE_SERVICE" + "UPDATE_SERVICE", ] sources = [ "//base/update/updateservice/callback/src/update_callback.cpp", -- Gitee