From 754d45f0f225973f741b08781b8b9bf713b71f18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Wed, 3 Jan 2024 01:28:07 +0000 Subject: [PATCH 01/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E6=88=90=E5=8A=9F=E5=90=8E=E5=AF=B9=E5=8D=87=E7=BA=A7=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E7=9A=84=E5=88=A4=E6=96=AD=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- .../status/include/firmware_result_process.h | 1 + .../status/src/firmware_result_process.cpp | 42 ++++++++++++------- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/services/firmware/upgrade/status/include/firmware_result_process.h b/services/firmware/upgrade/status/include/firmware_result_process.h index a5b240af..fa994271 100644 --- a/services/firmware/upgrade/status/include/firmware_result_process.h +++ b/services/firmware/upgrade/status/include/firmware_result_process.h @@ -71,6 +71,7 @@ private: const std::vector &components); UpdateResultCode HandleFileResults(std::map &resultMap, const std::vector &components); + void ParseResult(const std::vector &results, std::string &value, size_t index); }; } // namespace UpdateEngine } // namespace OHOS diff --git a/services/firmware/upgrade/status/src/firmware_result_process.cpp b/services/firmware/upgrade/status/src/firmware_result_process.cpp index 837079d7..e4ec1fa8 100644 --- a/services/firmware/upgrade/status/src/firmware_result_process.cpp +++ b/services/firmware/upgrade/status/src/firmware_result_process.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -37,6 +38,18 @@ static const std::string UPDATER_RESULT_FILE = "/data/updater/updater_result"; constexpr int32_t SYMBOL_LENGTH = 1; constexpr uint32_t UPDATE_SUCCESSED = 1; constexpr uint32_t UPDATE_FAILED = 2; +constexpr size_t PKG_PATH_INDEX = 0; +constexpr size_t RESULT_INDEX = 1; +constexpr size_t REASON_INDEX = 2; + +void FirmwareResultProcess::ParseResult(const std::vector &results, std::string &value, size_t index) +{ + if (index >= results.size()) { + return; + } + value = results[index]; + StringUtils::Trim(value); +} UpdateResultCode FirmwareResultProcess::GetUpdaterResult(const std::vector &components, std::map &resultMap) @@ -93,26 +106,27 @@ UpdateResult FirmwareResultProcess::CompareVersion(const FirmwareComponent &comp void FirmwareResultProcess::ParseUpdaterResultRecord(const std::string &resultLine, std::map &resultMap) { + FIRMWARE_LOGE("ParseUpdaterResultRecord"); if (resultLine.empty()) { FIRMWARE_LOGE("resultLine is null"); return; } - UpdateResult updaterReason; - std::string::size_type verticalPlace = resultLine.find_first_of("|"); - std::string resultAndReason; - if (verticalPlace == std::string::npos) { - updaterReason.spath = resultLine; - } else { - updaterReason.spath = resultLine.substr(0, verticalPlace); - resultAndReason = resultLine.substr(verticalPlace + SYMBOL_LENGTH); + UpdateResult updateResult; + std::vector results; + std::stringstream stringStream(resultLine); + std::string token; + while (std::getline(stringStream, token, '|')) { + results.push_back(token); } - std::string::size_type colonPlace = resultAndReason.find_first_of(":"); - if (colonPlace == std::string::npos) { - updaterReason.result = resultAndReason; - } else { - updaterReason.result = resultAndReason.substr(0, colonPlace); - updaterReason.reason = resultAndReason.substr(colonPlace + SYMBOL_LENGTH); + ParseResult(results, updateResult.spath, PKG_PATH_INDEX); + ParseResult(results, updateResult.result, RESULT_INDEX); + ParseResult(results, updateResult.reason, REASON_INDEX); + + auto colonPlace = updateResult.result.find_first_of(":"); + if (colonPlace != std::string::npos) { + updateResult.result = updateResult.result.substr(0, colonPlace); + updateResult.reason = results[RESULT_INDEX].substr(colonPlace + SYMBOL_LENGTH); } StringUtils::Trim(updaterReason.spath); StringUtils::Trim(updaterReason.result); -- Gitee From 1dbc5ac63df567edf95569b7b610bd28a01e4d5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Wed, 3 Jan 2024 01:59:50 +0000 Subject: [PATCH 02/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E6=88=90=E5=8A=9F=E6=9C=AA=E6=9B=B4=E6=96=B0changelog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- .../upgrade/status/src/firmware_result_process.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/services/firmware/upgrade/status/src/firmware_result_process.cpp b/services/firmware/upgrade/status/src/firmware_result_process.cpp index e4ec1fa8..681d1efc 100644 --- a/services/firmware/upgrade/status/src/firmware_result_process.cpp +++ b/services/firmware/upgrade/status/src/firmware_result_process.cpp @@ -128,10 +128,10 @@ void FirmwareResultProcess::ParseUpdaterResultRecord(const std::string &resultLi updateResult.result = updateResult.result.substr(0, colonPlace); updateResult.reason = results[RESULT_INDEX].substr(colonPlace + SYMBOL_LENGTH); } - StringUtils::Trim(updaterReason.spath); - StringUtils::Trim(updaterReason.result); - StringUtils::Trim(updaterReason.reason); - resultMap.emplace(std::make_pair(updaterReason.spath, updaterReason)); + StringUtils::Trim(updateResult.spath); + StringUtils::Trim(updateResult.result); + StringUtils::Trim(updateResult.reason); + resultMap.emplace(std::make_pair(updaterReason.spath, updateResult)); } void FirmwareResultProcess::HandleFileError(std::map &resultMap, -- Gitee From 09a89ea6710c0571ccd1d15ccd37608a99311079 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Wed, 3 Jan 2024 02:28:01 +0000 Subject: [PATCH 03/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E6=88=90=E5=8A=9F=EF=BC=8Cchangelog=20=E6=9C=AA=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- .../firmware/upgrade/status/src/firmware_result_process.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/firmware/upgrade/status/src/firmware_result_process.cpp b/services/firmware/upgrade/status/src/firmware_result_process.cpp index 681d1efc..7bcc3923 100644 --- a/services/firmware/upgrade/status/src/firmware_result_process.cpp +++ b/services/firmware/upgrade/status/src/firmware_result_process.cpp @@ -131,7 +131,7 @@ void FirmwareResultProcess::ParseUpdaterResultRecord(const std::string &resultLi StringUtils::Trim(updateResult.spath); StringUtils::Trim(updateResult.result); StringUtils::Trim(updateResult.reason); - resultMap.emplace(std::make_pair(updaterReason.spath, updateResult)); + resultMap.emplace(std::make_pair(updateResult.spath, updateResult)); } void FirmwareResultProcess::HandleFileError(std::map &resultMap, -- Gitee From b5d47da273433e9488578171102cf60c4b8dbe7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Thu, 11 Jan 2024 09:07:43 +0000 Subject: [PATCH 04/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E6=8F=90=E4=BA=A4=EF=BC=8C=E7=BD=91=E7=BB=9C?= =?UTF-8?q?=E6=9D=83=E9=99=90=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- services/engine/etc/updater_sa.cfg | 3 +- .../include/firmware_download_executor.h | 2 ++ .../src/firmware_download_executor.cpp | 31 +++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/services/engine/etc/updater_sa.cfg b/services/engine/etc/updater_sa.cfg index 28a8eee7..de4271cc 100644 --- a/services/engine/etc/updater_sa.cfg +++ b/services/engine/etc/updater_sa.cfg @@ -24,7 +24,8 @@ "uid" : "update", "gid" : ["update", "netsys_socket"], "permission" : [ - "ohos.permission.UPDATE_SYSTEM" + "ohos.permission.UPDATE_SYSTEM", + "ohos.permission.GET_NETWORK_INFO" ], "secon" : "u:r:updater_sa:s0" } diff --git a/services/firmware/upgrade/executor/include/firmware_download_executor.h b/services/firmware/upgrade/executor/include/firmware_download_executor.h index 809affbb..4e8bce14 100644 --- a/services/firmware/upgrade/executor/include/firmware_download_executor.h +++ b/services/firmware/upgrade/executor/include/firmware_download_executor.h @@ -24,6 +24,7 @@ namespace OHOS { namespace UpdateEngine { +const int32_t DOWNLOAD_SLEEP_MILLISECONDS = 200; class FirmwareDownloadExecutor : public FirmwareIExecutor { public: FirmwareDownloadExecutor(const DownloadOptions &downloadOptions, FirmwareProgressCallback progressCallback) @@ -37,6 +38,7 @@ private: void PerformDownload(); void DownloadCallback(std::string serverUrl, std::string packageName, Progress progress); bool VerifyDownloadPkg(const std::string &pkgName, Progress &progress); + std::string GenerateDownloadTaskId(); private: DownloadOptions downloadOptions_; diff --git a/services/firmware/upgrade/executor/src/firmware_download_executor.cpp b/services/firmware/upgrade/executor/src/firmware_download_executor.cpp index 3b24149a..95d03e4c 100644 --- a/services/firmware/upgrade/executor/src/firmware_download_executor.cpp +++ b/services/firmware/upgrade/executor/src/firmware_download_executor.cpp @@ -56,6 +56,21 @@ void FirmwareDownloadExecutor::DoDownload() GetTask(); if (tasks_.downloadTaskId.empty()) { // 首次触发下载 + std::this_thread::sleep_for(std::chrono::milliseconds(DOWNLOAD_SLEEP_MILLISECONDS)); + GetTask(); + FIRMWARE_LOGI("FirmwareDownloadExecutor StartDownload"); + if (tasks_.downloadTaskId.empty()) { + std::string downloadTaskId = GenerateDownloadTaskId(); + FIRMWARE_LOGI("DoDownload: %{public}s", downloadTaskId.c_str()); + FirmwareTaskOperator().UpdateDownloadTaskIdByTaskId(tasks_.taskId, downloadTaskId); + } else { + FIRMWARE_LOGI("DoDownload Repeat subcommit"); + Progress progress; + progress.status = UpgradeStatus::DOWNLOADING; + progress.endReason = "not perrmit repeat submmit"; + firmwareProgressCallback_.progressCallback(progress); + return; + } PerformDownload(); } else { // 恢复下载 @@ -175,5 +190,21 @@ bool FirmwareDownloadExecutor::VerifyDownloadPkg(const std::string &pkgName, Pro } return true; } + +std::string FirmwareDownloadExecutor::GenerateDownloadTaskId() +{ + std::vector downloadInfos; + std::vector components; + FirmwareComponentOperator().QueryAll(components); + for (auto component : components) { + downloadInfos.push_back(component.descriptPackageId); + } + sort(downloadInfos.begin(), downloadInfos.end()); + std::string srcString; + for (auto downloadInfo : downloadInfos) { + srcString += downloadInfo; + } + return Sha256Utils::CalculateHashCode(srcString); +} } // namespace UpdateEngine } // namespace OHOS -- Gitee From d0bd920b93511a142eb2230e910e65a5132fccc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Thu, 11 Jan 2024 13:50:20 +0000 Subject: [PATCH 05/98] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- .../upgrade/executor/include/firmware_download_executor.h | 1 + .../upgrade/executor/src/firmware_download_executor.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/services/firmware/upgrade/executor/include/firmware_download_executor.h b/services/firmware/upgrade/executor/include/firmware_download_executor.h index 4e8bce14..9d11f0d1 100644 --- a/services/firmware/upgrade/executor/include/firmware_download_executor.h +++ b/services/firmware/upgrade/executor/include/firmware_download_executor.h @@ -24,6 +24,7 @@ namespace OHOS { namespace UpdateEngine { +// 防止下载重复提交,设置查询时间间隔 const int32_t DOWNLOAD_SLEEP_MILLISECONDS = 200; class FirmwareDownloadExecutor : public FirmwareIExecutor { public: diff --git a/services/firmware/upgrade/executor/src/firmware_download_executor.cpp b/services/firmware/upgrade/executor/src/firmware_download_executor.cpp index 95d03e4c..7e71e8c0 100644 --- a/services/firmware/upgrade/executor/src/firmware_download_executor.cpp +++ b/services/firmware/upgrade/executor/src/firmware_download_executor.cpp @@ -196,12 +196,12 @@ std::string FirmwareDownloadExecutor::GenerateDownloadTaskId() std::vector downloadInfos; std::vector components; FirmwareComponentOperator().QueryAll(components); - for (auto component : components) { + for (const auto &component : components) { downloadInfos.push_back(component.descriptPackageId); } sort(downloadInfos.begin(), downloadInfos.end()); std::string srcString; - for (auto downloadInfo : downloadInfos) { + for (const auto &downloadInfo : downloadInfos) { srcString += downloadInfo; } return Sha256Utils::CalculateHashCode(srcString); -- Gitee From 09e4d656831aa478e8bba39900c5593a96c6175d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Mon, 15 Jan 2024 15:21:14 +0800 Subject: [PATCH 06/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=87=8D=E8=A4=87?= =?UTF-8?q?=E4=B8=8B=E8=BC=89=E4=B8=AD=E5=8A=A0=E9=8E=96=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=20Signed-off-by:=20=E9=82=B9=E5=8F=8B=E6=9D=BE=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../include/firmware_download_executor.h | 6 +-- .../src/firmware_download_executor.cpp | 43 ++++++------------- .../upgrade/flow/src/firmware_manager.cpp | 3 ++ 3 files changed, 20 insertions(+), 32 deletions(-) diff --git a/services/firmware/upgrade/executor/include/firmware_download_executor.h b/services/firmware/upgrade/executor/include/firmware_download_executor.h index 9d11f0d1..a6120830 100644 --- a/services/firmware/upgrade/executor/include/firmware_download_executor.h +++ b/services/firmware/upgrade/executor/include/firmware_download_executor.h @@ -16,6 +16,7 @@ #ifndef FIRMWARE_DOWNLOAD_EXECUTOR_H #define FIRMWARE_DOWNLOAD_EXECUTOR_H +#include #include "firmware_component.h" #include "firmware_iexecutor.h" #include "firmware_task.h" @@ -24,14 +25,13 @@ namespace OHOS { namespace UpdateEngine { -// 防止下载重复提交,设置查询时间间隔 -const int32_t DOWNLOAD_SLEEP_MILLISECONDS = 200; class FirmwareDownloadExecutor : public FirmwareIExecutor { public: FirmwareDownloadExecutor(const DownloadOptions &downloadOptions, FirmwareProgressCallback progressCallback) : downloadOptions_(downloadOptions), firmwareProgressCallback_(progressCallback) {} ~FirmwareDownloadExecutor() = default; void Execute() final; + static bool isDownloading_; private: void DoDownload(); @@ -39,7 +39,6 @@ private: void PerformDownload(); void DownloadCallback(std::string serverUrl, std::string packageName, Progress progress); bool VerifyDownloadPkg(const std::string &pkgName, Progress &progress); - std::string GenerateDownloadTaskId(); private: DownloadOptions downloadOptions_; @@ -48,6 +47,7 @@ private: FirmwareTask tasks_; UpgradeStatus upgradeStatus_; std::shared_ptr downloadThread_ = nullptr; + static std::mutex downloadMutex_; }; } // namespace UpdateEngine } // namespace OHOS diff --git a/services/firmware/upgrade/executor/src/firmware_download_executor.cpp b/services/firmware/upgrade/executor/src/firmware_download_executor.cpp index 7e71e8c0..f4649c9c 100644 --- a/services/firmware/upgrade/executor/src/firmware_download_executor.cpp +++ b/services/firmware/upgrade/executor/src/firmware_download_executor.cpp @@ -34,6 +34,8 @@ namespace OHOS { namespace UpdateEngine { const mode_t MKDIR_MODE = 0777; +bool FirmwareDownloadExecutor::isDownloading_ = false; +std::mutex FirmwareDownloadExecutor::downloadMutex_; void FirmwareDownloadExecutor::Execute() { FIRMWARE_LOGI("FirmwareDownloadExecutor::Execute"); @@ -56,20 +58,19 @@ void FirmwareDownloadExecutor::DoDownload() GetTask(); if (tasks_.downloadTaskId.empty()) { // 首次触发下载 - std::this_thread::sleep_for(std::chrono::milliseconds(DOWNLOAD_SLEEP_MILLISECONDS)); - GetTask(); FIRMWARE_LOGI("FirmwareDownloadExecutor StartDownload"); - if (tasks_.downloadTaskId.empty()) { - std::string downloadTaskId = GenerateDownloadTaskId(); - FIRMWARE_LOGI("DoDownload: %{public}s", downloadTaskId.c_str()); - FirmwareTaskOperator().UpdateDownloadTaskIdByTaskId(tasks_.taskId, downloadTaskId); - } else { - FIRMWARE_LOGI("DoDownload Repeat subcommit"); - Progress progress; - progress.status = UpgradeStatus::DOWNLOADING; - progress.endReason = "not perrmit repeat submmit"; - firmwareProgressCallback_.progressCallback(progress); - return; + { + std::lock_guard lock(downloadMutex_); + FIRMWARE_LOGI("DoDownload isDownloading_ %{public}s", StringUtils::GetBoolStr(isDownloading_).c_str()); + if (isDownloading_) { + FIRMWARE_LOGI("DoDownload Repeat subcommit"); + Progress progress; + progress.status = UpgradeStatus::DOWNLOADING; + progress.endReason = "not perrmit repeat submmit"; + firmwareProgressCallback_.progressCallback(progress); + return; + } + isDownloading_ = true; } PerformDownload(); } else { @@ -190,21 +191,5 @@ bool FirmwareDownloadExecutor::VerifyDownloadPkg(const std::string &pkgName, Pro } return true; } - -std::string FirmwareDownloadExecutor::GenerateDownloadTaskId() -{ - std::vector downloadInfos; - std::vector components; - FirmwareComponentOperator().QueryAll(components); - for (const auto &component : components) { - downloadInfos.push_back(component.descriptPackageId); - } - sort(downloadInfos.begin(), downloadInfos.end()); - std::string srcString; - for (const auto &downloadInfo : downloadInfos) { - srcString += downloadInfo; - } - return Sha256Utils::CalculateHashCode(srcString); -} } // namespace UpdateEngine } // namespace OHOS diff --git a/services/firmware/upgrade/flow/src/firmware_manager.cpp b/services/firmware/upgrade/flow/src/firmware_manager.cpp index f53c19e1..48a7e2c7 100644 --- a/services/firmware/upgrade/flow/src/firmware_manager.cpp +++ b/services/firmware/upgrade/flow/src/firmware_manager.cpp @@ -34,6 +34,7 @@ #include "firmware_iexecute_mode.h" #include "firmware_log.h" #include "firmware_manual_check_mode.h" +#include "firmware_download_executor.h" #include "firmware_download_mode.h" #include "firmware_install_apply_mode.h" #include "firmware_status_cache.h" @@ -162,6 +163,7 @@ void FirmwareManager::DoCancelDownload(BusinessError &businessError) return; } ProgressThread::isCancel_ = true; + FirmwareDownloadExecutor::isDownloading_ = false; return; } @@ -203,6 +205,7 @@ void FirmwareManager::DoDownload(const DownloadOptions &downloadOptions, Busines std::shared_ptr executeMode = std::make_shared(downloadOptions, businessError, [=]() { FIRMWARE_LOGI("FirmwareManager DoDownload finish"); + FirmwareDownloadExecutor::isDownloading_ = false; delete flowManager; }); flowManager->SetExecuteMode(executeMode); -- Gitee From 3ea4dbcae0500fbcfcda72a000aa196a24e0d894 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Wed, 17 Jan 2024 18:43:55 +0800 Subject: [PATCH 07/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E6=8F=90=E4=BA=A4=20Signed-off-by:=20?= =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/ability/common/include/constant.h | 1 + .../status_cache/include/status_cache.h | 4 ++++ .../ability/status_cache/src/status_cache.cpp | 18 ++++++++++++++++++ .../include/update_service_impl_firmware.h | 1 + .../src/update_service_impl_firmware.cpp | 14 ++++++++++++++ .../include/firmware_download_executor.h | 2 -- .../src/firmware_download_executor.cpp | 16 ---------------- .../upgrade/flow/src/firmware_manager.cpp | 4 +--- .../status/include/firmware_status_cache.h | 3 ++- .../status/src/firmware_status_cache.cpp | 16 ++++++++++++++++ 10 files changed, 57 insertions(+), 22 deletions(-) diff --git a/services/core/ability/common/include/constant.h b/services/core/ability/common/include/constant.h index 20383f9c..257a3f1e 100644 --- a/services/core/ability/common/include/constant.h +++ b/services/core/ability/common/include/constant.h @@ -29,6 +29,7 @@ constexpr int32_t ONE_DAY_HOUR = 24; constexpr int32_t ONE_HOUR_MINUTES = 60; constexpr int32_t ONE_MINUTE_SECONDS = 60; constexpr int32_t FIVE_MINUTES_SECONDS = 5 * Constant::ONE_MINUTE_SECONDS; +constexpr int32_t ONE_SECONDS = 1; static const std::string DUPDATE_ENGINE_CONFIG_PATH = "/system/etc/update/dupdate_config.json"; diff --git a/services/core/ability/status_cache/include/status_cache.h b/services/core/ability/status_cache/include/status_cache.h index 1ab7136b..5a265ada 100644 --- a/services/core/ability/status_cache/include/status_cache.h +++ b/services/core/ability/status_cache/include/status_cache.h @@ -29,6 +29,8 @@ public: bool IsChecking(); void SetIsChecking(bool isChecking); + bool IsDownloading(); + void SetIsDownloading(bool isDownloading); private: int64_t GetCurrentTime(); @@ -37,6 +39,8 @@ private: std::shared_ptr timeUtilsProxy_ = nullptr; bool isChecking_ = false; int64_t lastCheckTime_ = -1; + bool isDownloading_ = false; + int64_t lastDownloadTime_ = -1; }; } // namespace UpdateEngine } // namespace OHOS diff --git a/services/core/ability/status_cache/src/status_cache.cpp b/services/core/ability/status_cache/src/status_cache.cpp index 9fdca16a..09d24532 100644 --- a/services/core/ability/status_cache/src/status_cache.cpp +++ b/services/core/ability/status_cache/src/status_cache.cpp @@ -45,5 +45,23 @@ int64_t StatusCache::GetCurrentTime() } return timeUtilsProxy_->GetTimestamp(); } + +bool StatusCache::IsDownloading() +{ + if (lastDownloadTime_ != -1 && abs(GetCurrentTime() - lastDownloadTime_) > Constant::ONE_SECONDS) { + // 当前时间与上次下载时间间隔超过1秒钟,允许再次触发下载 + ENGINE_LOGE("minus time is more than one seconds"); + return false; + } + return isDownloading_; +} + +void StatusCache::SetIsDownloading(bool isDownloading) +{ + isDownloading_ = isDownloading; + if (isDownloading_) { + lastDownloadTime_ = GetCurrentTime(); + } +} } // namespace UpdateEngine } // namespace OHOS diff --git a/services/engine/include/update_service_impl_firmware.h b/services/engine/include/update_service_impl_firmware.h index dc4e145b..90de8775 100644 --- a/services/engine/include/update_service_impl_firmware.h +++ b/services/engine/include/update_service_impl_firmware.h @@ -80,6 +80,7 @@ private: DelayedSingleton::GetInstance(); std::condition_variable conditionVariable_; std::mutex checkNewVersionMutex_; + static std::mutex downloadMutex_; bool checkComplete_ = false; void GetChangelogContent(std::string &dataXml, const std::string &language); }; diff --git a/services/engine/src/update_service_impl_firmware.cpp b/services/engine/src/update_service_impl_firmware.cpp index 0d293585..2ebb6e53 100644 --- a/services/engine/src/update_service_impl_firmware.cpp +++ b/services/engine/src/update_service_impl_firmware.cpp @@ -22,6 +22,7 @@ #include "firmware_component_operator.h" #include "firmware_log.h" #include "firmware_manager.h" +#include "firmware_status_cache.h" #include "firmware_task_operator.h" #include "device_adapter.h" #include "firmware_update_helper.h" @@ -34,6 +35,7 @@ namespace UpdateEngine { const std::string LANGUAGE_CHINESE = ""; const std::string LANGUAGE_ENGLISH = ""; const std::string LANGUAGE_END = ""; +std::mutex UpdateServiceImplFirmware::downloadMutex_; int32_t UpdateServiceImplFirmware::CheckNewVersion(const UpgradeInfo &info, BusinessError &businessError, CheckResult &checkResult) @@ -67,12 +69,23 @@ int32_t UpdateServiceImplFirmware::Download(const UpgradeInfo &info, const Versi { FIRMWARE_LOGI("Download allowNetwork:%{public}d order:%{public}d", CAST_INT(downloadOptions.allowNetwork), CAST_INT(downloadOptions.order)); + { + //控制1秒内重复提交下载 + std::lock_guard lock(downloadMutex_); + if (DelayedSingleton::GetInstance()->IsDownloading()) { + FIRMWARE_LOGI("on downloading, not perrmit repeat submmit"); + businessError.Build(CallResult::FAIL, "repeat download error"); + return INT_CALL_SUCCESS; + } + DelayedSingleton::GetInstance()->SetIsDownloading(true); + } FirmwareTask task; FirmwareTaskOperator firmwareTaskOperator; firmwareTaskOperator.QueryTask(task); if (task.status != UpgradeStatus::CHECK_VERSION_SUCCESS) { FIRMWARE_LOGI("download fail current status: %{public}d", CAST_INT(task.status)); businessError.Build(CallResult::FAIL, "download error"); + DelayedSingleton::GetInstance()->SetIsDownloading(false); return INT_CALL_SUCCESS; } @@ -287,6 +300,7 @@ int32_t UpdateServiceImplFirmware::Cancel(const UpgradeInfo &info, int32_t servi FIRMWARE_LOGI("Cancel fail current status: %{public}d", CAST_INT(task.status)); businessError.Build(CallResult::FAIL, "Cancel download error"); } else { + DelayedSingleton::GetInstance()->SetIsDownloading(false); DelayedSingleton::GetInstance()->DoCancelDownload(businessError); } return INT_CALL_SUCCESS; diff --git a/services/firmware/upgrade/executor/include/firmware_download_executor.h b/services/firmware/upgrade/executor/include/firmware_download_executor.h index a6120830..6280a948 100644 --- a/services/firmware/upgrade/executor/include/firmware_download_executor.h +++ b/services/firmware/upgrade/executor/include/firmware_download_executor.h @@ -31,7 +31,6 @@ public: : downloadOptions_(downloadOptions), firmwareProgressCallback_(progressCallback) {} ~FirmwareDownloadExecutor() = default; void Execute() final; - static bool isDownloading_; private: void DoDownload(); @@ -47,7 +46,6 @@ private: FirmwareTask tasks_; UpgradeStatus upgradeStatus_; std::shared_ptr downloadThread_ = nullptr; - static std::mutex downloadMutex_; }; } // namespace UpdateEngine } // namespace OHOS diff --git a/services/firmware/upgrade/executor/src/firmware_download_executor.cpp b/services/firmware/upgrade/executor/src/firmware_download_executor.cpp index f4649c9c..3b24149a 100644 --- a/services/firmware/upgrade/executor/src/firmware_download_executor.cpp +++ b/services/firmware/upgrade/executor/src/firmware_download_executor.cpp @@ -34,8 +34,6 @@ namespace OHOS { namespace UpdateEngine { const mode_t MKDIR_MODE = 0777; -bool FirmwareDownloadExecutor::isDownloading_ = false; -std::mutex FirmwareDownloadExecutor::downloadMutex_; void FirmwareDownloadExecutor::Execute() { FIRMWARE_LOGI("FirmwareDownloadExecutor::Execute"); @@ -58,20 +56,6 @@ void FirmwareDownloadExecutor::DoDownload() GetTask(); if (tasks_.downloadTaskId.empty()) { // 首次触发下载 - FIRMWARE_LOGI("FirmwareDownloadExecutor StartDownload"); - { - std::lock_guard lock(downloadMutex_); - FIRMWARE_LOGI("DoDownload isDownloading_ %{public}s", StringUtils::GetBoolStr(isDownloading_).c_str()); - if (isDownloading_) { - FIRMWARE_LOGI("DoDownload Repeat subcommit"); - Progress progress; - progress.status = UpgradeStatus::DOWNLOADING; - progress.endReason = "not perrmit repeat submmit"; - firmwareProgressCallback_.progressCallback(progress); - return; - } - isDownloading_ = true; - } PerformDownload(); } else { // 恢复下载 diff --git a/services/firmware/upgrade/flow/src/firmware_manager.cpp b/services/firmware/upgrade/flow/src/firmware_manager.cpp index 48a7e2c7..56f759a5 100644 --- a/services/firmware/upgrade/flow/src/firmware_manager.cpp +++ b/services/firmware/upgrade/flow/src/firmware_manager.cpp @@ -34,7 +34,6 @@ #include "firmware_iexecute_mode.h" #include "firmware_log.h" #include "firmware_manual_check_mode.h" -#include "firmware_download_executor.h" #include "firmware_download_mode.h" #include "firmware_install_apply_mode.h" #include "firmware_status_cache.h" @@ -163,7 +162,6 @@ void FirmwareManager::DoCancelDownload(BusinessError &businessError) return; } ProgressThread::isCancel_ = true; - FirmwareDownloadExecutor::isDownloading_ = false; return; } @@ -205,7 +203,7 @@ void FirmwareManager::DoDownload(const DownloadOptions &downloadOptions, Busines std::shared_ptr executeMode = std::make_shared(downloadOptions, businessError, [=]() { FIRMWARE_LOGI("FirmwareManager DoDownload finish"); - FirmwareDownloadExecutor::isDownloading_ = false; + DelayedSingleton::GetInstance()->SetIsDownloading(false); delete flowManager; }); flowManager->SetExecuteMode(executeMode); diff --git a/services/firmware/upgrade/status/include/firmware_status_cache.h b/services/firmware/upgrade/status/include/firmware_status_cache.h index 8b19781c..8eaf1357 100644 --- a/services/firmware/upgrade/status/include/firmware_status_cache.h +++ b/services/firmware/upgrade/status/include/firmware_status_cache.h @@ -28,7 +28,8 @@ class FirmwareStatusCache : public DelayedSingleton { public: bool IsChecking(); void SetIsChecking(bool isChecking); - + bool IsDownloading(); + void SetIsDownloading(bool isDownloading); private: std::shared_ptr statusCache_ = nullptr; }; diff --git a/services/firmware/upgrade/status/src/firmware_status_cache.cpp b/services/firmware/upgrade/status/src/firmware_status_cache.cpp index 8b436a2c..7759de71 100644 --- a/services/firmware/upgrade/status/src/firmware_status_cache.cpp +++ b/services/firmware/upgrade/status/src/firmware_status_cache.cpp @@ -46,5 +46,21 @@ void FirmwareStatusCache::SetIsChecking(bool isChecking) } statusCache_->SetIsChecking(isChecking); } + +bool FirmwareStatusCache::IsDownloading() +{ + if (statusCache_ == nullptr) { + return false; + } + return statusCache_->IsDownloading(); +} + +void FirmwareStatusCache::SetIsDownloading(bool isDownloading) +{ + if (statusCache_ == nullptr) { + return; + } + statusCache_->SetIsDownloading(isDownloading); +} } // namespace UpdateEngine } // namespace OHOS -- Gitee From 792d64d04cbda96639a6effe5e99ccf0cb03ceee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Thu, 18 Jan 2024 03:43:29 +0000 Subject: [PATCH 08/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E6=8F=90=E4=BA=A4=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- .../upgrade/executor/include/firmware_download_executor.h | 1 - 1 file changed, 1 deletion(-) diff --git a/services/firmware/upgrade/executor/include/firmware_download_executor.h b/services/firmware/upgrade/executor/include/firmware_download_executor.h index 6280a948..809affbb 100644 --- a/services/firmware/upgrade/executor/include/firmware_download_executor.h +++ b/services/firmware/upgrade/executor/include/firmware_download_executor.h @@ -16,7 +16,6 @@ #ifndef FIRMWARE_DOWNLOAD_EXECUTOR_H #define FIRMWARE_DOWNLOAD_EXECUTOR_H -#include #include "firmware_component.h" #include "firmware_iexecutor.h" #include "firmware_task.h" -- Gitee From b40fe4aa74ccc8fb104a612c846939f4f54fa826 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Thu, 18 Jan 2024 14:01:18 +0000 Subject: [PATCH 09/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- .../include/update_service_impl_firmware.h | 1 - .../engine/src/update_service_impl_firmware.cpp | 17 +++++++---------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/services/engine/include/update_service_impl_firmware.h b/services/engine/include/update_service_impl_firmware.h index 90de8775..dc4e145b 100644 --- a/services/engine/include/update_service_impl_firmware.h +++ b/services/engine/include/update_service_impl_firmware.h @@ -80,7 +80,6 @@ private: DelayedSingleton::GetInstance(); std::condition_variable conditionVariable_; std::mutex checkNewVersionMutex_; - static std::mutex downloadMutex_; bool checkComplete_ = false; void GetChangelogContent(std::string &dataXml, const std::string &language); }; diff --git a/services/engine/src/update_service_impl_firmware.cpp b/services/engine/src/update_service_impl_firmware.cpp index 2ebb6e53..9ef209c8 100644 --- a/services/engine/src/update_service_impl_firmware.cpp +++ b/services/engine/src/update_service_impl_firmware.cpp @@ -35,7 +35,6 @@ namespace UpdateEngine { const std::string LANGUAGE_CHINESE = ""; const std::string LANGUAGE_ENGLISH = ""; const std::string LANGUAGE_END = ""; -std::mutex UpdateServiceImplFirmware::downloadMutex_; int32_t UpdateServiceImplFirmware::CheckNewVersion(const UpgradeInfo &info, BusinessError &businessError, CheckResult &checkResult) @@ -69,16 +68,14 @@ int32_t UpdateServiceImplFirmware::Download(const UpgradeInfo &info, const Versi { FIRMWARE_LOGI("Download allowNetwork:%{public}d order:%{public}d", CAST_INT(downloadOptions.allowNetwork), CAST_INT(downloadOptions.order)); - { - //控制1秒内重复提交下载 - std::lock_guard lock(downloadMutex_); - if (DelayedSingleton::GetInstance()->IsDownloading()) { - FIRMWARE_LOGI("on downloading, not perrmit repeat submmit"); - businessError.Build(CallResult::FAIL, "repeat download error"); - return INT_CALL_SUCCESS; - } - DelayedSingleton::GetInstance()->SetIsDownloading(true); + //控制1秒内重复点击下载 + if (DelayedSingleton::GetInstance()->IsDownloading()) { + FIRMWARE_LOGI("on downloading, not perrmit repeat submmit"); + businessError.Build(CallResult::FAIL, "repeat download error"); + return INT_CALL_SUCCESS; } + DelayedSingleton::GetInstance()->SetIsDownloading(true); + FirmwareTask task; FirmwareTaskOperator firmwareTaskOperator; firmwareTaskOperator.QueryTask(task); -- Gitee From c7564435f0dc8e819cf32d829decc2424dfea5dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Fri, 19 Jan 2024 08:48:21 +0000 Subject: [PATCH 10/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E6=90=9C=E5=8C=85=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- services/engine/src/update_service_impl_firmware.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/services/engine/src/update_service_impl_firmware.cpp b/services/engine/src/update_service_impl_firmware.cpp index 9ef209c8..1a145618 100644 --- a/services/engine/src/update_service_impl_firmware.cpp +++ b/services/engine/src/update_service_impl_firmware.cpp @@ -60,6 +60,7 @@ int32_t UpdateServiceImplFirmware::CheckNewVersion(const UpgradeInfo &info, Busi businessError.errorNum = CallResult::TIME_OUT; businessError.message = "CheckNewVersion TimeOut"; } + weakPtr->checkComplete_ = false; return INT_CALL_SUCCESS; } -- Gitee From 88f92357c67bbf16a1f24b207c218b4a0993e189 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Sat, 20 Jan 2024 08:07:33 +0000 Subject: [PATCH 11/98] =?UTF-8?q?sdk=20=E8=B0=83=E6=95=B4=E7=BC=96?= =?UTF-8?q?=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- interfaces/inner_api/modulemgr/BUILD.gn | 2 +- services/core/ability/sqlite/sqlite.gni | 1 - services/engine/engine_sa.gni | 42 ++----------------------- services/firmware/firmware.gni | 5 +-- 4 files changed, 5 insertions(+), 45 deletions(-) diff --git a/interfaces/inner_api/modulemgr/BUILD.gn b/interfaces/inner_api/modulemgr/BUILD.gn index 4f3cfcc0..4bacef5e 100644 --- a/interfaces/inner_api/modulemgr/BUILD.gn +++ b/interfaces/inner_api/modulemgr/BUILD.gn @@ -34,6 +34,6 @@ ohos_shared_library("update_module_mgr") { part_name = "$updateengine_part_name" subsystem_name = "updater" cflags = modulemgr_cflags - + innerapi_tags = [ "sasdk" ] public_configs = [ ":module_mgr_library_native_config" ] } diff --git a/services/core/ability/sqlite/sqlite.gni b/services/core/ability/sqlite/sqlite.gni index 5cddb3f5..6d310d5f 100644 --- a/services/core/ability/sqlite/sqlite.gni +++ b/services/core/ability/sqlite/sqlite.gni @@ -29,7 +29,6 @@ if (relational_store_native_rdb_enable) { sqlite_external_deps += [ "relational_store:native_rdb" ] sqlite_include += [ "$sqlite_root_path/core/include", - "//foundation/distributeddatamgr/relational_store/interfaces/inner_api/rdb/include", ] sqlite_src += [ "$sqlite_root_path/core/src/sqlite_db.cpp" ] sqlite_defines += [ "RELATIONAL_STORE_NATIVE_RDB_ENABLE" ] diff --git a/services/engine/engine_sa.gni b/services/engine/engine_sa.gni index 72dc2f5a..7a738d16 100644 --- a/services/engine/engine_sa.gni +++ b/services/engine/engine_sa.gni @@ -123,37 +123,9 @@ sa_include_dirs = [ "//third_party/cJSON/", ] -if (!ability_ability_base_enable || !ability_ability_runtime_enable) { - sa_include_dirs += [ - "//foundation/ability/ability_base/interfaces/inner_api/base/include", - "//foundation/ability/ability_base/interfaces/kits/native/uri/include", - "//foundation/ability/ability_base/interfaces/kits/native/want/include", - "//foundation/ability/ability_runtime/frameworks/simulator/common/include", - "//foundation/ability/ability_runtime/interfaces/inner_api/ability_manager/include", - "//foundation/ability/ability_runtime/interfaces/inner_api/app_manager/include/appmgr", - "//foundation/ability/ability_runtime/interfaces/kits/native/ability/native", - "//foundation/bundlemanager/bundle_framework/interfaces/inner_api/appexecfwk_base/include", - ] -} - -if (!preference_native_preferences_enable) { - sa_include_dirs += [ - "//foundation/distributeddatamgr/preferences/interfaces/inner_api/include", - ] -} - -if (!communication_netmanager_base_enable) { - sa_include_dirs += [ - "//foundation/communication/netmanager_base/interfaces/innerkits/include", - "//foundation/communication/netmanager_base/interfaces/innerkits/netconnclient/include", - "//foundation/communication/netmanager_base/interfaces/innerkits/netconnclient/include/proxy", - ] -} - if (!relational_store_native_rdb_enable) { sa_include_dirs += [ "//base/update/updateservice/services/core/ability/sqlite/core/include", - "//foundation/distributeddatamgr/relational_store/interfaces/inner_api/rdb/include", ] } @@ -161,8 +133,6 @@ sa_include_dirs += firmware_include sa_include_dirs += sqlite_include sa_include_dirs += update_log_include sa_include_dirs += startup_include -sa_include_dirs += - [ "//base/update/updateservice/interfaces/innner_api/modulemgr/include" ] sa_deps = [ "$updateengine_root_path/interfaces/inner_api/modulemgr:update_module_mgr", @@ -191,8 +161,8 @@ sa_external_deps = [ "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", - "updater:libpackageExt", # "package/package.h" - "updater:libupdaterkits", # "updaterkits/updaterkits.h" + "updater:libpackage_shared", # "package/package.h" + "updater:libupdater_shared", # "updaterkits/updaterkits.h" ] if (ability_ability_base_enable) { @@ -204,12 +174,6 @@ if (ability_ability_base_enable) { if (ability_ability_runtime_enable) { sa_external_deps += [ "ability_runtime:ability_manager" ] } -if (communication_netmanager_base_enable) { - sa_external_deps += [ "netmanager_base:net_conn_manager_if" ] -} -if (preference_native_preferences_enable) { - sa_external_deps += [ "preferences:native_preferences" ] -} if (ability_ability_runtime_enable) { sa_external_deps += firmware_external_deps @@ -218,7 +182,7 @@ if (ability_ability_runtime_enable) { sa_external_deps += sqlite_external_deps sa_external_deps += update_log_external_deps sa_external_deps += startup_external_deps - +sa_external_deps += [ "relational_store:native_rdb" ] sa_public_deps = [] sa_public_deps += startup_public_deps diff --git a/services/firmware/firmware.gni b/services/firmware/firmware.gni index ad84eaaf..65d5be1b 100644 --- a/services/firmware/firmware.gni +++ b/services/firmware/firmware.gni @@ -17,10 +17,7 @@ import("$updateengine_root_path/services/core/ability/sqlite/sqlite.gni") firmware_root_path = "$updateengine_root_path/services/firmware" ab_update_include = [ - "//base/update/sys_installer/include", - "//base/update/sys_installer/interfaces/innerkits", "//base/update/sys_installer/interfaces/inner_api/include", - "//base/update/sys_installer/interfaces/innerkits/ipc_client/include", ] download_include = [ @@ -105,7 +102,7 @@ firmware_src += ab_update_src firmware_external_deps = [ "sys_installer:libsysinstallerkits" ] -ab_update_deps = [] +ab_update_deps = [ "ipc_client:libsysinstallerkits"] firmware_deps = [] firmware_deps += ab_update_deps -- Gitee From df2f65aaa43823a04fdb5c313839f640e7d55ba2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Sat, 20 Jan 2024 09:15:57 +0000 Subject: [PATCH 12/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- services/core/ability/sqlite/sqlite.gni | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/services/core/ability/sqlite/sqlite.gni b/services/core/ability/sqlite/sqlite.gni index 6d310d5f..07dece57 100644 --- a/services/core/ability/sqlite/sqlite.gni +++ b/services/core/ability/sqlite/sqlite.gni @@ -27,9 +27,7 @@ sqlite_src = [] if (relational_store_native_rdb_enable) { sqlite_root_path = "$updateengine_root_path/services/core/ability/sqlite" sqlite_external_deps += [ "relational_store:native_rdb" ] - sqlite_include += [ - "$sqlite_root_path/core/include", - ] + sqlite_include += [ "$sqlite_root_path/core/include" ] sqlite_src += [ "$sqlite_root_path/core/src/sqlite_db.cpp" ] sqlite_defines += [ "RELATIONAL_STORE_NATIVE_RDB_ENABLE" ] } -- Gitee From 808a5b1962c4dfe6b208bfb74eedffa8ad128911 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Sat, 20 Jan 2024 13:59:16 +0000 Subject: [PATCH 13/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9gn=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- services/firmware/firmware.gni | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/firmware/firmware.gni b/services/firmware/firmware.gni index 65d5be1b..ec37ab6e 100644 --- a/services/firmware/firmware.gni +++ b/services/firmware/firmware.gni @@ -102,7 +102,7 @@ firmware_src += ab_update_src firmware_external_deps = [ "sys_installer:libsysinstallerkits" ] -ab_update_deps = [ "ipc_client:libsysinstallerkits"] +ab_update_deps = [ "ipc_client:libsysinstallerkits" ] firmware_deps = [] firmware_deps += ab_update_deps -- Gitee From d32aed0378d256e4713fedbdaae8fbca2f7ee8c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Mon, 22 Jan 2024 00:42:44 +0000 Subject: [PATCH 14/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9gn=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- services/firmware/firmware.gni | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/services/firmware/firmware.gni b/services/firmware/firmware.gni index ec37ab6e..5c7e0c1a 100644 --- a/services/firmware/firmware.gni +++ b/services/firmware/firmware.gni @@ -16,9 +16,7 @@ import("$updateengine_root_path/services/core/ability/sqlite/sqlite.gni") firmware_root_path = "$updateengine_root_path/services/firmware" -ab_update_include = [ - "//base/update/sys_installer/interfaces/inner_api/include", -] +ab_update_include = [ "//base/update/sys_installer/interfaces/inner_api/include" ] download_include = [ "//base/update/updateservice/services/core/ability/download/data/include", -- Gitee From 4acae38ca2f7753da1c6c1db6cca15538c606e38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Mon, 22 Jan 2024 00:49:35 +0000 Subject: [PATCH 15/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9gn=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- services/firmware/firmware.gni | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/firmware/firmware.gni b/services/firmware/firmware.gni index 5c7e0c1a..199670aa 100644 --- a/services/firmware/firmware.gni +++ b/services/firmware/firmware.gni @@ -16,7 +16,9 @@ import("$updateengine_root_path/services/core/ability/sqlite/sqlite.gni") firmware_root_path = "$updateengine_root_path/services/firmware" -ab_update_include = [ "//base/update/sys_installer/interfaces/inner_api/include" ] +ab_update_include = [ + "//base/update/sys_installer/interfaces/inner_api/include", + ] download_include = [ "//base/update/updateservice/services/core/ability/download/data/include", -- Gitee From 39ad569bbb662b0a2e0d5adfbe1ed1d058ea8968 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Mon, 22 Jan 2024 01:02:40 +0000 Subject: [PATCH 16/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9gn=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- services/firmware/firmware.gni | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/services/firmware/firmware.gni b/services/firmware/firmware.gni index 199670aa..38cefabe 100644 --- a/services/firmware/firmware.gni +++ b/services/firmware/firmware.gni @@ -16,9 +16,8 @@ import("$updateengine_root_path/services/core/ability/sqlite/sqlite.gni") firmware_root_path = "$updateengine_root_path/services/firmware" -ab_update_include = [ - "//base/update/sys_installer/interfaces/inner_api/include", - ] +ab_update_include = + [ "//base/update/sys_installer/interfaces/inner_api/include" ] download_include = [ "//base/update/updateservice/services/core/ability/download/data/include", -- Gitee From 55491af3d21e5016767e6b9aa991a0c6d979b854 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Mon, 22 Jan 2024 01:16:00 +0000 Subject: [PATCH 17/98] =?UTF-8?q?gn=E6=A0=BC=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- services/firmware/firmware.gni | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/firmware/firmware.gni b/services/firmware/firmware.gni index 38cefabe..90543005 100644 --- a/services/firmware/firmware.gni +++ b/services/firmware/firmware.gni @@ -17,7 +17,7 @@ import("$updateengine_root_path/services/core/ability/sqlite/sqlite.gni") firmware_root_path = "$updateengine_root_path/services/firmware" ab_update_include = - [ "//base/update/sys_installer/interfaces/inner_api/include" ] + [ "//base/update/sys_installer/interfaces/inner_api/include" ] download_include = [ "//base/update/updateservice/services/core/ability/download/data/include", -- Gitee From e8bfee5025200a8eb5acdc6d93d5f2580412cb85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Mon, 22 Jan 2024 11:02:47 +0800 Subject: [PATCH 18/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20sdk=20=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=20Signed-off-by:=20=E9=82=B9=E5=8F=8B=E6=9D=BE=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/engine/engine_sa.gni | 14 ++++++++++---- services/firmware/firmware.gni | 6 +++--- updateengine.gni | 1 + 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/services/engine/engine_sa.gni b/services/engine/engine_sa.gni index 7a738d16..a113fe96 100644 --- a/services/engine/engine_sa.gni +++ b/services/engine/engine_sa.gni @@ -133,6 +133,8 @@ sa_include_dirs += firmware_include sa_include_dirs += sqlite_include sa_include_dirs += update_log_include sa_include_dirs += startup_include +sa_include_dirs += + [ "//base/update/updateservice/interfaces/innner_api/modulemgr/include" ] sa_deps = [ "$updateengine_root_path/interfaces/inner_api/modulemgr:update_module_mgr", @@ -161,8 +163,8 @@ sa_external_deps = [ "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", - "updater:libpackage_shared", # "package/package.h" - "updater:libupdater_shared", # "updaterkits/updaterkits.h" + "updater:libpackageExt", # "package/package.h" + "updater:libupdaterkits", # "updaterkits/updaterkits.h" ] if (ability_ability_base_enable) { @@ -175,6 +177,10 @@ if (ability_ability_runtime_enable) { sa_external_deps += [ "ability_runtime:ability_manager" ] } +sa_external_deps += [ "netmanager_base:net_conn_manager_if" ] +sa_external_deps += [ "preferences:native_preferences" ] +sa_external_deps += [ "relational_store:native_rdb" ] + if (ability_ability_runtime_enable) { sa_external_deps += firmware_external_deps } @@ -182,7 +188,7 @@ if (ability_ability_runtime_enable) { sa_external_deps += sqlite_external_deps sa_external_deps += update_log_external_deps sa_external_deps += startup_external_deps -sa_external_deps += [ "relational_store:native_rdb" ] + sa_public_deps = [] sa_public_deps += startup_public_deps @@ -209,4 +215,4 @@ sa_cflags = [ "-fPIC", "-Os", "-Werror", -] +] \ No newline at end of file diff --git a/services/firmware/firmware.gni b/services/firmware/firmware.gni index 90543005..e9358e9a 100644 --- a/services/firmware/firmware.gni +++ b/services/firmware/firmware.gni @@ -17,10 +17,10 @@ import("$updateengine_root_path/services/core/ability/sqlite/sqlite.gni") firmware_root_path = "$updateengine_root_path/services/firmware" ab_update_include = - [ "//base/update/sys_installer/interfaces/inner_api/include" ] + [ "$updateengine_sysinstaller_path/interfaces/inner_api/include" ] download_include = [ - "//base/update/updateservice/services/core/ability/download/data/include", + "$updateengine_root_path/services/core/ability/download/data/include", ] firmware_include = [ @@ -101,7 +101,7 @@ firmware_src += ab_update_src firmware_external_deps = [ "sys_installer:libsysinstallerkits" ] -ab_update_deps = [ "ipc_client:libsysinstallerkits" ] +ab_update_deps = [] firmware_deps = [] firmware_deps += ab_update_deps diff --git a/updateengine.gni b/updateengine.gni index 5af8a006..656b23bd 100644 --- a/updateengine.gni +++ b/updateengine.gni @@ -21,5 +21,6 @@ updateengine_test_name = "update_service_test" updateengine_unittest_name = "update_service_unittest" updateengine_adapter_config = "$updateengine_root_path/adapter/default_config/feature_config" +updateengine_sysinstaller_path = "//base/update/sys_installer" import("$updateengine_adapter_config/standard/config.gni") -- Gitee From 4e1c572a12fcbf03e9aeedcef5f80d9caecce6c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Mon, 22 Jan 2024 03:49:01 +0000 Subject: [PATCH 19/98] =?UTF-8?q?gn=E4=BF=AE=E6=94=B9=EF=BC=8C=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=9B=9E=E8=BD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- services/engine/engine_sa.gni | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/engine/engine_sa.gni b/services/engine/engine_sa.gni index a113fe96..30bc422c 100644 --- a/services/engine/engine_sa.gni +++ b/services/engine/engine_sa.gni @@ -215,4 +215,4 @@ sa_cflags = [ "-fPIC", "-Os", "-Werror", -] \ No newline at end of file +] -- Gitee From e418a5b6d6a1367521cc5b2fc2e626b43b3d5121 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Mon, 22 Jan 2024 06:02:06 +0000 Subject: [PATCH 20/98] =?UTF-8?q?gn=E6=A0=BC=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- services/firmware/firmware.gni | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/services/firmware/firmware.gni b/services/firmware/firmware.gni index e9358e9a..785f6da4 100644 --- a/services/firmware/firmware.gni +++ b/services/firmware/firmware.gni @@ -19,9 +19,8 @@ firmware_root_path = "$updateengine_root_path/services/firmware" ab_update_include = [ "$updateengine_sysinstaller_path/interfaces/inner_api/include" ] -download_include = [ - "$updateengine_root_path/services/core/ability/download/data/include", -] +download_include = + [ "$updateengine_root_path/services/core/ability/download/data/include" ] firmware_include = [ "$firmware_root_path/alarm/include", -- Gitee From 3ecef0d71b616477530478276ced10c5c8cfc925 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Mon, 22 Jan 2024 20:07:48 +0800 Subject: [PATCH 21/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9sdk=20=E5=8F=8Amini?= =?UTF-8?q?=E8=A7=A3=E8=80=A6=20Signed-off-by:=20=E9=82=B9=E5=8F=8B?= =?UTF-8?q?=E6=9D=BE=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature_config/standard/config.gni | 4 + services/core/ability/log/log.gni | 5 +- services/engine/engine_sa.gni | 18 +-- .../engine/src/update_service_restorer.cpp | 2 + .../data/db/src/firmware_task_table_empty.cpp | 1 - .../src/firmware_event_listener_empty.cpp | 45 ++++++ services/firmware/firmware.gni | 29 ++-- .../firmware_check_data_processor_empty.cpp | 136 ++++++++++++++++++ .../upgrade/flow/src/firmware_manager.cpp | 4 + .../mode/src/firmware_download_mode_empty.cpp | 90 ++++++++++++ .../src/firmware_install_apply_mode_empty.cpp | 103 +++++++++++++ .../src/firmware_manual_check_mode_empty.cpp | 60 ++++++++ services/utils/include/dupdate_net_manager.h | 4 + updateengine.gni | 1 - 14 files changed, 482 insertions(+), 20 deletions(-) create mode 100644 services/firmware/event/src/firmware_event_listener_empty.cpp create mode 100644 services/firmware/upgrade/data_processor/src/firmware_check_data_processor_empty.cpp create mode 100644 services/firmware/upgrade/mode/src/firmware_download_mode_empty.cpp create mode 100644 services/firmware/upgrade/mode/src/firmware_install_apply_mode_empty.cpp create mode 100644 services/firmware/upgrade/mode/src/firmware_manual_check_mode_empty.cpp diff --git a/adapter/default_config/feature_config/standard/config.gni b/adapter/default_config/feature_config/standard/config.gni index 2598c14f..e333d5a8 100644 --- a/adapter/default_config/feature_config/standard/config.gni +++ b/adapter/default_config/feature_config/standard/config.gni @@ -22,4 +22,8 @@ declare_args() { if (!defined(global_parts_info.ability_ability_runtime)) { ability_ability_runtime_enable = false } + communication_netmanager_base_enable = true + if (!defined(global_parts_info.communication_netmanager_base)) { + communication_netmanager_base_enable = false + } } diff --git a/services/core/ability/log/log.gni b/services/core/ability/log/log.gni index be71f6e1..4da93736 100644 --- a/services/core/ability/log/log.gni +++ b/services/core/ability/log/log.gni @@ -15,7 +15,10 @@ import("//base/update/updateservice/updateengine.gni") update_log_root_path = "$updateengine_root_path/services/core/ability/log" -update_log_external_deps = [ "hilog:libhilog" ] +update_log_external_deps = [ + "hilog:libhilog", + "updater:libupdaterlog_shared", +] update_log_deps = [] update_log_include = [ "$update_log_root_path/include" ] update_log_src = [ "$update_log_root_path/src/update_log.cpp" ] diff --git a/services/engine/engine_sa.gni b/services/engine/engine_sa.gni index 30bc422c..e440a68e 100644 --- a/services/engine/engine_sa.gni +++ b/services/engine/engine_sa.gni @@ -24,10 +24,6 @@ declare_args() { ability_ability_base_enable = false } - communication_netmanager_base_enable = true - if (!defined(global_parts_info.communication_netmanager_base)) { - communication_netmanager_base_enable = false - } preference_native_preferences_enable = true if (!defined(global_parts_info.distributeddatamgr_preferences)) { preference_native_preferences_enable = false @@ -163,8 +159,8 @@ sa_external_deps = [ "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", - "updater:libpackageExt", # "package/package.h" - "updater:libupdaterkits", # "updaterkits/updaterkits.h" + "updater:libpackage_shared", # "package/package.h" + "updater:libupdater_shared", # "updaterkits/updaterkits.h" ] if (ability_ability_base_enable) { @@ -177,9 +173,13 @@ if (ability_ability_runtime_enable) { sa_external_deps += [ "ability_runtime:ability_manager" ] } -sa_external_deps += [ "netmanager_base:net_conn_manager_if" ] -sa_external_deps += [ "preferences:native_preferences" ] -sa_external_deps += [ "relational_store:native_rdb" ] +if (communication_netmanager_base_enable) { + sa_external_deps += [ "netmanager_base:net_conn_manager_if" ] +} + +if (preference_native_preferences_enable) { + sa_external_deps += [ "preferences:native_preferences" ] +} if (ability_ability_runtime_enable) { sa_external_deps += firmware_external_deps diff --git a/services/engine/src/update_service_restorer.cpp b/services/engine/src/update_service_restorer.cpp index 37a8fad7..47c37ffa 100644 --- a/services/engine/src/update_service_restorer.cpp +++ b/services/engine/src/update_service_restorer.cpp @@ -15,7 +15,9 @@ #include "update_service_restorer.h" +#ifndef UPDATER_FUZZ #include "fs_manager/mount.h" +#endif #include "updaterkits/updaterkits.h" #include "update_define.h" diff --git a/services/firmware/data/db/src/firmware_task_table_empty.cpp b/services/firmware/data/db/src/firmware_task_table_empty.cpp index d14701f6..64d723a7 100644 --- a/services/firmware/data/db/src/firmware_task_table_empty.cpp +++ b/services/firmware/data/db/src/firmware_task_table_empty.cpp @@ -15,7 +15,6 @@ #include "firmware_task_table.h" -#include "itable.h" #include "update_define.h" namespace OHOS { diff --git a/services/firmware/event/src/firmware_event_listener_empty.cpp b/services/firmware/event/src/firmware_event_listener_empty.cpp new file mode 100644 index 00000000..8e176dfd --- /dev/null +++ b/services/firmware/event/src/firmware_event_listener_empty.cpp @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "firmware_event_listener.h" + +#include "constant.h" +#include "firmware_log.h" +#include "firmware_manager.h" +#include "update_define.h" + +namespace OHOS { +namespace UpdateEngine { +FirmwareEventListener::FirmwareEventListener() +{ + FIRMWARE_LOGD("FirmwareEventListener::FirmwareEventListener"); +} + +FirmwareEventListener::~FirmwareEventListener() +{ + FIRMWARE_LOGD("FirmwareEventListener::~FirmwareEventListener"); +} + +void FirmwareEventListener::RegisterNetChangedListener() +{ + FIRMWARE_LOGI("FirmwareEventListener RegisterNetChangedListener"); +} + +void FirmwareEventListener::UnregisterNetChangedListener() +{ + FIRMWARE_LOGI("FirmwareEventListener UnregisterNetChangedListener"); +} +} // namespace UpdateEngine +} // namespace OHOS \ No newline at end of file diff --git a/services/firmware/firmware.gni b/services/firmware/firmware.gni index 785f6da4..4f6b72c6 100644 --- a/services/firmware/firmware.gni +++ b/services/firmware/firmware.gni @@ -17,10 +17,10 @@ import("$updateengine_root_path/services/core/ability/sqlite/sqlite.gni") firmware_root_path = "$updateengine_root_path/services/firmware" ab_update_include = - [ "$updateengine_sysinstaller_path/interfaces/inner_api/include" ] + [ "//base/update/sys_installer/interfaces/inner_api/include" ] download_include = - [ "$updateengine_root_path/services/core/ability/download/data/include" ] + [ "//base/update/updateservice/services/core/ability/download/data/include" ] firmware_include = [ "$firmware_root_path/alarm/include", @@ -55,8 +55,6 @@ firmware_src = [ "$firmware_root_path/callback/src/firmware_callback_utils.cpp", "$firmware_root_path/common/src/firmware_update_helper.cpp", "$firmware_root_path/data/manager/src/firmware_preferences_utils.cpp", - "$firmware_root_path/event/src/firmware_event_listener.cpp", - "$firmware_root_path/upgrade/data_processor/src/firmware_check_data_processor.cpp", "$firmware_root_path/upgrade/data_processor/src/firmware_download_data_processor.cpp", "$firmware_root_path/upgrade/data_processor/src/firmware_install_data_processor.cpp", "$firmware_root_path/upgrade/executor/src/firmware_apply_executor.cpp", @@ -68,9 +66,6 @@ firmware_src = [ "$firmware_root_path/upgrade/install/src/firmware_install.cpp", "$firmware_root_path/upgrade/install/src/firmware_updater_install.cpp", "$firmware_root_path/upgrade/install/src/firmware_install_factory.cpp", - "$firmware_root_path/upgrade/mode/src/firmware_manual_check_mode.cpp", - "$firmware_root_path/upgrade/mode/src/firmware_download_mode.cpp", - "$firmware_root_path/upgrade/mode/src/firmware_install_apply_mode.cpp", "$firmware_root_path/upgrade/status/src/firmware_status_cache.cpp", "$firmware_root_path/upgrade/status/src/firmware_result_process.cpp", "$firmware_root_path/utils/src/firmware_check_analyze_utils.cpp", @@ -78,6 +73,24 @@ firmware_src = [ "$firmware_root_path/utils/src/firmware_combine_version_utils.cpp", ] +if (communication_netmanager_base_enable) { + firmware_src += [ + "$firmware_root_path/event/src/firmware_event_listener.cpp", + "$firmware_root_path/upgrade/data_processor/src/firmware_check_data_processor.cpp", + "$firmware_root_path/upgrade/mode/src/firmware_download_mode.cpp", + "$firmware_root_path/upgrade/mode/src/firmware_manual_check_mode.cpp", + "$firmware_root_path/upgrade/mode/src/firmware_install_apply_mode.cpp", + ] +} else { + firmware_src += [ + "$firmware_root_path/event/src/firmware_event_listener_empty.cpp", + "$firmware_root_path/upgrade/data_processor/src/firmware_check_data_processor_empty.cpp", + "$firmware_root_path/upgrade/mode/src/firmware_download_mode_empty.cpp", + "$firmware_root_path/upgrade/mode/src/firmware_manual_check_mode_empty.cpp", + "$firmware_root_path/upgrade/mode/src/firmware_install_apply_mode_empty.cpp", + ] +} + if (relational_store_native_rdb_enable) { firmware_src += [ "$firmware_root_path/data/db/src/firmware_component_operator.cpp", @@ -98,7 +111,7 @@ if (relational_store_native_rdb_enable) { } firmware_src += ab_update_src -firmware_external_deps = [ "sys_installer:libsysinstallerkits" ] +firmware_external_deps = [ "sys_installer:libsysinstaller_shared" ] ab_update_deps = [] diff --git a/services/firmware/upgrade/data_processor/src/firmware_check_data_processor_empty.cpp b/services/firmware/upgrade/data_processor/src/firmware_check_data_processor_empty.cpp new file mode 100644 index 00000000..b0cb4a18 --- /dev/null +++ b/services/firmware/upgrade/data_processor/src/firmware_check_data_processor_empty.cpp @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "firmware_check_data_processor.h" + +#include "config_parse.h" +#include "constant.h" +#include "firmware_changelog_utils.h" +#include "firmware_combine_version_utils.h" +#include "firmware_common.h" +#include "firmware_component_operator.h" +#include "firmware_constant.h" +#include "firmware_callback_utils.h" +#include "firmware_log.h" +#include "firmware_task_operator.h" +#include "device_adapter.h" +#include "firmware_update_helper.h" +#include "string_utils.h" +#include "time_utils.h" +#include "update_helper.h" + +namespace OHOS { +namespace UpdateEngine { +FirmwareCheckDataProcessor::FirmwareCheckDataProcessor() +{ + FIRMWARE_LOGD("FirmwareCheckDataProcessor::FirmwareCheckDataProcessor"); +} + +FirmwareCheckDataProcessor::~FirmwareCheckDataProcessor() +{ + FIRMWARE_LOGD("FirmwareCheckDataProcessor::~FirmwareCheckDataProcessor"); +} + +void FirmwareCheckDataProcessor::SetCheckResult( + CheckStatus status, const Duration &duration, const std::vector &componentList) +{ + FIRMWARE_LOGI("FirmwareCheckDataProcessor::SetCheckResult status %{public}d duration %{public}d", + static_cast(status), duration.duration); + status_ = status; + duration_ = duration; + componentList_ = componentList; +} + +bool FirmwareCheckDataProcessor::IsCheckFailed() +{ + return true; +} + +bool FirmwareCheckDataProcessor::HasNewVersion() +{ + return !componentList_.empty(); +} + +bool FirmwareCheckDataProcessor::IsSameWithDb() +{ + return true; +} + +void FirmwareCheckDataProcessor::HandleCheckResult() +{ + FIRMWARE_LOGI("FirmwareCheckDataProcessor HandleCheckResult"); +} + +bool FirmwareCheckDataProcessor::HasUndoneTask() +{ + FIRMWARE_LOGI("HasUndoneTask"); + return true; +} + +bool FirmwareCheckDataProcessor::IsUpdateOnStatus() +{ + return true; +} + +void FirmwareCheckDataProcessor::HandleNewVersion() +{ + FIRMWARE_LOGI("FirmwareCheckDataProcessor::HandleNewVersion"); +} + +void FirmwareCheckDataProcessor::BuildComponentSPath() +{ + FIRMWARE_LOGI("FirmwareCheckDataProcessor::BuildComponentSPath"); +} + +bool FirmwareCheckDataProcessor::IsVersionSameWithDb() +{ + return true; +} + +void FirmwareCheckDataProcessor::UpdateFirmwareComponent() +{ + FIRMWARE_LOGI("FirmwareCheckDataProcessor::UpdateFirmwareComponent"); +} + +void FirmwareCheckDataProcessor::HandleNoNewVersion() +{ + FIRMWARE_LOGI("FirmwareCheckDataProcessor::HandleNoNewVersion"); + isSameWithDb_ = IsVersionSameWithDb(); +} + +CombinationType FirmwareCheckDataProcessor::GetCombinationType() +{ + uint32_t combinationType = CAST_UINT(CombinationType::INVALLID_TYPE); + FIRMWARE_LOGI("CombinationType::%{public}u", combinationType); + return static_cast(combinationType); +} + +void FirmwareCheckDataProcessor::RefreshPollingCycle() +{ + FIRMWARE_LOGI("FirmwareCheckDataProcessor::RefreshPollingCycle"); +} + +void FirmwareCheckDataProcessor::BuildCheckResult(CheckResult &checkResult) +{ + FIRMWARE_LOGI("FirmwareCheckDataProcessor::BuildCheckResult"); +} + +void FirmwareCheckDataProcessor::BuildVersionDigest( + NewVersionInfo &newVersionInfo, const std::vector &componentList) +{ + FIRMWARE_LOGI("FirmwareCheckDataProcessor::BuildVersionDigest"); +} +} // namespace UpdateEngine +} // namespace OHOS \ No newline at end of file diff --git a/services/firmware/upgrade/flow/src/firmware_manager.cpp b/services/firmware/upgrade/flow/src/firmware_manager.cpp index f53c19e1..b6fca874 100644 --- a/services/firmware/upgrade/flow/src/firmware_manager.cpp +++ b/services/firmware/upgrade/flow/src/firmware_manager.cpp @@ -22,7 +22,9 @@ #include "config_parse.h" #include "dupdate_errno.h" #include "dupdate_upgrade_helper.h" +#ifdef NATIVE_PREFERENCES_ENABLE #include "dupdate_net_manager.h" +#endif #include "file_utils.h" #include "firmware_callback_utils.h" #include "firmware_changelog_utils.h" @@ -314,6 +316,7 @@ void FirmwareManager::HandleBootComplete() void FirmwareManager::HandleNetChanged() { FIRMWARE_LOGI("HandleNetChanged"); + #ifdef NATIVE_PREFERENCES_ENABLE if (!DelayedSingleton::GetInstance()->IsNetAvailable()) { FIRMWARE_LOGE("HandleNetChanged network not available."); ProgressThread::isNoNet_ = true; @@ -342,6 +345,7 @@ void FirmwareManager::HandleNetChanged() DoAutoDownload(task); } } + #endif } // updater调用后正常启动 diff --git a/services/firmware/upgrade/mode/src/firmware_download_mode_empty.cpp b/services/firmware/upgrade/mode/src/firmware_download_mode_empty.cpp new file mode 100644 index 00000000..7da37447 --- /dev/null +++ b/services/firmware/upgrade/mode/src/firmware_download_mode_empty.cpp @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "firmware_download_mode.h" + +#include "dupdate_errno.h" +#include "firmware_callback_utils.h" +#include "firmware_common.h" +#include "firmware_constant.h" +#include "firmware_log.h" +#include "firmware_preferences_utils.h" +#include "firmware_status_cache.h" +#include "firmware_task_operator.h" +#include "firmware_update_helper.h" +#include "update_helper.h" + +namespace OHOS { +namespace UpdateEngine { +FirmwareStep FirmwareDownloadMode::GetNextStep(FirmwareStep step) +{ + FIRMWARE_LOGI("GetNextStep %{public}d", static_cast(step)); + return step; +} + +FirmwareStep FirmwareDownloadMode::GetStepAfterInit() +{ + return FirmwareStep::DOWNLOAD_STEP; +} + +FirmwareStep FirmwareDownloadMode::GetStepAfterDownload() +{ + FIRMWARE_LOGI("GetStepAfterDownload downloadOptions %{public}d", CAST_INT(downloadOptions_.order)); + return FirmwareStep::COMPLETE;; +} + +void FirmwareDownloadMode::DownloadPauseProcess(const FirmwareTask &task, const ErrorMessage &errorMessage) +{ + FIRMWARE_LOGI("GetStepAfterDownload download pause"); +} + +void FirmwareDownloadMode::DownloadFailProcess(const FirmwareTask &task, const ErrorMessage &errorMessage) +{ + FIRMWARE_LOGI("GetStepAfterDownload download fail"); +} + +void FirmwareDownloadMode::DownloadCancelProcess(const FirmwareTask &task, const ErrorMessage &errorMessage) +{ + FIRMWARE_LOGI("GetStepAfterDownload download cancel"); +} + +void FirmwareDownloadMode::DownloadSucessProcess(const FirmwareTask &task, const ErrorMessage &errorMessage) +{ + FIRMWARE_LOGI("GetStepAfterDownload download success"); +} + +void FirmwareDownloadMode::GetTask() +{ + FIRMWARE_LOGI("FirmwareDownloadMode::GetTask"); + businessError_.Build(CallResult::FAIL, "no task!"); +} + +void FirmwareDownloadMode::HandleComplete() +{ + FIRMWARE_LOGI("FirmwareDownloadMode::HandleComplete"); + onExecuteFinishCallback_(); +} + +DownloadOptions FirmwareDownloadMode::GetDownloadOptions() +{ + return downloadOptions_; +} + +void FirmwareDownloadMode::SetDownloadProgress(const Progress &progress) +{ + downloadDataProcessor_.SetDownloadProgress(progress); +} +} // namespace UpdateEngine +} // namespace OHOS \ No newline at end of file diff --git a/services/firmware/upgrade/mode/src/firmware_install_apply_mode_empty.cpp b/services/firmware/upgrade/mode/src/firmware_install_apply_mode_empty.cpp new file mode 100644 index 00000000..026d6ea0 --- /dev/null +++ b/services/firmware/upgrade/mode/src/firmware_install_apply_mode_empty.cpp @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "firmware_install_apply_mode.h" + +#include + +#include "dupdate_errno.h" +#include "dupdate_upgrade_helper.h" +#include "firmware_callback_utils.h" +#include "firmware_changelog_utils.h" +#include "firmware_common.h" +#include "firmware_component_operator.h" +#include "firmware_constant.h" +#include "firmware_log.h" +#include "firmware_preferences_utils.h" +#include "firmware_status_cache.h" +#include "firmware_task_operator.h" +#include "firmware_update_helper.h" +#include "update_helper.h" + +namespace OHOS { +namespace UpdateEngine { +FirmwareStep FirmwareInstallApplyMode::GetNextStep(FirmwareStep step) +{ + FIRMWARE_LOGI("GetNextStep %{public}d", static_cast(step)); + return step; +} + +FirmwareStep FirmwareInstallApplyMode::GetStepAfterInit() +{ + return FirmwareStep::COMPLETE; +} + +FirmwareStep FirmwareInstallApplyMode::GetStepForInstallAndApplyOrder() +{ + return FirmwareStep::INSTALL_STEP; +} + +bool FirmwareInstallApplyMode::IsAllowInstall() +{ + return true; +} + +bool FirmwareInstallApplyMode::IsUpgradeFilesReady() +{ + return true; +} + +FirmwareStep FirmwareInstallApplyMode::GetStepAfterInstall() +{ + return FirmwareStep::COMPLETE; +} + +FirmwareStep FirmwareInstallApplyMode::GetStepAfterApply() +{ + return FirmwareStep::COMPLETE; +} + +void FirmwareInstallApplyMode::GetTask() +{ + FIRMWARE_LOGI("FirmwareInstallApplyMode::GetTask"); + businessError_.Build(CallResult::FAIL, "no task!"); +} + +void FirmwareInstallApplyMode::HandleComplete() +{ + onExecuteFinishCallback_(); +} + +UpgradeOptions FirmwareInstallApplyMode::GetUpgradeOptions() +{ + return upgradeOptions_; +} + +InstallType FirmwareInstallApplyMode::GetInstallType() +{ + return installType_; +} + +void FirmwareInstallApplyMode::SetInstallResult(const InstallCallbackInfo &installCallbackInfo) +{ + installStepDataProcessor_.SetInstallResult(installCallbackInfo); +} + +void FirmwareInstallApplyMode::SetApplyResult(bool isSuccess) +{ + FIRMWARE_LOGI("SetApplyResult isSuccess: %{public}s", isSuccess ? "success" : "fail"); +} +} // namespace UpdateEngine +} // namespace OHOS \ No newline at end of file diff --git a/services/firmware/upgrade/mode/src/firmware_manual_check_mode_empty.cpp b/services/firmware/upgrade/mode/src/firmware_manual_check_mode_empty.cpp new file mode 100644 index 00000000..0847c612 --- /dev/null +++ b/services/firmware/upgrade/mode/src/firmware_manual_check_mode_empty.cpp @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "firmware_manual_check_mode.h" + +#include "dupdate_errno.h" +#include "firmware_callback_utils.h" +#include "firmware_common.h" +#include "firmware_constant.h" +#include "firmware_log.h" +#include "firmware_manager.h" +#include "firmware_preferences_utils.h" +#include "firmware_status_cache.h" +#include "firmware_task.h" +#include "firmware_task_operator.h" +#include "update_helper.h" + +namespace OHOS { +namespace UpdateEngine { +FirmwareStep FirmwareManualCheckMode::GetNextStep(FirmwareStep step) +{ + FIRMWARE_LOGI("GetNextStep %{public}d", static_cast(step)); + return step; +} + +FirmwareStep FirmwareManualCheckMode::GetStepAfterInit() +{ + return FirmwareStep::CHECK_STEP; +} + +FirmwareStep FirmwareManualCheckMode::GetStepAfterCheck() +{ + return FirmwareStep::COMPLETE; +} + +void FirmwareManualCheckMode::SetCheckResult( + CheckStatus status, const Duration &duration, const std::vector &componentList, + const CheckAndAuthInfo &checkAndAuthInfo) +{ + FIRMWARE_LOGI("FirmwareManualCheckMode::SetCheckResult %{public}d", static_cast(status)); +} + +void FirmwareManualCheckMode::HandleComplete() +{ + FIRMWARE_LOGI("FirmwareManualCheckMode::HandleComplete"); +} +} // namespace UpdateEngine +} // namespace OHOS \ No newline at end of file diff --git a/services/utils/include/dupdate_net_manager.h b/services/utils/include/dupdate_net_manager.h index 43a462a9..8ab584df 100644 --- a/services/utils/include/dupdate_net_manager.h +++ b/services/utils/include/dupdate_net_manager.h @@ -21,7 +21,9 @@ #include #include "dupdate_inet_observer.h" +#ifdef NETMANAGER_BASE_ENABLE #include "dupdate_net_observer.h" +#endif namespace OHOS { namespace UpdateEngine { @@ -49,7 +51,9 @@ public: private: bool IsBaseNetType(NetType netType); +#ifdef NETMANAGER_BASE_ENABLE sptr observer_ = nullptr; +#endif std::mutex netChangeMutex_; NetType netType_ = NetType::NO_NET; std::map netChangeCallbackMap_; diff --git a/updateengine.gni b/updateengine.gni index 656b23bd..5af8a006 100644 --- a/updateengine.gni +++ b/updateengine.gni @@ -21,6 +21,5 @@ updateengine_test_name = "update_service_test" updateengine_unittest_name = "update_service_unittest" updateengine_adapter_config = "$updateengine_root_path/adapter/default_config/feature_config" -updateengine_sysinstaller_path = "//base/update/sys_installer" import("$updateengine_adapter_config/standard/config.gni") -- Gitee From 88ac4c5b2ccf21ba0444450f5e09e6db84546da9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Mon, 22 Jan 2024 12:25:17 +0000 Subject: [PATCH 22/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9gn=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- services/core/ability/log/log.gni | 4 ++-- .../upgrade/mode/src/firmware_download_mode_empty.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/services/core/ability/log/log.gni b/services/core/ability/log/log.gni index 4da93736..7c482c33 100644 --- a/services/core/ability/log/log.gni +++ b/services/core/ability/log/log.gni @@ -16,8 +16,8 @@ import("//base/update/updateservice/updateengine.gni") update_log_root_path = "$updateengine_root_path/services/core/ability/log" update_log_external_deps = [ - "hilog:libhilog", - "updater:libupdaterlog_shared", + "hilog:libhilog", + "updater:libupdaterlog_shared", ] update_log_deps = [] update_log_include = [ "$update_log_root_path/include" ] diff --git a/services/firmware/upgrade/mode/src/firmware_download_mode_empty.cpp b/services/firmware/upgrade/mode/src/firmware_download_mode_empty.cpp index 7da37447..839ea508 100644 --- a/services/firmware/upgrade/mode/src/firmware_download_mode_empty.cpp +++ b/services/firmware/upgrade/mode/src/firmware_download_mode_empty.cpp @@ -42,7 +42,7 @@ FirmwareStep FirmwareDownloadMode::GetStepAfterInit() FirmwareStep FirmwareDownloadMode::GetStepAfterDownload() { FIRMWARE_LOGI("GetStepAfterDownload downloadOptions %{public}d", CAST_INT(downloadOptions_.order)); - return FirmwareStep::COMPLETE;; + return FirmwareStep::COMPLETE; } void FirmwareDownloadMode::DownloadPauseProcess(const FirmwareTask &task, const ErrorMessage &errorMessage) -- Gitee From 260ce8490f6e5eb66f896cefc058bcfe578de692 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Mon, 22 Jan 2024 12:37:45 +0000 Subject: [PATCH 23/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9gn=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- services/firmware/firmware.gni | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/firmware/firmware.gni b/services/firmware/firmware.gni index 4f6b72c6..f8146828 100644 --- a/services/firmware/firmware.gni +++ b/services/firmware/firmware.gni @@ -19,8 +19,9 @@ firmware_root_path = "$updateengine_root_path/services/firmware" ab_update_include = [ "//base/update/sys_installer/interfaces/inner_api/include" ] -download_include = - [ "//base/update/updateservice/services/core/ability/download/data/include" ] +download_include = [ + "//base/update/updateservice/services/core/ability/download/data/include", + ] firmware_include = [ "$firmware_root_path/alarm/include", -- Gitee From e54a09e0137786a9996041037ecc72a4f7420063 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Mon, 22 Jan 2024 12:49:53 +0000 Subject: [PATCH 24/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9gn=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- services/firmware/firmware.gni | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/firmware/firmware.gni b/services/firmware/firmware.gni index f8146828..b2049ece 100644 --- a/services/firmware/firmware.gni +++ b/services/firmware/firmware.gni @@ -21,7 +21,7 @@ ab_update_include = download_include = [ "//base/update/updateservice/services/core/ability/download/data/include", - ] +] firmware_include = [ "$firmware_root_path/alarm/include", -- Gitee From 283d7f264dda5c2b3c10debff33f2b1fba9c1bad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Wed, 24 Jan 2024 15:52:37 +0800 Subject: [PATCH 25/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9empty=E6=96=87=E4=BB=B6?= =?UTF-8?q?=20Signed-off-by:=20=E9=82=B9=E5=8F=8B=E6=9D=BE=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/db/src/firmware_task_table_empty.cpp | 2 -- .../event/src/firmware_event_listener_empty.cpp | 3 --- .../src/firmware_check_data_processor_empty.cpp | 14 -------------- .../mode/src/firmware_download_mode_empty.cpp | 8 -------- .../mode/src/firmware_install_apply_mode_empty.cpp | 13 ------------- .../mode/src/firmware_manual_check_mode_empty.cpp | 9 --------- 6 files changed, 49 deletions(-) diff --git a/services/firmware/data/db/src/firmware_task_table_empty.cpp b/services/firmware/data/db/src/firmware_task_table_empty.cpp index 64d723a7..56167839 100644 --- a/services/firmware/data/db/src/firmware_task_table_empty.cpp +++ b/services/firmware/data/db/src/firmware_task_table_empty.cpp @@ -15,8 +15,6 @@ #include "firmware_task_table.h" -#include "update_define.h" - namespace OHOS { namespace UpdateEngine { std::string FirmwareTaskTable::GetTableName() diff --git a/services/firmware/event/src/firmware_event_listener_empty.cpp b/services/firmware/event/src/firmware_event_listener_empty.cpp index 8e176dfd..21dc8281 100644 --- a/services/firmware/event/src/firmware_event_listener_empty.cpp +++ b/services/firmware/event/src/firmware_event_listener_empty.cpp @@ -15,10 +15,7 @@ #include "firmware_event_listener.h" -#include "constant.h" #include "firmware_log.h" -#include "firmware_manager.h" -#include "update_define.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/upgrade/data_processor/src/firmware_check_data_processor_empty.cpp b/services/firmware/upgrade/data_processor/src/firmware_check_data_processor_empty.cpp index b0cb4a18..41e27984 100644 --- a/services/firmware/upgrade/data_processor/src/firmware_check_data_processor_empty.cpp +++ b/services/firmware/upgrade/data_processor/src/firmware_check_data_processor_empty.cpp @@ -15,21 +15,7 @@ #include "firmware_check_data_processor.h" -#include "config_parse.h" -#include "constant.h" -#include "firmware_changelog_utils.h" -#include "firmware_combine_version_utils.h" -#include "firmware_common.h" -#include "firmware_component_operator.h" -#include "firmware_constant.h" -#include "firmware_callback_utils.h" #include "firmware_log.h" -#include "firmware_task_operator.h" -#include "device_adapter.h" -#include "firmware_update_helper.h" -#include "string_utils.h" -#include "time_utils.h" -#include "update_helper.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/upgrade/mode/src/firmware_download_mode_empty.cpp b/services/firmware/upgrade/mode/src/firmware_download_mode_empty.cpp index 839ea508..dad111bc 100644 --- a/services/firmware/upgrade/mode/src/firmware_download_mode_empty.cpp +++ b/services/firmware/upgrade/mode/src/firmware_download_mode_empty.cpp @@ -15,16 +15,8 @@ #include "firmware_download_mode.h" -#include "dupdate_errno.h" -#include "firmware_callback_utils.h" -#include "firmware_common.h" #include "firmware_constant.h" #include "firmware_log.h" -#include "firmware_preferences_utils.h" -#include "firmware_status_cache.h" -#include "firmware_task_operator.h" -#include "firmware_update_helper.h" -#include "update_helper.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/upgrade/mode/src/firmware_install_apply_mode_empty.cpp b/services/firmware/upgrade/mode/src/firmware_install_apply_mode_empty.cpp index 026d6ea0..ded4df2e 100644 --- a/services/firmware/upgrade/mode/src/firmware_install_apply_mode_empty.cpp +++ b/services/firmware/upgrade/mode/src/firmware_install_apply_mode_empty.cpp @@ -15,21 +15,8 @@ #include "firmware_install_apply_mode.h" -#include - -#include "dupdate_errno.h" -#include "dupdate_upgrade_helper.h" -#include "firmware_callback_utils.h" -#include "firmware_changelog_utils.h" -#include "firmware_common.h" -#include "firmware_component_operator.h" #include "firmware_constant.h" #include "firmware_log.h" -#include "firmware_preferences_utils.h" -#include "firmware_status_cache.h" -#include "firmware_task_operator.h" -#include "firmware_update_helper.h" -#include "update_helper.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/upgrade/mode/src/firmware_manual_check_mode_empty.cpp b/services/firmware/upgrade/mode/src/firmware_manual_check_mode_empty.cpp index 0847c612..5ed47565 100644 --- a/services/firmware/upgrade/mode/src/firmware_manual_check_mode_empty.cpp +++ b/services/firmware/upgrade/mode/src/firmware_manual_check_mode_empty.cpp @@ -15,17 +15,8 @@ #include "firmware_manual_check_mode.h" -#include "dupdate_errno.h" -#include "firmware_callback_utils.h" -#include "firmware_common.h" #include "firmware_constant.h" #include "firmware_log.h" -#include "firmware_manager.h" -#include "firmware_preferences_utils.h" -#include "firmware_status_cache.h" -#include "firmware_task.h" -#include "firmware_task_operator.h" -#include "update_helper.h" namespace OHOS { namespace UpdateEngine { -- Gitee From b16391f92b35dfba89658bd4d42e5637c67ec769 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Wed, 24 Jan 2024 09:01:00 +0000 Subject: [PATCH 26/98] =?UTF-8?q?=E5=8F=96=E6=B6=88=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E9=80=82=E9=85=8D=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- .../js/napi/update/src/update_client.cpp | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/frameworks/js/napi/update/src/update_client.cpp b/frameworks/js/napi/update/src/update_client.cpp index 39f2252f..a92dff3b 100644 --- a/frameworks/js/napi/update/src/update_client.cpp +++ b/frameworks/js/napi/update/src/update_client.cpp @@ -119,26 +119,14 @@ napi_value UpdateClient::CheckNewVersion(napi_env env, napi_callback_info info) napi_value UpdateClient::CancelUpgrade(napi_env env, napi_callback_info info) { - size_t argc = MAX_ARGC; - napi_value args[MAX_ARGC] = { 0 }; - napi_status status = napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); - PARAM_CHECK_NAPI_CALL(env, status == napi_ok && argc == 0, return nullptr, "Error get cb info"); ENGINE_LOGI("CancelUpgrade"); SessionParams sessionParams(SessionType::SESSION_CANCEL_UPGRADE, CALLBACK_POSITION_ONE, true); - std::shared_ptr sess = nullptr; - sess = std::make_shared(this, sessionParams, argc); - PARAM_CHECK_NAPI_CALL(env, sess != nullptr, return nullptr, "Failed to create update session"); - sessionsMgr_->AddSession(sess); - napi_value retValue = sess->StartWork( - env, args, - [=](void *context) -> int { - BusinessError *businessError = reinterpret_cast(context); + napi_value retValue = StartSession(env, info, sessionParams, [=](void *context) -> int { + BusinessError *businessError = reinterpret_cast(context); return UpdateServiceKits::GetInstance().Cancel(upgradeInfo_, CAST_INT(UpdaterSaInterfaceCode::DOWNLOAD), *businessError); - }, - nullptr); - PARAM_CHECK(retValue != nullptr, sessionsMgr_->RemoveSession(sess->GetSessionId()); - return nullptr, "Failed to start worker."); + }); + PARAM_CHECK(ret != nullptr, return nullptr, "Failed to start worker."); return retValue; } -- Gitee From db3c2deffbb3320840bef06a827263dec4c9595e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Thu, 25 Jan 2024 01:54:38 +0000 Subject: [PATCH 27/98] =?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: 邹友松 --- frameworks/js/napi/update/src/update_client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/js/napi/update/src/update_client.cpp b/frameworks/js/napi/update/src/update_client.cpp index a92dff3b..ddd9547a 100644 --- a/frameworks/js/napi/update/src/update_client.cpp +++ b/frameworks/js/napi/update/src/update_client.cpp @@ -126,7 +126,7 @@ napi_value UpdateClient::CancelUpgrade(napi_env env, napi_callback_info info) return UpdateServiceKits::GetInstance().Cancel(upgradeInfo_, CAST_INT(UpdaterSaInterfaceCode::DOWNLOAD), *businessError); }); - PARAM_CHECK(ret != nullptr, return nullptr, "Failed to start worker."); + PARAM_CHECK(retValue != nullptr, return nullptr, "Failed to start worker."); return retValue; } -- Gitee From 909d42a4eae0350c046e5f06099d64d7d329cee9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Thu, 25 Jan 2024 04:02:01 +0000 Subject: [PATCH 28/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- interfaces/inner_api/modulemgr/src/module_manager.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/interfaces/inner_api/modulemgr/src/module_manager.cpp b/interfaces/inner_api/modulemgr/src/module_manager.cpp index 5edaf939..8436004a 100644 --- a/interfaces/inner_api/modulemgr/src/module_manager.cpp +++ b/interfaces/inner_api/modulemgr/src/module_manager.cpp @@ -31,11 +31,13 @@ bool ModuleManager::isLoaded = false; void ModuleManager::LoadModule(std::string libPath) { std::string prefix = "/system/lib64/updateext"; + std::string modulePrefix = "/module_update/3006/lib64/updateext"; std::string suffix = ".so"; - if ((libPath.substr(0, prefix.length()) != prefix) || - (libPath.substr(libPath.length() - suffix.length(), suffix.length()) != suffix)) { - UTILS_LOGE("LoadModule lib path invalid"); - return; + if ((libPath.substr(0, prefix.length()) != prefix && + libPath.substr(0, modulePrefix.length()) != modulePrefix) || + (libPath.substr(libPath.length() - suffix.length(), suffix.length()) != suffix)) { + UTILS_LOGE("LoadModule lib path invalid"); + return; } UTILS_LOGD("LoadModule so path: %{public}s", libPath.c_str()); if (dueModuleHandler == nullptr) { -- Gitee From b69dcfbf0e534e403c91c733dd7eba92e54a3847 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Thu, 25 Jan 2024 08:58:57 +0000 Subject: [PATCH 29/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=8F=E5=90=8D?= =?UTF-8?q?=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- services/firmware/upgrade/flow/src/firmware_manager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/firmware/upgrade/flow/src/firmware_manager.cpp b/services/firmware/upgrade/flow/src/firmware_manager.cpp index b6fca874..8eebf184 100644 --- a/services/firmware/upgrade/flow/src/firmware_manager.cpp +++ b/services/firmware/upgrade/flow/src/firmware_manager.cpp @@ -22,7 +22,7 @@ #include "config_parse.h" #include "dupdate_errno.h" #include "dupdate_upgrade_helper.h" -#ifdef NATIVE_PREFERENCES_ENABLE +#ifdef NETMANAGER_BASE_ENABLE #include "dupdate_net_manager.h" #endif #include "file_utils.h" @@ -316,7 +316,7 @@ void FirmwareManager::HandleBootComplete() void FirmwareManager::HandleNetChanged() { FIRMWARE_LOGI("HandleNetChanged"); - #ifdef NATIVE_PREFERENCES_ENABLE + #ifdef NETMANAGER_BASE_ENABLE if (!DelayedSingleton::GetInstance()->IsNetAvailable()) { FIRMWARE_LOGE("HandleNetChanged network not available."); ProgressThread::isNoNet_ = true; -- Gitee From 6f42f205c89df6fa4d7dfcc61eb1895b6d472835 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Thu, 25 Jan 2024 09:26:25 +0000 Subject: [PATCH 30/98] test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- services/firmware/upgrade/flow/src/firmware_manager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/firmware/upgrade/flow/src/firmware_manager.cpp b/services/firmware/upgrade/flow/src/firmware_manager.cpp index 8eebf184..94b772da 100644 --- a/services/firmware/upgrade/flow/src/firmware_manager.cpp +++ b/services/firmware/upgrade/flow/src/firmware_manager.cpp @@ -22,7 +22,7 @@ #include "config_parse.h" #include "dupdate_errno.h" #include "dupdate_upgrade_helper.h" -#ifdef NETMANAGER_BASE_ENABLE +#ifdef NETMANAGER_BASE_ENABLE1 #include "dupdate_net_manager.h" #endif #include "file_utils.h" @@ -316,7 +316,7 @@ void FirmwareManager::HandleBootComplete() void FirmwareManager::HandleNetChanged() { FIRMWARE_LOGI("HandleNetChanged"); - #ifdef NETMANAGER_BASE_ENABLE + #ifdef NETMANAGER_BASE_ENABLE1 if (!DelayedSingleton::GetInstance()->IsNetAvailable()) { FIRMWARE_LOGE("HandleNetChanged network not available."); ProgressThread::isNoNet_ = true; -- Gitee From f6548fe689e3a934175bc75c5f92a172ab6db3bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Thu, 25 Jan 2024 10:14:35 +0000 Subject: [PATCH 31/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=8F=E5=90=8D?= =?UTF-8?q?=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- services/firmware/upgrade/flow/src/firmware_manager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/firmware/upgrade/flow/src/firmware_manager.cpp b/services/firmware/upgrade/flow/src/firmware_manager.cpp index 94b772da..8eebf184 100644 --- a/services/firmware/upgrade/flow/src/firmware_manager.cpp +++ b/services/firmware/upgrade/flow/src/firmware_manager.cpp @@ -22,7 +22,7 @@ #include "config_parse.h" #include "dupdate_errno.h" #include "dupdate_upgrade_helper.h" -#ifdef NETMANAGER_BASE_ENABLE1 +#ifdef NETMANAGER_BASE_ENABLE #include "dupdate_net_manager.h" #endif #include "file_utils.h" @@ -316,7 +316,7 @@ void FirmwareManager::HandleBootComplete() void FirmwareManager::HandleNetChanged() { FIRMWARE_LOGI("HandleNetChanged"); - #ifdef NETMANAGER_BASE_ENABLE1 + #ifdef NETMANAGER_BASE_ENABLE if (!DelayedSingleton::GetInstance()->IsNetAvailable()) { FIRMWARE_LOGE("HandleNetChanged network not available."); ProgressThread::isNoNet_ = true; -- Gitee From d4b212c314bde11065586d40a171887019c582a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Thu, 25 Jan 2024 19:22:34 +0800 Subject: [PATCH 32/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E6=A3=80=E6=9F=A5=E6=96=B9=E6=B3=95=20Signed?= =?UTF-8?q?-off-by:=20=E9=82=B9=E5=8F=8B=E6=9D=BE=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/ability/common/include/constant.h | 2 +- .../status_cache/include/status_cache.h | 4 +--- .../ability/status_cache/src/status_cache.cpp | 21 +++++++++---------- .../core/ability/utils/include/time_utils.h | 6 ++++++ .../src/update_service_impl_firmware.cpp | 5 +---- .../upgrade/flow/src/firmware_manager.cpp | 1 - .../status/include/firmware_status_cache.h | 3 +-- .../status/src/firmware_status_cache.cpp | 12 ++--------- 8 files changed, 22 insertions(+), 32 deletions(-) diff --git a/services/core/ability/common/include/constant.h b/services/core/ability/common/include/constant.h index 257a3f1e..63191878 100644 --- a/services/core/ability/common/include/constant.h +++ b/services/core/ability/common/include/constant.h @@ -29,7 +29,7 @@ constexpr int32_t ONE_DAY_HOUR = 24; constexpr int32_t ONE_HOUR_MINUTES = 60; constexpr int32_t ONE_MINUTE_SECONDS = 60; constexpr int32_t FIVE_MINUTES_SECONDS = 5 * Constant::ONE_MINUTE_SECONDS; -constexpr int32_t ONE_SECONDS = 1; +constexpr int32_t MILLESECONDS = 1000; static const std::string DUPDATE_ENGINE_CONFIG_PATH = "/system/etc/update/dupdate_config.json"; diff --git a/services/core/ability/status_cache/include/status_cache.h b/services/core/ability/status_cache/include/status_cache.h index 5a265ada..b90586fb 100644 --- a/services/core/ability/status_cache/include/status_cache.h +++ b/services/core/ability/status_cache/include/status_cache.h @@ -29,8 +29,7 @@ public: bool IsChecking(); void SetIsChecking(bool isChecking); - bool IsDownloading(); - void SetIsDownloading(bool isDownloading); + bool IsDownloadTriggered(); private: int64_t GetCurrentTime(); @@ -39,7 +38,6 @@ private: std::shared_ptr timeUtilsProxy_ = nullptr; bool isChecking_ = false; int64_t lastCheckTime_ = -1; - bool isDownloading_ = false; int64_t lastDownloadTime_ = -1; }; } // namespace UpdateEngine diff --git a/services/core/ability/status_cache/src/status_cache.cpp b/services/core/ability/status_cache/src/status_cache.cpp index 09d24532..32a5f7f0 100644 --- a/services/core/ability/status_cache/src/status_cache.cpp +++ b/services/core/ability/status_cache/src/status_cache.cpp @@ -17,6 +17,7 @@ #include "constant.h" #include "update_log.h" +#include "time_utils.h" namespace OHOS { namespace UpdateEngine { @@ -46,22 +47,20 @@ int64_t StatusCache::GetCurrentTime() return timeUtilsProxy_->GetTimestamp(); } -bool StatusCache::IsDownloading() +bool StatusCache::IsDownloadTriggered() { - if (lastDownloadTime_ != -1 && abs(GetCurrentTime() - lastDownloadTime_) > Constant::ONE_SECONDS) { - // 当前时间与上次下载时间间隔超过1秒钟,允许再次触发下载 - ENGINE_LOGE("minus time is more than one seconds"); + if (lastDownloadTime_ == -1) { + lastDownloadTime_ = TimeUtils::GetTimestampByMilliseconds(); return false; } - return isDownloading_; -} -void StatusCache::SetIsDownloading(bool isDownloading) -{ - isDownloading_ = isDownloading; - if (isDownloading_) { - lastDownloadTime_ = GetCurrentTime(); + if (abs(TimeUtils::GetTimestampByMilliseconds() - lastDownloadTime_) < + Constant::MILLESECONDS) { + // 当前时间与上次下载时间间隔小于1秒钟,不允许重复触发下载 + ENGINE_LOGE("minus time is less than one seconds"); + return true; } + return false; } } // namespace UpdateEngine } // namespace OHOS diff --git a/services/core/ability/utils/include/time_utils.h b/services/core/ability/utils/include/time_utils.h index c39fb132..b00c42ab 100644 --- a/services/core/ability/utils/include/time_utils.h +++ b/services/core/ability/utils/include/time_utils.h @@ -35,6 +35,12 @@ public: return static_cast(currentTime); } + static int64_t GetTimestampByMilliseconds() + { + return std::chrono::duration_cast + (std::chrono::system_clock::now().time_since_epoch()).count(); + } + static std::string GetPrintTimeStr(int64_t time) { time_t printTime = static_cast(time); diff --git a/services/engine/src/update_service_impl_firmware.cpp b/services/engine/src/update_service_impl_firmware.cpp index 1a145618..b51f2572 100644 --- a/services/engine/src/update_service_impl_firmware.cpp +++ b/services/engine/src/update_service_impl_firmware.cpp @@ -70,12 +70,11 @@ int32_t UpdateServiceImplFirmware::Download(const UpgradeInfo &info, const Versi FIRMWARE_LOGI("Download allowNetwork:%{public}d order:%{public}d", CAST_INT(downloadOptions.allowNetwork), CAST_INT(downloadOptions.order)); //控制1秒内重复点击下载 - if (DelayedSingleton::GetInstance()->IsDownloading()) { + if (DelayedSingleton::GetInstance()->IsDownloadTriggered()) { FIRMWARE_LOGI("on downloading, not perrmit repeat submmit"); businessError.Build(CallResult::FAIL, "repeat download error"); return INT_CALL_SUCCESS; } - DelayedSingleton::GetInstance()->SetIsDownloading(true); FirmwareTask task; FirmwareTaskOperator firmwareTaskOperator; @@ -83,7 +82,6 @@ int32_t UpdateServiceImplFirmware::Download(const UpgradeInfo &info, const Versi if (task.status != UpgradeStatus::CHECK_VERSION_SUCCESS) { FIRMWARE_LOGI("download fail current status: %{public}d", CAST_INT(task.status)); businessError.Build(CallResult::FAIL, "download error"); - DelayedSingleton::GetInstance()->SetIsDownloading(false); return INT_CALL_SUCCESS; } @@ -298,7 +296,6 @@ int32_t UpdateServiceImplFirmware::Cancel(const UpgradeInfo &info, int32_t servi FIRMWARE_LOGI("Cancel fail current status: %{public}d", CAST_INT(task.status)); businessError.Build(CallResult::FAIL, "Cancel download error"); } else { - DelayedSingleton::GetInstance()->SetIsDownloading(false); DelayedSingleton::GetInstance()->DoCancelDownload(businessError); } return INT_CALL_SUCCESS; diff --git a/services/firmware/upgrade/flow/src/firmware_manager.cpp b/services/firmware/upgrade/flow/src/firmware_manager.cpp index 56f759a5..f53c19e1 100644 --- a/services/firmware/upgrade/flow/src/firmware_manager.cpp +++ b/services/firmware/upgrade/flow/src/firmware_manager.cpp @@ -203,7 +203,6 @@ void FirmwareManager::DoDownload(const DownloadOptions &downloadOptions, Busines std::shared_ptr executeMode = std::make_shared(downloadOptions, businessError, [=]() { FIRMWARE_LOGI("FirmwareManager DoDownload finish"); - DelayedSingleton::GetInstance()->SetIsDownloading(false); delete flowManager; }); flowManager->SetExecuteMode(executeMode); diff --git a/services/firmware/upgrade/status/include/firmware_status_cache.h b/services/firmware/upgrade/status/include/firmware_status_cache.h index 8eaf1357..4c60a414 100644 --- a/services/firmware/upgrade/status/include/firmware_status_cache.h +++ b/services/firmware/upgrade/status/include/firmware_status_cache.h @@ -28,8 +28,7 @@ class FirmwareStatusCache : public DelayedSingleton { public: bool IsChecking(); void SetIsChecking(bool isChecking); - bool IsDownloading(); - void SetIsDownloading(bool isDownloading); + bool IsDownloadTriggered(); private: std::shared_ptr statusCache_ = nullptr; }; diff --git a/services/firmware/upgrade/status/src/firmware_status_cache.cpp b/services/firmware/upgrade/status/src/firmware_status_cache.cpp index 7759de71..b5abc046 100644 --- a/services/firmware/upgrade/status/src/firmware_status_cache.cpp +++ b/services/firmware/upgrade/status/src/firmware_status_cache.cpp @@ -47,20 +47,12 @@ void FirmwareStatusCache::SetIsChecking(bool isChecking) statusCache_->SetIsChecking(isChecking); } -bool FirmwareStatusCache::IsDownloading() +bool FirmwareStatusCache::IsDownloadTriggered() { if (statusCache_ == nullptr) { return false; } - return statusCache_->IsDownloading(); -} - -void FirmwareStatusCache::SetIsDownloading(bool isDownloading) -{ - if (statusCache_ == nullptr) { - return; - } - statusCache_->SetIsDownloading(isDownloading); + return statusCache_->IsDownloadTriggered(); } } // namespace UpdateEngine } // namespace OHOS -- Gitee From 7ff0f22c1dff6dfde94165d60c2e0517e77823f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Thu, 25 Jan 2024 12:10:29 +0000 Subject: [PATCH 33/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E6=8F=90=E4=BA=A4=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- services/core/ability/status_cache/src/status_cache.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/services/core/ability/status_cache/src/status_cache.cpp b/services/core/ability/status_cache/src/status_cache.cpp index 32a5f7f0..299445d1 100644 --- a/services/core/ability/status_cache/src/status_cache.cpp +++ b/services/core/ability/status_cache/src/status_cache.cpp @@ -60,6 +60,7 @@ bool StatusCache::IsDownloadTriggered() ENGINE_LOGE("minus time is less than one seconds"); return true; } + lastDownloadTime_ = TimeUtils::GetTimestampByMilliseconds(); return false; } } // namespace UpdateEngine -- Gitee From 530532053923360db6688a758003d7870960db51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Fri, 26 Jan 2024 01:53:01 +0000 Subject: [PATCH 34/98] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=A4=B4=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=AD=97=E5=85=B8=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- services/core/ability/status_cache/src/status_cache.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/services/core/ability/status_cache/src/status_cache.cpp b/services/core/ability/status_cache/src/status_cache.cpp index 299445d1..51c0585f 100644 --- a/services/core/ability/status_cache/src/status_cache.cpp +++ b/services/core/ability/status_cache/src/status_cache.cpp @@ -16,8 +16,8 @@ #include "status_cache.h" #include "constant.h" -#include "update_log.h" #include "time_utils.h" +#include "update_log.h" namespace OHOS { namespace UpdateEngine { @@ -54,10 +54,9 @@ bool StatusCache::IsDownloadTriggered() return false; } - if (abs(TimeUtils::GetTimestampByMilliseconds() - lastDownloadTime_) < - Constant::MILLESECONDS) { + if (abs(TimeUtils::GetTimestampByMilliseconds() - lastDownloadTime_) < Constant::MILLESECONDS) { // 当前时间与上次下载时间间隔小于1秒钟,不允许重复触发下载 - ENGINE_LOGE("minus time is less than one seconds"); + ENGINE_LOGI("interval time is less than one seconds"); return true; } lastDownloadTime_ = TimeUtils::GetTimestampByMilliseconds(); -- Gitee From f99d4b0a342dafe81bfda4e6b761b359e2ffd2b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=8F=8B=E6=9D=BE?= Date: Fri, 26 Jan 2024 02:05:04 +0000 Subject: [PATCH 35/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹友松 --- services/core/ability/status_cache/src/status_cache.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core/ability/status_cache/src/status_cache.cpp b/services/core/ability/status_cache/src/status_cache.cpp index 51c0585f..bf73d464 100644 --- a/services/core/ability/status_cache/src/status_cache.cpp +++ b/services/core/ability/status_cache/src/status_cache.cpp @@ -56,7 +56,7 @@ bool StatusCache::IsDownloadTriggered() if (abs(TimeUtils::GetTimestampByMilliseconds() - lastDownloadTime_) < Constant::MILLESECONDS) { // 当前时间与上次下载时间间隔小于1秒钟,不允许重复触发下载 - ENGINE_LOGI("interval time is less than one seconds"); + ENGINE_LOGI("interval time within one seconds"); return true; } lastDownloadTime_ = TimeUtils::GetTimestampByMilliseconds(); -- Gitee From b90c4bfb67a63ee4bf4b9d2a13dd9c81998ef18e Mon Sep 17 00:00:00 2001 From: Monster Date: Tue, 30 Jan 2024 16:31:30 +0800 Subject: [PATCH 36/98] =?UTF-8?q?=E6=8B=86=E8=A7=A3update=5Fhelper?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- bundle.json | 7 + common/BUILD.gn | 27 + .../core => common}/ability/define/define.gni | 9 +- .../ability/define/include/update_define.h | 0 .../ability/log/include/update_log.h | 1 + {services/core => common}/ability/log/log.gni | 13 +- .../ability/log/src/update_log.cpp | 0 .../include/base_service_kits_impl.h | 2 - .../include/common_death_recipient.h | 0 .../sa_loader}/include/load_sa_service.h | 0 common/ability/sa_loader/sa_loader.gni | 23 + .../sa_loader}/src/load_sa_service.cpp | 0 .../sys_event}/include/update_system_event.h | 0 common/ability/sys_event/sys_event.gni | 17 + common/ability/utils/include/encrypt_utils.h | 83 +++ .../ability/utils}/include/json_builder.h | 0 .../ability/utils/include/string_utils.h | 0 common/ability/utils/utils.gni | 23 + common/common.gni | 52 ++ .../model/base/business_error.h | 75 +-- common/model/base/call_result.h | 57 ++ common/model/base/device_type.h | 30 + common/model/base/error_message.h | 54 ++ .../model/base}/json_utils.h | 0 .../model/base/network_type.h | 6 +- common/model/model.gni | 19 + .../napi/session/include/napi_common_define.h | 1 + .../napi/session/include/napi_common_utils.h | 4 +- .../js/napi/session/include/napi_session.h | 2 + .../napi/session/include/napi_structs_base.h | 2 +- frameworks/js/napi/update/BUILD.gn | 7 +- .../update/common/include/client_helper.h | 15 +- .../napi/update/common/include/upgrade_file.h | 29 + .../napi/update/common/src/client_helper.cpp | 6 +- .../js/napi/update/common/src/iupdater.cpp | 1 - .../js/napi/update/include/local_updater.h | 1 - .../js/napi/update/include/session_manager.h | 3 +- .../js/napi/update/include/session_type.h | 46 +- .../js/napi/update/include/update_client.h | 6 + .../js/napi/update/include/update_result.h | 7 + .../js/napi/update/include/update_session.h | 2 - .../js/napi/update/src/define_property.cpp | 14 +- .../js/napi/update/src/local_updater.cpp | 1 + .../js/napi/update/src/session_manager.cpp | 1 - .../js/napi/update/src/update_client.cpp | 2 +- .../js/napi/update/src/update_session.cpp | 1 - interfaces/inner_api/engine/BUILD.gn | 33 +- .../engine}/include/update_callback.h | 2 +- .../engine}/include/update_callback_stub.h | 0 .../include/update_service_kits_impl.h | 1 - .../engine/include/update_service_proxy.h | 0 .../inner_api/engine}/src/update_callback.cpp | 2 +- .../engine}/src/update_callback_stub.cpp | 1 - .../{ => src}/update_service_kits_impl.cpp | 0 .../engine/{ => src}/update_service_proxy.cpp | 15 +- interfaces/inner_api/feature/feature.gni | 32 ++ .../inner_api/feature/update/api/api.gni | 23 + .../update/api/callback}/iupdate_callback.h | 2 +- .../local_updater}/iservice_local_updater.h | 3 +- .../online_updater}/iservice_online_updater.h | 18 +- .../update/api/restorer}/iservice_restorer.h | 2 +- .../api/update_service}/iupdate_service.h | 1 - .../update/model/check/check_result.h} | 24 +- .../update/model/check/search_status.h | 30 + .../update/model/clear/clear_options.h | 26 + .../update/model/common/base_json_struct.h | 34 ++ .../feature/update/model/common/order.h | 28 + .../feature/update/model/common/progress.h | 31 ++ .../update/model/common/upgrade_status.h | 47 ++ .../update/model/download/download_options.h | 28 + .../model/download/pause_download_options.h | 24 + .../model/download/resume_download_options.h | 26 + .../update/model/event/event_classify.h | 29 + .../feature/update/model/event/event_id.h | 51 ++ .../feature/update/model/event/event_info.h | 34 ++ .../model/event/on_off/event_classify_info.h | 33 ++ .../update/model/event/src/event_info.cpp | 28 + .../update/model/event/update_callback_info.h | 29 + .../update/model/install/install_mode.h | 26 + .../include/message_parcel_helper.h | 17 +- .../model/message_parcel/message_parcel.gni | 17 + .../src/message_parcel_helper.cpp | 2 +- .../inner_api/feature/update/model/model.gni | 46 ++ .../update/model/policy/upgrade_period.h | 27 + .../update/model/policy/upgrade_policy.h | 28 + .../model/subscribe/src/subscribe_info.cpp | 32 ++ .../update/model/subscribe/subscribe_info.h | 47 ++ .../update/model/task/src/task_body.cpp | 94 +--- .../feature/update/model/task/task_body.h | 40 ++ .../update/model/task/task_body_member_mask.h | 57 ++ .../feature/update/model/task/task_info.h | 27 + .../update/model/upgrade/upgrade_interval.h | 27 + .../update/model/upgrade/upgrade_options.h | 26 + .../model/upgrade_info/business_sub_type.h | 28 + .../update/model/upgrade_info/business_type.h | 45 ++ .../model/upgrade_info/business_vendor.h | 25 + .../model/upgrade_info/src/business_type.cpp | 27 + .../model/upgrade_info/src/upgrade_info.cpp | 30 + .../update/model/upgrade_info/upgrade_info.h | 65 +++ .../model/version_info/component_type.h | 29 + .../current_version/current_version_info.h | 31 ++ .../description/component_description.h | 30 + .../description/description_format.h | 25 + .../description/description_info.h | 30 + .../description/description_options.h | 29 + .../description/description_type.h | 26 + .../description/src/description_info.cpp | 28 + .../description/version_description_info.h | 28 + .../model/version_info/effective_mode.h | 26 + .../new_version/new_version_info.h | 30 + .../version_info/src/version_component.cpp | 34 ++ .../version_info/src/version_digest_info.cpp | 26 + .../model/version_info/upgrade_action.h | 27 + .../model/version_info/version_component.h | 44 ++ .../model/version_info/version_digest_info.h | 30 + interfaces/inner_api/include/update_helper.h | 522 ------------------ .../inner_api/include/update_service_kits.h | 2 +- .../callback/include/update_callback_proxy.h | 3 +- .../callback/src/update_callback_proxy.cpp | 2 +- .../ability/adapter/include/config_info.h | 18 + .../ability/adapter/include/config_parse.h | 2 +- .../ability/adapter/src/device_adapter.cpp | 1 - .../callback/include/base_callback_utils.h | 9 +- .../callback/src/base_callback_utils.cpp | 2 +- .../src/base_callback_utils_empty.cpp | 4 - .../download/data/include/download_info.h | 4 +- .../core/ability/model/include/package_type.h | 32 ++ .../core/ability/utils/include/file_utils.h | 1 + .../core/ability/utils/src/file_utils.cpp | 1 - services/engine/engine_sa.gni | 11 +- services/engine/include/progress_thread.h | 3 +- services/engine/include/update_service.h | 1 - .../engine/include/update_service_cache.h | 6 +- .../include/update_service_impl_firmware.h | 1 - .../include/update_service_impl_manager.h | 2 +- services/engine/include/update_service_util.h | 4 +- services/engine/src/update_notify.cpp | 2 +- services/engine/src/update_service.cpp | 1 - services/engine/src/update_service_cache.cpp | 5 +- services/engine/src/update_service_stub.cpp | 5 +- .../firmware/check/include/firmware_icheck.h | 2 +- .../firmware/common/include/firmware_common.h | 2 +- .../common/include/firmware_constant.h | 1 - .../common/include/firmware_update_helper.h | 3 +- .../common/src/firmware_update_adapter.cpp | 1 - .../data/db/include/firmware_component.h | 4 +- .../db/include/firmware_component_operator.h | 3 +- .../firmware/data/db/include/firmware_task.h | 4 +- .../data/db/include/firmware_task_operator.h | 3 + .../data/db/src/firmware_database_empty.cpp | 1 - .../data/db/src/firmware_task_operator.cpp | 5 +- .../db/src/firmware_task_operator_empty.cpp | 3 +- .../data/db/src/firmware_task_table_empty.cpp | 3 + .../event/include/firmware_event_listener.h | 1 - .../include/firmware_check_data_processor.h | 2 + .../firmware_download_data_processor.h | 2 +- .../src/firmware_check_data_processor.cpp | 1 - .../include/firmware_download_executor.h | 2 +- .../executor/include/firmware_iexecutor.h | 2 + .../executor/src/firmware_apply_executor.cpp | 1 - .../executor/src/firmware_check_executor.cpp | 1 - .../src/firmware_download_executor.cpp | 1 - .../src/firmware_install_executor.cpp | 3 +- .../flow/include/firmware_flow_manager.h | 2 +- .../upgrade/flow/include/firmware_manager.h | 4 +- .../upgrade/flow/src/firmware_manager.cpp | 1 - .../install/include/firmware_install.h | 3 +- .../include/firmware_sys_installer_install.h | 1 - .../install/src/firmware_updater_install.cpp | 1 - .../mode/include/firmware_download_mode.h | 7 +- .../mode/include/firmware_iexecute_mode.h | 6 +- .../include/firmware_install_apply_mode.h | 5 +- .../mode/include/firmware_manual_check_mode.h | 2 +- .../mode/src/firmware_download_mode.cpp | 1 - .../mode/src/firmware_install_apply_mode.cpp | 1 - .../mode/src/firmware_manual_check_mode.cpp | 3 +- .../src/firmware_check_analyze_utils.cpp | 1 - .../utils/include/dupdate_inet_observer.h | 2 +- .../updateservicecancel_fuzzer.cpp | 2 - 179 files changed, 2372 insertions(+), 857 deletions(-) create mode 100644 common/BUILD.gn rename {services/core => common}/ability/define/define.gni (78%) rename {services/core => common}/ability/define/include/update_define.h (100%) rename {services/core => common}/ability/log/include/update_log.h (99%) rename {services/core => common}/ability/log/log.gni (64%) rename {services/core => common}/ability/log/src/update_log.cpp (100%) rename {interfaces/inner_api/common => common/ability/sa_loader}/include/base_service_kits_impl.h (99%) rename {interfaces/inner_api/common => common/ability/sa_loader}/include/common_death_recipient.h (100%) rename {interfaces/inner_api/common => common/ability/sa_loader}/include/load_sa_service.h (100%) create mode 100644 common/ability/sa_loader/sa_loader.gni rename {interfaces/inner_api/common => common/ability/sa_loader}/src/load_sa_service.cpp (100%) rename {interfaces/inner_api => common/ability/sys_event}/include/update_system_event.h (100%) create mode 100644 common/ability/sys_event/sys_event.gni create mode 100644 common/ability/utils/include/encrypt_utils.h rename {interfaces/inner_api => common/ability/utils}/include/json_builder.h (100%) rename {services/core => common}/ability/utils/include/string_utils.h (100%) create mode 100644 common/ability/utils/utils.gni create mode 100644 common/common.gni rename interfaces/inner_api/common/include/common_error_define.h => common/model/base/business_error.h (45%) create mode 100644 common/model/base/call_result.h create mode 100644 common/model/base/device_type.h create mode 100644 common/model/base/error_message.h rename {services/core/ability/utils/include => common/model/base}/json_utils.h (100%) rename interfaces/inner_api/include/net_manager_model.h => common/model/base/network_type.h (88%) create mode 100644 common/model/model.gni create mode 100644 frameworks/js/napi/update/common/include/upgrade_file.h rename {services/callback => interfaces/inner_api/engine}/include/update_callback.h (97%) rename {services/callback => interfaces/inner_api/engine}/include/update_callback_stub.h (100%) rename interfaces/inner_api/{ => engine}/include/update_service_kits_impl.h (99%) rename {services => interfaces/inner_api}/engine/include/update_service_proxy.h (100%) rename {services/callback => interfaces/inner_api/engine}/src/update_callback.cpp (96%) rename {services/callback => interfaces/inner_api/engine}/src/update_callback_stub.cpp (98%) rename interfaces/inner_api/engine/{ => src}/update_service_kits_impl.cpp (100%) rename interfaces/inner_api/engine/{ => src}/update_service_proxy.cpp (97%) create mode 100644 interfaces/inner_api/feature/feature.gni create mode 100644 interfaces/inner_api/feature/update/api/api.gni rename interfaces/inner_api/{include => feature/update/api/callback}/iupdate_callback.h (97%) rename interfaces/inner_api/{include => feature/update/api/local_updater}/iservice_local_updater.h (95%) rename interfaces/inner_api/{include => feature/update/api/online_updater}/iservice_online_updater.h (86%) rename interfaces/inner_api/{include => feature/update/api/restorer}/iservice_restorer.h (97%) rename interfaces/inner_api/{include => feature/update/api/update_service}/iupdate_service.h (98%) rename interfaces/inner_api/{common/include/common_check.h => feature/update/model/check/check_result.h} (50%) create mode 100644 interfaces/inner_api/feature/update/model/check/search_status.h create mode 100644 interfaces/inner_api/feature/update/model/clear/clear_options.h create mode 100644 interfaces/inner_api/feature/update/model/common/base_json_struct.h create mode 100644 interfaces/inner_api/feature/update/model/common/order.h create mode 100644 interfaces/inner_api/feature/update/model/common/progress.h create mode 100644 interfaces/inner_api/feature/update/model/common/upgrade_status.h create mode 100644 interfaces/inner_api/feature/update/model/download/download_options.h create mode 100644 interfaces/inner_api/feature/update/model/download/pause_download_options.h create mode 100644 interfaces/inner_api/feature/update/model/download/resume_download_options.h create mode 100644 interfaces/inner_api/feature/update/model/event/event_classify.h create mode 100644 interfaces/inner_api/feature/update/model/event/event_id.h create mode 100644 interfaces/inner_api/feature/update/model/event/event_info.h create mode 100644 interfaces/inner_api/feature/update/model/event/on_off/event_classify_info.h create mode 100644 interfaces/inner_api/feature/update/model/event/src/event_info.cpp create mode 100644 interfaces/inner_api/feature/update/model/event/update_callback_info.h create mode 100644 interfaces/inner_api/feature/update/model/install/install_mode.h rename interfaces/inner_api/{ => feature/update/model/message_parcel}/include/message_parcel_helper.h (89%) create mode 100644 interfaces/inner_api/feature/update/model/message_parcel/message_parcel.gni rename {services/engine => interfaces/inner_api/feature/update/model/message_parcel}/src/message_parcel_helper.cpp (99%) create mode 100644 interfaces/inner_api/feature/update/model/model.gni create mode 100644 interfaces/inner_api/feature/update/model/policy/upgrade_period.h create mode 100644 interfaces/inner_api/feature/update/model/policy/upgrade_policy.h create mode 100644 interfaces/inner_api/feature/update/model/subscribe/src/subscribe_info.cpp create mode 100644 interfaces/inner_api/feature/update/model/subscribe/subscribe_info.h rename services/engine/src/update_helper.cpp => interfaces/inner_api/feature/update/model/task/src/task_body.cpp (43%) create mode 100644 interfaces/inner_api/feature/update/model/task/task_body.h create mode 100644 interfaces/inner_api/feature/update/model/task/task_body_member_mask.h create mode 100644 interfaces/inner_api/feature/update/model/task/task_info.h create mode 100644 interfaces/inner_api/feature/update/model/upgrade/upgrade_interval.h create mode 100644 interfaces/inner_api/feature/update/model/upgrade/upgrade_options.h create mode 100644 interfaces/inner_api/feature/update/model/upgrade_info/business_sub_type.h create mode 100644 interfaces/inner_api/feature/update/model/upgrade_info/business_type.h create mode 100644 interfaces/inner_api/feature/update/model/upgrade_info/business_vendor.h create mode 100644 interfaces/inner_api/feature/update/model/upgrade_info/src/business_type.cpp create mode 100644 interfaces/inner_api/feature/update/model/upgrade_info/src/upgrade_info.cpp create mode 100644 interfaces/inner_api/feature/update/model/upgrade_info/upgrade_info.h create mode 100644 interfaces/inner_api/feature/update/model/version_info/component_type.h create mode 100644 interfaces/inner_api/feature/update/model/version_info/current_version/current_version_info.h create mode 100644 interfaces/inner_api/feature/update/model/version_info/description/component_description.h create mode 100644 interfaces/inner_api/feature/update/model/version_info/description/description_format.h create mode 100644 interfaces/inner_api/feature/update/model/version_info/description/description_info.h create mode 100644 interfaces/inner_api/feature/update/model/version_info/description/description_options.h create mode 100644 interfaces/inner_api/feature/update/model/version_info/description/description_type.h create mode 100644 interfaces/inner_api/feature/update/model/version_info/description/src/description_info.cpp create mode 100644 interfaces/inner_api/feature/update/model/version_info/description/version_description_info.h create mode 100644 interfaces/inner_api/feature/update/model/version_info/effective_mode.h create mode 100644 interfaces/inner_api/feature/update/model/version_info/new_version/new_version_info.h create mode 100644 interfaces/inner_api/feature/update/model/version_info/src/version_component.cpp create mode 100644 interfaces/inner_api/feature/update/model/version_info/src/version_digest_info.cpp create mode 100644 interfaces/inner_api/feature/update/model/version_info/upgrade_action.h create mode 100644 interfaces/inner_api/feature/update/model/version_info/version_component.h create mode 100644 interfaces/inner_api/feature/update/model/version_info/version_digest_info.h delete mode 100644 interfaces/inner_api/include/update_helper.h create mode 100644 services/core/ability/adapter/include/config_info.h create mode 100644 services/core/ability/model/include/package_type.h diff --git a/bundle.json b/bundle.json index 761522ff..450b3064 100644 --- a/bundle.json +++ b/bundle.json @@ -67,6 +67,13 @@ "//base/update/updateservice/services/engine/sa_profile:updater_sa_profile" ], "inner_api": [ + { + "header": { + "header_base": "//base/update/updateservice/common/ability/log/include", + "header_files": [] + }, + "name": "//base/update/updateservice/common:common" + }, { "header": { "header_base": "//base/update/updateservice/interfaces/inner_api/include", diff --git a/common/BUILD.gn b/common/BUILD.gn new file mode 100644 index 00000000..f53eb429 --- /dev/null +++ b/common/BUILD.gn @@ -0,0 +1,27 @@ + +import("//build/ohos.gni") +import("//base/update/updateservice/updateengine.gni") +import("common.gni") + +config("update_service_common_config") { + include_dirs = common_include +} + +ohos_shared_library("common") { + sanitize = { + cfi = true + cfi_cross_dso = true + debug = false + } + branch_protector_ret = "pac_ret" + + include_dirs = common_include + sources = common_sources + deps = common_deps + external_deps = common_external_deps + + public_configs = [ ":update_service_common_config" ] + + part_name = "$updateengine_part_name" + subsystem_name = "updater" +} diff --git a/services/core/ability/define/define.gni b/common/ability/define/define.gni similarity index 78% rename from services/core/ability/define/define.gni rename to common/ability/define/define.gni index 0d202f8b..ec0a5d0f 100644 --- a/services/core/ability/define/define.gni +++ b/common/ability/define/define.gni @@ -11,8 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("../../../updateengine.gni") - -define_root_path = "$updateengine_root_path/services/core/ability/define" - -define_include = [ "$define_root_path/include" ] +define_external_deps = [] +define_deps = [] +define_include = [ "ability/define/include" ] +define_src = [] diff --git a/services/core/ability/define/include/update_define.h b/common/ability/define/include/update_define.h similarity index 100% rename from services/core/ability/define/include/update_define.h rename to common/ability/define/include/update_define.h diff --git a/services/core/ability/log/include/update_log.h b/common/ability/log/include/update_log.h similarity index 99% rename from services/core/ability/log/include/update_log.h rename to common/ability/log/include/update_log.h index 9b20ef5c..ebbc6ce0 100644 --- a/services/core/ability/log/include/update_log.h +++ b/common/ability/log/include/update_log.h @@ -16,6 +16,7 @@ #ifndef UPDATE_LOG_H #define UPDATE_LOG_H +#include #include #include "hilog/log.h" diff --git a/services/core/ability/log/log.gni b/common/ability/log/log.gni similarity index 64% rename from services/core/ability/log/log.gni rename to common/ability/log/log.gni index 7c482c33..9b77c283 100644 --- a/services/core/ability/log/log.gni +++ b/common/ability/log/log.gni @@ -11,14 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//base/update/updateservice/updateengine.gni") - -update_log_root_path = "$updateengine_root_path/services/core/ability/log" - -update_log_external_deps = [ - "hilog:libhilog", - "updater:libupdaterlog_shared", -] +update_log_external_deps = [ "hilog:libhilog" ] update_log_deps = [] -update_log_include = [ "$update_log_root_path/include" ] -update_log_src = [ "$update_log_root_path/src/update_log.cpp" ] +update_log_include = [ "ability/log/include" ] +update_log_src = [ "ability/log/src/update_log.cpp" ] diff --git a/services/core/ability/log/src/update_log.cpp b/common/ability/log/src/update_log.cpp similarity index 100% rename from services/core/ability/log/src/update_log.cpp rename to common/ability/log/src/update_log.cpp diff --git a/interfaces/inner_api/common/include/base_service_kits_impl.h b/common/ability/sa_loader/include/base_service_kits_impl.h similarity index 99% rename from interfaces/inner_api/common/include/base_service_kits_impl.h rename to common/ability/sa_loader/include/base_service_kits_impl.h index c2ae8ceb..3a1d317d 100644 --- a/interfaces/inner_api/common/include/base_service_kits_impl.h +++ b/common/ability/sa_loader/include/base_service_kits_impl.h @@ -18,9 +18,7 @@ #include -#ifndef ABILITY_RUNTIME_INNER_ENABLE #include "ability_manager_proxy.h" -#endif #include "iremote_object.h" #include "common_death_recipient.h" diff --git a/interfaces/inner_api/common/include/common_death_recipient.h b/common/ability/sa_loader/include/common_death_recipient.h similarity index 100% rename from interfaces/inner_api/common/include/common_death_recipient.h rename to common/ability/sa_loader/include/common_death_recipient.h diff --git a/interfaces/inner_api/common/include/load_sa_service.h b/common/ability/sa_loader/include/load_sa_service.h similarity index 100% rename from interfaces/inner_api/common/include/load_sa_service.h rename to common/ability/sa_loader/include/load_sa_service.h diff --git a/common/ability/sa_loader/sa_loader.gni b/common/ability/sa_loader/sa_loader.gni new file mode 100644 index 00000000..a1835e1f --- /dev/null +++ b/common/ability/sa_loader/sa_loader.gni @@ -0,0 +1,23 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +sa_loader_external_deps = [ + "c_utils:utils", # sptr + "ability_runtime:ability_manager", + "ipc:ipc_core", + "safwk:system_ability_fwk", + "samgr:samgr_proxy", +] +sa_loader_deps = [] +sa_loader_include = [ "ability/sa_loader/include" ] +sa_loader_src = [ "ability/sa_loader/src/load_sa_service.cpp" ] diff --git a/interfaces/inner_api/common/src/load_sa_service.cpp b/common/ability/sa_loader/src/load_sa_service.cpp similarity index 100% rename from interfaces/inner_api/common/src/load_sa_service.cpp rename to common/ability/sa_loader/src/load_sa_service.cpp diff --git a/interfaces/inner_api/include/update_system_event.h b/common/ability/sys_event/include/update_system_event.h similarity index 100% rename from interfaces/inner_api/include/update_system_event.h rename to common/ability/sys_event/include/update_system_event.h diff --git a/common/ability/sys_event/sys_event.gni b/common/ability/sys_event/sys_event.gni new file mode 100644 index 00000000..238b66b1 --- /dev/null +++ b/common/ability/sys_event/sys_event.gni @@ -0,0 +1,17 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +sys_event_external_deps = [] +sys_event_deps = [] +sys_event_include = [ "ability/sys_event/include" ] +sys_event_src = [] diff --git a/common/ability/utils/include/encrypt_utils.h b/common/ability/utils/include/encrypt_utils.h new file mode 100644 index 00000000..cf810577 --- /dev/null +++ b/common/ability/utils/include/encrypt_utils.h @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ENCRYPT_UTILS_H +#define ENCRYPT_UTILS_H + +#include +#include +#include +#include + +#include "update_log.h" + +namespace OHOS { +namespace UpdateEngine { +static const int32_t ENCRYPT_LENGTH = 4; // 需要替换*的长度 +static const int32_t ENCRYPT_TOTAL_LENGTH = 8; // 敏感数据匿名化后最长长度 +static const std::string ENCRYPT_STR = "****"; + +class EncryptUtils { +public: + static int64_t GetRand(int32_t min, int32_t max) + { + // 随机 min ~ max值 + if (max < min) { + return min; + } + srand(time(nullptr)); + return min + rand() % (max - min); + } + + static std::string EncryptUrl(const std::string &url) + { + std::string encryptUrl = url; + std::string httpsPrefix = "https://"; + std::string httpPrefix = "http://"; + + // 从https:// 或者 http:// 开始后面4位替换为 xxxx + if (encryptUrl.compare(0, httpsPrefix.size(), httpsPrefix) == 0) { + encryptUrl.replace(httpsPrefix.size(), ENCRYPT_LENGTH, ENCRYPT_STR); + return encryptUrl; + } + if (encryptUrl.compare(0, httpPrefix.size(), httpPrefix) == 0) { + encryptUrl.replace(httpPrefix.size(), ENCRYPT_LENGTH, ENCRYPT_STR); + return encryptUrl; + } + return encryptUrl; + } + + static std::string EncryptString(std::string inputStr) + { + if (inputStr.empty()) { + return inputStr; + } + std::string result; + size_t length = inputStr.length(); + if (length >= ENCRYPT_TOTAL_LENGTH) { + std::string sequence = inputStr.substr(0, ENCRYPT_LENGTH); + result = sequence + ENCRYPT_STR; + } else if (length > ENCRYPT_LENGTH) { + std::string sequence = inputStr.substr(0, length - ENCRYPT_LENGTH); + result = sequence + ENCRYPT_STR; + } else { + result = ENCRYPT_STR; + } + return result; + } +}; +} // namespace UpdateEngine +} // namespace OHOS +#endif // ENCRYPT_UTILS_H \ No newline at end of file diff --git a/interfaces/inner_api/include/json_builder.h b/common/ability/utils/include/json_builder.h similarity index 100% rename from interfaces/inner_api/include/json_builder.h rename to common/ability/utils/include/json_builder.h diff --git a/services/core/ability/utils/include/string_utils.h b/common/ability/utils/include/string_utils.h similarity index 100% rename from services/core/ability/utils/include/string_utils.h rename to common/ability/utils/include/string_utils.h diff --git a/common/ability/utils/utils.gni b/common/ability/utils/utils.gni new file mode 100644 index 00000000..0d233afa --- /dev/null +++ b/common/ability/utils/utils.gni @@ -0,0 +1,23 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +utils_external_deps = [] +utils_deps = [ + "//third_party/cJSON:cjson", + "//third_party/json:nlohmann_json_static" +] +utils_include = [ + "ability/utils/include", + "//third_party/json/include", +] +utils_src = [] diff --git a/common/common.gni b/common/common.gni new file mode 100644 index 00000000..dea4c72b --- /dev/null +++ b/common/common.gni @@ -0,0 +1,52 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("ability/define/define.gni") +import("ability/log/log.gni") +import("ability/sa_loader/sa_loader.gni") +import("ability/sys_event/sys_event.gni") +import("ability/utils/utils.gni") +import("model/model.gni") + +common_external_deps = [] +common_external_deps += define_external_deps +common_external_deps += update_log_external_deps +common_external_deps += sa_loader_external_deps +common_external_deps += sys_event_external_deps +common_external_deps += utils_external_deps +common_external_deps += model_external_deps + +common_deps = [] +common_deps += define_deps +common_deps += update_log_deps +common_deps += sa_loader_deps +common_deps += sys_event_deps +common_deps += utils_deps +common_deps += model_deps + +common_include = [] +common_include += define_include +common_include += update_log_include +common_include += sa_loader_include +common_include += sys_event_include +common_include += utils_include +common_include += model_include + + +common_sources = [] +common_sources += define_src +common_sources += update_log_src +common_sources += sa_loader_src +common_sources += sys_event_src +common_sources += utils_src +common_sources += model_src diff --git a/interfaces/inner_api/common/include/common_error_define.h b/common/model/base/business_error.h similarity index 45% rename from interfaces/inner_api/common/include/common_error_define.h rename to common/model/base/business_error.h index 7b1a89ec..e7d96113 100644 --- a/interfaces/inner_api/common/include/common_error_define.h +++ b/common/model/base/business_error.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,79 +13,20 @@ * limitations under the License. */ -#ifndef COMMON_ERROR_DEFINE_H -#define COMMON_ERROR_DEFINE_H +#ifndef UPDATE_SERVICE_BUSINESS_ERROR_H +#define UPDATE_SERVICE_BUSINESS_ERROR_H #include #include +#include "nlohmann/json.hpp" + +#include "call_result.h" +#include "error_message.h" #include "json_builder.h" #include "json_utils.h" namespace OHOS::UpdateEngine { -#define CAST_INT(enumClass) (static_cast(enumClass)) -#define CALL_RESULT_TO_IPC_RESULT(callResult) ((callResult) + CALL_RESULT_OFFSET) -constexpr int32_t COMPONENT_ERR = 11500000; -constexpr int CALL_RESULT_OFFSET = 2000; -enum class CallResult { - // 通用错误码 - APP_NOT_GRANTED = 201, - NOT_SYSTEM_APP = 202, - PARAM_ERR = 401, - UN_SUPPORT = 801, - - // 模块内错误码 - SUCCESS = 0, - FAIL = 100, - DEV_UPG_INFO_ERR = 102, - FORBIDDEN = 103, - IPC_ERR = 104, - TIME_OUT = 402, - DB_ERROR = 501, - IO_ERROR = 502, - NET_ERROR = 503 -}; - -constexpr int32_t INT_CALL_SUCCESS = CAST_INT(CallResult::SUCCESS); -constexpr int32_t INT_CALL_FAIL = CAST_INT(CallResult::FAIL); -constexpr int32_t INT_UN_SUPPORT = CAST_INT(CallResult::UN_SUPPORT); -constexpr int32_t INT_FORBIDDEN = CAST_INT(CallResult::FORBIDDEN); -constexpr int32_t INT_CALL_IPC_ERR = CAST_INT(CallResult::IPC_ERR); -constexpr int32_t INT_APP_NOT_GRANTED = CAST_INT(CallResult::APP_NOT_GRANTED); -constexpr int32_t INT_NOT_SYSTEM_APP = CAST_INT(CallResult::NOT_SYSTEM_APP); -constexpr int32_t INT_PARAM_ERR = CAST_INT(CallResult::PARAM_ERR); -constexpr int32_t INT_DEV_UPG_INFO_ERR = CAST_INT(CallResult::DEV_UPG_INFO_ERR); -constexpr int32_t INT_TIME_OUT = CAST_INT(CallResult::TIME_OUT); -constexpr int32_t INT_DB_ERROR = CAST_INT(CallResult::DB_ERROR); -constexpr int32_t INT_IO_ERROR = CAST_INT(CallResult::IO_ERROR); -constexpr int32_t INT_NET_ERROR = CAST_INT(CallResult::NET_ERROR); - -struct ErrorMessage { - int32_t errorCode = 0; - std::string errorMessage; - - friend void to_json(nlohmann::json &jsonObj, const ErrorMessage &message) - { - jsonObj["errorCode"] = message.errorCode; - jsonObj["errorMessage"] = message.errorMessage; - } - - friend void from_json(const nlohmann::json &jsonObj, ErrorMessage &message) - { - JsonUtils::GetValueAndSetTo(jsonObj, "errorCode", message.errorCode); - JsonUtils::GetValueAndSetTo(jsonObj, "errorMessage", message.errorMessage); - } - - JsonBuilder GetJsonBuilder() - { - return JsonBuilder() - .Append("{") - .Append("errorCode", errorCode) - .Append("errorMessage", errorMessage) - .Append("}"); - } -}; - struct BusinessError { std::string message; CallResult errorNum = CallResult::SUCCESS; @@ -124,4 +65,4 @@ struct BusinessError { } }; } // namespace OHOS::UpdateEngine -#endif // COMMON_ERROR_DEFINE_H \ No newline at end of file +#endif // UPDATE_SERVICE_BUSINESS_ERROR_H diff --git a/common/model/base/call_result.h b/common/model/base/call_result.h new file mode 100644 index 00000000..e32cff45 --- /dev/null +++ b/common/model/base/call_result.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_CALL_RESULT_H +#define UPDATE_SERVICE_CALL_RESULT_H + +#include "update_define.h" + +namespace OHOS::UpdateEngine { +constexpr int CALL_RESULT_OFFSET = 2000; + +enum class CallResult { + // 通用错误码 + APP_NOT_GRANTED = 201, + NOT_SYSTEM_APP = 202, + PARAM_ERR = 401, + UN_SUPPORT = 801, + + // 模块内错误码 + SUCCESS = 0, + FAIL = 100, + DEV_UPG_INFO_ERR = 102, + FORBIDDEN = 103, + IPC_ERR = 104, + TIME_OUT = 402, + DB_ERROR = 501, + IO_ERROR = 502, + NET_ERROR = 503 +}; + +constexpr int32_t INT_CALL_SUCCESS = CAST_INT(CallResult::SUCCESS); +constexpr int32_t INT_CALL_FAIL = CAST_INT(CallResult::FAIL); +constexpr int32_t INT_UN_SUPPORT = CAST_INT(CallResult::UN_SUPPORT); +constexpr int32_t INT_FORBIDDEN = CAST_INT(CallResult::FORBIDDEN); +constexpr int32_t INT_CALL_IPC_ERR = CAST_INT(CallResult::IPC_ERR); +constexpr int32_t INT_APP_NOT_GRANTED = CAST_INT(CallResult::APP_NOT_GRANTED); +constexpr int32_t INT_NOT_SYSTEM_APP = CAST_INT(CallResult::NOT_SYSTEM_APP); +constexpr int32_t INT_PARAM_ERR = CAST_INT(CallResult::PARAM_ERR); +constexpr int32_t INT_DEV_UPG_INFO_ERR = CAST_INT(CallResult::DEV_UPG_INFO_ERR); +constexpr int32_t INT_TIME_OUT = CAST_INT(CallResult::TIME_OUT); +constexpr int32_t INT_DB_ERROR = CAST_INT(CallResult::DB_ERROR); +constexpr int32_t INT_IO_ERROR = CAST_INT(CallResult::IO_ERROR); +constexpr int32_t INT_NET_ERROR = CAST_INT(CallResult::NET_ERROR); +} // namespace OHOS::UpdateEngine +#endif // UPDATE_SERVICE_CALL_RESULT_H diff --git a/common/model/base/device_type.h b/common/model/base/device_type.h new file mode 100644 index 00000000..9783e199 --- /dev/null +++ b/common/model/base/device_type.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_DEVICE_TYPE_H +#define UPDATE_SERVICE_DEVICE_TYPE_H + +namespace OHOS::UpdateEngine { +enum class DeviceType { + UNKNOWN = 0, + SMART_PHONE = 1, // 手机 + SMART_PAD = 2, // 平板 + SMART_TV = 4, // 智能电视 + TWS = 6, // 真无线耳机 + KEYBOARD = 7, // 键盘 + PEN = 8 // 手写笔 +}; +} // namespace OHOS::UpdateEngine +#endif // UPDATE_SERVICE_DEVICE_TYPE_H diff --git a/common/model/base/error_message.h b/common/model/base/error_message.h new file mode 100644 index 00000000..b49b81af --- /dev/null +++ b/common/model/base/error_message.h @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_ERROR_MESSAGE_H +#define UPDATE_SERVICE_ERROR_MESSAGE_H + +#include +#include + +#include "nlohmann/json.hpp" + +#include "json_builder.h" +#include "json_utils.h" + +namespace OHOS::UpdateEngine { +struct ErrorMessage { + int32_t errorCode = 0; + std::string errorMessage; + + friend void to_json(nlohmann::json &jsonObj, const ErrorMessage &message) + { + jsonObj["errorCode"] = message.errorCode; + jsonObj["errorMessage"] = message.errorMessage; + } + + friend void from_json(const nlohmann::json &jsonObj, ErrorMessage &message) + { + JsonUtils::GetValueAndSetTo(jsonObj, "errorCode", message.errorCode); + JsonUtils::GetValueAndSetTo(jsonObj, "errorMessage", message.errorMessage); + } + + JsonBuilder GetJsonBuilder() + { + return JsonBuilder() + .Append("{") + .Append("errorCode", errorCode) + .Append("errorMessage", errorMessage) + .Append("}"); + } +}; +} // namespace OHOS::UpdateEngine +#endif // UPDATE_SERVICE_ERROR_MESSAGE_H diff --git a/services/core/ability/utils/include/json_utils.h b/common/model/base/json_utils.h similarity index 100% rename from services/core/ability/utils/include/json_utils.h rename to common/model/base/json_utils.h diff --git a/interfaces/inner_api/include/net_manager_model.h b/common/model/base/network_type.h similarity index 88% rename from interfaces/inner_api/include/net_manager_model.h rename to common/model/base/network_type.h index 7efa829d..fc85b435 100644 --- a/interfaces/inner_api/include/net_manager_model.h +++ b/common/model/base/network_type.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef MIGRATE_SERVER_NET_MANAGER_MODEL_H -#define MIGRATE_SERVER_NET_MANAGER_MODEL_H +#ifndef UPDATE_SERVICE_NETWORK_TYPE_H +#define UPDATE_SERVICE_NETWORK_TYPE_H namespace OHOS::UpdateEngine { enum class NetType { @@ -28,4 +28,4 @@ enum class NetType { CELLULAR_AND_WIFI = CELLULAR | WIFI }; } // namespace OHOS::UpdateEngine -#endif // MIGRATE_SERVER_NET_MANAGER_MODEL_H +#endif // UPDATE_SERVICE_NETWORK_TYPE_H diff --git a/common/model/model.gni b/common/model/model.gni new file mode 100644 index 00000000..5eb4d4ca --- /dev/null +++ b/common/model/model.gni @@ -0,0 +1,19 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +model_external_deps = [] +model_deps = [] +model_include = [ + "model/base" +] +model_src = [] diff --git a/frameworks/js/napi/session/include/napi_common_define.h b/frameworks/js/napi/session/include/napi_common_define.h index cf04ef38..0db714dc 100644 --- a/frameworks/js/napi/session/include/napi_common_define.h +++ b/frameworks/js/napi/session/include/napi_common_define.h @@ -24,6 +24,7 @@ #include "update_log.h" namespace OHOS::UpdateEngine { +constexpr int32_t COMPONENT_ERR = 11500000; #define PARAM_CHECK(validCheck, exper, ...) \ if (!(validCheck)) { \ ENGINE_LOGE(__VA_ARGS__); \ diff --git a/frameworks/js/napi/session/include/napi_common_utils.h b/frameworks/js/napi/session/include/napi_common_utils.h index e1f180c4..41ddd10d 100644 --- a/frameworks/js/napi/session/include/napi_common_utils.h +++ b/frameworks/js/napi/session/include/napi_common_utils.h @@ -22,7 +22,9 @@ #include "js_native_api.h" #include "js_native_api_types.h" -#include "common_error_define.h" +#include "business_error.h" +#include "call_result.h" +#include "error_message.h" #include "napi_common_define.h" namespace OHOS::UpdateEngine { diff --git a/frameworks/js/napi/session/include/napi_session.h b/frameworks/js/napi/session/include/napi_session.h index 7efec3d4..9ba9e093 100644 --- a/frameworks/js/napi/session/include/napi_session.h +++ b/frameworks/js/napi/session/include/napi_session.h @@ -25,6 +25,8 @@ #include "base_client.h" #include "base_session.h" +#include "business_error.h" +#include "call_result.h" #include "napi_common_define.h" #include "napi_common_utils.h" #include "napi_structs_base.h" diff --git a/frameworks/js/napi/session/include/napi_structs_base.h b/frameworks/js/napi/session/include/napi_structs_base.h index 145ec5c8..726a7218 100644 --- a/frameworks/js/napi/session/include/napi_structs_base.h +++ b/frameworks/js/napi/session/include/napi_structs_base.h @@ -18,7 +18,7 @@ #include -#include "common_error_define.h" +#include "business_error.h" #include "napi_common_define.h" namespace OHOS::UpdateEngine { diff --git a/frameworks/js/napi/update/BUILD.gn b/frameworks/js/napi/update/BUILD.gn index c4e7b8b2..45f4de41 100644 --- a/frameworks/js/napi/update/BUILD.gn +++ b/frameworks/js/napi/update/BUILD.gn @@ -45,8 +45,6 @@ ohos_shared_library("$updateengine_client_library_name") { "$updateengine_root_path/frameworks/js/napi/update/common/include", "$updateengine_root_path/frameworks/js/napi/update/include", - "$updateengine_root_path/services/core/ability/utils/include", - "//third_party/json/include", "//third_party/node/src", # napi ] @@ -54,15 +52,12 @@ ohos_shared_library("$updateengine_client_library_name") { deps = [ "$updateengine_root_path/interfaces/inner_api/engine:$updateengine_inner_library_name", - "//third_party/json:nlohmann_json_static", + "$updateengine_root_path/common:common", ] external_deps = [ "c_utils:utils", # sptr "hilog:libhilog", - "ipc:ipc_core", - "safwk:system_ability_fwk", - "samgr:samgr_proxy", ] if (ability_ability_runtime_enable) { diff --git a/frameworks/js/napi/update/common/include/client_helper.h b/frameworks/js/napi/update/common/include/client_helper.h index bbbb380c..066f23a2 100644 --- a/frameworks/js/napi/update/common/include/client_helper.h +++ b/frameworks/js/napi/update/common/include/client_helper.h @@ -20,9 +20,22 @@ #include "node_api.h" +#include "clear_options.h" +#include "description_format.h" +#include "description_options.h" +#include "download_options.h" +#include "event_classify_info.h" +#include "event_info.h" #include "napi_common_utils.h" -#include "update_helper.h" +#include "network_type.h" +#include "order.h" +#include "pause_download_options.h" +#include "resume_download_options.h" #include "update_result.h" +#include "upgrade_file.h" +#include "upgrade_info.h" +#include "upgrade_options.h" +#include "upgrade_policy.h" namespace OHOS::UpdateEngine { class ClientHelper { diff --git a/frameworks/js/napi/update/common/include/upgrade_file.h b/frameworks/js/napi/update/common/include/upgrade_file.h new file mode 100644 index 00000000..dd111442 --- /dev/null +++ b/frameworks/js/napi/update/common/include/upgrade_file.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_UPGRADE_FILE_H +#define UPDATE_SERVICE_UPGRADE_FILE_H + +#include + +#include "component_type.h" + +namespace OHOS::UpdateEngine { +struct UpgradeFile { + ComponentType fileType = ComponentType::INVALID; + std::string filePath; +}; +} // OHOS::UpdateEngine +#endif // UPDATE_SERVICE_UPGRADE_FILE_H diff --git a/frameworks/js/napi/update/common/src/client_helper.cpp b/frameworks/js/napi/update/common/src/client_helper.cpp index 44a3e0fb..758a181b 100644 --- a/frameworks/js/napi/update/common/src/client_helper.cpp +++ b/frameworks/js/napi/update/common/src/client_helper.cpp @@ -21,9 +21,13 @@ #include "node_api.h" #include "unistd.h" +#include "check_result.h" +#include "component_description.h" +#include "current_version_info.h" #include "napi_common_define.h" +#include "task_body_member_mask.h" #include "update_define.h" -#include "update_helper.h" +#include "version_description_info.h" namespace OHOS::UpdateEngine { void ClientHelper::TrimString(std::string &str) diff --git a/frameworks/js/napi/update/common/src/iupdater.cpp b/frameworks/js/napi/update/common/src/iupdater.cpp index 100ca3e1..ac44fb01 100644 --- a/frameworks/js/napi/update/common/src/iupdater.cpp +++ b/frameworks/js/napi/update/common/src/iupdater.cpp @@ -16,7 +16,6 @@ #include "iupdater.h" #include "napi_common_define.h" -#include "update_helper.h" #include "update_session.h" namespace OHOS::UpdateEngine { diff --git a/frameworks/js/napi/update/include/local_updater.h b/frameworks/js/napi/update/include/local_updater.h index 6336693f..3dce891b 100644 --- a/frameworks/js/napi/update/include/local_updater.h +++ b/frameworks/js/napi/update/include/local_updater.h @@ -18,7 +18,6 @@ #include "iupdater.h" #include "node_api.h" -#include "update_helper.h" namespace OHOS::UpdateEngine { class LocalUpdater : public IUpdater { diff --git a/frameworks/js/napi/update/include/session_manager.h b/frameworks/js/napi/update/include/session_manager.h index 4d36cc84..38bf5dc0 100644 --- a/frameworks/js/napi/update/include/session_manager.h +++ b/frameworks/js/napi/update/include/session_manager.h @@ -24,7 +24,8 @@ #include "js_native_api_types.h" #include "base_session.h" -#include "update_helper.h" +#include "event_classify_info.h" +#include "event_info.h" namespace OHOS::UpdateEngine { class SessionManager { diff --git a/frameworks/js/napi/update/include/session_type.h b/frameworks/js/napi/update/include/session_type.h index c7d76e99..560a2aa1 100644 --- a/frameworks/js/napi/update/include/session_type.h +++ b/frameworks/js/napi/update/include/session_type.h @@ -19,28 +19,28 @@ #include namespace OHOS::UpdateEngine::SessionType { - constexpr uint32_t SESSION_CHECK_VERSION = 0; - constexpr uint32_t SESSION_DOWNLOAD = 1; - constexpr uint32_t SESSION_PAUSE_DOWNLOAD = 2; - constexpr uint32_t SESSION_RESUME_DOWNLOAD = 3; - constexpr uint32_t SESSION_UPGRADE = 4; - constexpr uint32_t SESSION_SET_POLICY = 5; - constexpr uint32_t SESSION_GET_POLICY = 6; - constexpr uint32_t SESSION_CLEAR_ERROR = 7; - constexpr uint32_t SESSION_TERMINATE_UPGRADE = 8; - constexpr uint32_t SESSION_GET_NEW_VERSION = 9; - constexpr uint32_t SESSION_GET_NEW_VERSION_DESCRIPTION = 10; - constexpr uint32_t SESSION_SUBSCRIBE = 11; - constexpr uint32_t SESSION_UNSUBSCRIBE = 12; - constexpr uint32_t SESSION_GET_UPDATER = 13; - constexpr uint32_t SESSION_APPLY_NEW_VERSION = 14; - constexpr uint32_t SESSION_FACTORY_RESET = 15; - constexpr uint32_t SESSION_VERIFY_PACKAGE = 16; - constexpr uint32_t SESSION_CANCEL_UPGRADE = 17; - constexpr uint32_t SESSION_GET_CUR_VERSION = 18; - constexpr uint32_t SESSION_GET_CUR_VERSION_DESCRIPTION = 19; - constexpr uint32_t SESSION_GET_TASK_INFO = 20; - constexpr uint32_t SESSION_REPLY_PARAM_ERROR = 21; - constexpr uint32_t SESSION_MAX = UINT32_MAX; +constexpr uint32_t SESSION_CHECK_VERSION = 0; +constexpr uint32_t SESSION_DOWNLOAD = 1; +constexpr uint32_t SESSION_PAUSE_DOWNLOAD = 2; +constexpr uint32_t SESSION_RESUME_DOWNLOAD = 3; +constexpr uint32_t SESSION_UPGRADE = 4; +constexpr uint32_t SESSION_SET_POLICY = 5; +constexpr uint32_t SESSION_GET_POLICY = 6; +constexpr uint32_t SESSION_CLEAR_ERROR = 7; +constexpr uint32_t SESSION_TERMINATE_UPGRADE = 8; +constexpr uint32_t SESSION_GET_NEW_VERSION = 9; +constexpr uint32_t SESSION_GET_NEW_VERSION_DESCRIPTION = 10; +constexpr uint32_t SESSION_SUBSCRIBE = 11; +constexpr uint32_t SESSION_UNSUBSCRIBE = 12; +constexpr uint32_t SESSION_GET_UPDATER = 13; +constexpr uint32_t SESSION_APPLY_NEW_VERSION = 14; +constexpr uint32_t SESSION_FACTORY_RESET = 15; +constexpr uint32_t SESSION_VERIFY_PACKAGE = 16; +constexpr uint32_t SESSION_CANCEL_UPGRADE = 17; +constexpr uint32_t SESSION_GET_CUR_VERSION = 18; +constexpr uint32_t SESSION_GET_CUR_VERSION_DESCRIPTION = 19; +constexpr uint32_t SESSION_GET_TASK_INFO = 20; +constexpr uint32_t SESSION_REPLY_PARAM_ERROR = 21; +constexpr uint32_t SESSION_MAX = UINT32_MAX; } // namespace OHOS::UpdateEngine::SessionType #endif // UPDATE_SESSION_TYPE_H diff --git a/frameworks/js/napi/update/include/update_client.h b/frameworks/js/napi/update/include/update_client.h index 392d43f5..dfb93d9d 100644 --- a/frameworks/js/napi/update/include/update_client.h +++ b/frameworks/js/napi/update/include/update_client.h @@ -16,7 +16,13 @@ #ifndef UPDATE_CLIENT_H #define UPDATE_CLIENT_H +#include "check_result.h" +#include "current_version_info.h" #include "iupdater.h" +#include "new_version_info.h" +#include "progress.h" +#include "task_info.h" +#include "version_description_info.h" namespace OHOS::UpdateEngine { class UpdateClient : public IUpdater { diff --git a/frameworks/js/napi/update/include/update_result.h b/frameworks/js/napi/update/include/update_result.h index 3fe6ac60..435f978a 100644 --- a/frameworks/js/napi/update/include/update_result.h +++ b/frameworks/js/napi/update/include/update_result.h @@ -16,8 +16,15 @@ #ifndef UPDATE_RESULT_H #define UPDATE_RESULT_H +#include "check_result.h" +#include "current_version_info.h" #include "napi_structs_base.h" +#include "new_version_info.h" +#include "progress.h" #include "session_type.h" +#include "task_info.h" +#include "upgrade_policy.h" +#include "version_description_info.h" namespace OHOS::UpdateEngine { struct UpdateResult : NapiResult { diff --git a/frameworks/js/napi/update/include/update_session.h b/frameworks/js/napi/update/include/update_session.h index b67df889..dfe615f1 100644 --- a/frameworks/js/napi/update/include/update_session.h +++ b/frameworks/js/napi/update/include/update_session.h @@ -25,9 +25,7 @@ #include "base_async_session.h" #include "base_promise_session.h" #include "iupdater.h" -#include "iupdate_service.h" #include "napi_session.h" -#include "update_client.h" namespace OHOS::UpdateEngine { class BaseUpdateSession : public BaseAsyncSession { diff --git a/frameworks/js/napi/update/src/define_property.cpp b/frameworks/js/napi/update/src/define_property.cpp index bd97a3e9..b4bddcaf 100644 --- a/frameworks/js/napi/update/src/define_property.cpp +++ b/frameworks/js/napi/update/src/define_property.cpp @@ -15,10 +15,22 @@ #include "define_property.h" +#include "business_sub_type.h" +#include "business_vendor.h" +#include "call_result.h" +#include "component_type.h" +#include "description_format.h" +#include "description_type.h" +#include "effective_mode.h" +#include "event_classify.h" +#include "event_id.h" #include "napi_common_utils.h" +#include "network_type.h" +#include "order.h" #include "string_utils.h" #include "update_define.h" -#include "update_helper.h" +#include "upgrade_action.h" +#include "upgrade_status.h" #define DECLARE_ENUM_PROPERTY(item) \ {StringUtils::GetEnumValueString(#item), NapiCommonUtils::CreateUint32(env, CAST_UINT((item)))} diff --git a/frameworks/js/napi/update/src/local_updater.cpp b/frameworks/js/napi/update/src/local_updater.cpp index 5b3967bf..16214501 100644 --- a/frameworks/js/napi/update/src/local_updater.cpp +++ b/frameworks/js/napi/update/src/local_updater.cpp @@ -17,6 +17,7 @@ #include "napi_common_utils.h" #include "update_define.h" +#include "update_callback_info.h" #include "update_service_kits.h" namespace OHOS::UpdateEngine { diff --git a/frameworks/js/napi/update/src/session_manager.cpp b/frameworks/js/napi/update/src/session_manager.cpp index 66aacd0e..eb17ba7d 100644 --- a/frameworks/js/napi/update/src/session_manager.cpp +++ b/frameworks/js/napi/update/src/session_manager.cpp @@ -21,7 +21,6 @@ #include "client_helper.h" #include "update_define.h" -#include "update_helper.h" #include "update_session.h" using namespace std; diff --git a/frameworks/js/napi/update/src/update_client.cpp b/frameworks/js/napi/update/src/update_client.cpp index ddd9547a..2bc0d39d 100644 --- a/frameworks/js/napi/update/src/update_client.cpp +++ b/frameworks/js/napi/update/src/update_client.cpp @@ -19,9 +19,9 @@ #include "client_helper.h" #include "napi_common_utils.h" -#include "update_helper.h" #include "update_service_kits.h" #include "update_session.h" +#include "update_callback_info.h" #include "updater_sa_ipc_interface_code.h" using namespace std; diff --git a/frameworks/js/napi/update/src/update_session.cpp b/frameworks/js/napi/update/src/update_session.cpp index 9c13a8e7..59da7c8c 100644 --- a/frameworks/js/napi/update/src/update_session.cpp +++ b/frameworks/js/napi/update/src/update_session.cpp @@ -20,7 +20,6 @@ #include "client_helper.h" #include "napi_common_utils.h" #include "update_define.h" -#include "update_helper.h" using namespace std; diff --git a/interfaces/inner_api/engine/BUILD.gn b/interfaces/inner_api/engine/BUILD.gn index 8dcbb7d1..272c95a7 100644 --- a/interfaces/inner_api/engine/BUILD.gn +++ b/interfaces/inner_api/engine/BUILD.gn @@ -13,7 +13,7 @@ import("//base/update/updateservice/updateengine.gni") import("//build/ohos.gni") -import("$updateengine_root_path/services/core/ability/log/log.gni") +import("../feature/feature.gni") ohos_prebuilt_etc("updater_sa.rc") { source = "etc/updater_sa.rc" @@ -25,13 +25,9 @@ ohos_prebuilt_etc("updater_sa.rc") { config("updateengine_inner_library_native_config") { include_dirs = [ "$updateengine_root_path/interfaces/inner_api/include", - "$updateengine_root_path/interfaces/inner_api/common/include", - "$updateengine_root_path/services/core/ability/define/include", - "$updateengine_root_path/services/core/ability/log/include", - "$updateengine_root_path/services/core/ability/utils/include", - "//third_party/json/include", ] + include_dirs += feature_include } ohos_shared_library("$updateengine_inner_library_name") { @@ -47,24 +43,15 @@ ohos_shared_library("$updateengine_inner_library_name") { defines += [ "ABILITY_RUNTIME_INNER_ENABLE" ] } sources = [ - "$updateengine_root_path/interfaces/inner_api/common/src/load_sa_service.cpp", - "$updateengine_root_path/interfaces/inner_api/engine/update_service_kits_impl.cpp", - "$updateengine_root_path/interfaces/inner_api/engine/update_service_proxy.cpp", - "$updateengine_root_path/services/callback/src/update_callback.cpp", - "$updateengine_root_path/services/callback/src/update_callback_stub.cpp", - "$updateengine_root_path/services/core/ability/log/src/update_log.cpp", - "$updateengine_root_path/services/engine/src/message_parcel_helper.cpp", - "$updateengine_root_path/services/engine/src/update_helper.cpp", + "$updateengine_root_path/interfaces/inner_api/engine/src/update_callback.cpp", + "$updateengine_root_path/interfaces/inner_api/engine/src/update_callback_stub.cpp", + "$updateengine_root_path/interfaces/inner_api/engine/src/update_service_kits_impl.cpp", + "$updateengine_root_path/interfaces/inner_api/engine/src/update_service_proxy.cpp", ] include_dirs = [ - "$updateengine_root_path/interfaces/inner_api/common/include", + "$updateengine_root_path/interfaces/inner_api/engine/include", "$updateengine_root_path/interfaces/inner_api/include", - "$updateengine_root_path/services/callback/include", - "$updateengine_root_path/services/engine/include", - - "$updateengine_root_path/services/core/ability/define/include", - "$updateengine_root_path/services/core/ability/utils/include", "//third_party/json/include", "//third_party/bounds_checking_function/include", # secure method @@ -74,6 +61,7 @@ ohos_shared_library("$updateengine_inner_library_name") { deps = [ "$updateengine_root_path/interfaces/inner_api/modulemgr:update_module_mgr", + "$updateengine_root_path/common:common", "//third_party/bounds_checking_function:libsec_static", "//third_party/json:nlohmann_json_static", ] @@ -86,6 +74,11 @@ ohos_shared_library("$updateengine_inner_library_name") { "samgr:samgr_proxy", ] + include_dirs += feature_include + sources += feature_sources + deps += feature_deps + external_deps += feature_external_deps + if (ability_ability_runtime_enable) { external_deps += [ "ability_runtime:ability_manager" ] } diff --git a/services/callback/include/update_callback.h b/interfaces/inner_api/engine/include/update_callback.h similarity index 97% rename from services/callback/include/update_callback.h rename to interfaces/inner_api/engine/include/update_callback.h index 202a9500..8d83ff6f 100644 --- a/services/callback/include/update_callback.h +++ b/interfaces/inner_api/engine/include/update_callback.h @@ -16,8 +16,8 @@ #ifndef UPDATE_CALLBACK_H #define UPDATE_CALLBACK_H +#include "update_callback_info.h" #include "update_callback_stub.h" -#include "update_helper.h" namespace OHOS::UpdateEngine { class UpdateCallback : public UpdateCallbackStub { diff --git a/services/callback/include/update_callback_stub.h b/interfaces/inner_api/engine/include/update_callback_stub.h similarity index 100% rename from services/callback/include/update_callback_stub.h rename to interfaces/inner_api/engine/include/update_callback_stub.h diff --git a/interfaces/inner_api/include/update_service_kits_impl.h b/interfaces/inner_api/engine/include/update_service_kits_impl.h similarity index 99% rename from interfaces/inner_api/include/update_service_kits_impl.h rename to interfaces/inner_api/engine/include/update_service_kits_impl.h index a759e86c..96407977 100644 --- a/interfaces/inner_api/include/update_service_kits_impl.h +++ b/interfaces/inner_api/engine/include/update_service_kits_impl.h @@ -21,7 +21,6 @@ #include "base_service_kits_impl.h" #include "iupdate_callback.h" #include "update_define.h" -#include "update_helper.h" #include "update_service_kits.h" #include "update_callback.h" #include "update_service_proxy.h" diff --git a/services/engine/include/update_service_proxy.h b/interfaces/inner_api/engine/include/update_service_proxy.h similarity index 100% rename from services/engine/include/update_service_proxy.h rename to interfaces/inner_api/engine/include/update_service_proxy.h diff --git a/services/callback/src/update_callback.cpp b/interfaces/inner_api/engine/src/update_callback.cpp similarity index 96% rename from services/callback/src/update_callback.cpp rename to interfaces/inner_api/engine/src/update_callback.cpp index 181c5966..363c3997 100644 --- a/services/callback/src/update_callback.cpp +++ b/interfaces/inner_api/engine/src/update_callback.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "update_callback.h" +#include "../include/update_callback.h" #include "update_log.h" diff --git a/services/callback/src/update_callback_stub.cpp b/interfaces/inner_api/engine/src/update_callback_stub.cpp similarity index 98% rename from services/callback/src/update_callback_stub.cpp rename to interfaces/inner_api/engine/src/update_callback_stub.cpp index 55f9b032..a8be6b92 100644 --- a/services/callback/src/update_callback_stub.cpp +++ b/interfaces/inner_api/engine/src/update_callback_stub.cpp @@ -16,7 +16,6 @@ #include "update_callback_stub.h" #include "message_parcel_helper.h" -#include "update_helper.h" #include "update_log.h" using namespace std; diff --git a/interfaces/inner_api/engine/update_service_kits_impl.cpp b/interfaces/inner_api/engine/src/update_service_kits_impl.cpp similarity index 100% rename from interfaces/inner_api/engine/update_service_kits_impl.cpp rename to interfaces/inner_api/engine/src/update_service_kits_impl.cpp diff --git a/interfaces/inner_api/engine/update_service_proxy.cpp b/interfaces/inner_api/engine/src/update_service_proxy.cpp similarity index 97% rename from interfaces/inner_api/engine/update_service_proxy.cpp rename to interfaces/inner_api/engine/src/update_service_proxy.cpp index 05d69311..f8120401 100644 --- a/interfaces/inner_api/engine/update_service_proxy.cpp +++ b/interfaces/inner_api/engine/src/update_service_proxy.cpp @@ -13,17 +13,28 @@ * limitations under the License. */ +#include #include "update_service_proxy.h" #include "securec.h" -#include "common_check.h" #include "message_parcel_helper.h" #include "update_define.h" -#include "update_helper.h" +#include "update_define.h" #include "update_log.h" #include "updater_sa_ipc_interface_code.h" +#define RETURN_WHEN_REMOTE_NULL(remote) ENGINE_CHECK((remote) != nullptr, return INT_CALL_IPC_ERR, "Can not get remote") + +#define IPC_RESULT_TO_CALL_RESULT(result) \ + if ((result) == ERR_NONE) { \ + result = INT_CALL_SUCCESS; \ + } else if ((result) >= CALL_RESULT_OFFSET) { \ + result = (result) - CALL_RESULT_OFFSET; \ + } else { \ + result = INT_CALL_IPC_ERR; \ + } + namespace OHOS::UpdateEngine { #define RETURN_WHEN_TOKEN_WRITE_FAIL(data) \ if (!(data).WriteInterfaceToken(GetDescriptor())) { \ diff --git a/interfaces/inner_api/feature/feature.gni b/interfaces/inner_api/feature/feature.gni new file mode 100644 index 00000000..80c55fec --- /dev/null +++ b/interfaces/inner_api/feature/feature.gni @@ -0,0 +1,32 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("../feature/update/api/api.gni") +import("../feature/update/model/model.gni") + +feature_external_deps = [] +feature_external_deps += api_external_deps +feature_external_deps += model_external_deps + +feature_deps = [] +feature_deps += api_deps +feature_deps += model_deps + +feature_include = [] +feature_include += api_include +feature_include += model_include + + +feature_sources = [] +feature_sources += api_src +feature_sources += model_src diff --git a/interfaces/inner_api/feature/update/api/api.gni b/interfaces/inner_api/feature/update/api/api.gni new file mode 100644 index 00000000..c7b60910 --- /dev/null +++ b/interfaces/inner_api/feature/update/api/api.gni @@ -0,0 +1,23 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +api_external_deps = [] +api_deps = [] +api_include = [ + "../feature/update/api/callback", + "../feature/update/api/local_updater", + "../feature/update/api/online_updater", + "../feature/update/api/restorer", + "../feature/update/api/update_service", +] +api_src = [] diff --git a/interfaces/inner_api/include/iupdate_callback.h b/interfaces/inner_api/feature/update/api/callback/iupdate_callback.h similarity index 97% rename from interfaces/inner_api/include/iupdate_callback.h rename to interfaces/inner_api/feature/update/api/callback/iupdate_callback.h index 68f83ed9..73263d0c 100644 --- a/interfaces/inner_api/include/iupdate_callback.h +++ b/interfaces/inner_api/feature/update/api/callback/iupdate_callback.h @@ -17,7 +17,7 @@ #define IUPDATE_CALLBACK_H #include -#include "update_helper.h" +#include "event_info.h" #include "iremote_broker.h" #include "iremote_proxy.h" diff --git a/interfaces/inner_api/include/iservice_local_updater.h b/interfaces/inner_api/feature/update/api/local_updater/iservice_local_updater.h similarity index 95% rename from interfaces/inner_api/include/iservice_local_updater.h rename to interfaces/inner_api/feature/update/api/local_updater/iservice_local_updater.h index 6d44ff90..d699e717 100644 --- a/interfaces/inner_api/include/iservice_local_updater.h +++ b/interfaces/inner_api/feature/update/api/local_updater/iservice_local_updater.h @@ -18,7 +18,8 @@ #include "refbase.h" -#include "update_helper.h" +#include "business_error.h" +#include "upgrade_info.h" namespace OHOS::UpdateEngine { class IServiceLocalUpdater : public virtual RefBase { diff --git a/interfaces/inner_api/include/iservice_online_updater.h b/interfaces/inner_api/feature/update/api/online_updater/iservice_online_updater.h similarity index 86% rename from interfaces/inner_api/include/iservice_online_updater.h rename to interfaces/inner_api/feature/update/api/online_updater/iservice_online_updater.h index a38db25a..92db3449 100644 --- a/interfaces/inner_api/include/iservice_online_updater.h +++ b/interfaces/inner_api/feature/update/api/online_updater/iservice_online_updater.h @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -18,8 +18,22 @@ #include "refbase.h" +#include "business_error.h" +#include "check_result.h" +#include "clear_options.h" +#include "current_version_info.h" +#include "description_options.h" +#include "download_options.h" #include "iupdate_callback.h" -#include "update_helper.h" +#include "pause_download_options.h" +#include "resume_download_options.h" +#include "new_version_info.h" +#include "upgrade_info.h" +#include "upgrade_options.h" +#include "upgrade_policy.h" +#include "task_info.h" +#include "version_description_info.h" +#include "version_digest_info.h" namespace OHOS::UpdateEngine { class IServiceOnlineUpdater : public virtual RefBase { diff --git a/interfaces/inner_api/include/iservice_restorer.h b/interfaces/inner_api/feature/update/api/restorer/iservice_restorer.h similarity index 97% rename from interfaces/inner_api/include/iservice_restorer.h rename to interfaces/inner_api/feature/update/api/restorer/iservice_restorer.h index b1bd7a60..0c784dc7 100644 --- a/interfaces/inner_api/include/iservice_restorer.h +++ b/interfaces/inner_api/feature/update/api/restorer/iservice_restorer.h @@ -18,7 +18,7 @@ #include "refbase.h" -#include "update_helper.h" +#include "business_error.h" namespace OHOS::UpdateEngine { class IServiceRestorer : public virtual RefBase { diff --git a/interfaces/inner_api/include/iupdate_service.h b/interfaces/inner_api/feature/update/api/update_service/iupdate_service.h similarity index 98% rename from interfaces/inner_api/include/iupdate_service.h rename to interfaces/inner_api/feature/update/api/update_service/iupdate_service.h index 6a28bf72..44f9c248 100644 --- a/interfaces/inner_api/include/iupdate_service.h +++ b/interfaces/inner_api/feature/update/api/update_service/iupdate_service.h @@ -23,7 +23,6 @@ #include "iservice_online_updater.h" #include "iservice_restorer.h" #include "iupdate_callback.h" -#include "update_helper.h" namespace OHOS::UpdateEngine { class IUpdateService : public OHOS::IRemoteBroker, public IServiceOnlineUpdater, public IServiceRestorer, diff --git a/interfaces/inner_api/common/include/common_check.h b/interfaces/inner_api/feature/update/model/check/check_result.h similarity index 50% rename from interfaces/inner_api/common/include/common_check.h rename to interfaces/inner_api/feature/update/model/check/check_result.h index 5200df94..828fe406 100644 --- a/interfaces/inner_api/common/include/common_check.h +++ b/interfaces/inner_api/feature/update/model/check/check_result.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,19 +13,15 @@ * limitations under the License. */ -#ifndef COMMON_CHECK_H -#define COMMON_CHECK_H +#ifndef UPDATE_SERVICE_CHECK_RESULT_H +#define UPDATE_SERVICE_CHECK_RESULT_H -namespace OHOS::UpdateEngine { -#define RETURN_WHEN_REMOTE_NULL(remote) ENGINE_CHECK((remote) != nullptr, return INT_CALL_IPC_ERR, "Can not get remote") +#include "new_version_info.h" -#define IPC_RESULT_TO_CALL_RESULT(result) \ - if ((result) == ERR_NONE) { \ - result = INT_CALL_SUCCESS; \ - } else if ((result) >= CALL_RESULT_OFFSET) { \ - result = (result) - CALL_RESULT_OFFSET; \ - } else { \ - result = INT_CALL_IPC_ERR; \ - } +namespace OHOS::UpdateEngine { +struct CheckResult { + bool isExistNewVersion = false; + NewVersionInfo newVersionInfo; +}; } // namespace OHOS::UpdateEngine -#endif // COMMON_CHECK_H \ No newline at end of file +#endif // UPDATE_SERVICE_CHECK_RESULT_H diff --git a/interfaces/inner_api/feature/update/model/check/search_status.h b/interfaces/inner_api/feature/update/model/check/search_status.h new file mode 100644 index 00000000..1a30af16 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/check/search_status.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_SEARCH_STATUS_H +#define UPDATE_SERVICE_SEARCH_STATUS_H + +namespace OHOS::UpdateEngine { +// 搜索状态 +enum class SearchStatus { + NET_ERROR = -2, + SYSTEM_ERROR, + HAS_NEW_VERSION, + NO_NEW_VERSION, + SERVER_BUSY, + CHECK_EXECUTE_ERR +}; +} // namespace OHOS::UpdateEngine +#endif // UPDATE_SERVICE_SEARCH_STATUS_H diff --git a/interfaces/inner_api/feature/update/model/clear/clear_options.h b/interfaces/inner_api/feature/update/model/clear/clear_options.h new file mode 100644 index 00000000..5b8abe89 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/clear/clear_options.h @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_CLEAR_OPTIONS_H +#define UPDATE_SERVICE_CLEAR_OPTIONS_H + +#include "upgrade_status.h" + +namespace OHOS::UpdateEngine { +struct ClearOptions { + UpgradeStatus status = UpgradeStatus::INIT; +}; +} // namespace OHOS::UpdateEngine +#endif // UPDATE_SERVICE_CLEAR_OPTIONS_H diff --git a/interfaces/inner_api/feature/update/model/common/base_json_struct.h b/interfaces/inner_api/feature/update/model/common/base_json_struct.h new file mode 100644 index 00000000..2dfb87f8 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/common/base_json_struct.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_BASE_JSON_STRUCT_H +#define UPDATE_SERVICE_BASE_JSON_STRUCT_H + +#include + +#include "json_builder.h" + +namespace OHOS::UpdateEngine { +struct BaseJsonStruct { + virtual ~BaseJsonStruct() = default; + + virtual JsonBuilder GetJsonBuilder() = 0; + + virtual std::string ToJson() { + return GetJsonBuilder().ToJson(); + }; +}; +} // namespace OHOS::UpdateEngine +#endif // UPDATE_SERVICE_BASE_JSON_STRUCT_H diff --git a/interfaces/inner_api/feature/update/model/common/order.h b/interfaces/inner_api/feature/update/model/common/order.h new file mode 100644 index 00000000..812559e2 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/common/order.h @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_ORDER_H +#define UPDATE_SERVICE_ORDER_H + +namespace OHOS::UpdateEngine { +enum class Order { + DOWNLOAD = 1, + INSTALL = 2, + DOWNLOAD_AND_INSTALL = DOWNLOAD | INSTALL, + APPLY = 4, + INSTALL_AND_APPLY = INSTALL | APPLY +}; +} // namespace OHOS::UpdateEngine +#endif // UPDATE_SERVICE_ORDER_H diff --git a/interfaces/inner_api/feature/update/model/common/progress.h b/interfaces/inner_api/feature/update/model/common/progress.h new file mode 100644 index 00000000..aaed216c --- /dev/null +++ b/interfaces/inner_api/feature/update/model/common/progress.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_PROGRESS_H +#define UPDATE_SERVICE_PROGRESS_H + +#include +#include + +#include "upgrade_status.h" + +namespace OHOS::UpdateEngine { +struct Progress { + uint32_t percent = 0; + UpgradeStatus status = UpgradeStatus::INIT; + std::string endReason; +}; +} // OHOS::UpdateEngine +#endif // UPDATE_SERVICE_PROGRESS_H diff --git a/interfaces/inner_api/feature/update/model/common/upgrade_status.h b/interfaces/inner_api/feature/update/model/common/upgrade_status.h new file mode 100644 index 00000000..21f97c43 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/common/upgrade_status.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_UPGRADE_STATUS_H +#define UPDATE_SERVICE_UPGRADE_STATUS_H + +namespace OHOS::UpdateEngine { +enum class UpgradeStatus { + INIT = 0, + CHECKING_VERSION = 10, + CHECK_VERSION_FAIL, + CHECK_VERSION_SUCCESS, + DOWNLOADING = 20, + DOWNLOAD_PAUSE, + DOWNLOAD_CANCEL, + DOWNLOAD_FAIL, + DOWNLOAD_SUCCESS, + VERIFYING = 30, + VERIFY_FAIL, + VERIFY_SUCCESS, + AUTHING, + AUTH_FAIL, + AUTH_SUCCESS, + PACKAGE_TRANSING = 70, + PACKAGE_TRANS_FAIL, + PACKAGE_TRANS_SUCCESS, + INSTALLING = 80, + INSTALL_FAIL, + INSTALL_SUCCESS, + UPDATING = 90, + UPDATE_FAIL, + UPDATE_SUCCESS +}; +} // namespace OHOS::UpdateEngine +#endif // UPDATE_SERVICE_UPGRADE_STATUS_H diff --git a/interfaces/inner_api/feature/update/model/download/download_options.h b/interfaces/inner_api/feature/update/model/download/download_options.h new file mode 100644 index 00000000..71fb7737 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/download/download_options.h @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_DOWNLOAD_OPTIONS_H +#define UPDATE_SERVICE_DOWNLOAD_OPTIONS_H + +#include "order.h" +#include "network_type.h" + +namespace OHOS::UpdateEngine { +struct DownloadOptions { + NetType allowNetwork = NetType::WIFI; + Order order = Order::DOWNLOAD; +}; +} // namespace OHOS::UpdateEngine +#endif // UPDATE_SERVICE_DOWNLOAD_OPTIONS_H diff --git a/interfaces/inner_api/feature/update/model/download/pause_download_options.h b/interfaces/inner_api/feature/update/model/download/pause_download_options.h new file mode 100644 index 00000000..bd26b4de --- /dev/null +++ b/interfaces/inner_api/feature/update/model/download/pause_download_options.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_PAUSE_DOWNLOAD_OPTIONS_H +#define UPDATE_SERVICE_PAUSE_DOWNLOAD_OPTIONS_H + +namespace OHOS::UpdateEngine { +struct PauseDownloadOptions { + bool isAllowAutoResume = false; +}; +} // namespace OHOS::UpdateEngine +#endif // UPDATE_SERVICE_PAUSE_DOWNLOAD_OPTIONS_H diff --git a/interfaces/inner_api/feature/update/model/download/resume_download_options.h b/interfaces/inner_api/feature/update/model/download/resume_download_options.h new file mode 100644 index 00000000..22a35d16 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/download/resume_download_options.h @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_RESUME_DOWNLOAD_OPTIONS_H +#define UPDATE_SERVICE_RESUME_DOWNLOAD_OPTIONS_H + +#include "network_type.h" + +namespace OHOS::UpdateEngine { +struct ResumeDownloadOptions { + NetType allowNetwork = NetType::WIFI; +}; +} // namespace OHOS::UpdateEngine +#endif // UPDATE_SERVICE_RESUME_DOWNLOAD_OPTIONS_H diff --git a/interfaces/inner_api/feature/update/model/event/event_classify.h b/interfaces/inner_api/feature/update/model/event/event_classify.h new file mode 100644 index 00000000..2c2f46d0 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/event/event_classify.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_EVENT_CLASSIFY_H +#define UPDATE_SERVICE_EVENT_CLASSIFY_H + +#include + +namespace OHOS::UpdateEngine { +enum class EventClassify { + TASK = 0x01000000, + SYSTEM = 0x02000000, +}; + +const std::list g_eventClassifyList = { EventClassify::TASK, EventClassify::SYSTEM }; +} // namespace OHOS::UpdateEngine +#endif // UPDATE_SERVICE_EVENT_CLASSIFY_H diff --git a/interfaces/inner_api/feature/update/model/event/event_id.h b/interfaces/inner_api/feature/update/model/event/event_id.h new file mode 100644 index 00000000..11e13724 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/event/event_id.h @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_EVENT_ID_H +#define UPDATE_SERVICE_EVENT_ID_H + +#include "event_classify.h" +#include "update_define.h" + +namespace OHOS::UpdateEngine { +enum class EventId { + EVENT_TASK_BASE = CAST_UINT(EventClassify::TASK), + EVENT_TASK_RECEIVE, + EVENT_TASK_CANCEL, + EVENT_DOWNLOAD_WAIT, + EVENT_DOWNLOAD_START, + EVENT_DOWNLOAD_UPDATE, + EVENT_DOWNLOAD_PAUSE, + EVENT_DOWNLOAD_RESUME, + EVENT_DOWNLOAD_SUCCESS, + EVENT_DOWNLOAD_FAIL, + EVENT_UPGRADE_WAIT, + EVENT_UPGRADE_START, + EVENT_UPGRADE_UPDATE, + EVENT_APPLY_WAIT, + EVENT_APPLY_START, + EVENT_UPGRADE_SUCCESS, + EVENT_UPGRADE_FAIL, + EVENT_AUTH_START, + EVENT_AUTH_SUCCESS, + EVENT_DOWNLOAD_CANCEL, + EVENT_INITIALIZE, + EVENT_TASK_CHANGE, + EVENT_VERSION_INFO_CHANGE, + SYSTEM_BASE = CAST_UINT(EventClassify::SYSTEM), + SYSTEM_BOOT_COMPLETE, +}; +} // namespace OHOS::UpdateEngine +#endif // UPDATE_SERVICE_EVENT_ID_H diff --git a/interfaces/inner_api/feature/update/model/event/event_info.h b/interfaces/inner_api/feature/update/model/event/event_info.h new file mode 100644 index 00000000..461d58f6 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/event/event_info.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_EVENT_INFO_H +#define UPDATE_SERVICE_EVENT_INFO_H + +#include "base_json_struct.h" +#include "event_id.h" +#include "task_body.h" + +namespace OHOS::UpdateEngine { +struct EventInfo : public BaseJsonStruct { + EventId eventId = EventId::EVENT_TASK_BASE; + TaskBody taskBody; + + EventInfo() = default; + EventInfo(EventId id, TaskBody body) : eventId(id), taskBody(std::move(body)) {} + + JsonBuilder GetJsonBuilder() final; +}; +} // OHOS::UpdateEngine +#endif // UPDATE_SERVICE_EVENT_INFO_H diff --git a/interfaces/inner_api/feature/update/model/event/on_off/event_classify_info.h b/interfaces/inner_api/feature/update/model/event/on_off/event_classify_info.h new file mode 100644 index 00000000..5c88b568 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/event/on_off/event_classify_info.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_EVENT_CLASSIFY_INFO_H +#define UPDATE_SERVICE_EVENT_CLASSIFY_INFO_H + +#include + +#include "event_classify.h" + +namespace OHOS::UpdateEngine { +struct EventClassifyInfo { + EventClassify eventClassify = EventClassify::TASK; + std::string extraInfo; + + EventClassifyInfo() : eventClassify(EventClassify::TASK) {} + explicit EventClassifyInfo(EventClassify classify) : eventClassify(classify) {} + EventClassifyInfo(EventClassify classify, const std::string &info) : eventClassify(classify), extraInfo(info) {} +}; +} // OHOS::UpdateEngine +#endif // UPDATE_SERVICE_EVENT_CLASSIFY_INFO_H diff --git a/interfaces/inner_api/feature/update/model/event/src/event_info.cpp b/interfaces/inner_api/feature/update/model/event/src/event_info.cpp new file mode 100644 index 00000000..ffea4a75 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/event/src/event_info.cpp @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "event_info.h" +#include "update_define.h" + +namespace OHOS::UpdateEngine { +JsonBuilder EventInfo::GetJsonBuilder() +{ + return JsonBuilder() + .Append("{") + .Append("eventId", CAST_INT(eventId)) + .Append("taskBody", taskBody.GetJsonBuilder(eventId)) + .Append("}"); +} +} // namespace OHOS::UpdateEngine \ No newline at end of file diff --git a/interfaces/inner_api/feature/update/model/event/update_callback_info.h b/interfaces/inner_api/feature/update/model/event/update_callback_info.h new file mode 100644 index 00000000..32777c56 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/event/update_callback_info.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_UPDATE_CALLBACK_INFO_H +#define UPDATE_SERVICE_UPDATE_CALLBACK_INFO_H + +#include "event_info.h" + +namespace OHOS::UpdateEngine { +using OnEvent = std::function; + +// 回调函数 +struct UpdateCallbackInfo { + OnEvent onEvent; +}; +} // OHOS::UpdateEngine +#endif // UPDATE_SERVICE_UPDATE_CALLBACK_INFO_H diff --git a/interfaces/inner_api/feature/update/model/install/install_mode.h b/interfaces/inner_api/feature/update/model/install/install_mode.h new file mode 100644 index 00000000..ba0a4c1f --- /dev/null +++ b/interfaces/inner_api/feature/update/model/install/install_mode.h @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_INSTALL_MODE_H +#define UPDATE_SERVICE_INSTALL_MODE_H + +namespace OHOS::UpdateEngine { +enum class InstallMode { + NORMAL = 0, + NIGHT, + AUTO +}; +} // namespace OHOS::UpdateEngine +#endif // UPDATE_SERVICE_INSTALL_MODE_H diff --git a/interfaces/inner_api/include/message_parcel_helper.h b/interfaces/inner_api/feature/update/model/message_parcel/include/message_parcel_helper.h similarity index 89% rename from interfaces/inner_api/include/message_parcel_helper.h rename to interfaces/inner_api/feature/update/model/message_parcel/include/message_parcel_helper.h index 1d1d0da7..0990c551 100644 --- a/interfaces/inner_api/include/message_parcel_helper.h +++ b/interfaces/inner_api/feature/update/model/message_parcel/include/message_parcel_helper.h @@ -18,9 +18,24 @@ #include +#include "business_error.h" +#include "check_result.h" +#include "clear_options.h" +#include "current_version_info.h" +#include "description_options.h" +#include "download_options.h" +#include "event_info.h" #include "message_parcel.h" +#include "new_version_info.h" #include "parcel.h" -#include "update_helper.h" +#include "pause_download_options.h" +#include "resume_download_options.h" +#include "task_info.h" +#include "upgrade_info.h" +#include "upgrade_options.h" +#include "upgrade_policy.h" +#include "version_description_info.h" +#include "version_digest_info.h" namespace OHOS::UpdateEngine { class MessageParcelHelper { diff --git a/interfaces/inner_api/feature/update/model/message_parcel/message_parcel.gni b/interfaces/inner_api/feature/update/model/message_parcel/message_parcel.gni new file mode 100644 index 00000000..0ce48265 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/message_parcel/message_parcel.gni @@ -0,0 +1,17 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +message_parcel_external_deps = [ "c_utils:utils" ] +message_parcel_deps = [] +message_parcel_include = [ "../feature/update/model/message_parcel/include" ] +message_parcel_src = [ "../feature/update/model/message_parcel/src/message_parcel_helper.cpp" ] diff --git a/services/engine/src/message_parcel_helper.cpp b/interfaces/inner_api/feature/update/model/message_parcel/src/message_parcel_helper.cpp similarity index 99% rename from services/engine/src/message_parcel_helper.cpp rename to interfaces/inner_api/feature/update/model/message_parcel/src/message_parcel_helper.cpp index ca27a2a8..62146059 100644 --- a/services/engine/src/message_parcel_helper.cpp +++ b/interfaces/inner_api/feature/update/model/message_parcel/src/message_parcel_helper.cpp @@ -17,9 +17,9 @@ #include #include +#include #include -#include "update_helper.h" #include "update_log.h" namespace OHOS { diff --git a/interfaces/inner_api/feature/update/model/model.gni b/interfaces/inner_api/feature/update/model/model.gni new file mode 100644 index 00000000..d8bdf713 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/model.gni @@ -0,0 +1,46 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +model_external_deps = [] +model_deps = [] +model_include = [ + "../feature/update/model/check", + "../feature/update/model/clear", + "../feature/update/model/common", + "../feature/update/model/download", + "../feature/update/model/event", + "../feature/update/model/event/on_off", + "../feature/update/model/install", + "../feature/update/model/message_parcel/include", + "../feature/update/model/policy", + "../feature/update/model/subscribe", + "../feature/update/model/task", + "../feature/update/model/upgrade", + "../feature/update/model/upgrade_info", + "../feature/update/model/upgrade", + "../feature/update/model/version_info", + "../feature/update/model/version_info/current_version", + "../feature/update/model/version_info/description", + "../feature/update/model/version_info/new_version", +] +model_src = [ + "../feature/update/model/event/src/event_info.cpp", + "../feature/update/model/message_parcel/src/message_parcel_helper.cpp", + "../feature/update/model/subscribe/src/subscribe_info.cpp", + "../feature/update/model/task/src/task_body.cpp", + "../feature/update/model/upgrade_info/src/business_type.cpp", + "../feature/update/model/upgrade_info/src/upgrade_info.cpp", + "../feature/update/model/version_info/description/src/description_info.cpp", + "../feature/update/model/version_info/src/version_component.cpp", + "../feature/update/model/version_info/src/version_digest_info.cpp", +] diff --git a/interfaces/inner_api/feature/update/model/policy/upgrade_period.h b/interfaces/inner_api/feature/update/model/policy/upgrade_period.h new file mode 100644 index 00000000..e5dabf25 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/policy/upgrade_period.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_UPGRADE_PERIOD_H +#define UPDATE_SERVICE_UPGRADE_PERIOD_H + +#include + +namespace OHOS::UpdateEngine { +struct UpgradePeriod { + uint32_t start = 0; + uint32_t end = 0; +}; +} // OHOS::UpdateEngine +#endif // UPDATE_SERVICE_UPGRADE_PERIOD_H diff --git a/interfaces/inner_api/feature/update/model/policy/upgrade_policy.h b/interfaces/inner_api/feature/update/model/policy/upgrade_policy.h new file mode 100644 index 00000000..97fcf583 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/policy/upgrade_policy.h @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_UPGRADE_POLICY_H +#define UPDATE_SERVICE_UPGRADE_POLICY_H + +#include "upgrade_period.h" + +namespace OHOS::UpdateEngine { +struct UpgradePolicy { + bool downloadStrategy = false; + bool autoUpgradeStrategy = false; + UpgradePeriod autoUpgradePeriods[2]; +}; +} // OHOS::UpdateEngine +#endif // UPDATE_SERVICE_UPGRADE_POLICY_H diff --git a/interfaces/inner_api/feature/update/model/subscribe/src/subscribe_info.cpp b/interfaces/inner_api/feature/update/model/subscribe/src/subscribe_info.cpp new file mode 100644 index 00000000..dc619e52 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/subscribe/src/subscribe_info.cpp @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "subscribe_info.h" + +namespace OHOS::UpdateEngine { +JsonBuilder SubscribeInfo::GetJsonBuilder() +{ + return JsonBuilder() + .Append("{") + .Append("upgradeApp", upgradeApp) + .Append("businessType", businessType.GetJsonBuilder()) + .Append("abilityName", abilityName) + .Append("subscriberDevId", subscriberDevId) + .Append("upgradeDevId", upgradeDevId) + .Append("deviceType", CAST_INT(deviceType)) + .Append("deviceName", deviceName) + .Append("}"); +} +} // namespace OHOS::UpdateEngine \ No newline at end of file diff --git a/interfaces/inner_api/feature/update/model/subscribe/subscribe_info.h b/interfaces/inner_api/feature/update/model/subscribe/subscribe_info.h new file mode 100644 index 00000000..4998f80d --- /dev/null +++ b/interfaces/inner_api/feature/update/model/subscribe/subscribe_info.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_SUBSCRIBE_INFO_H +#define UPDATE_SERVICE_SUBSCRIBE_INFO_H + +#include + +#include "base_json_struct.h" +#include "business_type.h" +#include "device_type.h" + +namespace OHOS::UpdateEngine { +const std::string OUC_PACKAGE_NAME = "com.ohos.updateapp"; +const std::string OUC_SERVICE_EXT_ABILITY_NAME = "ServiceExtAbility"; + +struct SubscribeInfo : public BaseJsonStruct { + std::string upgradeApp = OUC_PACKAGE_NAME; + BusinessType businessType; + std::string abilityName; + std::string subscriberDevId; + std::string upgradeDevId; + DeviceType deviceType = DeviceType::UNKNOWN; + std::string deviceName; + + explicit SubscribeInfo(BusinessSubType subType) + { + businessType.subType = subType; + } + SubscribeInfo() = default; + + JsonBuilder GetJsonBuilder() final; +}; +} // namespace OHOS::UpdateEngine +#endif // UPDATE_SERVICE_SUBSCRIBE_INFO_H diff --git a/services/engine/src/update_helper.cpp b/interfaces/inner_api/feature/update/model/task/src/task_body.cpp similarity index 43% rename from services/engine/src/update_helper.cpp rename to interfaces/inner_api/feature/update/model/task/src/task_body.cpp index 87009b20..38ba79f8 100644 --- a/services/engine/src/update_helper.cpp +++ b/interfaces/inner_api/feature/update/model/task/src/task_body.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,88 +13,11 @@ * limitations under the License. */ -#include "update_helper.h" - -#include -#include - -#include "encrypt_utils.h" #include "update_log.h" +#include "task_body.h" +#include "task_body_member_mask.h" -namespace OHOS { -namespace UpdateEngine { -std::string UpgradeInfo::ToString() const -{ - std::string output = "upgradeApp:" + upgradeApp; - output += ",businessType(vender:" + businessType.vendor; - output += ",subType:" + std::to_string(CAST_INT(businessType.subType)); - output += "),upgradeDevId:" + EncryptUtils::EncryptString(upgradeDevId); - output += ",controlDevId:" + EncryptUtils::EncryptString(controlDevId); - return output; -} - -JsonBuilder BusinessType::GetJsonBuilder() -{ - return JsonBuilder() - .Append("{") - .Append("vendor", vendor) - .Append("subType", CAST_INT(subType)) - .Append("}"); -} - -JsonBuilder VersionDigestInfo::GetJsonBuilder() -{ - return JsonBuilder().Append("{").Append("versionDigest", versionDigest).Append("}"); -} - -JsonBuilder SubscribeInfo::GetJsonBuilder() -{ - return JsonBuilder() - .Append("{") - .Append("upgradeApp", upgradeApp) - .Append("businessType", businessType.GetJsonBuilder()) - .Append("abilityName", abilityName) - .Append("subscriberDevId", subscriberDevId) - .Append("upgradeDevId", upgradeDevId) - .Append("deviceType", CAST_INT(deviceType)) - .Append("deviceName", deviceName) - .Append("}"); -} - -JsonBuilder EventInfo::GetJsonBuilder() -{ - return JsonBuilder() - .Append("{") - .Append("eventId", CAST_INT(eventId)) - .Append("taskBody", taskBody.GetJsonBuilder(eventId)) - .Append("}"); -} - -JsonBuilder DescriptionInfo::GetJsonBuilder() -{ - return JsonBuilder() - .Append("{") - .Append("descriptionType", CAST_INT(descriptionType)) - .Append("content", content) - .Append("}"); -} - -JsonBuilder VersionComponent::GetJsonBuilder() -{ - return JsonBuilder() - .Append("{") - .Append("componentId", componentId) - .Append("componentType", componentType) - .Append("upgradeAction", upgradeAction) - .Append("displayVersion", displayVersion) - .Append("innerVersion", innerVersion) - .Append("size", static_cast(size)) - .Append("effectiveMode", static_cast(effectiveMode)) - .Append("descriptionInfo", descriptionInfo.GetJsonBuilder()) - .Append("componentExtra", componentExtra, true) - .Append("}"); -} - +namespace OHOS::UpdateEngine { JsonBuilder GetJsonBuilder(VersionComponent &versionComponent) { return versionComponent.GetJsonBuilder(); @@ -106,7 +29,7 @@ JsonBuilder GetJsonBuilder(ErrorMessage &errorMessage) } template -std::vector GetArrayJsonBuidlerList(const std::vector &valueList) +std::vector GetArrayJsonBuilderList(const std::vector &valueList) { std::vector jsonBuilderList; for (T value : valueList) { @@ -141,12 +64,11 @@ JsonBuilder TaskBody::GetJsonBuilder(EventId eventId) jsonBuilder.Append("installMode", installMode); } if (taskBodyTemplate & ERROR_MESSAGE) { - jsonBuilder.Append("errorMessages", GetArrayJsonBuidlerList(errorMessages)); + jsonBuilder.Append("errorMessages", GetArrayJsonBuilderList(errorMessages)); } if (taskBodyTemplate & VERSION_COMPONENT) { - jsonBuilder.Append("versionComponents", GetArrayJsonBuidlerList(versionComponents)); + jsonBuilder.Append("versionComponents", GetArrayJsonBuilderList(versionComponents)); } return jsonBuilder.Append("}"); } -} // namespace UpdateEngine -} // namespace OHOS +} // namespace OHOS::UpdateEngine \ No newline at end of file diff --git a/interfaces/inner_api/feature/update/model/task/task_body.h b/interfaces/inner_api/feature/update/model/task/task_body.h new file mode 100644 index 00000000..b803013e --- /dev/null +++ b/interfaces/inner_api/feature/update/model/task/task_body.h @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_TASK_BODY_H +#define UPDATE_SERVICE_TASK_BODY_H + +#include "event_id.h" +#include "error_message.h" +#include "install_mode.h" +#include "update_define.h" +#include "upgrade_status.h" +#include "version_digest_info.h" +#include "version_component.h" + +namespace OHOS::UpdateEngine { +struct TaskBody { + VersionDigestInfo versionDigestInfo; + UpgradeStatus status = UpgradeStatus::INIT; + int32_t subStatus = CAST_INT(UpgradeStatus::INIT); + int32_t progress = 0; + int32_t installMode = CAST_INT(InstallMode::NORMAL); + std::vector errorMessages; + std::vector versionComponents; + + JsonBuilder GetJsonBuilder(EventId eventId); +}; +} // namespace OHOS::UpdateEngine +#endif // UPDATE_SERVICE_TASK_BODY_H diff --git a/interfaces/inner_api/feature/update/model/task/task_body_member_mask.h b/interfaces/inner_api/feature/update/model/task/task_body_member_mask.h new file mode 100644 index 00000000..508a0285 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/task/task_body_member_mask.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_TASK_BODY_MEMBER_MASK_H +#define UPDATE_SERVICE_TASK_BODY_MEMBER_MASK_H + +#include + +#include "event_id.h" + +namespace OHOS::UpdateEngine { +enum TaskBodyMemberMask { + VERSION_DIGEST_INFO = 0x00000001, + UPGRADE_STATUS = 0x00000010, + SUB_STATUS = 0x00000100, + PROGRESS = 0x00001000, + INSTALL_MODE = 0x00010000, + ERROR_MESSAGE = 0x00100000, + VERSION_COMPONENT = 0x01000000 +}; + +const std::map g_taskBodyTemplateMap = { + { EventId::EVENT_TASK_RECEIVE, VERSION_DIGEST_INFO }, + { EventId::EVENT_TASK_CANCEL, VERSION_DIGEST_INFO }, + { EventId::EVENT_DOWNLOAD_WAIT, VERSION_DIGEST_INFO | UPGRADE_STATUS | INSTALL_MODE }, + { EventId::EVENT_DOWNLOAD_START, VERSION_DIGEST_INFO | INSTALL_MODE }, + { EventId::EVENT_DOWNLOAD_UPDATE, VERSION_DIGEST_INFO | UPGRADE_STATUS | PROGRESS | INSTALL_MODE }, + { EventId::EVENT_DOWNLOAD_PAUSE, VERSION_DIGEST_INFO | UPGRADE_STATUS | PROGRESS | INSTALL_MODE | ERROR_MESSAGE }, + { EventId::EVENT_DOWNLOAD_RESUME, VERSION_DIGEST_INFO | UPGRADE_STATUS | PROGRESS | INSTALL_MODE }, + { EventId::EVENT_DOWNLOAD_SUCCESS, VERSION_DIGEST_INFO | INSTALL_MODE }, + { EventId::EVENT_DOWNLOAD_CANCEL, VERSION_DIGEST_INFO | UPGRADE_STATUS }, + { EventId::EVENT_DOWNLOAD_FAIL, VERSION_DIGEST_INFO | INSTALL_MODE | ERROR_MESSAGE }, + { EventId::EVENT_UPGRADE_WAIT, VERSION_DIGEST_INFO | UPGRADE_STATUS | INSTALL_MODE | ERROR_MESSAGE }, + { EventId::EVENT_UPGRADE_START, VERSION_DIGEST_INFO | UPGRADE_STATUS | INSTALL_MODE }, + { EventId::EVENT_UPGRADE_UPDATE, VERSION_DIGEST_INFO | UPGRADE_STATUS | PROGRESS | INSTALL_MODE }, + { EventId::EVENT_APPLY_WAIT, VERSION_DIGEST_INFO | UPGRADE_STATUS | ERROR_MESSAGE }, + { EventId::EVENT_APPLY_START, VERSION_DIGEST_INFO }, + { EventId::EVENT_UPGRADE_SUCCESS, VERSION_DIGEST_INFO | VERSION_COMPONENT }, + { EventId::EVENT_UPGRADE_FAIL, VERSION_DIGEST_INFO | VERSION_COMPONENT | ERROR_MESSAGE }, + { EventId::EVENT_AUTH_START, VERSION_DIGEST_INFO | VERSION_COMPONENT | UPGRADE_STATUS }, + { EventId::EVENT_AUTH_SUCCESS, VERSION_DIGEST_INFO | VERSION_COMPONENT | UPGRADE_STATUS }, + { EventId::EVENT_INITIALIZE, UPGRADE_STATUS }, +}; +} // namespace OHOS::UpdateEngine +#endif // UPDATE_SERVICE_TASK_BODY_MEMBER_MASK_H diff --git a/interfaces/inner_api/feature/update/model/task/task_info.h b/interfaces/inner_api/feature/update/model/task/task_info.h new file mode 100644 index 00000000..d9651f5d --- /dev/null +++ b/interfaces/inner_api/feature/update/model/task/task_info.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_TASK_INFO_H +#define UPDATE_SERVICE_TASK_INFO_H + +#include "task_body.h" + +namespace OHOS::UpdateEngine { +struct TaskInfo { + bool existTask = false; + TaskBody taskBody; +}; +} // OHOS::UpdateEngine +#endif // UPDATE_SERVICE_TASK_INFO_H diff --git a/interfaces/inner_api/feature/update/model/upgrade/upgrade_interval.h b/interfaces/inner_api/feature/update/model/upgrade/upgrade_interval.h new file mode 100644 index 00000000..af12b11d --- /dev/null +++ b/interfaces/inner_api/feature/update/model/upgrade/upgrade_interval.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_UPGRADE_INTERVAL_H +#define UPDATE_SERVICE_UPGRADE_INTERVAL_H + +#include + +namespace OHOS::UpdateEngine { +struct UpgradeInterval { + uint64_t timeStart = 0; + uint64_t timeEnd = 0; +}; +} // OHOS::UpdateEngine +#endif // UPDATE_SERVICE_UPGRADE_INTERVAL_H diff --git a/interfaces/inner_api/feature/update/model/upgrade/upgrade_options.h b/interfaces/inner_api/feature/update/model/upgrade/upgrade_options.h new file mode 100644 index 00000000..c8b9d9a6 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/upgrade/upgrade_options.h @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_UPGRADE_OPTIONS_H +#define UPDATE_SERVICE_UPGRADE_OPTIONS_H + +#include "order.h" + +namespace OHOS::UpdateEngine { +struct UpgradeOptions { + Order order = Order::INSTALL; +}; +} // namespace OHOS::UpdateEngine +#endif // UPDATE_SERVICE_UPGRADE_OPTIONS_H diff --git a/interfaces/inner_api/feature/update/model/upgrade_info/business_sub_type.h b/interfaces/inner_api/feature/update/model/upgrade_info/business_sub_type.h new file mode 100644 index 00000000..d37e3929 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/upgrade_info/business_sub_type.h @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_BUSINESS_SUB_TYPE_H +#define UPDATE_SERVICE_BUSINESS_SUB_TYPE_H + +namespace OHOS::UpdateEngine { +enum class BusinessSubType { + START_UP = 0, + FIRMWARE = 1, + PARAM = 2, + ROLLBACK = 3, + ACCESSORY = 4 +}; +} // namespace OHOS::UpdateEngine: +#endif // UPDATE_SERVICE_BUSINESS_SUB_TYPE_H diff --git a/interfaces/inner_api/feature/update/model/upgrade_info/business_type.h b/interfaces/inner_api/feature/update/model/upgrade_info/business_type.h new file mode 100644 index 00000000..ea25b917 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/upgrade_info/business_type.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_BUSINESS_TYPE_H +#define UPDATE_SERVICE_BUSINESS_TYPE_H + +#include + +#include "base_json_struct.h" +#include "business_sub_type.h" +#include "business_vendor.h" +#include "update_define.h" + +namespace OHOS::UpdateEngine { +struct BusinessType : public BaseJsonStruct { + std::string vendor; // BusinessVendor + BusinessSubType subType = BusinessSubType::FIRMWARE; + + bool operator<(const BusinessType &businessType) const + { + if (vendor < businessType.vendor) return true; + if (vendor > businessType.vendor) return false; + + if (CAST_INT(subType) < CAST_INT(businessType.subType)) return true; + if (CAST_INT(subType) > CAST_INT(businessType.subType)) return false; + + return false; + } + + JsonBuilder GetJsonBuilder() final; +}; +} // namespace OHOS::UpdateEngine +#endif // UPDATE_SERVICE_BUSINESS_TYPE_H diff --git a/interfaces/inner_api/feature/update/model/upgrade_info/business_vendor.h b/interfaces/inner_api/feature/update/model/upgrade_info/business_vendor.h new file mode 100644 index 00000000..a6732da0 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/upgrade_info/business_vendor.h @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_BUSINESS_VENDOR_H +#define UPDATE_SERVICE_BUSINESS_VENDOR_H + +namespace OHOS::UpdateEngine { +class BusinessVendor { +public: + static constexpr const char *PUBLIC = "public"; +}; +} // namespace OHOS::UpdateEngine +#endif // UPDATE_SERVICE_BUSINESS_VENDOR_H diff --git a/interfaces/inner_api/feature/update/model/upgrade_info/src/business_type.cpp b/interfaces/inner_api/feature/update/model/upgrade_info/src/business_type.cpp new file mode 100644 index 00000000..1cb14a37 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/upgrade_info/src/business_type.cpp @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "business_type.h" + +namespace OHOS::UpdateEngine { +JsonBuilder BusinessType::GetJsonBuilder() +{ + return JsonBuilder() + .Append("{") + .Append("vendor", vendor) + .Append("subType", CAST_INT(subType)) + .Append("}"); +} +} // namespace OHOS::UpdateEngine \ No newline at end of file diff --git a/interfaces/inner_api/feature/update/model/upgrade_info/src/upgrade_info.cpp b/interfaces/inner_api/feature/update/model/upgrade_info/src/upgrade_info.cpp new file mode 100644 index 00000000..56856b59 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/upgrade_info/src/upgrade_info.cpp @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "encrypt_utils.h" +#include "upgrade_info.h" +#include "update_define.h" + +namespace OHOS::UpdateEngine { +std::string UpgradeInfo::ToString() const +{ + std::string output = "upgradeApp:" + upgradeApp; + output += ",businessType(vender:" + businessType.vendor; + output += ",subType:" + std::to_string(CAST_INT(businessType.subType)); + output += "),upgradeDevId:" + EncryptUtils::EncryptString(upgradeDevId); + output += ",controlDevId:" + EncryptUtils::EncryptString(controlDevId); + return output; +} +} // namespace OHOS::UpdateEngine \ No newline at end of file diff --git a/interfaces/inner_api/feature/update/model/upgrade_info/upgrade_info.h b/interfaces/inner_api/feature/update/model/upgrade_info/upgrade_info.h new file mode 100644 index 00000000..89ce5b13 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/upgrade_info/upgrade_info.h @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_UPGRADE_INFO_H +#define UPDATE_SERVICE_UPGRADE_INFO_H + +#include + +#include "business_type.h" +#include "device_type.h" + +namespace OHOS::UpdateEngine { +const std::string LOCAL_UPGRADE_INFO = "LocalUpgradeInfo"; +struct UpgradeInfo { + std::string upgradeApp; + BusinessType businessType; + std::string upgradeDevId; + std::string controlDevId; + int32_t processId; + DeviceType deviceType; + + bool operator<(const UpgradeInfo &r) const + { + if (upgradeApp < r.upgradeApp) return true; + if (upgradeApp > r.upgradeApp) return false; + + if (businessType < r.businessType) return true; + if (r.businessType < businessType) return false; + + if (upgradeDevId < r.upgradeDevId) return true; + if (upgradeDevId > r.upgradeDevId) return false; + + if (controlDevId < r.controlDevId) return true; + if (controlDevId > r.controlDevId) return false; + + if (processId < r.processId) return true; + if (processId > r.processId) return false; + + if (deviceType < r.deviceType) return true; + if (deviceType > r.deviceType) return false; + + return false; + } + + std::string ToString() const; + + bool IsLocal() const + { + return upgradeApp == LOCAL_UPGRADE_INFO; + } +}; +} // namespace OHOS::UpdateEngine +#endif // UPDATE_SERVICE_UPGRADE_INFO_H diff --git a/interfaces/inner_api/feature/update/model/version_info/component_type.h b/interfaces/inner_api/feature/update/model/version_info/component_type.h new file mode 100644 index 00000000..55538de9 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/version_info/component_type.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_COMPONENT_TYPE_H +#define UPDATE_SERVICE_COMPONENT_TYPE_H + +namespace OHOS::UpdateEngine { +enum class ComponentType { + INVALID = 0, + OTA = 1, + PATCH = 2, + COTA = 4, + PARAM = 8, + SA = 16 +}; +} // namespace OHOS::UpdateEngine +#endif // UPDATE_SERVICE_COMPONENT_TYPE_H diff --git a/interfaces/inner_api/feature/update/model/version_info/current_version/current_version_info.h b/interfaces/inner_api/feature/update/model/version_info/current_version/current_version_info.h new file mode 100644 index 00000000..d6645118 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/version_info/current_version/current_version_info.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_CURRENT_VERSION_INFO_H +#define UPDATE_SERVICE_CURRENT_VERSION_INFO_H + +#include +#include + +#include "version_component.h" + +namespace OHOS::UpdateEngine { +struct CurrentVersionInfo { + std::string osVersion; + std::string deviceName; + std::vector versionComponents; +}; +} // namespace OHOS::UpdateEngine +#endif // UPDATE_SERVICE_CURRENT_VERSION_INFO_H diff --git a/interfaces/inner_api/feature/update/model/version_info/description/component_description.h b/interfaces/inner_api/feature/update/model/version_info/description/component_description.h new file mode 100644 index 00000000..8ed99c97 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/version_info/description/component_description.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_COMPONENT_DESCRIPTION_H +#define UPDATE_SERVICE_COMPONENT_DESCRIPTION_H + +#include + +#include "description_info.h" + +namespace OHOS::UpdateEngine { +struct ComponentDescription { + std::string componentId; + DescriptionInfo descriptionInfo; + DescriptionInfo notifyDescriptionInfo; +}; +} // namespace OHOS::UpdateEngine +#endif // UPDATE_SERVICE_COMPONENT_DESCRIPTION_H diff --git a/interfaces/inner_api/feature/update/model/version_info/description/description_format.h b/interfaces/inner_api/feature/update/model/version_info/description/description_format.h new file mode 100644 index 00000000..0d266d75 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/version_info/description/description_format.h @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_DESCRIPTION_FORMAT_H +#define UPDATE_SERVICE_DESCRIPTION_FORMAT_H + +namespace OHOS::UpdateEngine { +enum class DescriptionFormat { + STANDARD = 0, + SIMPLIFIED = 1 +}; +} // namespace OHOS::UpdateEngine +#endif // UPDATE_SERVICE_DESCRIPTION_FORMAT_H diff --git a/interfaces/inner_api/feature/update/model/version_info/description/description_info.h b/interfaces/inner_api/feature/update/model/version_info/description/description_info.h new file mode 100644 index 00000000..a3cf3267 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/version_info/description/description_info.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_DESCRIPTION_INFO_H +#define UPDATE_SERVICE_DESCRIPTION_INFO_H + +#include "base_json_struct.h" +#include "description_type.h" + +namespace OHOS::UpdateEngine { +struct DescriptionInfo : public BaseJsonStruct { + DescriptionType descriptionType = DescriptionType::CONTENT; + std::string content; + + JsonBuilder GetJsonBuilder() final; +}; +} // namespace OHOS::UpdateEngine +#endif // UPDATE_SERVICE_DESCRIPTION_INFO_H diff --git a/interfaces/inner_api/feature/update/model/version_info/description/description_options.h b/interfaces/inner_api/feature/update/model/version_info/description/description_options.h new file mode 100644 index 00000000..192bf1d0 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/version_info/description/description_options.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_DESCRIPTION_OPTIONS_H +#define UPDATE_SERVICE_DESCRIPTION_OPTIONS_H + +#include + +#include "description_format.h" + +namespace OHOS::UpdateEngine { +struct DescriptionOptions { + DescriptionFormat format = DescriptionFormat::STANDARD; + std::string language; +}; +} // namespace OHOS::UpdateEngine +#endif // UPDATE_SERVICE_DESCRIPTION_OPTIONS_H diff --git a/interfaces/inner_api/feature/update/model/version_info/description/description_type.h b/interfaces/inner_api/feature/update/model/version_info/description/description_type.h new file mode 100644 index 00000000..e717f1bf --- /dev/null +++ b/interfaces/inner_api/feature/update/model/version_info/description/description_type.h @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_DESCRIPTION_TYPE_H +#define UPDATE_SERVICE_DESCRIPTION_TYPE_H + +namespace OHOS::UpdateEngine { +enum class DescriptionType { + CONTENT = 0, + URI = 1, + ID = 2 +}; +} // namespace OHOS::UpdateEngine +#endif // UPDATE_SERVICE_DESCRIPTION_TYPE_H diff --git a/interfaces/inner_api/feature/update/model/version_info/description/src/description_info.cpp b/interfaces/inner_api/feature/update/model/version_info/description/src/description_info.cpp new file mode 100644 index 00000000..27e74c93 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/version_info/description/src/description_info.cpp @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "description_info.h" +#include "update_define.h" + +namespace OHOS::UpdateEngine { +JsonBuilder DescriptionInfo::GetJsonBuilder() +{ + return JsonBuilder() + .Append("{") + .Append("descriptionType", CAST_INT(descriptionType)) + .Append("content", content) + .Append("}"); +} +} // namespace OHOS::UpdateEngine \ No newline at end of file diff --git a/interfaces/inner_api/feature/update/model/version_info/description/version_description_info.h b/interfaces/inner_api/feature/update/model/version_info/description/version_description_info.h new file mode 100644 index 00000000..83fa61b5 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/version_info/description/version_description_info.h @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_VERSION_DESCRIPTION_INFO_H +#define UPDATE_SERVICE_VERSION_DESCRIPTION_INFO_H + +#include + +#include "component_description.h" + +namespace OHOS::UpdateEngine { +struct VersionDescriptionInfo { + std::vector componentDescriptions; +}; +} // namespace OHOS::UpdateEngine +#endif // UPDATE_SERVICE_VERSION_DESCRIPTION_INFO_H diff --git a/interfaces/inner_api/feature/update/model/version_info/effective_mode.h b/interfaces/inner_api/feature/update/model/version_info/effective_mode.h new file mode 100644 index 00000000..ecf221ea --- /dev/null +++ b/interfaces/inner_api/feature/update/model/version_info/effective_mode.h @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_EFFECTIVE_MODE_H +#define UPDATE_SERVICE_EFFECTIVE_MODE_H + +namespace OHOS::UpdateEngine { +enum class EffectiveMode { + COLD = 1, + LIVE = 2, + LIVE_AND_COLD = 3 +}; +} // namespace OHOS::UpdateEngine +#endif // UPDATE_SERVICE_EFFECTIVE_MODE_H diff --git a/interfaces/inner_api/feature/update/model/version_info/new_version/new_version_info.h b/interfaces/inner_api/feature/update/model/version_info/new_version/new_version_info.h new file mode 100644 index 00000000..6578830f --- /dev/null +++ b/interfaces/inner_api/feature/update/model/version_info/new_version/new_version_info.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_NEW_VERSION_INFO_H +#define UPDATE_SERVICE_NEW_VERSION_INFO_H + +#include + +#include "version_component.h" +#include "version_digest_info.h" + +namespace OHOS::UpdateEngine { +struct NewVersionInfo { + VersionDigestInfo versionDigestInfo; + std::vector versionComponents; +}; +} // namespace OHOS::UpdateEngine +#endif // UPDATE_SERVICE_NEW_VERSION_INFO_H diff --git a/interfaces/inner_api/feature/update/model/version_info/src/version_component.cpp b/interfaces/inner_api/feature/update/model/version_info/src/version_component.cpp new file mode 100644 index 00000000..7a11eff8 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/version_info/src/version_component.cpp @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "version_component.h" + +namespace OHOS::UpdateEngine { +JsonBuilder VersionComponent::GetJsonBuilder() +{ + return JsonBuilder() + .Append("{") + .Append("componentId", componentId) + .Append("componentType", componentType) + .Append("upgradeAction", upgradeAction) + .Append("displayVersion", displayVersion) + .Append("innerVersion", innerVersion) + .Append("size", static_cast(size)) + .Append("effectiveMode", static_cast(effectiveMode)) + .Append("descriptionInfo", descriptionInfo.GetJsonBuilder()) + .Append("componentExtra", componentExtra, true) + .Append("}"); +} +} // namespace OHOS::UpdateEngine \ No newline at end of file diff --git a/interfaces/inner_api/feature/update/model/version_info/src/version_digest_info.cpp b/interfaces/inner_api/feature/update/model/version_info/src/version_digest_info.cpp new file mode 100644 index 00000000..e3c1217e --- /dev/null +++ b/interfaces/inner_api/feature/update/model/version_info/src/version_digest_info.cpp @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "version_digest_info.h" + +namespace OHOS::UpdateEngine { +JsonBuilder VersionDigestInfo::GetJsonBuilder() +{ + return JsonBuilder() + .Append("{") + .Append("versionDigest", versionDigest) + .Append("}"); +} +} // namespace OHOS::UpdateEngine \ No newline at end of file diff --git a/interfaces/inner_api/feature/update/model/version_info/upgrade_action.h b/interfaces/inner_api/feature/update/model/version_info/upgrade_action.h new file mode 100644 index 00000000..2b7b8b15 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/version_info/upgrade_action.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_UPGRADE_ACTION_H +#define UPDATE_SERVICE_UPGRADE_ACTION_H + +namespace OHOS::UpdateEngine { +class UpgradeAction { +public: + static constexpr const char *UPGRADE = "upgrade"; + static constexpr const char *RECOVERY = "recovery"; + static constexpr const char *ROLLBACK = "rollback"; +}; +} // namespace OHOS::UpdateEngine +#endif // UPDATE_SERVICE_UPGRADE_ACTION_H diff --git a/interfaces/inner_api/feature/update/model/version_info/version_component.h b/interfaces/inner_api/feature/update/model/version_info/version_component.h new file mode 100644 index 00000000..12be40da --- /dev/null +++ b/interfaces/inner_api/feature/update/model/version_info/version_component.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_VERSION_COMPONENT_H +#define UPDATE_SERVICE_VERSION_COMPONENT_H + +#include +#include + +#include "base_json_struct.h" +#include "component_type.h" +#include "description_info.h" +#include "effective_mode.h" +#include "update_define.h" +#include "upgrade_action.h" + +namespace OHOS::UpdateEngine { +struct VersionComponent : public BaseJsonStruct { + std::string componentId; + int32_t componentType = CAST_INT(ComponentType::INVALID); + std::string upgradeAction; + std::string displayVersion; + std::string innerVersion; + size_t size = 0; + size_t effectiveMode = static_cast(EffectiveMode::COLD); + DescriptionInfo descriptionInfo; + std::string componentExtra; + + JsonBuilder GetJsonBuilder() final; +}; +} // namespace OHOS::UpdateEngine +#endif // UPDATE_SERVICE_VERSION_COMPONENT_H diff --git a/interfaces/inner_api/feature/update/model/version_info/version_digest_info.h b/interfaces/inner_api/feature/update/model/version_info/version_digest_info.h new file mode 100644 index 00000000..188c9ca7 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/version_info/version_digest_info.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_VERSION_DIGEST_INFO_H +#define UPDATE_SERVICE_VERSION_DIGEST_INFO_H + +#include + +#include "base_json_struct.h" + +namespace OHOS::UpdateEngine { +struct VersionDigestInfo : public BaseJsonStruct { + std::string versionDigest; + + JsonBuilder GetJsonBuilder() final; +}; +} // namespace OHOS::UpdateEngine +#endif // UPDATE_SERVICE_VERSION_DIGEST_INFO_H diff --git a/interfaces/inner_api/include/update_helper.h b/interfaces/inner_api/include/update_helper.h deleted file mode 100644 index ef5949b6..00000000 --- a/interfaces/inner_api/include/update_helper.h +++ /dev/null @@ -1,522 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef UPDATE_HELPER_H -#define UPDATE_HELPER_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "nlohmann/json.hpp" - -#include "common_error_define.h" -#include "json_builder.h" -#include "net_manager_model.h" -#include "update_define.h" - -namespace OHOS::UpdateEngine { -const std::string OUC_PACKAGE_NAME = "com.ohos.updateapp"; -const std::string OUC_SERVICE_EXT_ABILITY_NAME = "ServiceExtAbility"; - -// 搜索状态 -enum class SearchStatus { - NET_ERROR = -2, - SYSTEM_ERROR, - HAS_NEW_VERSION, - NO_NEW_VERSION, - SERVER_BUSY, - CHECK_EXECUTE_ERR -}; - -enum class UpgradeStatus { - INIT = 0, - CHECKING_VERSION = 10, - CHECK_VERSION_FAIL, - CHECK_VERSION_SUCCESS, - DOWNLOADING = 20, - DOWNLOAD_PAUSE, - DOWNLOAD_CANCEL, - DOWNLOAD_FAIL, - DOWNLOAD_SUCCESS, - VERIFYING = 30, - VERIFY_FAIL, - VERIFY_SUCCESS, - AUTHING, - AUTH_FAIL, - AUTH_SUCCESS, - PACKAGE_TRANSING = 70, - PACKAGE_TRANS_FAIL, - PACKAGE_TRANS_SUCCESS, - INSTALLING = 80, - INSTALL_FAIL, - INSTALL_SUCCESS, - UPDATING = 90, - UPDATE_FAIL, - UPDATE_SUCCESS -}; - -enum class PackageType { - DYNAMIC = 0, - NORMAL = 1, - BASE = 2, - CUST = 3, - PRELOAD = 4, - COTA = 5, - VERSION = 6, - PATCH = 8, - SA = 9 -}; - -enum class ComponentType { - INVALID = 0, - OTA = 1, - PATCH = 2, - COTA = 4, - PARAM = 8, - SA = 16 -}; - -enum class EffectiveMode { - COLD = 1, - LIVE = 2, - LIVE_AND_COLD = 3 -}; - -enum class Order { - DOWNLOAD = 1, - INSTALL = 2, - DOWNLOAD_AND_INSTALL = DOWNLOAD | INSTALL, - APPLY = 4, - INSTALL_AND_APPLY = INSTALL | APPLY -}; - -enum class OptionsAfterUpgrade { - NORMAL = 0, - REBOOT = 1, - SHUTDOWN = 2 -}; - -enum class BusinessSubType { - START_UP = 0, - FIRMWARE = 1, - PARAM = 2, - ROLLBACK = 3, - ACCESSORY = 4 -}; - -enum class DescriptionType { - CONTENT = 0, - URI = 1, - ID = 2 -}; - -enum class DescriptionFormat { - STANDARD = 0, - SIMPLIFIED = 1 -}; - -enum ForceUpgradeSwitch { - OPEN = 0x01000000, - CLOSE = 0x00000000, -}; - -enum ForceUpgradeDataNetworkOption { - CELLULAR_NOT_SUPPORT = 0x00000000, - CELLULAR = 0x00000001, - ROAMING = 0x00000002, - CELLULAR_AND_ROAMING = CELLULAR | ROAMING, -}; - -enum class ForceUpgradeType { - NOT_SUPPORT = ForceUpgradeSwitch::CLOSE, - CELLULAR_NOT_SUPPORT = ForceUpgradeSwitch::OPEN | ForceUpgradeDataNetworkOption::CELLULAR_NOT_SUPPORT, - CELLULAR = ForceUpgradeSwitch::OPEN | ForceUpgradeDataNetworkOption::CELLULAR, - CELLULAR_AND_ROAMING = ForceUpgradeSwitch::OPEN | ForceUpgradeDataNetworkOption::CELLULAR_AND_ROAMING, -}; - -enum class EventClassify { - TASK = 0x01000000, - SYSTEM = 0x02000000, -}; - -const std::list g_eventClassifyList = { EventClassify::TASK, EventClassify::SYSTEM }; - -enum class EventId { - EVENT_TASK_BASE = CAST_UINT(EventClassify::TASK), - EVENT_TASK_RECEIVE, - EVENT_TASK_CANCEL, - EVENT_DOWNLOAD_WAIT, - EVENT_DOWNLOAD_START, - EVENT_DOWNLOAD_UPDATE, - EVENT_DOWNLOAD_PAUSE, - EVENT_DOWNLOAD_RESUME, - EVENT_DOWNLOAD_SUCCESS, - EVENT_DOWNLOAD_FAIL, - EVENT_UPGRADE_WAIT, - EVENT_UPGRADE_START, - EVENT_UPGRADE_UPDATE, - EVENT_APPLY_WAIT, - EVENT_APPLY_START, - EVENT_UPGRADE_SUCCESS, - EVENT_UPGRADE_FAIL, - EVENT_AUTH_START, - EVENT_AUTH_SUCCESS, - EVENT_DOWNLOAD_CANCEL, - EVENT_INITIALIZE, - EVENT_TASK_CHANGE, - EVENT_VERSION_INFO_CHANGE, - SYSTEM_BASE = CAST_UINT(EventClassify::SYSTEM), - SYSTEM_BOOT_COMPLETE, -}; - -enum TaskBodyMemeberMask { - VERSION_DIGEST_INFO = 0x00000001, - UPGRADE_STATUS = 0x00000010, - SUB_STATUS = 0x00000100, - PROGRESS = 0x00001000, - INSTALL_MODE = 0x00010000, - ERROR_MESSAGE = 0x00100000, - VERSION_COMPONENT = 0x01000000 -}; - -const std::map g_taskBodyTemplateMap = { - { EventId::EVENT_TASK_RECEIVE, VERSION_DIGEST_INFO }, - { EventId::EVENT_TASK_CHANGE, VERSION_DIGEST_INFO | UPGRADE_STATUS | PROGRESS }, - { EventId::EVENT_TASK_CANCEL, VERSION_DIGEST_INFO }, - { EventId::EVENT_VERSION_INFO_CHANGE, VERSION_DIGEST_INFO | UPGRADE_STATUS }, - { EventId::EVENT_DOWNLOAD_WAIT, VERSION_DIGEST_INFO | UPGRADE_STATUS | INSTALL_MODE }, - { EventId::EVENT_DOWNLOAD_START, VERSION_DIGEST_INFO | INSTALL_MODE }, - { EventId::EVENT_DOWNLOAD_UPDATE, VERSION_DIGEST_INFO | UPGRADE_STATUS | PROGRESS | INSTALL_MODE }, - { EventId::EVENT_DOWNLOAD_PAUSE, VERSION_DIGEST_INFO | UPGRADE_STATUS | PROGRESS | INSTALL_MODE | ERROR_MESSAGE }, - { EventId::EVENT_DOWNLOAD_RESUME, VERSION_DIGEST_INFO | UPGRADE_STATUS | PROGRESS | INSTALL_MODE }, - { EventId::EVENT_DOWNLOAD_SUCCESS, VERSION_DIGEST_INFO | INSTALL_MODE }, - { EventId::EVENT_DOWNLOAD_CANCEL, VERSION_DIGEST_INFO | UPGRADE_STATUS }, - { EventId::EVENT_DOWNLOAD_FAIL, VERSION_DIGEST_INFO | INSTALL_MODE | ERROR_MESSAGE }, - { EventId::EVENT_UPGRADE_WAIT, VERSION_DIGEST_INFO | UPGRADE_STATUS | INSTALL_MODE | ERROR_MESSAGE }, - { EventId::EVENT_UPGRADE_START, VERSION_DIGEST_INFO | UPGRADE_STATUS | INSTALL_MODE }, - { EventId::EVENT_UPGRADE_UPDATE, VERSION_DIGEST_INFO | UPGRADE_STATUS | PROGRESS | INSTALL_MODE }, - { EventId::EVENT_APPLY_WAIT, VERSION_DIGEST_INFO | UPGRADE_STATUS | ERROR_MESSAGE }, - { EventId::EVENT_APPLY_START, VERSION_DIGEST_INFO }, - { EventId::EVENT_UPGRADE_SUCCESS, VERSION_DIGEST_INFO | VERSION_COMPONENT }, - { EventId::EVENT_UPGRADE_FAIL, VERSION_DIGEST_INFO | VERSION_COMPONENT | ERROR_MESSAGE }, - { EventId::EVENT_AUTH_START, VERSION_DIGEST_INFO | VERSION_COMPONENT | UPGRADE_STATUS }, - { EventId::EVENT_AUTH_SUCCESS, VERSION_DIGEST_INFO | VERSION_COMPONENT | UPGRADE_STATUS }, - { EventId::EVENT_INITIALIZE, UPGRADE_STATUS }, - { EventId::SYSTEM_BOOT_COMPLETE, UPGRADE_STATUS } -}; - -class UpgradeAction { -public: - static constexpr const char *UPGRADE = "upgrade"; - static constexpr const char *RECOVERY = "recovery"; - static constexpr const char *ROLLBACK = "rollback"; -}; - -class BusinessVendor { -public: - static constexpr const char *PUBLIC = "public"; -}; - -struct BaseJsonStruct { - virtual ~BaseJsonStruct() {} - virtual JsonBuilder GetJsonBuilder() = 0; - - virtual std::string ToJson() - { - return GetJsonBuilder().ToJson(); - }; -}; - -enum class DeviceType { - UNKNOWN = 0, - SMART_PHONE = 1, // 手机 - SMART_PAD = 2, // 平板 - SMART_TV = 4, // 智能电视 - TWS = 6, // 真无线耳机 - KEYBOARD = 7, // 键盘 - PEN = 8 // 手写笔 -}; - -struct BusinessType : public BaseJsonStruct { - std::string vendor; // BusinessVendor - BusinessSubType subType = BusinessSubType::FIRMWARE; - - bool operator<(const BusinessType &businessType) const - { - if (vendor < businessType.vendor) return true; - if (vendor > businessType.vendor) return false; - - if (CAST_INT(subType) < CAST_INT(businessType.subType)) return true; - if (CAST_INT(subType) > CAST_INT(businessType.subType)) return false; - - return false; - } - - JsonBuilder GetJsonBuilder() final; -}; - -const std::string LOCAL_UPGRADE_INFO = "LocalUpgradeInfo"; -struct UpgradeInfo { - std::string upgradeApp; - BusinessType businessType; - std::string upgradeDevId; - std::string controlDevId; - int32_t processId; - DeviceType deviceType; - - bool operator<(const UpgradeInfo &r) const - { - if (upgradeApp < r.upgradeApp) return true; - if (upgradeApp > r.upgradeApp) return false; - - if (businessType < r.businessType) return true; - if (r.businessType < businessType) return false; - - if (upgradeDevId < r.upgradeDevId) return true; - if (upgradeDevId > r.upgradeDevId) return false; - - if (controlDevId < r.controlDevId) return true; - if (controlDevId > r.controlDevId) return false; - - if (processId < r.processId) return true; - if (processId > r.processId) return false; - - if (deviceType < r.deviceType) return true; - if (deviceType > r.deviceType) return false; - - return false; - } - - std::string ToString() const; - - bool IsLocal() const - { - return upgradeApp == LOCAL_UPGRADE_INFO; - } -}; - -struct SubscribeInfo : public BaseJsonStruct { - std::string upgradeApp = OUC_PACKAGE_NAME; - BusinessType businessType; - std::string abilityName; - std::string subscriberDevId; - std::string upgradeDevId; - DeviceType deviceType = DeviceType::UNKNOWN; - std::string deviceName; - - explicit SubscribeInfo(BusinessSubType subType) - { - businessType.subType = subType; - } - SubscribeInfo() = default; - - JsonBuilder GetJsonBuilder() final; -}; - -struct VersionDigestInfo : public BaseJsonStruct { - std::string versionDigest; - - JsonBuilder GetJsonBuilder() final; -}; - -struct DescriptionOptions { - DescriptionFormat format = DescriptionFormat::STANDARD; - std::string language; -}; - -struct DownloadOptions { - NetType allowNetwork = NetType::WIFI; - Order order = Order::DOWNLOAD; -}; - -struct ResumeDownloadOptions { - NetType allowNetwork = NetType::WIFI; -}; - -struct PauseDownloadOptions { - bool isAllowAutoResume = false; -}; - -struct UpgradeOptions { - Order order = Order::INSTALL; - OptionsAfterUpgrade optionsAfterUpgrade = OptionsAfterUpgrade::NORMAL; -}; - -struct ClearOptions { - UpgradeStatus status = UpgradeStatus::INIT; -}; - -enum class InstallMode { - NORMAL = 0, - NIGHT, - AUTO -}; - -enum class AutoUpgradeCondition { - IDLE = 0, -}; - -struct DescriptionInfo : public BaseJsonStruct { - DescriptionType descriptionType = DescriptionType::CONTENT; - std::string content; - - JsonBuilder GetJsonBuilder() final; -}; - -struct ComponentDescription { - std::string componentId; - DescriptionInfo descriptionInfo; - DescriptionInfo notifyDescriptionInfo; -}; - -struct VersionComponent : public BaseJsonStruct { - std::string componentId; - int32_t componentType = CAST_INT(ComponentType::INVALID); - std::string upgradeAction; - std::string displayVersion; - std::string innerVersion; - size_t size = 0; - size_t effectiveMode = static_cast(EffectiveMode::COLD); - DescriptionInfo descriptionInfo; - std::string componentExtra; - - JsonBuilder GetJsonBuilder() final; -}; - -struct CurrentVersionInfo { - std::string osVersion; - std::string deviceName; - std::vector versionComponents; -}; - -struct NewVersionInfo { - VersionDigestInfo versionDigestInfo; - std::vector versionComponents; -}; - -struct VersionDescriptionInfo { - std::vector componentDescriptions; -}; - -struct CheckResult { - bool isExistNewVersion = false; - NewVersionInfo newVersionInfo; -}; - -struct TaskBody { - VersionDigestInfo versionDigestInfo; - UpgradeStatus status = UpgradeStatus::INIT; - int32_t subStatus = CAST_INT(UpgradeStatus::INIT); - int32_t progress = 0; - int32_t installMode = CAST_INT(InstallMode::NORMAL); - std::vector errorMessages; - std::vector versionComponents; - - JsonBuilder GetJsonBuilder(EventId eventId); -}; - -struct TaskInfo { - bool existTask; - TaskBody taskBody; -}; - -struct Progress { - uint32_t percent = 0; - UpgradeStatus status = UpgradeStatus::INIT; - std::string endReason; -}; - -struct UpgradeInterval { - uint64_t timeStart = 0; - uint64_t timeEnd = 0; -}; - -struct UpgradePeriod { - uint32_t start = 0; - uint32_t end = 0; -}; - -struct UpdateTime { - int64_t lastUpdateTime = 0; - int64_t installWindowStart = 0; - int64_t installWindowEnd = 0; - - friend void to_json(nlohmann::json &jsonObj, const UpdateTime &updateTime) - { - jsonObj["lastUpdateTime"] = updateTime.lastUpdateTime; - jsonObj["installWindowStart"] = updateTime.installWindowStart; - jsonObj["installWindowEnd"] = updateTime.installWindowEnd; - } - - friend void from_json(const nlohmann::json &jsonObj, UpdateTime &updateTime) - { - JsonUtils::GetValueAndSetTo(jsonObj, "lastUpdateTime", updateTime.lastUpdateTime); - JsonUtils::GetValueAndSetTo(jsonObj, "installWindowStart", updateTime.installWindowStart); - JsonUtils::GetValueAndSetTo(jsonObj, "installWindowEnd", updateTime.installWindowEnd); - } -}; - -struct UpgradePolicy { - bool downloadStrategy = false; - bool autoUpgradeStrategy = false; - UpgradePeriod autoUpgradePeriods[2]; -}; - -struct UpgradeFile { - ComponentType fileType = ComponentType::INVALID; - std::string filePath; -}; - -struct EventClassifyInfo { - EventClassify eventClassify = EventClassify::TASK; - std::string extraInfo; - - EventClassifyInfo() : eventClassify(EventClassify::TASK) {} - explicit EventClassifyInfo(EventClassify classify) : eventClassify(classify) {} - EventClassifyInfo(EventClassify classify, const std::string &info) : eventClassify(classify), extraInfo(info) {} -}; - -struct EventInfo : public BaseJsonStruct { - EventId eventId = EventId::EVENT_TASK_BASE; - TaskBody taskBody; - - EventInfo() = default; - EventInfo(EventId id, TaskBody body) : eventId(id), taskBody(std::move(body)) {} - - JsonBuilder GetJsonBuilder() final; -}; - -struct ConfigInfo { - std::string businessDomain; - uint32_t abInstallTimeout = 1800; // 1800s - std::string moduleLibPath; -}; - -using OnEvent = std::function; - -// 回调函数 -struct UpdateCallbackInfo { - OnEvent onEvent; -}; -} // namespace OHOS::UpdateEngine -#endif // UPDATE_HELPER_H diff --git a/interfaces/inner_api/include/update_service_kits.h b/interfaces/inner_api/include/update_service_kits.h index ed547e37..33b9c771 100644 --- a/interfaces/inner_api/include/update_service_kits.h +++ b/interfaces/inner_api/include/update_service_kits.h @@ -18,7 +18,7 @@ #include #include "iupdate_service.h" -#include "update_helper.h" +#include "update_callback_info.h" namespace OHOS::UpdateEngine { class UpdateServiceKits { diff --git a/services/callback/include/update_callback_proxy.h b/services/callback/include/update_callback_proxy.h index 42ec5916..a0d99c0e 100644 --- a/services/callback/include/update_callback_proxy.h +++ b/services/callback/include/update_callback_proxy.h @@ -18,8 +18,9 @@ #include "iremote_broker.h" #include "iremote_proxy.h" + +#include "event_info.h" #include "iupdate_callback.h" -#include "update_helper.h" namespace OHOS::UpdateEngine { class UpdateCallbackProxy : public IRemoteProxy { diff --git a/services/callback/src/update_callback_proxy.cpp b/services/callback/src/update_callback_proxy.cpp index a79a0515..3ab9fa96 100644 --- a/services/callback/src/update_callback_proxy.cpp +++ b/services/callback/src/update_callback_proxy.cpp @@ -15,8 +15,8 @@ #include "update_callback_proxy.h" +#include "event_info.h" #include "message_parcel_helper.h" -#include "update_helper.h" #include "update_log.h" namespace OHOS::UpdateEngine { diff --git a/services/core/ability/adapter/include/config_info.h b/services/core/ability/adapter/include/config_info.h new file mode 100644 index 00000000..462b7327 --- /dev/null +++ b/services/core/ability/adapter/include/config_info.h @@ -0,0 +1,18 @@ +// +// Created by x30015763 on 2024/1/23. +// + +#ifndef UPDATE_SERVICE_CONFIG_INFO_H +#define UPDATE_SERVICE_CONFIG_INFO_H + +#include +#include + +namespace OHOS::UpdateEngine { +struct ConfigInfo { + std::string businessDomain; + uint32_t abInstallTimeout = 1800; // 1800s + std::string moduleLibPath; +}; +} // OHOS::UpdateEngine +#endif //UPDATE_SERVICE_CONFIG_INFO_H diff --git a/services/core/ability/adapter/include/config_parse.h b/services/core/ability/adapter/include/config_parse.h index 84a0c859..2f6ec850 100644 --- a/services/core/ability/adapter/include/config_parse.h +++ b/services/core/ability/adapter/include/config_parse.h @@ -18,7 +18,7 @@ #include "singleton.h" -#include "update_helper.h" +#include "config_info.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/core/ability/adapter/src/device_adapter.cpp b/services/core/ability/adapter/src/device_adapter.cpp index 81709a69..44e942e5 100644 --- a/services/core/ability/adapter/src/device_adapter.cpp +++ b/services/core/ability/adapter/src/device_adapter.cpp @@ -31,7 +31,6 @@ #include "config_parse.h" #include "encrypt_utils.h" #include "update_log.h" -#include "update_helper.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/core/ability/callback/include/base_callback_utils.h b/services/core/ability/callback/include/base_callback_utils.h index 1aa4a794..9486be05 100644 --- a/services/core/ability/callback/include/base_callback_utils.h +++ b/services/core/ability/callback/include/base_callback_utils.h @@ -18,8 +18,15 @@ #include +#include "business_sub_type.h" +#include "error_message.h" +#include "event_id.h" +#include "event_info.h" #include "iupdate_callback.h" -#include "update_helper.h" +#include "progress.h" +#include "upgrade_status.h" +#include "upgrade_info.h" +#include "version_component.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/core/ability/callback/src/base_callback_utils.cpp b/services/core/ability/callback/src/base_callback_utils.cpp index ec1db30e..5741a3b2 100644 --- a/services/core/ability/callback/src/base_callback_utils.cpp +++ b/services/core/ability/callback/src/base_callback_utils.cpp @@ -16,7 +16,7 @@ #include "base_callback_utils.h" #include "iupdate_callback.h" -#include "update_helper.h" +#include "subscribe_info.h" #include "update_log.h" #include "update_notify.h" #include "update_service.h" diff --git a/services/core/ability/callback/src/base_callback_utils_empty.cpp b/services/core/ability/callback/src/base_callback_utils_empty.cpp index 059dfe98..00ca9b65 100644 --- a/services/core/ability/callback/src/base_callback_utils_empty.cpp +++ b/services/core/ability/callback/src/base_callback_utils_empty.cpp @@ -16,12 +16,8 @@ #include "base_callback_utils.h" #include "iupdate_callback.h" -#include "update_define.h" -#include "update_helper.h" #include "update_log.h" -#include "update_service.h" #include "update_service_cache.h" -#include "update_service_util.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/core/ability/download/data/include/download_info.h b/services/core/ability/download/data/include/download_info.h index ac944eec..e543cc1d 100644 --- a/services/core/ability/download/data/include/download_info.h +++ b/services/core/ability/download/data/include/download_info.h @@ -16,11 +16,11 @@ #ifndef DOWNLOAD_INFO_H #define DOWNLOAD_INFO_H +#include +#include #include #include "encrypt_utils.h" -#include "update_define.h" -#include "update_helper.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/core/ability/model/include/package_type.h b/services/core/ability/model/include/package_type.h new file mode 100644 index 00000000..d01cc4f6 --- /dev/null +++ b/services/core/ability/model/include/package_type.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_PACKAGE_TYPE_H +#define UPDATE_SERVICE_PACKAGE_TYPE_H + +namespace OHOS::UpdateEngine { +enum class PackageType { + DYNAMIC = 0, + NORMAL = 1, + BASE = 2, + CUST = 3, + PRELOAD = 4, + COTA = 5, + VERSION = 6, + PATCH = 8, + SA = 9 +}; +} // namespace OHOS::UpdateEngine +#endif // UPDATE_SERVICE_PACKAGE_TYPE_H diff --git a/services/core/ability/utils/include/file_utils.h b/services/core/ability/utils/include/file_utils.h index 25ee0479..bc5b16d5 100644 --- a/services/core/ability/utils/include/file_utils.h +++ b/services/core/ability/utils/include/file_utils.h @@ -21,6 +21,7 @@ #include #include #include +#include namespace OHOS { namespace UpdateEngine { diff --git a/services/core/ability/utils/src/file_utils.cpp b/services/core/ability/utils/src/file_utils.cpp index 7c607017..7baef164 100644 --- a/services/core/ability/utils/src/file_utils.cpp +++ b/services/core/ability/utils/src/file_utils.cpp @@ -26,7 +26,6 @@ #include #include "constant.h" -#include "update_helper.h" #include "update_log.h" namespace OHOS { diff --git a/services/engine/engine_sa.gni b/services/engine/engine_sa.gni index e440a68e..c3f2ae2d 100644 --- a/services/engine/engine_sa.gni +++ b/services/engine/engine_sa.gni @@ -13,7 +13,6 @@ import("//base/update/updateservice/updateengine.gni") import("//build/ohos.gni") -import("$updateengine_root_path/services/core/ability/log/log.gni") import("$updateengine_root_path/services/core/ability/sqlite/sqlite.gni") import("$updateengine_root_path/services/firmware/firmware.gni") import("$updateengine_root_path/services/startup/startup.gni") @@ -31,9 +30,7 @@ declare_args() { } sa_sources = [ - "$updateengine_root_path/services/callback/src/update_callback.cpp", "$updateengine_root_path/services/callback/src/update_callback_proxy.cpp", - "$updateengine_root_path/services/callback/src/update_callback_stub.cpp", "$updateengine_root_path/services/core/ability/adapter/src/config_parse.cpp", "$updateengine_root_path/services/core/ability/adapter/src/device_adapter.cpp", "$updateengine_root_path/services/core/ability/alarm/src/alarm_manager.cpp", @@ -42,9 +39,7 @@ sa_sources = [ "$updateengine_root_path/services/core/ability/utils/src/file_utils.cpp", "$updateengine_root_path/services/core/ability/utils/src/sha256_utils.cpp", "$updateengine_root_path/services/core/ability/utils/src/time_utils_proxy.cpp", - "$updateengine_root_path/services/engine/src/message_parcel_helper.cpp", "$updateengine_root_path/services/engine/src/progress_thread.cpp", - "$updateengine_root_path/services/engine/src/update_helper.cpp", "$updateengine_root_path/services/engine/src/update_service.cpp", "$updateengine_root_path/services/engine/src/update_service_cache.cpp", "$updateengine_root_path/services/engine/src/update_service_impl_firmware.cpp", @@ -83,7 +78,6 @@ if (preference_native_preferences_enable) { sa_sources += firmware_src sa_sources += sqlite_src -sa_sources += update_log_src sa_sources += startup_src sa_include_dirs = [ @@ -94,7 +88,6 @@ sa_include_dirs = [ "$updateengine_root_path/services/core/ability/alarm/include", "$updateengine_root_path/services/core/ability/callback/include", "$updateengine_root_path/services/core/ability/common/include", - "$updateengine_root_path/services/core/ability/define/include", "$updateengine_root_path/services/core/ability/model/include", "$updateengine_root_path/services/core/ability/net/include", "$updateengine_root_path/services/core/ability/preference/include", @@ -127,13 +120,14 @@ if (!relational_store_native_rdb_enable) { sa_include_dirs += firmware_include sa_include_dirs += sqlite_include -sa_include_dirs += update_log_include sa_include_dirs += startup_include sa_include_dirs += [ "//base/update/updateservice/interfaces/innner_api/modulemgr/include" ] sa_deps = [ "$updateengine_root_path/interfaces/inner_api/modulemgr:update_module_mgr", + "$updateengine_root_path/interfaces/inner_api/engine:$updateengine_inner_library_name", + "$updateengine_root_path/common:common", "//base/update/updater/services/fs_manager:libfsmanager", # factory_reset_GetBlockDeviceByMountPoint_"fs_manager/mount.h" "//third_party/cJSON:cjson", "//third_party/curl:curl", @@ -146,7 +140,6 @@ sa_deps = [ ] sa_deps += firmware_deps -sa_deps += update_log_deps sa_deps += startup_deps sa_external_deps = [ diff --git a/services/engine/include/progress_thread.h b/services/engine/include/progress_thread.h index d36a114a..8e352e28 100644 --- a/services/engine/include/progress_thread.h +++ b/services/engine/include/progress_thread.h @@ -21,7 +21,8 @@ #include #include #include "curl/curl.h" -#include "update_helper.h" + +#include "progress.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/engine/include/update_service.h b/services/engine/include/update_service.h index fb69dd80..0090f95b 100644 --- a/services/engine/include/update_service.h +++ b/services/engine/include/update_service.h @@ -24,7 +24,6 @@ #include "iremote_stub.h" #include "system_ability.h" -#include "update_helper.h" #include "update_service_impl_manager.h" #include "update_service_stub.h" diff --git a/services/engine/include/update_service_cache.h b/services/engine/include/update_service_cache.h index 75e616ef..a42a986e 100644 --- a/services/engine/include/update_service_cache.h +++ b/services/engine/include/update_service_cache.h @@ -16,7 +16,11 @@ #ifndef UPDATE_SERVICE_CACHE_H #define UPDATE_SERVICE_CACHE_H -#include "update_helper.h" +#include + +#include "business_sub_type.h" +#include "upgrade_info.h" +#include "upgrade_interval.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/engine/include/update_service_impl_firmware.h b/services/engine/include/update_service_impl_firmware.h index dc4e145b..d8c1ec3e 100644 --- a/services/engine/include/update_service_impl_firmware.h +++ b/services/engine/include/update_service_impl_firmware.h @@ -22,7 +22,6 @@ #include "firmware_preferences_utils.h" #include "firmware_task.h" -#include "update_helper.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/engine/include/update_service_impl_manager.h b/services/engine/include/update_service_impl_manager.h index 66186d67..49dbe81c 100644 --- a/services/engine/include/update_service_impl_manager.h +++ b/services/engine/include/update_service_impl_manager.h @@ -20,7 +20,7 @@ #include -#include "update_helper.h" +#include "upgrade_info.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/engine/include/update_service_util.h b/services/engine/include/update_service_util.h index 6260ac01..d2429498 100644 --- a/services/engine/include/update_service_util.h +++ b/services/engine/include/update_service_util.h @@ -17,7 +17,9 @@ #define UPDATE_SERVICE_UTIL_H #include "iupdate_callback.h" -#include "update_helper.h" +#include "progress.h" +#include "task_body.h" +#include "upgrade_info.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/engine/src/update_notify.cpp b/services/engine/src/update_notify.cpp index 98a66040..01000ac1 100644 --- a/services/engine/src/update_notify.cpp +++ b/services/engine/src/update_notify.cpp @@ -17,7 +17,7 @@ #include "iservice_registry.h" -#include "update_helper.h" +#include "subscribe_info.h" #include "update_log.h" namespace OHOS { diff --git a/services/engine/src/update_service.cpp b/services/engine/src/update_service.cpp index 6b14d0ce..f888c6ec 100644 --- a/services/engine/src/update_service.cpp +++ b/services/engine/src/update_service.cpp @@ -18,7 +18,6 @@ #include #include #include -#include #include "iservice_registry.h" #include "ohos_types.h" diff --git a/services/engine/src/update_service_cache.cpp b/services/engine/src/update_service_cache.cpp index 61394bdc..081ef7bf 100644 --- a/services/engine/src/update_service_cache.cpp +++ b/services/engine/src/update_service_cache.cpp @@ -15,9 +15,12 @@ #include "update_service_cache.h" +#include + #include "update_define.h" -#include "update_helper.h" #include "update_log.h" +#include "upgrade_info.h" +#include "upgrade_interval.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/engine/src/update_service_stub.cpp b/services/engine/src/update_service_stub.cpp index 66174265..c862be67 100644 --- a/services/engine/src/update_service_stub.cpp +++ b/services/engine/src/update_service_stub.cpp @@ -13,6 +13,8 @@ * limitations under the License. */ +#include + #include "accesstoken_kit.h" #include "access_token.h" #include "ipc_skeleton.h" @@ -20,7 +22,6 @@ #include "securec.h" #include "tokenid_kit.h" #include "update_define.h" -#include "update_helper.h" #include "update_log.h" #include "update_service_stub.h" #include "update_system_event.h" @@ -39,6 +40,8 @@ constexpr const pid_t EDM_UID = 3057; #define RETURN_FAIL_WHEN_SERVICE_NULL(service) \ ENGINE_CHECK((service) != nullptr, return INT_CALL_IPC_ERR, "service null") +#define CALL_RESULT_TO_IPC_RESULT(callResult) ((callResult) + CALL_RESULT_OFFSET) + UpdateServiceStub::UpdateServiceStub() { requestFuncMap_ = { diff --git a/services/firmware/check/include/firmware_icheck.h b/services/firmware/check/include/firmware_icheck.h index fb303e2c..ee6f1e94 100644 --- a/services/firmware/check/include/firmware_icheck.h +++ b/services/firmware/check/include/firmware_icheck.h @@ -37,7 +37,7 @@ #include "device_adapter.h" #include "firmware_update_helper.h" #include "network_response.h" -#include "update_helper.h" +#include "search_status.h" #include "update_service_util.h" constexpr int32_t PORT_NUMBER = 5022; diff --git a/services/firmware/common/include/firmware_common.h b/services/firmware/common/include/firmware_common.h index 3865d51b..401ff521 100644 --- a/services/firmware/common/include/firmware_common.h +++ b/services/firmware/common/include/firmware_common.h @@ -24,7 +24,7 @@ #include "encrypt_utils.h" #include "firmware_component.h" #include "firmware_log.h" -#include "update_helper.h" +#include "update_define.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/common/include/firmware_constant.h b/services/firmware/common/include/firmware_constant.h index adf5c4bd..b232b098 100644 --- a/services/firmware/common/include/firmware_constant.h +++ b/services/firmware/common/include/firmware_constant.h @@ -19,7 +19,6 @@ #include #include "constant.h" -#include "update_helper.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/common/include/firmware_update_helper.h b/services/firmware/common/include/firmware_update_helper.h index a0e2336c..f96ddb9c 100644 --- a/services/firmware/common/include/firmware_update_helper.h +++ b/services/firmware/common/include/firmware_update_helper.h @@ -20,6 +20,7 @@ #include "nlohmann/json.hpp" +#include "current_version_info.h" #include "firmware_changelog_utils.h" #include "firmware_constant.h" #include "firmware_combine_version_utils.h" @@ -33,7 +34,7 @@ #include "device_adapter.h" #include "sha256_utils.h" #include "time_utils.h" -#include "update_helper.h" +#include "version_component.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/common/src/firmware_update_adapter.cpp b/services/firmware/common/src/firmware_update_adapter.cpp index febe4b78..d02a69b2 100644 --- a/services/firmware/common/src/firmware_update_adapter.cpp +++ b/services/firmware/common/src/firmware_update_adapter.cpp @@ -34,7 +34,6 @@ #include "firmware_preferences_utils.h" #include "firmware_task.h" #include "time_utils.h" -#include "update_helper.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/data/db/include/firmware_component.h b/services/firmware/data/db/include/firmware_component.h index fd83ae9c..babc8712 100644 --- a/services/firmware/data/db/include/firmware_component.h +++ b/services/firmware/data/db/include/firmware_component.h @@ -18,7 +18,9 @@ #include -#include "update_helper.h" +#include "package_type.h" +#include "update_define.h" +#include "upgrade_status.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/data/db/include/firmware_component_operator.h b/services/firmware/data/db/include/firmware_component_operator.h index 9d14f08c..bf3e2146 100644 --- a/services/firmware/data/db/include/firmware_component_operator.h +++ b/services/firmware/data/db/include/firmware_component_operator.h @@ -21,10 +21,11 @@ #include "firmware_component.h" #include "firmware_component_table.h" #include "firmware_database.h" +#include "upgrade_status.h" + #ifdef RELATIONAL_STORE_NATIVE_RDB_ENABLE #include "table_base_operator.h" #endif -#include "update_helper.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/data/db/include/firmware_task.h b/services/firmware/data/db/include/firmware_task.h index 55646f5f..db7064da 100644 --- a/services/firmware/data/db/include/firmware_task.h +++ b/services/firmware/data/db/include/firmware_task.h @@ -19,7 +19,9 @@ #include #include "firmware_common.h" -#include "update_helper.h" +#include "network_type.h" +#include "order.h" +#include "update_define.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/data/db/include/firmware_task_operator.h b/services/firmware/data/db/include/firmware_task_operator.h index 2438203b..c9163fe1 100644 --- a/services/firmware/data/db/include/firmware_task_operator.h +++ b/services/firmware/data/db/include/firmware_task_operator.h @@ -22,6 +22,9 @@ #include "firmware_database.h" #include "firmware_task_table.h" #include "firmware_task.h" +#include "network_type.h" +#include "order.h" + #ifdef RELATIONAL_STORE_NATIVE_RDB_ENABLE #include "table_base_operator.h" #endif diff --git a/services/firmware/data/db/src/firmware_database_empty.cpp b/services/firmware/data/db/src/firmware_database_empty.cpp index 36621288..d10b6163 100644 --- a/services/firmware/data/db/src/firmware_database_empty.cpp +++ b/services/firmware/data/db/src/firmware_database_empty.cpp @@ -16,7 +16,6 @@ #include "firmware_database.h" #include "constant.h" -#include "update_log.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/data/db/src/firmware_task_operator.cpp b/services/firmware/data/db/src/firmware_task_operator.cpp index a4811a80..8cc133fb 100644 --- a/services/firmware/data/db/src/firmware_task_operator.cpp +++ b/services/firmware/data/db/src/firmware_task_operator.cpp @@ -17,8 +17,11 @@ #include +#include "network_type.h" +#include "order.h" #include "time_utils.h" -#include "update_helper.h" +#include "update_define.h" +#include "upgrade_status.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/data/db/src/firmware_task_operator_empty.cpp b/services/firmware/data/db/src/firmware_task_operator_empty.cpp index f7ce5f37..b2454fca 100644 --- a/services/firmware/data/db/src/firmware_task_operator_empty.cpp +++ b/services/firmware/data/db/src/firmware_task_operator_empty.cpp @@ -18,7 +18,8 @@ #include #include "time_utils.h" -#include "update_helper.h" +#include "network_type.h" +#include "order.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/data/db/src/firmware_task_table_empty.cpp b/services/firmware/data/db/src/firmware_task_table_empty.cpp index 56167839..d14701f6 100644 --- a/services/firmware/data/db/src/firmware_task_table_empty.cpp +++ b/services/firmware/data/db/src/firmware_task_table_empty.cpp @@ -15,6 +15,9 @@ #include "firmware_task_table.h" +#include "itable.h" +#include "update_define.h" + namespace OHOS { namespace UpdateEngine { std::string FirmwareTaskTable::GetTableName() diff --git a/services/firmware/event/include/firmware_event_listener.h b/services/firmware/event/include/firmware_event_listener.h index 1fbd87c2..d49927f4 100644 --- a/services/firmware/event/include/firmware_event_listener.h +++ b/services/firmware/event/include/firmware_event_listener.h @@ -19,7 +19,6 @@ #include "singleton.h" #include "dupdate_inet_observer.h" -#include "update_helper.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/upgrade/data_processor/include/firmware_check_data_processor.h b/services/firmware/upgrade/data_processor/include/firmware_check_data_processor.h index bdc43c4b..b1bbe6d7 100644 --- a/services/firmware/upgrade/data_processor/include/firmware_check_data_processor.h +++ b/services/firmware/upgrade/data_processor/include/firmware_check_data_processor.h @@ -16,9 +16,11 @@ #ifndef FIRMWARE_CHECK_DATA_PROCESSOR_H #define FIRMWARE_CHECK_DATA_PROCESSOR_H +#include "check_result.h" #include "firmware_common.h" #include "firmware_component.h" #include "firmware_preferences_utils.h" +#include "new_version_info.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/upgrade/data_processor/include/firmware_download_data_processor.h b/services/firmware/upgrade/data_processor/include/firmware_download_data_processor.h index 189bfafe..186c864b 100644 --- a/services/firmware/upgrade/data_processor/include/firmware_download_data_processor.h +++ b/services/firmware/upgrade/data_processor/include/firmware_download_data_processor.h @@ -18,7 +18,7 @@ #include "firmware_common.h" #include "firmware_task.h" -#include "update_helper.h" +#include "progress.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/upgrade/data_processor/src/firmware_check_data_processor.cpp b/services/firmware/upgrade/data_processor/src/firmware_check_data_processor.cpp index 62de4e82..5e4c2d6c 100644 --- a/services/firmware/upgrade/data_processor/src/firmware_check_data_processor.cpp +++ b/services/firmware/upgrade/data_processor/src/firmware_check_data_processor.cpp @@ -31,7 +31,6 @@ #include "firmware_update_helper.h" #include "string_utils.h" #include "time_utils.h" -#include "update_helper.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/upgrade/executor/include/firmware_download_executor.h b/services/firmware/upgrade/executor/include/firmware_download_executor.h index b1aaed54..fb8f301d 100644 --- a/services/firmware/upgrade/executor/include/firmware_download_executor.h +++ b/services/firmware/upgrade/executor/include/firmware_download_executor.h @@ -16,11 +16,11 @@ #ifndef FIRMWARE_DOWNLOAD_EXECUTOR_H #define FIRMWARE_DOWNLOAD_EXECUTOR_H +#include "download_options.h" #include "firmware_component.h" #include "firmware_iexecutor.h" #include "firmware_task.h" #include "progress_thread.h" -#include "update_helper.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/upgrade/executor/include/firmware_iexecutor.h b/services/firmware/upgrade/executor/include/firmware_iexecutor.h index f13c76ca..47c9b81e 100644 --- a/services/firmware/upgrade/executor/include/firmware_iexecutor.h +++ b/services/firmware/upgrade/executor/include/firmware_iexecutor.h @@ -16,9 +16,11 @@ #ifndef FIRMWARE_IEXECUTOR_H #define FIRMWARE_IEXECUTOR_H +#include "error_message.h" #include "firmware_common.h" #include "firmware_component.h" #include "firmware_log.h" +#include "progress.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/upgrade/executor/src/firmware_apply_executor.cpp b/services/firmware/upgrade/executor/src/firmware_apply_executor.cpp index 6113454f..9a27865e 100644 --- a/services/firmware/upgrade/executor/src/firmware_apply_executor.cpp +++ b/services/firmware/upgrade/executor/src/firmware_apply_executor.cpp @@ -26,7 +26,6 @@ #include "firmware_log.h" #include "firmware_task_operator.h" #include "firmware_update_helper.h" -#include "update_helper.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/upgrade/executor/src/firmware_check_executor.cpp b/services/firmware/upgrade/executor/src/firmware_check_executor.cpp index d4e9b079..7a9c0f8e 100644 --- a/services/firmware/upgrade/executor/src/firmware_check_executor.cpp +++ b/services/firmware/upgrade/executor/src/firmware_check_executor.cpp @@ -25,7 +25,6 @@ #include "firmware_log.h" #include "firmware_status_cache.h" #include "firmware_update_helper.h" -#include "update_helper.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/upgrade/executor/src/firmware_download_executor.cpp b/services/firmware/upgrade/executor/src/firmware_download_executor.cpp index 0f316c7e..9519a1e5 100644 --- a/services/firmware/upgrade/executor/src/firmware_download_executor.cpp +++ b/services/firmware/upgrade/executor/src/firmware_download_executor.cpp @@ -29,7 +29,6 @@ #include "firmware_update_helper.h" #include "progress_thread.h" #include "string_utils.h" -#include "update_helper.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/upgrade/executor/src/firmware_install_executor.cpp b/services/firmware/upgrade/executor/src/firmware_install_executor.cpp index 815c2d63..96219b0b 100644 --- a/services/firmware/upgrade/executor/src/firmware_install_executor.cpp +++ b/services/firmware/upgrade/executor/src/firmware_install_executor.cpp @@ -17,14 +17,13 @@ #include +#include "event_id.h" #include "firmware_callback_utils.h" #include "firmware_component_operator.h" #include "firmware_constant.h" #include "firmware_install_factory.h" #include "firmware_log.h" #include "firmware_task_operator.h" -#include "firmware_update_helper.h" -#include "update_helper.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/upgrade/flow/include/firmware_flow_manager.h b/services/firmware/upgrade/flow/include/firmware_flow_manager.h index f297c964..1940a9c0 100644 --- a/services/firmware/upgrade/flow/include/firmware_flow_manager.h +++ b/services/firmware/upgrade/flow/include/firmware_flow_manager.h @@ -16,11 +16,11 @@ #ifndef FIRMWARE_FLOW_MANAGER_H #define FIRMWARE_FLOW_MANAGER_H -#include "update_helper.h" #include "firmware_common.h" #include "firmware_component.h" #include "firmware_iexecute_mode.h" #include "firmware_iexecutor.h" +#include "progress.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/upgrade/flow/include/firmware_manager.h b/services/firmware/upgrade/flow/include/firmware_manager.h index 4b672940..5adfaab2 100644 --- a/services/firmware/upgrade/flow/include/firmware_manager.h +++ b/services/firmware/upgrade/flow/include/firmware_manager.h @@ -18,7 +18,9 @@ #include "singleton.h" +#include "business_error.h" #include "constant.h" +#include "download_options.h" #include "firmware_common.h" #include "firmware_flow_manager.h" #include "firmware_result_process.h" @@ -26,7 +28,7 @@ #include "device_adapter.h" #include "firmware_preferences_utils.h" #include "schedule_task.h" -#include "update_helper.h" +#include "upgrade_options.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/upgrade/flow/src/firmware_manager.cpp b/services/firmware/upgrade/flow/src/firmware_manager.cpp index 8eebf184..8eed5221 100644 --- a/services/firmware/upgrade/flow/src/firmware_manager.cpp +++ b/services/firmware/upgrade/flow/src/firmware_manager.cpp @@ -46,7 +46,6 @@ #include "startup_schedule.h" #include "string_utils.h" #include "time_utils.h" -#include "update_helper.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/upgrade/install/include/firmware_install.h b/services/firmware/upgrade/install/include/firmware_install.h index 09db3585..cf6bdbcd 100644 --- a/services/firmware/upgrade/install/include/firmware_install.h +++ b/services/firmware/upgrade/install/include/firmware_install.h @@ -20,9 +20,10 @@ #include #include +#include "error_message.h" #include "firmware_common.h" #include "firmware_component.h" -#include "update_helper.h" +#include "progress.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/upgrade/install/include/firmware_sys_installer_install.h b/services/firmware/upgrade/install/include/firmware_sys_installer_install.h index 65954ee7..ac597701 100644 --- a/services/firmware/upgrade/install/include/firmware_sys_installer_install.h +++ b/services/firmware/upgrade/install/include/firmware_sys_installer_install.h @@ -20,7 +20,6 @@ #include "firmware_component.h" #include "firmware_install.h" -#include "update_helper.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/upgrade/install/src/firmware_updater_install.cpp b/services/firmware/upgrade/install/src/firmware_updater_install.cpp index 87b7f1db..0941dfa4 100644 --- a/services/firmware/upgrade/install/src/firmware_updater_install.cpp +++ b/services/firmware/upgrade/install/src/firmware_updater_install.cpp @@ -28,7 +28,6 @@ #include "firmware_constant.h" #include "firmware_log.h" #include "firmware_update_helper.h" -#include "update_helper.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/upgrade/mode/include/firmware_download_mode.h b/services/firmware/upgrade/mode/include/firmware_download_mode.h index ca2499cb..018f5deb 100644 --- a/services/firmware/upgrade/mode/include/firmware_download_mode.h +++ b/services/firmware/upgrade/mode/include/firmware_download_mode.h @@ -16,13 +16,16 @@ #ifndef FIRMWARE_DOWNLOAD_MODE_H #define FIRMWARE_DOWNLOAD_MODE_H +#include "business_error.h" +#include "device_adapter.h" +#include "download_options.h" +#include "error_message.h" #include "firmware_common.h" #include "firmware_download_data_processor.h" #include "firmware_iexecute_mode.h" #include "firmware_install_data_processor.h" #include "firmware_task.h" -#include "device_adapter.h" -#include "update_helper.h" +#include "progress.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/upgrade/mode/include/firmware_iexecute_mode.h b/services/firmware/upgrade/mode/include/firmware_iexecute_mode.h index a0a2356b..7572b2df 100644 --- a/services/firmware/upgrade/mode/include/firmware_iexecute_mode.h +++ b/services/firmware/upgrade/mode/include/firmware_iexecute_mode.h @@ -16,10 +16,14 @@ #ifndef FIRMWARE_IEXECUTE_MODE_H #define FIRMWARE_IEXECUTE_MODE_H +#include "business_error.h" +#include "check_result.h" +#include "download_options.h" #include "firmware_common.h" #include "firmware_component.h" #include "firmware_iexecutor.h" -#include "update_helper.h" +#include "progress.h" +#include "upgrade_options.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/upgrade/mode/include/firmware_install_apply_mode.h b/services/firmware/upgrade/mode/include/firmware_install_apply_mode.h index e102de46..b0512dfc 100644 --- a/services/firmware/upgrade/mode/include/firmware_install_apply_mode.h +++ b/services/firmware/upgrade/mode/include/firmware_install_apply_mode.h @@ -16,14 +16,15 @@ #ifndef FIRMWARE_INSTALL_APPLY_MODE_H #define FIRMWARE_INSTALL_APPLY_MODE_H +#include "business_error.h" +#include "device_adapter.h" #include "firmware_common.h" #include "firmware_download_data_processor.h" #include "firmware_iexecute_mode.h" #include "firmware_install_data_processor.h" #include "firmware_preferences_utils.h" #include "firmware_task.h" -#include "device_adapter.h" -#include "update_helper.h" +#include "upgrade_options.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/upgrade/mode/include/firmware_manual_check_mode.h b/services/firmware/upgrade/mode/include/firmware_manual_check_mode.h index 89d27893..3ec40aa1 100644 --- a/services/firmware/upgrade/mode/include/firmware_manual_check_mode.h +++ b/services/firmware/upgrade/mode/include/firmware_manual_check_mode.h @@ -16,8 +16,8 @@ #ifndef FIRMWARE_MANUAL_CHECK_MODE_H #define FIRMWARE_MANUAL_CHECK_MODE_H +#include "business_error.h" #include "firmware_check_data_processor.h" - #include "firmware_common.h" #include "firmware_component.h" #include "firmware_iexecute_mode.h" diff --git a/services/firmware/upgrade/mode/src/firmware_download_mode.cpp b/services/firmware/upgrade/mode/src/firmware_download_mode.cpp index 638e99c1..31690471 100644 --- a/services/firmware/upgrade/mode/src/firmware_download_mode.cpp +++ b/services/firmware/upgrade/mode/src/firmware_download_mode.cpp @@ -26,7 +26,6 @@ #include "firmware_status_cache.h" #include "firmware_task_operator.h" #include "firmware_update_helper.h" -#include "update_helper.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/upgrade/mode/src/firmware_install_apply_mode.cpp b/services/firmware/upgrade/mode/src/firmware_install_apply_mode.cpp index 513aa5ab..ae0827d0 100644 --- a/services/firmware/upgrade/mode/src/firmware_install_apply_mode.cpp +++ b/services/firmware/upgrade/mode/src/firmware_install_apply_mode.cpp @@ -30,7 +30,6 @@ #include "firmware_status_cache.h" #include "firmware_task_operator.h" #include "firmware_update_helper.h" -#include "update_helper.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/upgrade/mode/src/firmware_manual_check_mode.cpp b/services/firmware/upgrade/mode/src/firmware_manual_check_mode.cpp index 2d72310c..7d37a03f 100644 --- a/services/firmware/upgrade/mode/src/firmware_manual_check_mode.cpp +++ b/services/firmware/upgrade/mode/src/firmware_manual_check_mode.cpp @@ -15,6 +15,7 @@ #include "firmware_manual_check_mode.h" +#include "check_result.h" #include "dupdate_errno.h" #include "dupdate_net_manager.h" #include "firmware_callback_utils.h" @@ -26,7 +27,7 @@ #include "firmware_status_cache.h" #include "firmware_task.h" #include "firmware_task_operator.h" -#include "update_helper.h" +#include "search_status.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/utils/src/firmware_check_analyze_utils.cpp b/services/firmware/utils/src/firmware_check_analyze_utils.cpp index 7fdb7d16..4633b20a 100644 --- a/services/firmware/utils/src/firmware_check_analyze_utils.cpp +++ b/services/firmware/utils/src/firmware_check_analyze_utils.cpp @@ -29,7 +29,6 @@ #include "firmware_preferences_utils.h" #include "json_utils.h" #include "string_utils.h" -#include "update_helper.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/utils/include/dupdate_inet_observer.h b/services/utils/include/dupdate_inet_observer.h index c5d33ec4..ad6ca08a 100644 --- a/services/utils/include/dupdate_inet_observer.h +++ b/services/utils/include/dupdate_inet_observer.h @@ -18,7 +18,7 @@ #include -#include "update_helper.h" +#include "network_type.h" namespace OHOS { namespace UpdateEngine { diff --git a/test/fuzztest/updateservicecancel_fuzzer/updateservicecancel_fuzzer.cpp b/test/fuzztest/updateservicecancel_fuzzer/updateservicecancel_fuzzer.cpp index db62e447..55a9d3bd 100644 --- a/test/fuzztest/updateservicecancel_fuzzer/updateservicecancel_fuzzer.cpp +++ b/test/fuzztest/updateservicecancel_fuzzer/updateservicecancel_fuzzer.cpp @@ -15,8 +15,6 @@ #include "updateservicecancel_fuzzer.h" -#include "update_helper.h" - using namespace OHOS::UpdateEngine; namespace OHOS { -- Gitee From 96e1e0248a7cb39c4b237da201d42bba1905d123 Mon Sep 17 00:00:00 2001 From: Monster Date: Tue, 30 Jan 2024 16:45:56 +0800 Subject: [PATCH 37/98] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=81=97=E6=BC=8F?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- common/ability/log/log.gni | 5 ++++- common/ability/sa_loader/include/base_service_kits_impl.h | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/common/ability/log/log.gni b/common/ability/log/log.gni index 9b77c283..db153a82 100644 --- a/common/ability/log/log.gni +++ b/common/ability/log/log.gni @@ -11,7 +11,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -update_log_external_deps = [ "hilog:libhilog" ] +update_log_external_deps = [ + "hilog:libhilog", + "updater:libupdaterlog_shared", + ] update_log_deps = [] update_log_include = [ "ability/log/include" ] update_log_src = [ "ability/log/src/update_log.cpp" ] diff --git a/common/ability/sa_loader/include/base_service_kits_impl.h b/common/ability/sa_loader/include/base_service_kits_impl.h index 3a1d317d..c2ae8ceb 100644 --- a/common/ability/sa_loader/include/base_service_kits_impl.h +++ b/common/ability/sa_loader/include/base_service_kits_impl.h @@ -18,7 +18,9 @@ #include +#ifndef ABILITY_RUNTIME_INNER_ENABLE #include "ability_manager_proxy.h" +#endif #include "iremote_object.h" #include "common_death_recipient.h" -- Gitee From b4da98f86309e93c488e4e8f1936859a23ca99a6 Mon Sep 17 00:00:00 2001 From: Monster Date: Tue, 30 Jan 2024 17:02:12 +0800 Subject: [PATCH 38/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B7=AE=E5=BC=82?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- common/BUILD.gn | 5 +++++ common/ability/sa_loader/sa_loader.gni | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/common/BUILD.gn b/common/BUILD.gn index f53eb429..a7164b01 100644 --- a/common/BUILD.gn +++ b/common/BUILD.gn @@ -15,6 +15,11 @@ ohos_shared_library("common") { } branch_protector_ret = "pac_ret" + defines = [] + if (!ability_ability_runtime_enable) { + defines += [ "ABILITY_RUNTIME_INNER_ENABLE" ] + } + include_dirs = common_include sources = common_sources deps = common_deps diff --git a/common/ability/sa_loader/sa_loader.gni b/common/ability/sa_loader/sa_loader.gni index a1835e1f..d350f50c 100644 --- a/common/ability/sa_loader/sa_loader.gni +++ b/common/ability/sa_loader/sa_loader.gni @@ -13,11 +13,14 @@ sa_loader_external_deps = [ "c_utils:utils", # sptr - "ability_runtime:ability_manager", "ipc:ipc_core", "safwk:system_ability_fwk", "samgr:samgr_proxy", ] +if (!ability_ability_runtime_enable) { + sa_loader_external_deps += [ "ability_runtime:ability_manager" ] +} + sa_loader_deps = [] sa_loader_include = [ "ability/sa_loader/include" ] sa_loader_src = [ "ability/sa_loader/src/load_sa_service.cpp" ] -- Gitee From e0f5ac441a6d68f0fed70f132ff558bf9e474207 Mon Sep 17 00:00:00 2001 From: Monster Date: Tue, 30 Jan 2024 17:05:47 +0800 Subject: [PATCH 39/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=81=97=E6=BC=8F?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- common/ability/sa_loader/sa_loader.gni | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/ability/sa_loader/sa_loader.gni b/common/ability/sa_loader/sa_loader.gni index d350f50c..cf310c07 100644 --- a/common/ability/sa_loader/sa_loader.gni +++ b/common/ability/sa_loader/sa_loader.gni @@ -17,7 +17,7 @@ sa_loader_external_deps = [ "safwk:system_ability_fwk", "samgr:samgr_proxy", ] -if (!ability_ability_runtime_enable) { +if (ability_ability_runtime_enable) { sa_loader_external_deps += [ "ability_runtime:ability_manager" ] } -- Gitee From 0d877ec50ff344379f26eb90e03218451640b67a Mon Sep 17 00:00:00 2001 From: Monster Date: Tue, 30 Jan 2024 17:12:58 +0800 Subject: [PATCH 40/98] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- common/{model/base => ability/utils/include}/json_utils.h | 0 common/ability/utils/utils.gni | 1 - 2 files changed, 1 deletion(-) rename common/{model/base => ability/utils/include}/json_utils.h (100%) diff --git a/common/model/base/json_utils.h b/common/ability/utils/include/json_utils.h similarity index 100% rename from common/model/base/json_utils.h rename to common/ability/utils/include/json_utils.h diff --git a/common/ability/utils/utils.gni b/common/ability/utils/utils.gni index 0d233afa..89e546c7 100644 --- a/common/ability/utils/utils.gni +++ b/common/ability/utils/utils.gni @@ -13,7 +13,6 @@ utils_external_deps = [] utils_deps = [ - "//third_party/cJSON:cjson", "//third_party/json:nlohmann_json_static" ] utils_include = [ -- Gitee From 38c31d233b7f59f5c3e72634c81c199050b16e37 Mon Sep 17 00:00:00 2001 From: Monster Date: Wed, 31 Jan 2024 10:07:00 +0800 Subject: [PATCH 41/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=84=E5=AE=A1?= =?UTF-8?q?=E5=BB=BA=E8=AE=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- bundle.json | 4 +- {common => foundations}/BUILD.gn | 8 ++-- .../ability/define/define.gni | 0 .../ability/define/include/update_define.h | 0 .../ability/log/include/update_log.h | 0 {common => foundations}/ability/log/log.gni | 0 .../ability/log/src/update_log.cpp | 0 .../include/base_service_kits_impl.h | 0 .../include/common_death_recipient.h | 0 .../sa_loader/include/load_sa_service.h | 0 .../ability/sa_loader/sa_loader.gni | 0 .../ability/sa_loader/src/load_sa_service.cpp | 0 .../sys_event/include/update_system_event.h | 0 .../ability/sys_event/sys_event.gni | 0 .../ability/utils/include/anonymous_utils.h | 0 .../utils/include/dupdate_json_utils.h | 0 .../ability/utils/include/json_builder.h | 0 .../ability/utils/include/string_utils.h | 0 .../ability/utils/utils.gni | 0 .../common.gni => foundations/foundations.gni | 0 .../model/base/business_error.h | 2 +- .../model/base/call_result.h | 0 .../model/base/device_type.h | 0 .../model/base/error_message.h | 11 +---- .../model/base/network_type.h | 0 {common => foundations}/model/model.gni | 0 frameworks/js/napi/update/BUILD.gn | 2 +- interfaces/inner_api/engine/BUILD.gn | 2 +- .../inner_api/engine/src/update_callback.cpp | 2 +- .../online_updater/iservice_online_updater.h | 2 +- .../update/model/download/download_options.h | 2 +- .../update/model/event/event_classify.h | 2 +- .../update/model/policy/upgrade_period.h | 27 ------------ .../update/model/subscribe/subscribe_info.h | 3 +- .../update/model/task/src/task_body.cpp | 2 +- .../update/model/upgrade_info/business_type.h | 22 +++++++--- .../model/upgrade_info/src/upgrade_info.cpp | 2 +- .../update/model/upgrade_info/upgrade_info.h | 43 ++++++++++++------- .../ability/adapter/include/config_info.h | 17 ++++++-- .../core/ability/adapter/src/config_parse.cpp | 3 +- .../ability/adapter/src/device_adapter.cpp | 2 +- .../download/data/include/download_info.h | 2 +- .../core/ability/model/include/device_info.h | 2 +- services/engine/engine_sa.gni | 3 +- .../firmware/check/include/firmware_icheck.h | 2 +- .../firmware/common/include/firmware_common.h | 2 +- .../data/db/src/firmware_database_empty.cpp | 1 + .../data/db/src/firmware_task_table_empty.cpp | 3 -- .../include/firmware_check_analyze_utils.h | 2 +- .../src/firmware_check_analyze_utils.cpp | 2 +- .../startup/manage/include/schedule_config.h | 2 +- 51 files changed, 89 insertions(+), 90 deletions(-) rename {common => foundations}/BUILD.gn (75%) rename {common => foundations}/ability/define/define.gni (100%) rename {common => foundations}/ability/define/include/update_define.h (100%) rename {common => foundations}/ability/log/include/update_log.h (100%) rename {common => foundations}/ability/log/log.gni (100%) rename {common => foundations}/ability/log/src/update_log.cpp (100%) rename {common => foundations}/ability/sa_loader/include/base_service_kits_impl.h (100%) rename {common => foundations}/ability/sa_loader/include/common_death_recipient.h (100%) rename {common => foundations}/ability/sa_loader/include/load_sa_service.h (100%) rename {common => foundations}/ability/sa_loader/sa_loader.gni (100%) rename {common => foundations}/ability/sa_loader/src/load_sa_service.cpp (100%) rename {common => foundations}/ability/sys_event/include/update_system_event.h (100%) rename {common => foundations}/ability/sys_event/sys_event.gni (100%) rename common/ability/utils/include/encrypt_utils.h => foundations/ability/utils/include/anonymous_utils.h (100%) rename common/ability/utils/include/json_utils.h => foundations/ability/utils/include/dupdate_json_utils.h (100%) rename {common => foundations}/ability/utils/include/json_builder.h (100%) rename {common => foundations}/ability/utils/include/string_utils.h (100%) rename {common => foundations}/ability/utils/utils.gni (100%) rename common/common.gni => foundations/foundations.gni (100%) rename {common => foundations}/model/base/business_error.h (98%) rename {common => foundations}/model/base/call_result.h (100%) rename {common => foundations}/model/base/device_type.h (100%) rename {common => foundations}/model/base/error_message.h (85%) rename {common => foundations}/model/base/network_type.h (100%) rename {common => foundations}/model/model.gni (100%) delete mode 100644 interfaces/inner_api/feature/update/model/policy/upgrade_period.h diff --git a/bundle.json b/bundle.json index 450b3064..8803a9d8 100644 --- a/bundle.json +++ b/bundle.json @@ -69,10 +69,10 @@ "inner_api": [ { "header": { - "header_base": "//base/update/updateservice/common/ability/log/include", + "header_base": "//base/update/updateservice/foundations", "header_files": [] }, - "name": "//base/update/updateservice/common:common" + "name": "//base/update/updateservice/foundations:foundations" }, { "header": { diff --git a/common/BUILD.gn b/foundations/BUILD.gn similarity index 75% rename from common/BUILD.gn rename to foundations/BUILD.gn index a7164b01..08fd8cd1 100644 --- a/common/BUILD.gn +++ b/foundations/BUILD.gn @@ -1,13 +1,13 @@ import("//build/ohos.gni") import("//base/update/updateservice/updateengine.gni") -import("common.gni") +import("foundations.gni") -config("update_service_common_config") { +config("update_service_foundations_config") { include_dirs = common_include } -ohos_shared_library("common") { +ohos_shared_library("foundations") { sanitize = { cfi = true cfi_cross_dso = true @@ -25,7 +25,7 @@ ohos_shared_library("common") { deps = common_deps external_deps = common_external_deps - public_configs = [ ":update_service_common_config" ] + public_configs = [ ":update_service_foundations_config" ] part_name = "$updateengine_part_name" subsystem_name = "updater" diff --git a/common/ability/define/define.gni b/foundations/ability/define/define.gni similarity index 100% rename from common/ability/define/define.gni rename to foundations/ability/define/define.gni diff --git a/common/ability/define/include/update_define.h b/foundations/ability/define/include/update_define.h similarity index 100% rename from common/ability/define/include/update_define.h rename to foundations/ability/define/include/update_define.h diff --git a/common/ability/log/include/update_log.h b/foundations/ability/log/include/update_log.h similarity index 100% rename from common/ability/log/include/update_log.h rename to foundations/ability/log/include/update_log.h diff --git a/common/ability/log/log.gni b/foundations/ability/log/log.gni similarity index 100% rename from common/ability/log/log.gni rename to foundations/ability/log/log.gni diff --git a/common/ability/log/src/update_log.cpp b/foundations/ability/log/src/update_log.cpp similarity index 100% rename from common/ability/log/src/update_log.cpp rename to foundations/ability/log/src/update_log.cpp diff --git a/common/ability/sa_loader/include/base_service_kits_impl.h b/foundations/ability/sa_loader/include/base_service_kits_impl.h similarity index 100% rename from common/ability/sa_loader/include/base_service_kits_impl.h rename to foundations/ability/sa_loader/include/base_service_kits_impl.h diff --git a/common/ability/sa_loader/include/common_death_recipient.h b/foundations/ability/sa_loader/include/common_death_recipient.h similarity index 100% rename from common/ability/sa_loader/include/common_death_recipient.h rename to foundations/ability/sa_loader/include/common_death_recipient.h diff --git a/common/ability/sa_loader/include/load_sa_service.h b/foundations/ability/sa_loader/include/load_sa_service.h similarity index 100% rename from common/ability/sa_loader/include/load_sa_service.h rename to foundations/ability/sa_loader/include/load_sa_service.h diff --git a/common/ability/sa_loader/sa_loader.gni b/foundations/ability/sa_loader/sa_loader.gni similarity index 100% rename from common/ability/sa_loader/sa_loader.gni rename to foundations/ability/sa_loader/sa_loader.gni diff --git a/common/ability/sa_loader/src/load_sa_service.cpp b/foundations/ability/sa_loader/src/load_sa_service.cpp similarity index 100% rename from common/ability/sa_loader/src/load_sa_service.cpp rename to foundations/ability/sa_loader/src/load_sa_service.cpp diff --git a/common/ability/sys_event/include/update_system_event.h b/foundations/ability/sys_event/include/update_system_event.h similarity index 100% rename from common/ability/sys_event/include/update_system_event.h rename to foundations/ability/sys_event/include/update_system_event.h diff --git a/common/ability/sys_event/sys_event.gni b/foundations/ability/sys_event/sys_event.gni similarity index 100% rename from common/ability/sys_event/sys_event.gni rename to foundations/ability/sys_event/sys_event.gni diff --git a/common/ability/utils/include/encrypt_utils.h b/foundations/ability/utils/include/anonymous_utils.h similarity index 100% rename from common/ability/utils/include/encrypt_utils.h rename to foundations/ability/utils/include/anonymous_utils.h diff --git a/common/ability/utils/include/json_utils.h b/foundations/ability/utils/include/dupdate_json_utils.h similarity index 100% rename from common/ability/utils/include/json_utils.h rename to foundations/ability/utils/include/dupdate_json_utils.h diff --git a/common/ability/utils/include/json_builder.h b/foundations/ability/utils/include/json_builder.h similarity index 100% rename from common/ability/utils/include/json_builder.h rename to foundations/ability/utils/include/json_builder.h diff --git a/common/ability/utils/include/string_utils.h b/foundations/ability/utils/include/string_utils.h similarity index 100% rename from common/ability/utils/include/string_utils.h rename to foundations/ability/utils/include/string_utils.h diff --git a/common/ability/utils/utils.gni b/foundations/ability/utils/utils.gni similarity index 100% rename from common/ability/utils/utils.gni rename to foundations/ability/utils/utils.gni diff --git a/common/common.gni b/foundations/foundations.gni similarity index 100% rename from common/common.gni rename to foundations/foundations.gni diff --git a/common/model/base/business_error.h b/foundations/model/base/business_error.h similarity index 98% rename from common/model/base/business_error.h rename to foundations/model/base/business_error.h index e7d96113..24a7f572 100644 --- a/common/model/base/business_error.h +++ b/foundations/model/base/business_error.h @@ -22,9 +22,9 @@ #include "nlohmann/json.hpp" #include "call_result.h" +#include "dupdate_json_utils.h" #include "error_message.h" #include "json_builder.h" -#include "json_utils.h" namespace OHOS::UpdateEngine { struct BusinessError { diff --git a/common/model/base/call_result.h b/foundations/model/base/call_result.h similarity index 100% rename from common/model/base/call_result.h rename to foundations/model/base/call_result.h diff --git a/common/model/base/device_type.h b/foundations/model/base/device_type.h similarity index 100% rename from common/model/base/device_type.h rename to foundations/model/base/device_type.h diff --git a/common/model/base/error_message.h b/foundations/model/base/error_message.h similarity index 85% rename from common/model/base/error_message.h rename to foundations/model/base/error_message.h index b49b81af..8821469d 100644 --- a/common/model/base/error_message.h +++ b/foundations/model/base/error_message.h @@ -21,8 +21,8 @@ #include "nlohmann/json.hpp" +#include "dupdate_json_utils.h" #include "json_builder.h" -#include "json_utils.h" namespace OHOS::UpdateEngine { struct ErrorMessage { @@ -40,15 +40,6 @@ struct ErrorMessage { JsonUtils::GetValueAndSetTo(jsonObj, "errorCode", message.errorCode); JsonUtils::GetValueAndSetTo(jsonObj, "errorMessage", message.errorMessage); } - - JsonBuilder GetJsonBuilder() - { - return JsonBuilder() - .Append("{") - .Append("errorCode", errorCode) - .Append("errorMessage", errorMessage) - .Append("}"); - } }; } // namespace OHOS::UpdateEngine #endif // UPDATE_SERVICE_ERROR_MESSAGE_H diff --git a/common/model/base/network_type.h b/foundations/model/base/network_type.h similarity index 100% rename from common/model/base/network_type.h rename to foundations/model/base/network_type.h diff --git a/common/model/model.gni b/foundations/model/model.gni similarity index 100% rename from common/model/model.gni rename to foundations/model/model.gni diff --git a/frameworks/js/napi/update/BUILD.gn b/frameworks/js/napi/update/BUILD.gn index 45f4de41..599a85c3 100644 --- a/frameworks/js/napi/update/BUILD.gn +++ b/frameworks/js/napi/update/BUILD.gn @@ -52,7 +52,7 @@ ohos_shared_library("$updateengine_client_library_name") { deps = [ "$updateengine_root_path/interfaces/inner_api/engine:$updateengine_inner_library_name", - "$updateengine_root_path/common:common", + "$updateengine_root_path/foundations:foundations", ] external_deps = [ diff --git a/interfaces/inner_api/engine/BUILD.gn b/interfaces/inner_api/engine/BUILD.gn index 272c95a7..bda8a59c 100644 --- a/interfaces/inner_api/engine/BUILD.gn +++ b/interfaces/inner_api/engine/BUILD.gn @@ -61,7 +61,7 @@ ohos_shared_library("$updateengine_inner_library_name") { deps = [ "$updateengine_root_path/interfaces/inner_api/modulemgr:update_module_mgr", - "$updateengine_root_path/common:common", + "$updateengine_root_path/foundations:foundations", "//third_party/bounds_checking_function:libsec_static", "//third_party/json:nlohmann_json_static", ] diff --git a/interfaces/inner_api/engine/src/update_callback.cpp b/interfaces/inner_api/engine/src/update_callback.cpp index 363c3997..181c5966 100644 --- a/interfaces/inner_api/engine/src/update_callback.cpp +++ b/interfaces/inner_api/engine/src/update_callback.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "../include/update_callback.h" +#include "update_callback.h" #include "update_log.h" diff --git a/interfaces/inner_api/feature/update/api/online_updater/iservice_online_updater.h b/interfaces/inner_api/feature/update/api/online_updater/iservice_online_updater.h index 92db3449..46a5ae28 100644 --- a/interfaces/inner_api/feature/update/api/online_updater/iservice_online_updater.h +++ b/interfaces/inner_api/feature/update/api/online_updater/iservice_online_updater.h @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/interfaces/inner_api/feature/update/model/download/download_options.h b/interfaces/inner_api/feature/update/model/download/download_options.h index 71fb7737..d8e38097 100644 --- a/interfaces/inner_api/feature/update/model/download/download_options.h +++ b/interfaces/inner_api/feature/update/model/download/download_options.h @@ -16,8 +16,8 @@ #ifndef UPDATE_SERVICE_DOWNLOAD_OPTIONS_H #define UPDATE_SERVICE_DOWNLOAD_OPTIONS_H -#include "order.h" #include "network_type.h" +#include "order.h" namespace OHOS::UpdateEngine { struct DownloadOptions { diff --git a/interfaces/inner_api/feature/update/model/event/event_classify.h b/interfaces/inner_api/feature/update/model/event/event_classify.h index 2c2f46d0..4b70e86c 100644 --- a/interfaces/inner_api/feature/update/model/event/event_classify.h +++ b/interfaces/inner_api/feature/update/model/event/event_classify.h @@ -24,6 +24,6 @@ enum class EventClassify { SYSTEM = 0x02000000, }; -const std::list g_eventClassifyList = { EventClassify::TASK, EventClassify::SYSTEM }; +const std::list g_eventClassifyList = { EventClassify::TASK, EventClassify::SYSTEM }; } // namespace OHOS::UpdateEngine #endif // UPDATE_SERVICE_EVENT_CLASSIFY_H diff --git a/interfaces/inner_api/feature/update/model/policy/upgrade_period.h b/interfaces/inner_api/feature/update/model/policy/upgrade_period.h deleted file mode 100644 index e5dabf25..00000000 --- a/interfaces/inner_api/feature/update/model/policy/upgrade_period.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2024 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef UPDATE_SERVICE_UPGRADE_PERIOD_H -#define UPDATE_SERVICE_UPGRADE_PERIOD_H - -#include - -namespace OHOS::UpdateEngine { -struct UpgradePeriod { - uint32_t start = 0; - uint32_t end = 0; -}; -} // OHOS::UpdateEngine -#endif // UPDATE_SERVICE_UPGRADE_PERIOD_H diff --git a/interfaces/inner_api/feature/update/model/subscribe/subscribe_info.h b/interfaces/inner_api/feature/update/model/subscribe/subscribe_info.h index 4998f80d..d72b1abf 100644 --- a/interfaces/inner_api/feature/update/model/subscribe/subscribe_info.h +++ b/interfaces/inner_api/feature/update/model/subscribe/subscribe_info.h @@ -28,7 +28,7 @@ const std::string OUC_SERVICE_EXT_ABILITY_NAME = "ServiceExtAbility"; struct SubscribeInfo : public BaseJsonStruct { std::string upgradeApp = OUC_PACKAGE_NAME; - BusinessType businessType; + BusinessType businessType = {}; std::string abilityName; std::string subscriberDevId; std::string upgradeDevId; @@ -39,6 +39,7 @@ struct SubscribeInfo : public BaseJsonStruct { { businessType.subType = subType; } + SubscribeInfo() = default; JsonBuilder GetJsonBuilder() final; diff --git a/interfaces/inner_api/feature/update/model/task/src/task_body.cpp b/interfaces/inner_api/feature/update/model/task/src/task_body.cpp index 38ba79f8..2275c17c 100644 --- a/interfaces/inner_api/feature/update/model/task/src/task_body.cpp +++ b/interfaces/inner_api/feature/update/model/task/src/task_body.cpp @@ -13,9 +13,9 @@ * limitations under the License. */ -#include "update_log.h" #include "task_body.h" #include "task_body_member_mask.h" +#include "update_log.h" namespace OHOS::UpdateEngine { JsonBuilder GetJsonBuilder(VersionComponent &versionComponent) diff --git a/interfaces/inner_api/feature/update/model/upgrade_info/business_type.h b/interfaces/inner_api/feature/update/model/upgrade_info/business_type.h index ea25b917..bc17e150 100644 --- a/interfaces/inner_api/feature/update/model/upgrade_info/business_type.h +++ b/interfaces/inner_api/feature/update/model/upgrade_info/business_type.h @@ -30,11 +30,23 @@ struct BusinessType : public BaseJsonStruct { bool operator<(const BusinessType &businessType) const { - if (vendor < businessType.vendor) return true; - if (vendor > businessType.vendor) return false; - - if (CAST_INT(subType) < CAST_INT(businessType.subType)) return true; - if (CAST_INT(subType) > CAST_INT(businessType.subType)) return false; + if (vendor < businessType.vendor) + { + return true; + } + if (vendor > businessType.vendor) + { + return false; + } + + if (CAST_INT(subType) < CAST_INT(businessType.subType)) + { + return true; + } + if (CAST_INT(subType) > CAST_INT(businessType.subType)) + { + return true; + } return false; } diff --git a/interfaces/inner_api/feature/update/model/upgrade_info/src/upgrade_info.cpp b/interfaces/inner_api/feature/update/model/upgrade_info/src/upgrade_info.cpp index 56856b59..d7fa9fab 100644 --- a/interfaces/inner_api/feature/update/model/upgrade_info/src/upgrade_info.cpp +++ b/interfaces/inner_api/feature/update/model/upgrade_info/src/upgrade_info.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "encrypt_utils.h" +#include "anonymous_utils.h" #include "upgrade_info.h" #include "update_define.h" diff --git a/interfaces/inner_api/feature/update/model/upgrade_info/upgrade_info.h b/interfaces/inner_api/feature/update/model/upgrade_info/upgrade_info.h index 89ce5b13..99b786fe 100644 --- a/interfaces/inner_api/feature/update/model/upgrade_info/upgrade_info.h +++ b/interfaces/inner_api/feature/update/model/upgrade_info/upgrade_info.h @@ -25,31 +25,44 @@ namespace OHOS::UpdateEngine { const std::string LOCAL_UPGRADE_INFO = "LocalUpgradeInfo"; struct UpgradeInfo { std::string upgradeApp; - BusinessType businessType; + BusinessType businessType = {}; std::string upgradeDevId; std::string controlDevId; int32_t processId; - DeviceType deviceType; + DeviceType deviceType = DeviceType::UNKNOWN; - bool operator<(const UpgradeInfo &r) const + bool operator<(const UpgradeInfo &other) const { - if (upgradeApp < r.upgradeApp) return true; - if (upgradeApp > r.upgradeApp) return false; + if (upgradeApp != other.upgradeApp) + { + return upgradeApp < other.upgradeApp; + } + - if (businessType < r.businessType) return true; - if (r.businessType < businessType) return false; + if (businessType != other.businessType) + { + return businessType < other.businessType; + } - if (upgradeDevId < r.upgradeDevId) return true; - if (upgradeDevId > r.upgradeDevId) return false; + if (upgradeDevId != other.upgradeDevId) + { + return upgradeDevId < other.upgradeDevId; + } - if (controlDevId < r.controlDevId) return true; - if (controlDevId > r.controlDevId) return false; + if (controlDevId != other.controlDevId) + { + return controlDevId < other.controlDevId; + } - if (processId < r.processId) return true; - if (processId > r.processId) return false; + if (processId != other.processId) + { + return processId < other.processId; + } - if (deviceType < r.deviceType) return true; - if (deviceType > r.deviceType) return false; + if (deviceType != other.deviceType) + { + return deviceType < other.deviceType; + } return false; } diff --git a/services/core/ability/adapter/include/config_info.h b/services/core/ability/adapter/include/config_info.h index 462b7327..1ca9adda 100644 --- a/services/core/ability/adapter/include/config_info.h +++ b/services/core/ability/adapter/include/config_info.h @@ -1,6 +1,17 @@ -// -// Created by x30015763 on 2024/1/23. -// +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #ifndef UPDATE_SERVICE_CONFIG_INFO_H #define UPDATE_SERVICE_CONFIG_INFO_H diff --git a/services/core/ability/adapter/src/config_parse.cpp b/services/core/ability/adapter/src/config_parse.cpp index 621f694d..9ea2d3e0 100644 --- a/services/core/ability/adapter/src/config_parse.cpp +++ b/services/core/ability/adapter/src/config_parse.cpp @@ -19,9 +19,10 @@ #include #include #include + #include "constant.h" +#include "dupdate_json_utils.h" #include "firmware_constant.h" -#include "json_utils.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/core/ability/adapter/src/device_adapter.cpp b/services/core/ability/adapter/src/device_adapter.cpp index 44e942e5..26e03272 100644 --- a/services/core/ability/adapter/src/device_adapter.cpp +++ b/services/core/ability/adapter/src/device_adapter.cpp @@ -27,9 +27,9 @@ #include "parameter.h" #include "securec.h" +#include "anonymous_utils.h" #include "constant.h" #include "config_parse.h" -#include "encrypt_utils.h" #include "update_log.h" namespace OHOS { diff --git a/services/core/ability/download/data/include/download_info.h b/services/core/ability/download/data/include/download_info.h index e543cc1d..d57aa3d2 100644 --- a/services/core/ability/download/data/include/download_info.h +++ b/services/core/ability/download/data/include/download_info.h @@ -20,7 +20,7 @@ #include #include -#include "encrypt_utils.h" +#include "anonymous_utils.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/core/ability/model/include/device_info.h b/services/core/ability/model/include/device_info.h index 10e7593a..bba10752 100644 --- a/services/core/ability/model/include/device_info.h +++ b/services/core/ability/model/include/device_info.h @@ -20,7 +20,7 @@ #include "nlohmann/json.hpp" -#include "encrypt_utils.h" +#include "anonymous_utils.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/engine/engine_sa.gni b/services/engine/engine_sa.gni index c3f2ae2d..3ff21751 100644 --- a/services/engine/engine_sa.gni +++ b/services/engine/engine_sa.gni @@ -127,7 +127,7 @@ sa_include_dirs += sa_deps = [ "$updateengine_root_path/interfaces/inner_api/modulemgr:update_module_mgr", "$updateengine_root_path/interfaces/inner_api/engine:$updateengine_inner_library_name", - "$updateengine_root_path/common:common", + "$updateengine_root_path/foundations:foundations", "//base/update/updater/services/fs_manager:libfsmanager", # factory_reset_GetBlockDeviceByMountPoint_"fs_manager/mount.h" "//third_party/cJSON:cjson", "//third_party/curl:curl", @@ -179,7 +179,6 @@ if (ability_ability_runtime_enable) { } sa_external_deps += sqlite_external_deps -sa_external_deps += update_log_external_deps sa_external_deps += startup_external_deps sa_public_deps = [] diff --git a/services/firmware/check/include/firmware_icheck.h b/services/firmware/check/include/firmware_icheck.h index ee6f1e94..ae188fe7 100644 --- a/services/firmware/check/include/firmware_icheck.h +++ b/services/firmware/check/include/firmware_icheck.h @@ -29,7 +29,7 @@ #include "parameter.h" #include "parameters.h" -#include "encrypt_utils.h" +#include "anonymous_utils.h" #include "firmware_check_analyze_utils.h" #include "firmware_common.h" #include "firmware_component.h" diff --git a/services/firmware/common/include/firmware_common.h b/services/firmware/common/include/firmware_common.h index 401ff521..e496da43 100644 --- a/services/firmware/common/include/firmware_common.h +++ b/services/firmware/common/include/firmware_common.h @@ -20,8 +20,8 @@ #include "nlohmann/json.hpp" +#include "anonymous_utils.h" #include "constant.h" -#include "encrypt_utils.h" #include "firmware_component.h" #include "firmware_log.h" #include "update_define.h" diff --git a/services/firmware/data/db/src/firmware_database_empty.cpp b/services/firmware/data/db/src/firmware_database_empty.cpp index d10b6163..36621288 100644 --- a/services/firmware/data/db/src/firmware_database_empty.cpp +++ b/services/firmware/data/db/src/firmware_database_empty.cpp @@ -16,6 +16,7 @@ #include "firmware_database.h" #include "constant.h" +#include "update_log.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/data/db/src/firmware_task_table_empty.cpp b/services/firmware/data/db/src/firmware_task_table_empty.cpp index d14701f6..56167839 100644 --- a/services/firmware/data/db/src/firmware_task_table_empty.cpp +++ b/services/firmware/data/db/src/firmware_task_table_empty.cpp @@ -15,9 +15,6 @@ #include "firmware_task_table.h" -#include "itable.h" -#include "update_define.h" - namespace OHOS { namespace UpdateEngine { std::string FirmwareTaskTable::GetTableName() diff --git a/services/firmware/utils/include/firmware_check_analyze_utils.h b/services/firmware/utils/include/firmware_check_analyze_utils.h index e56d9c1d..bb676d41 100644 --- a/services/firmware/utils/include/firmware_check_analyze_utils.h +++ b/services/firmware/utils/include/firmware_check_analyze_utils.h @@ -21,8 +21,8 @@ #include "singleton.h" +#include "dupdate_json_utils.h" #include "firmware_common.h" -#include "json_utils.h" namespace OHOS { namespace UpdateEngine { diff --git a/services/firmware/utils/src/firmware_check_analyze_utils.cpp b/services/firmware/utils/src/firmware_check_analyze_utils.cpp index 4633b20a..a5de85c0 100644 --- a/services/firmware/utils/src/firmware_check_analyze_utils.cpp +++ b/services/firmware/utils/src/firmware_check_analyze_utils.cpp @@ -22,12 +22,12 @@ #include #include "constant.h" +#include "dupdate_json_utils.h" #include "file_utils.h" #include "firmware_combine_version_utils.h" #include "firmware_constant.h" #include "firmware_log.h" #include "firmware_preferences_utils.h" -#include "json_utils.h" #include "string_utils.h" namespace OHOS { diff --git a/services/startup/manage/include/schedule_config.h b/services/startup/manage/include/schedule_config.h index 48d98116..66ed1100 100644 --- a/services/startup/manage/include/schedule_config.h +++ b/services/startup/manage/include/schedule_config.h @@ -16,7 +16,7 @@ #ifndef SCHEDULE_CONFIG_H #define SCHEDULE_CONFIG_H -#include "json_utils.h" +#include "dupdate_json_utils.h" #include "startup_constant.h" namespace OHOS { -- Gitee From 04370d209b3bcd8ccdea2ad4822e173a4418f0dd Mon Sep 17 00:00:00 2001 From: Monster Date: Wed, 31 Jan 2024 10:31:01 +0800 Subject: [PATCH 42/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9sa=5Floader=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- foundations/ability/sa_loader/sa_loader.gni | 2 ++ 1 file changed, 2 insertions(+) diff --git a/foundations/ability/sa_loader/sa_loader.gni b/foundations/ability/sa_loader/sa_loader.gni index cf310c07..112ff4eb 100644 --- a/foundations/ability/sa_loader/sa_loader.gni +++ b/foundations/ability/sa_loader/sa_loader.gni @@ -11,6 +11,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/update/updateservice/updateengine.gni") + sa_loader_external_deps = [ "c_utils:utils", # sptr "ipc:ipc_core", -- Gitee From 9f19e6695848e45cd81bcf29cb625e1038c5472c Mon Sep 17 00:00:00 2001 From: Monster Date: Wed, 31 Jan 2024 10:52:51 +0800 Subject: [PATCH 43/98] =?UTF-8?q?=E5=9B=9E=E9=80=80=E8=AA=A4=E5=88=AA?= =?UTF-8?q?=E9=99=A4=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- .../update/model/policy/upgrade_period.h | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 interfaces/inner_api/feature/update/model/policy/upgrade_period.h diff --git a/interfaces/inner_api/feature/update/model/policy/upgrade_period.h b/interfaces/inner_api/feature/update/model/policy/upgrade_period.h new file mode 100644 index 00000000..e5dabf25 --- /dev/null +++ b/interfaces/inner_api/feature/update/model/policy/upgrade_period.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UPDATE_SERVICE_UPGRADE_PERIOD_H +#define UPDATE_SERVICE_UPGRADE_PERIOD_H + +#include + +namespace OHOS::UpdateEngine { +struct UpgradePeriod { + uint32_t start = 0; + uint32_t end = 0; +}; +} // OHOS::UpdateEngine +#endif // UPDATE_SERVICE_UPGRADE_PERIOD_H -- Gitee From 4f66981eff2bbd8e319c85d3c402bb7eff4ec7a6 Mon Sep 17 00:00:00 2001 From: Monster Date: Wed, 31 Jan 2024 11:17:04 +0800 Subject: [PATCH 44/98] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E7=AC=A6=E9=87=8D=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- .../feature/update/model/upgrade_info/business_type.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/interfaces/inner_api/feature/update/model/upgrade_info/business_type.h b/interfaces/inner_api/feature/update/model/upgrade_info/business_type.h index bc17e150..c2b4fde6 100644 --- a/interfaces/inner_api/feature/update/model/upgrade_info/business_type.h +++ b/interfaces/inner_api/feature/update/model/upgrade_info/business_type.h @@ -51,6 +51,11 @@ struct BusinessType : public BaseJsonStruct { return false; } + bool operator!=(const BusinessType &businessType) const + { + return vendor != businessType.vendor || CAST_INT(subType) != CAST_INT(businessType.subType); + } + JsonBuilder GetJsonBuilder() final; }; } // namespace OHOS::UpdateEngine -- Gitee From 6fef5c15dd7ce53a04a93fa9b6db344e849fb6e9 Mon Sep 17 00:00:00 2001 From: Monster Date: Wed, 31 Jan 2024 11:41:58 +0800 Subject: [PATCH 45/98] =?UTF-8?q?=E6=81=A2=E5=A4=8D=E5=A4=9A=E5=88=A0?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- foundations/model/base/error_message.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/foundations/model/base/error_message.h b/foundations/model/base/error_message.h index 8821469d..7d565bf8 100644 --- a/foundations/model/base/error_message.h +++ b/foundations/model/base/error_message.h @@ -40,6 +40,15 @@ struct ErrorMessage { JsonUtils::GetValueAndSetTo(jsonObj, "errorCode", message.errorCode); JsonUtils::GetValueAndSetTo(jsonObj, "errorMessage", message.errorMessage); } + + JsonBuilder GetJsonBuilder() + { + return JsonBuilder() + .Append("{") + .Append("errorCode", errorCode) + .Append("errorMessage", errorMessage) + .Append("}"); + } }; } // namespace OHOS::UpdateEngine #endif // UPDATE_SERVICE_ERROR_MESSAGE_H -- Gitee From d3935f3b81bd397f677b8d23b18ceb0ee63d823c Mon Sep 17 00:00:00 2001 From: Monster Date: Wed, 31 Jan 2024 14:35:27 +0800 Subject: [PATCH 46/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9gn=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- foundations/BUILD.gn | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/foundations/BUILD.gn b/foundations/BUILD.gn index 08fd8cd1..b30e2996 100644 --- a/foundations/BUILD.gn +++ b/foundations/BUILD.gn @@ -1,6 +1,18 @@ +# Copyright (c) 2024 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. -import("//build/ohos.gni") import("//base/update/updateservice/updateengine.gni") +import("//build/ohos.gni") import("foundations.gni") config("update_service_foundations_config") { -- Gitee From d725b54b67bd047b6f0155d3dbacdc9c6b44e561 Mon Sep 17 00:00:00 2001 From: Monster Date: Wed, 31 Jan 2024 14:43:35 +0800 Subject: [PATCH 47/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E7=A0=81?= =?UTF-8?q?=E8=A7=84=E8=8C=83=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- .../update/model/common/base_json_struct.h | 3 ++- .../update/model/upgrade_info/business_type.h | 12 ++++-------- .../update/model/upgrade_info/upgrade_info.h | 19 ++++++------------- 3 files changed, 12 insertions(+), 22 deletions(-) diff --git a/interfaces/inner_api/feature/update/model/common/base_json_struct.h b/interfaces/inner_api/feature/update/model/common/base_json_struct.h index 2dfb87f8..fb816966 100644 --- a/interfaces/inner_api/feature/update/model/common/base_json_struct.h +++ b/interfaces/inner_api/feature/update/model/common/base_json_struct.h @@ -26,7 +26,8 @@ struct BaseJsonStruct { virtual JsonBuilder GetJsonBuilder() = 0; - virtual std::string ToJson() { + virtual std::string ToJson() + { return GetJsonBuilder().ToJson(); }; }; diff --git a/interfaces/inner_api/feature/update/model/upgrade_info/business_type.h b/interfaces/inner_api/feature/update/model/upgrade_info/business_type.h index c2b4fde6..618ed9c3 100644 --- a/interfaces/inner_api/feature/update/model/upgrade_info/business_type.h +++ b/interfaces/inner_api/feature/update/model/upgrade_info/business_type.h @@ -30,21 +30,17 @@ struct BusinessType : public BaseJsonStruct { bool operator<(const BusinessType &businessType) const { - if (vendor < businessType.vendor) - { + if (vendor < businessType.vendor) { return true; } - if (vendor > businessType.vendor) - { + if (vendor > businessType.vendor) { return false; } - if (CAST_INT(subType) < CAST_INT(businessType.subType)) - { + if (CAST_INT(subType) < CAST_INT(businessType.subType)) { return true; } - if (CAST_INT(subType) > CAST_INT(businessType.subType)) - { + if (CAST_INT(subType) > CAST_INT(businessType.subType)) { return true; } diff --git a/interfaces/inner_api/feature/update/model/upgrade_info/upgrade_info.h b/interfaces/inner_api/feature/update/model/upgrade_info/upgrade_info.h index 99b786fe..171bb8eb 100644 --- a/interfaces/inner_api/feature/update/model/upgrade_info/upgrade_info.h +++ b/interfaces/inner_api/feature/update/model/upgrade_info/upgrade_info.h @@ -33,34 +33,27 @@ struct UpgradeInfo { bool operator<(const UpgradeInfo &other) const { - if (upgradeApp != other.upgradeApp) - { + if (upgradeApp != other.upgradeApp) { return upgradeApp < other.upgradeApp; } - - if (businessType != other.businessType) - { + if (businessType != other.businessType) { return businessType < other.businessType; } - if (upgradeDevId != other.upgradeDevId) - { + if (upgradeDevId != other.upgradeDevId) { return upgradeDevId < other.upgradeDevId; } - if (controlDevId != other.controlDevId) - { + if (controlDevId != other.controlDevId) { return controlDevId < other.controlDevId; } - if (processId != other.processId) - { + if (processId != other.processId) { return processId < other.processId; } - if (deviceType != other.deviceType) - { + if (deviceType != other.deviceType) { return deviceType < other.deviceType; } -- Gitee From c73f370c1ea5b12bae589ddbf21441e9722fe8f0 Mon Sep 17 00:00:00 2001 From: Monster Date: Wed, 31 Jan 2024 15:03:14 +0800 Subject: [PATCH 48/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=B7=A8=E7=A2=BC?= =?UTF-8?q?=E8=A6=8F=E7=AF=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- interfaces/inner_api/engine/src/update_service_proxy.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/interfaces/inner_api/engine/src/update_service_proxy.cpp b/interfaces/inner_api/engine/src/update_service_proxy.cpp index f8120401..4a044238 100644 --- a/interfaces/inner_api/engine/src/update_service_proxy.cpp +++ b/interfaces/inner_api/engine/src/update_service_proxy.cpp @@ -24,7 +24,9 @@ #include "update_log.h" #include "updater_sa_ipc_interface_code.h" -#define RETURN_WHEN_REMOTE_NULL(remote) ENGINE_CHECK((remote) != nullptr, return INT_CALL_IPC_ERR, "Can not get remote") +namespace OHOS::UpdateEngine { +#define RETURN_WHEN_REMOTE_NULL(remote) \ + ENGINE_CHECK((remote) != nullptr, return INT_CALL_IPC_ERR, "Can not get remote") #define IPC_RESULT_TO_CALL_RESULT(result) \ if ((result) == ERR_NONE) { \ @@ -35,7 +37,6 @@ result = INT_CALL_IPC_ERR; \ } -namespace OHOS::UpdateEngine { #define RETURN_WHEN_TOKEN_WRITE_FAIL(data) \ if (!(data).WriteInterfaceToken(GetDescriptor())) { \ ENGINE_LOGE("UpdateServiceProxy WriteInterfaceToken fail"); \ -- Gitee From 6175e4c1b3ac9977c3dd8ec635ea4964a36bffb3 Mon Sep 17 00:00:00 2001 From: Monster Date: Wed, 31 Jan 2024 15:08:49 +0800 Subject: [PATCH 49/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9gn=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- foundations/ability/sa_loader/sa_loader.gni | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foundations/ability/sa_loader/sa_loader.gni b/foundations/ability/sa_loader/sa_loader.gni index 112ff4eb..673fb2f7 100644 --- a/foundations/ability/sa_loader/sa_loader.gni +++ b/foundations/ability/sa_loader/sa_loader.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. +# Copyright (c) 2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -- Gitee From 39e851215de4a89adbc314c4f1923499f6941ea8 Mon Sep 17 00:00:00 2001 From: Monster Date: Wed, 31 Jan 2024 15:24:40 +0800 Subject: [PATCH 50/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9gn=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- foundations/ability/sa_loader/sa_loader.gni | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/foundations/ability/sa_loader/sa_loader.gni b/foundations/ability/sa_loader/sa_loader.gni index 673fb2f7..ee3c7169 100644 --- a/foundations/ability/sa_loader/sa_loader.gni +++ b/foundations/ability/sa_loader/sa_loader.gni @@ -14,13 +14,13 @@ import("//base/update/updateservice/updateengine.gni") sa_loader_external_deps = [ - "c_utils:utils", # sptr - "ipc:ipc_core", - "safwk:system_ability_fwk", - "samgr:samgr_proxy", + "c_utils:utils", # sptr + "ipc:ipc_core", + "safwk:system_ability_fwk", + "samgr:samgr_proxy", ] if (ability_ability_runtime_enable) { - sa_loader_external_deps += [ "ability_runtime:ability_manager" ] + sa_loader_external_deps += [ "ability_runtime:ability_manager" ] } sa_loader_deps = [] -- Gitee From 4b1732c7a7ab346429c3e071aef44deacb5c0c5c Mon Sep 17 00:00:00 2001 From: Monster Date: Wed, 31 Jan 2024 15:36:39 +0800 Subject: [PATCH 51/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9gni=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- foundations/ability/log/log.gni | 2 +- foundations/ability/utils/utils.gni | 6 +-- foundations/model/model.gni | 2 +- .../inner_api/feature/update/api/api.gni | 10 ++-- .../inner_api/feature/update/model/model.gni | 54 +++++++++---------- 5 files changed, 37 insertions(+), 37 deletions(-) diff --git a/foundations/ability/log/log.gni b/foundations/ability/log/log.gni index db153a82..ae7f229c 100644 --- a/foundations/ability/log/log.gni +++ b/foundations/ability/log/log.gni @@ -14,7 +14,7 @@ update_log_external_deps = [ "hilog:libhilog", "updater:libupdaterlog_shared", - ] +] update_log_deps = [] update_log_include = [ "ability/log/include" ] update_log_src = [ "ability/log/src/update_log.cpp" ] diff --git a/foundations/ability/utils/utils.gni b/foundations/ability/utils/utils.gni index 89e546c7..292d8439 100644 --- a/foundations/ability/utils/utils.gni +++ b/foundations/ability/utils/utils.gni @@ -13,10 +13,10 @@ utils_external_deps = [] utils_deps = [ - "//third_party/json:nlohmann_json_static" + "//third_party/json:nlohmann_json_static" ] utils_include = [ - "ability/utils/include", - "//third_party/json/include", + "ability/utils/include", + "//third_party/json/include", ] utils_src = [] diff --git a/foundations/model/model.gni b/foundations/model/model.gni index 5eb4d4ca..75d62a9d 100644 --- a/foundations/model/model.gni +++ b/foundations/model/model.gni @@ -14,6 +14,6 @@ model_external_deps = [] model_deps = [] model_include = [ - "model/base" + "model/base" ] model_src = [] diff --git a/interfaces/inner_api/feature/update/api/api.gni b/interfaces/inner_api/feature/update/api/api.gni index c7b60910..b344d317 100644 --- a/interfaces/inner_api/feature/update/api/api.gni +++ b/interfaces/inner_api/feature/update/api/api.gni @@ -14,10 +14,10 @@ api_external_deps = [] api_deps = [] api_include = [ - "../feature/update/api/callback", - "../feature/update/api/local_updater", - "../feature/update/api/online_updater", - "../feature/update/api/restorer", - "../feature/update/api/update_service", + "../feature/update/api/callback", + "../feature/update/api/local_updater", + "../feature/update/api/online_updater", + "../feature/update/api/restorer", + "../feature/update/api/update_service", ] api_src = [] diff --git a/interfaces/inner_api/feature/update/model/model.gni b/interfaces/inner_api/feature/update/model/model.gni index d8bdf713..87ac3837 100644 --- a/interfaces/inner_api/feature/update/model/model.gni +++ b/interfaces/inner_api/feature/update/model/model.gni @@ -14,33 +14,33 @@ model_external_deps = [] model_deps = [] model_include = [ - "../feature/update/model/check", - "../feature/update/model/clear", - "../feature/update/model/common", - "../feature/update/model/download", - "../feature/update/model/event", - "../feature/update/model/event/on_off", - "../feature/update/model/install", - "../feature/update/model/message_parcel/include", - "../feature/update/model/policy", - "../feature/update/model/subscribe", - "../feature/update/model/task", - "../feature/update/model/upgrade", - "../feature/update/model/upgrade_info", - "../feature/update/model/upgrade", - "../feature/update/model/version_info", - "../feature/update/model/version_info/current_version", - "../feature/update/model/version_info/description", - "../feature/update/model/version_info/new_version", + "../feature/update/model/check", + "../feature/update/model/clear", + "../feature/update/model/common", + "../feature/update/model/download", + "../feature/update/model/event", + "../feature/update/model/event/on_off", + "../feature/update/model/install", + "../feature/update/model/message_parcel/include", + "../feature/update/model/policy", + "../feature/update/model/subscribe", + "../feature/update/model/task", + "../feature/update/model/upgrade", + "../feature/update/model/upgrade_info", + "../feature/update/model/upgrade", + "../feature/update/model/version_info", + "../feature/update/model/version_info/current_version", + "../feature/update/model/version_info/description", + "../feature/update/model/version_info/new_version", ] model_src = [ - "../feature/update/model/event/src/event_info.cpp", - "../feature/update/model/message_parcel/src/message_parcel_helper.cpp", - "../feature/update/model/subscribe/src/subscribe_info.cpp", - "../feature/update/model/task/src/task_body.cpp", - "../feature/update/model/upgrade_info/src/business_type.cpp", - "../feature/update/model/upgrade_info/src/upgrade_info.cpp", - "../feature/update/model/version_info/description/src/description_info.cpp", - "../feature/update/model/version_info/src/version_component.cpp", - "../feature/update/model/version_info/src/version_digest_info.cpp", + "../feature/update/model/event/src/event_info.cpp", + "../feature/update/model/message_parcel/src/message_parcel_helper.cpp", + "../feature/update/model/subscribe/src/subscribe_info.cpp", + "../feature/update/model/task/src/task_body.cpp", + "../feature/update/model/upgrade_info/src/business_type.cpp", + "../feature/update/model/upgrade_info/src/upgrade_info.cpp", + "../feature/update/model/version_info/description/src/description_info.cpp", + "../feature/update/model/version_info/src/version_component.cpp", + "../feature/update/model/version_info/src/version_digest_info.cpp", ] -- Gitee From c1cbb1c2e65cd0b889ec0466c1b870056f09bb8d Mon Sep 17 00:00:00 2001 From: Monster Date: Wed, 31 Jan 2024 15:50:32 +0800 Subject: [PATCH 52/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9gn=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=A0=87=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- foundations/BUILD.gn | 10 +++---- foundations/foundations.gni | 56 ++++++++++++++++++------------------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/foundations/BUILD.gn b/foundations/BUILD.gn index b30e2996..05632620 100644 --- a/foundations/BUILD.gn +++ b/foundations/BUILD.gn @@ -16,7 +16,7 @@ import("//build/ohos.gni") import("foundations.gni") config("update_service_foundations_config") { - include_dirs = common_include + include_dirs = foundations_include } ohos_shared_library("foundations") { @@ -32,10 +32,10 @@ ohos_shared_library("foundations") { defines += [ "ABILITY_RUNTIME_INNER_ENABLE" ] } - include_dirs = common_include - sources = common_sources - deps = common_deps - external_deps = common_external_deps + include_dirs = foundations_include + sources = foundations_sources + deps = foundations_deps + external_deps = foundations_external_deps public_configs = [ ":update_service_foundations_config" ] diff --git a/foundations/foundations.gni b/foundations/foundations.gni index dea4c72b..ccd7825e 100644 --- a/foundations/foundations.gni +++ b/foundations/foundations.gni @@ -18,35 +18,35 @@ import("ability/sys_event/sys_event.gni") import("ability/utils/utils.gni") import("model/model.gni") -common_external_deps = [] -common_external_deps += define_external_deps -common_external_deps += update_log_external_deps -common_external_deps += sa_loader_external_deps -common_external_deps += sys_event_external_deps -common_external_deps += utils_external_deps -common_external_deps += model_external_deps +foundations_external_deps = [] +foundations_external_deps += define_external_deps +foundations_external_deps += update_log_external_deps +foundations_external_deps += sa_loader_external_deps +foundations_external_deps += sys_event_external_deps +foundations_external_deps += utils_external_deps +foundations_external_deps += model_external_deps -common_deps = [] -common_deps += define_deps -common_deps += update_log_deps -common_deps += sa_loader_deps -common_deps += sys_event_deps -common_deps += utils_deps -common_deps += model_deps +foundations_deps = [] +foundations_deps += define_deps +foundations_deps += update_log_deps +foundations_deps += sa_loader_deps +foundations_deps += sys_event_deps +foundations_deps += utils_deps +foundations_deps += model_deps -common_include = [] -common_include += define_include -common_include += update_log_include -common_include += sa_loader_include -common_include += sys_event_include -common_include += utils_include -common_include += model_include +foundations_include = [] +foundations_include += define_include +foundations_include += update_log_include +foundations_include += sa_loader_include +foundations_include += sys_event_include +foundations_include += utils_include +foundations_include += model_include -common_sources = [] -common_sources += define_src -common_sources += update_log_src -common_sources += sa_loader_src -common_sources += sys_event_src -common_sources += utils_src -common_sources += model_src +foundations_sources = [] +foundations_sources += define_src +foundations_sources += update_log_src +foundations_sources += sa_loader_src +foundations_sources += sys_event_src +foundations_sources += utils_src +foundations_sources += model_src -- Gitee From 8b5dbed0ce9f5db600dc017e6ffe207b1c3f2232 Mon Sep 17 00:00:00 2001 From: Monster Date: Wed, 31 Jan 2024 15:55:52 +0800 Subject: [PATCH 53/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9gni=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=92=8C=E5=A4=B4=E6=97=A5=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- foundations/ability/define/define.gni | 2 +- foundations/ability/log/log.gni | 2 +- foundations/ability/sys_event/sys_event.gni | 2 +- foundations/ability/utils/utils.gni | 6 ++---- foundations/foundations.gni | 2 +- foundations/model/model.gni | 6 ++---- interfaces/inner_api/feature/feature.gni | 2 +- interfaces/inner_api/feature/update/api/api.gni | 2 +- .../feature/update/api/callback/iupdate_callback.h | 2 +- .../update/api/local_updater/iservice_local_updater.h | 2 +- .../update/api/online_updater/iservice_online_updater.h | 2 +- .../feature/update/api/restorer/iservice_restorer.h | 2 +- .../feature/update/api/update_service/iupdate_service.h | 2 +- interfaces/inner_api/feature/update/model/model.gni | 2 +- 14 files changed, 16 insertions(+), 20 deletions(-) diff --git a/foundations/ability/define/define.gni b/foundations/ability/define/define.gni index ec0a5d0f..760a8b7b 100644 --- a/foundations/ability/define/define.gni +++ b/foundations/ability/define/define.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Huawei Device Co., Ltd. +# Copyright (c) 2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/foundations/ability/log/log.gni b/foundations/ability/log/log.gni index ae7f229c..fee6103f 100644 --- a/foundations/ability/log/log.gni +++ b/foundations/ability/log/log.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. +# Copyright (c) 2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/foundations/ability/sys_event/sys_event.gni b/foundations/ability/sys_event/sys_event.gni index 238b66b1..574a3e53 100644 --- a/foundations/ability/sys_event/sys_event.gni +++ b/foundations/ability/sys_event/sys_event.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. +# Copyright (c) 2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/foundations/ability/utils/utils.gni b/foundations/ability/utils/utils.gni index 292d8439..80701ff6 100644 --- a/foundations/ability/utils/utils.gni +++ b/foundations/ability/utils/utils.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. +# Copyright (c) 2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -12,9 +12,7 @@ # limitations under the License. utils_external_deps = [] -utils_deps = [ - "//third_party/json:nlohmann_json_static" -] +utils_deps = [ "//third_party/json:nlohmann_json_static" ] utils_include = [ "ability/utils/include", "//third_party/json/include", diff --git a/foundations/foundations.gni b/foundations/foundations.gni index ccd7825e..1261102e 100644 --- a/foundations/foundations.gni +++ b/foundations/foundations.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. +# Copyright (c) 2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/foundations/model/model.gni b/foundations/model/model.gni index 75d62a9d..91a42e5e 100644 --- a/foundations/model/model.gni +++ b/foundations/model/model.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. +# Copyright (c) 2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -13,7 +13,5 @@ model_external_deps = [] model_deps = [] -model_include = [ - "model/base" -] +model_include = [ "model/base" ] model_src = [] diff --git a/interfaces/inner_api/feature/feature.gni b/interfaces/inner_api/feature/feature.gni index 80c55fec..c0de10b0 100644 --- a/interfaces/inner_api/feature/feature.gni +++ b/interfaces/inner_api/feature/feature.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. +# Copyright (c) 2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/interfaces/inner_api/feature/update/api/api.gni b/interfaces/inner_api/feature/update/api/api.gni index b344d317..a5d40ef5 100644 --- a/interfaces/inner_api/feature/update/api/api.gni +++ b/interfaces/inner_api/feature/update/api/api.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. +# Copyright (c) 2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/interfaces/inner_api/feature/update/api/callback/iupdate_callback.h b/interfaces/inner_api/feature/update/api/callback/iupdate_callback.h index 73263d0c..7d212634 100644 --- a/interfaces/inner_api/feature/update/api/callback/iupdate_callback.h +++ b/interfaces/inner_api/feature/update/api/callback/iupdate_callback.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at 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 d699e717..1d98f686 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/interfaces/inner_api/feature/update/api/online_updater/iservice_online_updater.h b/interfaces/inner_api/feature/update/api/online_updater/iservice_online_updater.h index 46a5ae28..ef26ce68 100644 --- a/interfaces/inner_api/feature/update/api/online_updater/iservice_online_updater.h +++ b/interfaces/inner_api/feature/update/api/online_updater/iservice_online_updater.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/interfaces/inner_api/feature/update/api/restorer/iservice_restorer.h b/interfaces/inner_api/feature/update/api/restorer/iservice_restorer.h index 0c784dc7..857554b1 100644 --- a/interfaces/inner_api/feature/update/api/restorer/iservice_restorer.h +++ b/interfaces/inner_api/feature/update/api/restorer/iservice_restorer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/interfaces/inner_api/feature/update/api/update_service/iupdate_service.h b/interfaces/inner_api/feature/update/api/update_service/iupdate_service.h index 44f9c248..dda1db37 100644 --- a/interfaces/inner_api/feature/update/api/update_service/iupdate_service.h +++ b/interfaces/inner_api/feature/update/api/update_service/iupdate_service.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/interfaces/inner_api/feature/update/model/model.gni b/interfaces/inner_api/feature/update/model/model.gni index 87ac3837..12d344c6 100644 --- a/interfaces/inner_api/feature/update/model/model.gni +++ b/interfaces/inner_api/feature/update/model/model.gni @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. +# Copyright (c) 2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -- Gitee From 2d450fbb3e99eaf4ecf06fe326097520d804f992 Mon Sep 17 00:00:00 2001 From: Monster Date: Wed, 31 Jan 2024 16:09:47 +0800 Subject: [PATCH 54/98] =?UTF-8?q?=E5=88=A0=E9=99=A4gni=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=B8=AD=E5=AF=B9=E4=BA=8E=E7=9A=84=E6=8D=A2=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- interfaces/inner_api/feature/feature.gni | 1 - 1 file changed, 1 deletion(-) diff --git a/interfaces/inner_api/feature/feature.gni b/interfaces/inner_api/feature/feature.gni index c0de10b0..045c15c8 100644 --- a/interfaces/inner_api/feature/feature.gni +++ b/interfaces/inner_api/feature/feature.gni @@ -26,7 +26,6 @@ feature_include = [] feature_include += api_include feature_include += model_include - feature_sources = [] feature_sources += api_src feature_sources += model_src -- Gitee From ed18449fb597e8e757a83a3d339f2f64c6778fe2 Mon Sep 17 00:00:00 2001 From: Monster Date: Wed, 31 Jan 2024 16:24:49 +0800 Subject: [PATCH 55/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9gni=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- foundations/foundations.gni | 1 - 1 file changed, 1 deletion(-) diff --git a/foundations/foundations.gni b/foundations/foundations.gni index 1261102e..38763f06 100644 --- a/foundations/foundations.gni +++ b/foundations/foundations.gni @@ -42,7 +42,6 @@ foundations_include += sys_event_include foundations_include += utils_include foundations_include += model_include - foundations_sources = [] foundations_sources += define_src foundations_sources += update_log_src -- Gitee From d179b8d09acb56b30f0e0f6a47f89850bbb8e60b Mon Sep 17 00:00:00 2001 From: Monster Date: Wed, 31 Jan 2024 16:26:14 +0800 Subject: [PATCH 56/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9codex?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- foundations/ability/utils/include/anonymous_utils.h | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/foundations/ability/utils/include/anonymous_utils.h b/foundations/ability/utils/include/anonymous_utils.h index cf810577..35cefa98 100644 --- a/foundations/ability/utils/include/anonymous_utils.h +++ b/foundations/ability/utils/include/anonymous_utils.h @@ -31,16 +31,6 @@ static const std::string ENCRYPT_STR = "****"; class EncryptUtils { public: - static int64_t GetRand(int32_t min, int32_t max) - { - // 随机 min ~ max值 - if (max < min) { - return min; - } - srand(time(nullptr)); - return min + rand() % (max - min); - } - static std::string EncryptUrl(const std::string &url) { std::string encryptUrl = url; -- Gitee From 1fd2f6ee81d22986c6f388d575c387949f6524b7 Mon Sep 17 00:00:00 2001 From: Monster Date: Wed, 31 Jan 2024 16:39:00 +0800 Subject: [PATCH 57/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9gn=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- frameworks/js/napi/update/BUILD.gn | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frameworks/js/napi/update/BUILD.gn b/frameworks/js/napi/update/BUILD.gn index 599a85c3..3868678c 100644 --- a/frameworks/js/napi/update/BUILD.gn +++ b/frameworks/js/napi/update/BUILD.gn @@ -29,7 +29,6 @@ ohos_shared_library("$updateengine_client_library_name") { sources += [ "$updateengine_root_path/frameworks/js/napi/update/common/src/client_helper.cpp", "$updateengine_root_path/frameworks/js/napi/update/common/src/iupdater.cpp", - "$updateengine_root_path/frameworks/js/napi/update/src/define_property.cpp", "$updateengine_root_path/frameworks/js/napi/update/src/local_updater.cpp", "$updateengine_root_path/frameworks/js/napi/update/src/restorer.cpp", @@ -51,8 +50,8 @@ ohos_shared_library("$updateengine_client_library_name") { include_dirs += session_include_dirs deps = [ - "$updateengine_root_path/interfaces/inner_api/engine:$updateengine_inner_library_name", "$updateengine_root_path/foundations:foundations", + "$updateengine_root_path/interfaces/inner_api/engine:$updateengine_inner_library_name", ] external_deps = [ -- Gitee From 8f72dfa2ae400291f7b536f3882fc0ea17c960ef Mon Sep 17 00:00:00 2001 From: Monster Date: Wed, 31 Jan 2024 16:49:14 +0800 Subject: [PATCH 58/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9gn=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- interfaces/inner_api/engine/BUILD.gn | 2 +- services/engine/engine_sa.gni | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/interfaces/inner_api/engine/BUILD.gn b/interfaces/inner_api/engine/BUILD.gn index bda8a59c..25a8a2b2 100644 --- a/interfaces/inner_api/engine/BUILD.gn +++ b/interfaces/inner_api/engine/BUILD.gn @@ -60,8 +60,8 @@ ohos_shared_library("$updateengine_inner_library_name") { public_configs = [ ":updateengine_inner_library_native_config" ] deps = [ - "$updateengine_root_path/interfaces/inner_api/modulemgr:update_module_mgr", "$updateengine_root_path/foundations:foundations", + "$updateengine_root_path/interfaces/inner_api/modulemgr:update_module_mgr", "//third_party/bounds_checking_function:libsec_static", "//third_party/json:nlohmann_json_static", ] diff --git a/services/engine/engine_sa.gni b/services/engine/engine_sa.gni index 3ff21751..9c7b316b 100644 --- a/services/engine/engine_sa.gni +++ b/services/engine/engine_sa.gni @@ -125,9 +125,9 @@ sa_include_dirs += [ "//base/update/updateservice/interfaces/innner_api/modulemgr/include" ] sa_deps = [ + "$updateengine_root_path/foundations:foundations", "$updateengine_root_path/interfaces/inner_api/modulemgr:update_module_mgr", "$updateengine_root_path/interfaces/inner_api/engine:$updateengine_inner_library_name", - "$updateengine_root_path/foundations:foundations", "//base/update/updater/services/fs_manager:libfsmanager", # factory_reset_GetBlockDeviceByMountPoint_"fs_manager/mount.h" "//third_party/cJSON:cjson", "//third_party/curl:curl", -- Gitee From b7c5d5d9787b96bc0bb1045188e5b2da14d96863 Mon Sep 17 00:00:00 2001 From: Monster Date: Wed, 31 Jan 2024 17:20:39 +0800 Subject: [PATCH 59/98] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8?= =?UTF-8?q?=E7=9A=84gni=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- .../model/message_parcel/message_parcel.gni | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 interfaces/inner_api/feature/update/model/message_parcel/message_parcel.gni diff --git a/interfaces/inner_api/feature/update/model/message_parcel/message_parcel.gni b/interfaces/inner_api/feature/update/model/message_parcel/message_parcel.gni deleted file mode 100644 index 0ce48265..00000000 --- a/interfaces/inner_api/feature/update/model/message_parcel/message_parcel.gni +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -message_parcel_external_deps = [ "c_utils:utils" ] -message_parcel_deps = [] -message_parcel_include = [ "../feature/update/model/message_parcel/include" ] -message_parcel_src = [ "../feature/update/model/message_parcel/src/message_parcel_helper.cpp" ] -- Gitee From cde0fc4452f8c87e65a81e8ca969a956ea2ee461 Mon Sep 17 00:00:00 2001 From: Monster Date: Thu, 1 Feb 2024 08:51:20 +0800 Subject: [PATCH 60/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9gni=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- services/engine/engine_sa.gni | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/engine/engine_sa.gni b/services/engine/engine_sa.gni index 9c7b316b..199c7aa5 100644 --- a/services/engine/engine_sa.gni +++ b/services/engine/engine_sa.gni @@ -122,12 +122,12 @@ sa_include_dirs += firmware_include sa_include_dirs += sqlite_include sa_include_dirs += startup_include sa_include_dirs += - [ "//base/update/updateservice/interfaces/innner_api/modulemgr/include" ] +[ "//base/update/updateservice/interfaces/innner_api/modulemgr/include" ] sa_deps = [ "$updateengine_root_path/foundations:foundations", - "$updateengine_root_path/interfaces/inner_api/modulemgr:update_module_mgr", "$updateengine_root_path/interfaces/inner_api/engine:$updateengine_inner_library_name", + "$updateengine_root_path/interfaces/inner_api/modulemgr:update_module_mgr", "//base/update/updater/services/fs_manager:libfsmanager", # factory_reset_GetBlockDeviceByMountPoint_"fs_manager/mount.h" "//third_party/cJSON:cjson", "//third_party/curl:curl", -- Gitee From 95015076585773513aa4f5991b7c5662b0ca38b9 Mon Sep 17 00:00:00 2001 From: Monster Date: Thu, 1 Feb 2024 09:07:10 +0800 Subject: [PATCH 61/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9gni=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- services/engine/engine_sa.gni | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/engine/engine_sa.gni b/services/engine/engine_sa.gni index 199c7aa5..ba4442d9 100644 --- a/services/engine/engine_sa.gni +++ b/services/engine/engine_sa.gni @@ -122,7 +122,7 @@ sa_include_dirs += firmware_include sa_include_dirs += sqlite_include sa_include_dirs += startup_include sa_include_dirs += -[ "//base/update/updateservice/interfaces/innner_api/modulemgr/include" ] + [ "//base/update/updateservice/interfaces/innner_api/modulemgr/include" ] sa_deps = [ "$updateengine_root_path/foundations:foundations", -- Gitee From e0c0de6fc9ac9245cefb37c1badb154359e7d7b6 Mon Sep 17 00:00:00 2001 From: Monster Date: Thu, 1 Feb 2024 09:37:29 +0800 Subject: [PATCH 62/98] =?UTF-8?q?=E5=88=A0=E9=99=A4json=20inculde?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- foundations/ability/utils/utils.gni | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/foundations/ability/utils/utils.gni b/foundations/ability/utils/utils.gni index 80701ff6..16547780 100644 --- a/foundations/ability/utils/utils.gni +++ b/foundations/ability/utils/utils.gni @@ -13,8 +13,5 @@ utils_external_deps = [] utils_deps = [ "//third_party/json:nlohmann_json_static" ] -utils_include = [ - "ability/utils/include", - "//third_party/json/include", -] +utils_include = [ "ability/utils/include" ] utils_src = [] -- Gitee From 5fa32cb8fe51797b63094469fa83883ce7ab173b Mon Sep 17 00:00:00 2001 From: Monster Date: Thu, 1 Feb 2024 09:52:48 +0800 Subject: [PATCH 63/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- foundations/ability/utils/utils.gni | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/foundations/ability/utils/utils.gni b/foundations/ability/utils/utils.gni index 16547780..9daf51f8 100644 --- a/foundations/ability/utils/utils.gni +++ b/foundations/ability/utils/utils.gni @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -utils_external_deps = [] -utils_deps = [ "//third_party/json:nlohmann_json_static" ] +utils_external_deps = [ "thirdparty:nlohmann_json_static" ] +utils_deps = [] utils_include = [ "ability/utils/include" ] utils_src = [] -- Gitee From 85792bd558f269c926297359d1303558b4f4c817 Mon Sep 17 00:00:00 2001 From: Monster Date: Thu, 1 Feb 2024 10:06:52 +0800 Subject: [PATCH 64/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- bundle.json | 1 + foundations/ability/utils/utils.gni | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/bundle.json b/bundle.json index 8803a9d8..7d47e65a 100644 --- a/bundle.json +++ b/bundle.json @@ -58,6 +58,7 @@ }, "build": { "modules": [ + "//base/update/updateservice/foundations:foundations", "//base/update/updateservice/frameworks/js/napi/update:update", "//base/update/updateservice/interfaces/inner_api/engine:updateservicekits", "//base/update/updateservice/interfaces/inner_api/modulemgr:update_module_mgr", diff --git a/foundations/ability/utils/utils.gni b/foundations/ability/utils/utils.gni index 9daf51f8..80701ff6 100644 --- a/foundations/ability/utils/utils.gni +++ b/foundations/ability/utils/utils.gni @@ -11,7 +11,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -utils_external_deps = [ "thirdparty:nlohmann_json_static" ] -utils_deps = [] -utils_include = [ "ability/utils/include" ] +utils_external_deps = [] +utils_deps = [ "//third_party/json:nlohmann_json_static" ] +utils_include = [ + "ability/utils/include", + "//third_party/json/include", +] utils_src = [] -- Gitee From b30c4a9fdadf593d10f76b3d3b13be8a1a06de92 Mon Sep 17 00:00:00 2001 From: Monster Date: Thu, 1 Feb 2024 10:18:48 +0800 Subject: [PATCH 65/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- foundations/BUILD.gn | 3 ++- foundations/ability/utils/utils.gni | 5 +---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/foundations/BUILD.gn b/foundations/BUILD.gn index 05632620..875c472f 100644 --- a/foundations/BUILD.gn +++ b/foundations/BUILD.gn @@ -32,7 +32,8 @@ ohos_shared_library("foundations") { defines += [ "ABILITY_RUNTIME_INNER_ENABLE" ] } - include_dirs = foundations_include + include_dirs = [ "//third_party/json/include" ] + include_dirs += foundations_include sources = foundations_sources deps = foundations_deps external_deps = foundations_external_deps diff --git a/foundations/ability/utils/utils.gni b/foundations/ability/utils/utils.gni index 80701ff6..16547780 100644 --- a/foundations/ability/utils/utils.gni +++ b/foundations/ability/utils/utils.gni @@ -13,8 +13,5 @@ utils_external_deps = [] utils_deps = [ "//third_party/json:nlohmann_json_static" ] -utils_include = [ - "ability/utils/include", - "//third_party/json/include", -] +utils_include = [ "ability/utils/include" ] utils_src = [] -- Gitee From 15af6a26e4c54bc8f86303eb920c9cab8a6b6c47 Mon Sep 17 00:00:00 2001 From: Monster Date: Thu, 1 Feb 2024 10:53:08 +0800 Subject: [PATCH 66/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- foundations/BUILD.gn | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/foundations/BUILD.gn b/foundations/BUILD.gn index 875c472f..05632620 100644 --- a/foundations/BUILD.gn +++ b/foundations/BUILD.gn @@ -32,8 +32,7 @@ ohos_shared_library("foundations") { defines += [ "ABILITY_RUNTIME_INNER_ENABLE" ] } - include_dirs = [ "//third_party/json/include" ] - include_dirs += foundations_include + include_dirs = foundations_include sources = foundations_sources deps = foundations_deps external_deps = foundations_external_deps -- Gitee From c17cd9bce2f746c0a10aa9bb33d6783ab0aa6618 Mon Sep 17 00:00:00 2001 From: Monster Date: Thu, 1 Feb 2024 11:06:10 +0800 Subject: [PATCH 67/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- foundations/ability/utils/utils.gni | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/foundations/ability/utils/utils.gni b/foundations/ability/utils/utils.gni index 16547780..9cfebd01 100644 --- a/foundations/ability/utils/utils.gni +++ b/foundations/ability/utils/utils.gni @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -utils_external_deps = [] -utils_deps = [ "//third_party/json:nlohmann_json_static" ] +utils_external_deps = [ "json:nlohmann_json_static" ] +utils_deps = [] utils_include = [ "ability/utils/include" ] utils_src = [] -- Gitee From 6447f0da8b4b145f78461b18047c465edd332bed Mon Sep 17 00:00:00 2001 From: Monster Date: Thu, 1 Feb 2024 11:16:48 +0800 Subject: [PATCH 68/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- foundations/ability/utils/utils.gni | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/foundations/ability/utils/utils.gni b/foundations/ability/utils/utils.gni index 9cfebd01..16547780 100644 --- a/foundations/ability/utils/utils.gni +++ b/foundations/ability/utils/utils.gni @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -utils_external_deps = [ "json:nlohmann_json_static" ] -utils_deps = [] +utils_external_deps = [] +utils_deps = [ "//third_party/json:nlohmann_json_static" ] utils_include = [ "ability/utils/include" ] utils_src = [] -- Gitee From da91176772917565cb927298dcb31d3d93c00bf0 Mon Sep 17 00:00:00 2001 From: Monster Date: Thu, 1 Feb 2024 15:47:47 +0800 Subject: [PATCH 69/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- bundle.json | 2 +- foundations/ability/utils/utils.gni | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bundle.json b/bundle.json index 7d47e65a..e0ba3bc8 100644 --- a/bundle.json +++ b/bundle.json @@ -36,6 +36,7 @@ "access_token", "hisysevent", "init", + "json", "updater", "ability_base", "ability_runtime", @@ -47,7 +48,6 @@ "third_party": [ "curl", "libxml2", - "json", "cJSON", "bounds_checking_function", "glib", diff --git a/foundations/ability/utils/utils.gni b/foundations/ability/utils/utils.gni index 16547780..9cfebd01 100644 --- a/foundations/ability/utils/utils.gni +++ b/foundations/ability/utils/utils.gni @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -utils_external_deps = [] -utils_deps = [ "//third_party/json:nlohmann_json_static" ] +utils_external_deps = [ "json:nlohmann_json_static" ] +utils_deps = [] utils_include = [ "ability/utils/include" ] utils_src = [] -- Gitee From 828ba0354b19ecd8c3044154b7a0d2e2c99ca36b Mon Sep 17 00:00:00 2001 From: Monster Date: Thu, 1 Feb 2024 20:32:55 +0800 Subject: [PATCH 70/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- bundle.json | 1 - foundations/ability/utils/utils.gni | 12 +++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/bundle.json b/bundle.json index e0ba3bc8..cc765dfe 100644 --- a/bundle.json +++ b/bundle.json @@ -58,7 +58,6 @@ }, "build": { "modules": [ - "//base/update/updateservice/foundations:foundations", "//base/update/updateservice/frameworks/js/napi/update:update", "//base/update/updateservice/interfaces/inner_api/engine:updateservicekits", "//base/update/updateservice/interfaces/inner_api/modulemgr:update_module_mgr", diff --git a/foundations/ability/utils/utils.gni b/foundations/ability/utils/utils.gni index 9cfebd01..a443d889 100644 --- a/foundations/ability/utils/utils.gni +++ b/foundations/ability/utils/utils.gni @@ -11,7 +11,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -utils_external_deps = [ "json:nlohmann_json_static" ] -utils_deps = [] -utils_include = [ "ability/utils/include" ] +json_component_path = "../../../../third_party" + +utils_external_deps = [] +utils_deps = [ "$json_component_path/json:nlohmann_json_static" +] +utils_include = [ + "ability/utils/include", + "$json_component_path/json/include", +] utils_src = [] -- Gitee From bdc7da31e665b32d190a01e8412ec94c08dd914f Mon Sep 17 00:00:00 2001 From: Monster Date: Thu, 1 Feb 2024 20:45:42 +0800 Subject: [PATCH 71/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- foundations/ability/utils/utils.gni | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/foundations/ability/utils/utils.gni b/foundations/ability/utils/utils.gni index a443d889..c43eec2e 100644 --- a/foundations/ability/utils/utils.gni +++ b/foundations/ability/utils/utils.gni @@ -16,8 +16,5 @@ json_component_path = "../../../../third_party" utils_external_deps = [] utils_deps = [ "$json_component_path/json:nlohmann_json_static" ] -utils_include = [ - "ability/utils/include", - "$json_component_path/json/include", -] +utils_include = [ "ability/utils/include" ] utils_src = [] -- Gitee From 55aed533d2ccc0d24c02fac65b36c5587eb679c4 Mon Sep 17 00:00:00 2001 From: Monster Date: Fri, 2 Feb 2024 10:48:41 +0800 Subject: [PATCH 72/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- foundations/ability/utils/utils.gni | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/foundations/ability/utils/utils.gni b/foundations/ability/utils/utils.gni index c43eec2e..9cfebd01 100644 --- a/foundations/ability/utils/utils.gni +++ b/foundations/ability/utils/utils.gni @@ -11,10 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -json_component_path = "../../../../third_party" - -utils_external_deps = [] -utils_deps = [ "$json_component_path/json:nlohmann_json_static" -] +utils_external_deps = [ "json:nlohmann_json_static" ] +utils_deps = [] utils_include = [ "ability/utils/include" ] utils_src = [] -- Gitee From ef74590d5c55c2567a4ebe2f62bd689e47465f49 Mon Sep 17 00:00:00 2001 From: Monster Date: Sun, 4 Feb 2024 11:20:50 +0800 Subject: [PATCH 73/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=84=E5=AE=A1?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- .../ability/utils/include/anonymous_utils.h | 12 +-- .../model/upgrade_info/src/upgrade_info.cpp | 4 +- .../download/data/include/download_info.h | 2 +- .../core/ability/model/include/device_info.h | 4 +- .../ability/utils/include/encrypt_utils.h | 82 ------------------- 5 files changed, 11 insertions(+), 93 deletions(-) delete mode 100644 services/core/ability/utils/include/encrypt_utils.h diff --git a/foundations/ability/utils/include/anonymous_utils.h b/foundations/ability/utils/include/anonymous_utils.h index 35cefa98..5f55322f 100644 --- a/foundations/ability/utils/include/anonymous_utils.h +++ b/foundations/ability/utils/include/anonymous_utils.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef ENCRYPT_UTILS_H -#define ENCRYPT_UTILS_H +#ifndef ANONYMOUS_UTILS_H +#define ANONYMOUS_UTILS_H #include #include @@ -29,9 +29,9 @@ static const int32_t ENCRYPT_LENGTH = 4; // 需要替换*的长度 static const int32_t ENCRYPT_TOTAL_LENGTH = 8; // 敏感数据匿名化后最长长度 static const std::string ENCRYPT_STR = "****"; -class EncryptUtils { +class AnonymousUtils { public: - static std::string EncryptUrl(const std::string &url) + static std::string AnonymousUrl(const std::string &url) { std::string encryptUrl = url; std::string httpsPrefix = "https://"; @@ -49,7 +49,7 @@ public: return encryptUrl; } - static std::string EncryptString(std::string inputStr) + static std::string AnonymousString(std::string inputStr) { if (inputStr.empty()) { return inputStr; @@ -70,4 +70,4 @@ public: }; } // namespace UpdateEngine } // namespace OHOS -#endif // ENCRYPT_UTILS_H \ No newline at end of file +#endif // ANONYMOUS_UTILS_H \ No newline at end of file diff --git a/interfaces/inner_api/feature/update/model/upgrade_info/src/upgrade_info.cpp b/interfaces/inner_api/feature/update/model/upgrade_info/src/upgrade_info.cpp index d7fa9fab..d088c888 100644 --- a/interfaces/inner_api/feature/update/model/upgrade_info/src/upgrade_info.cpp +++ b/interfaces/inner_api/feature/update/model/upgrade_info/src/upgrade_info.cpp @@ -23,8 +23,8 @@ std::string UpgradeInfo::ToString() const std::string output = "upgradeApp:" + upgradeApp; output += ",businessType(vender:" + businessType.vendor; output += ",subType:" + std::to_string(CAST_INT(businessType.subType)); - output += "),upgradeDevId:" + EncryptUtils::EncryptString(upgradeDevId); - output += ",controlDevId:" + EncryptUtils::EncryptString(controlDevId); + output += "),upgradeDevId:" + AnonymousUtils::AnonymousString(upgradeDevId); + output += ",controlDevId:" + AnonymousUtils::AnonymousString(controlDevId); return output; } } // namespace OHOS::UpdateEngine \ No newline at end of file diff --git a/services/core/ability/download/data/include/download_info.h b/services/core/ability/download/data/include/download_info.h index d57aa3d2..82fa4070 100644 --- a/services/core/ability/download/data/include/download_info.h +++ b/services/core/ability/download/data/include/download_info.h @@ -58,7 +58,7 @@ public: return std::string("DownloadInfo: ") .append("id=").append(std::to_string(id)).append(",") .append("taskId=").append(taskId).append(",") - .append("url=").append(EncryptUtils::EncryptUrl(url)).append(",") + .append("url=").append(AnonymousUtils::AnonymousUrl(url)).append(",") .append("path=").append(path).append(",") .append("veriftInfo=").append(veriftInfo).append(",") .append("retryTimes=").append(std::to_string(retryTimes)).append(",") diff --git a/services/core/ability/model/include/device_info.h b/services/core/ability/model/include/device_info.h index bba10752..ed112c75 100644 --- a/services/core/ability/model/include/device_info.h +++ b/services/core/ability/model/include/device_info.h @@ -32,8 +32,8 @@ public: nlohmann::ordered_json ToJson(bool isPrint) { nlohmann::ordered_json json = nlohmann::ordered_json::object(); - json["udid"] = isPrint ? EncryptUtils::EncryptString(udid) : udid; - json["deviceId"] = isPrint ? EncryptUtils::EncryptString(deviceId) : deviceId; + json["udid"] = isPrint ? AnonymousUtils::AnonymousString(udid) : udid; + json["deviceId"] = isPrint ? AnonymousUtils::AnonymousString(deviceId) : deviceId; return json; } }; diff --git a/services/core/ability/utils/include/encrypt_utils.h b/services/core/ability/utils/include/encrypt_utils.h deleted file mode 100644 index 0f8b53e4..00000000 --- a/services/core/ability/utils/include/encrypt_utils.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ENCRYPT_UTILS_H -#define ENCRYPT_UTILS_H - -#include -#include -#include -#include - -#include "update_log.h" -namespace OHOS { -namespace UpdateEngine { -static const int32_t ENCRYPT_LENGTH = 4; // 需要替换*的长度 -static const int32_t ENCRYPT_TOTAL_LENGTH = 8; // 敏感数据匿名化后最长长度 -static const std::string ENCRYPT_STR = "****"; - -class EncryptUtils { -public: - static int64_t GetRand(int32_t min, int32_t max) - { - // 随机 min ~ max值 - if (max < min) { - return min; - } - srand(time(nullptr)); - return min + rand() % (max - min); - } - - static std::string EncryptUrl(const std::string &url) - { - std::string encryptUrl = url; - std::string httpsPrefix = "https://"; - std::string httpPrefix = "http://"; - - // 从https:// 或者 http:// 开始后面4位替换为 xxxx - if (encryptUrl.compare(0, httpsPrefix.size(), httpsPrefix) == 0) { - encryptUrl.replace(httpsPrefix.size(), ENCRYPT_LENGTH, ENCRYPT_STR); - return encryptUrl; - } - if (encryptUrl.compare(0, httpPrefix.size(), httpPrefix) == 0) { - encryptUrl.replace(httpPrefix.size(), ENCRYPT_LENGTH, ENCRYPT_STR); - return encryptUrl; - } - return encryptUrl; - } - - static std::string EncryptString(std::string inputStr) - { - if (inputStr.empty()) { - return inputStr; - } - std::string result; - size_t length = inputStr.length(); - if (length >= ENCRYPT_TOTAL_LENGTH) { - std::string sequence = inputStr.substr(0, ENCRYPT_LENGTH); - result = sequence + ENCRYPT_STR; - } else if (length > ENCRYPT_LENGTH) { - std::string sequence = inputStr.substr(0, length - ENCRYPT_LENGTH); - result = sequence + ENCRYPT_STR; - } else { - result = ENCRYPT_STR; - } - return result; - } -}; -} // namespace UpdateEngine -} // namespace OHOS -#endif // ENCRYPT_UTILS_H \ No newline at end of file -- Gitee From 29745bb96e11bbd97674c88e31a539f7ed81f390 Mon Sep 17 00:00:00 2001 From: Monster Date: Sun, 4 Feb 2024 11:40:37 +0800 Subject: [PATCH 74/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- interfaces/inner_api/engine/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interfaces/inner_api/engine/BUILD.gn b/interfaces/inner_api/engine/BUILD.gn index 25a8a2b2..81cd0078 100644 --- a/interfaces/inner_api/engine/BUILD.gn +++ b/interfaces/inner_api/engine/BUILD.gn @@ -63,13 +63,13 @@ ohos_shared_library("$updateengine_inner_library_name") { "$updateengine_root_path/foundations:foundations", "$updateengine_root_path/interfaces/inner_api/modulemgr:update_module_mgr", "//third_party/bounds_checking_function:libsec_static", - "//third_party/json:nlohmann_json_static", ] external_deps = [ "c_utils:utils", # sptr "hilog:libhilog", "ipc:ipc_core", + "json:nlohmann_json_static", "safwk:system_ability_fwk", "samgr:samgr_proxy", ] -- Gitee From 95e35f9538b402b611d54b566b34de985e1c0648 Mon Sep 17 00:00:00 2001 From: Monster Date: Sun, 4 Feb 2024 12:24:49 +0800 Subject: [PATCH 75/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- interfaces/inner_api/engine/BUILD.gn | 1 + 1 file changed, 1 insertion(+) diff --git a/interfaces/inner_api/engine/BUILD.gn b/interfaces/inner_api/engine/BUILD.gn index 81cd0078..d442f05d 100644 --- a/interfaces/inner_api/engine/BUILD.gn +++ b/interfaces/inner_api/engine/BUILD.gn @@ -24,6 +24,7 @@ ohos_prebuilt_etc("updater_sa.rc") { config("updateengine_inner_library_native_config") { include_dirs = [ + "$updateengine_root_path/foundations/model/base", "$updateengine_root_path/interfaces/inner_api/include", "//third_party/json/include", ] -- Gitee From 75d1ae24eaec7f28ba9f99e0c3aa3cae972057ce Mon Sep 17 00:00:00 2001 From: Monster Date: Sun, 4 Feb 2024 12:44:14 +0800 Subject: [PATCH 76/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- foundations/model/base/call_result.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/foundations/model/base/call_result.h b/foundations/model/base/call_result.h index e32cff45..e3ddbbfe 100644 --- a/foundations/model/base/call_result.h +++ b/foundations/model/base/call_result.h @@ -16,7 +16,7 @@ #ifndef UPDATE_SERVICE_CALL_RESULT_H #define UPDATE_SERVICE_CALL_RESULT_H -#include "update_define.h" +#include namespace OHOS::UpdateEngine { constexpr int CALL_RESULT_OFFSET = 2000; @@ -40,18 +40,18 @@ enum class CallResult { NET_ERROR = 503 }; -constexpr int32_t INT_CALL_SUCCESS = CAST_INT(CallResult::SUCCESS); -constexpr int32_t INT_CALL_FAIL = CAST_INT(CallResult::FAIL); -constexpr int32_t INT_UN_SUPPORT = CAST_INT(CallResult::UN_SUPPORT); -constexpr int32_t INT_FORBIDDEN = CAST_INT(CallResult::FORBIDDEN); -constexpr int32_t INT_CALL_IPC_ERR = CAST_INT(CallResult::IPC_ERR); -constexpr int32_t INT_APP_NOT_GRANTED = CAST_INT(CallResult::APP_NOT_GRANTED); -constexpr int32_t INT_NOT_SYSTEM_APP = CAST_INT(CallResult::NOT_SYSTEM_APP); -constexpr int32_t INT_PARAM_ERR = CAST_INT(CallResult::PARAM_ERR); -constexpr int32_t INT_DEV_UPG_INFO_ERR = CAST_INT(CallResult::DEV_UPG_INFO_ERR); -constexpr int32_t INT_TIME_OUT = CAST_INT(CallResult::TIME_OUT); -constexpr int32_t INT_DB_ERROR = CAST_INT(CallResult::DB_ERROR); -constexpr int32_t INT_IO_ERROR = CAST_INT(CallResult::IO_ERROR); -constexpr int32_t INT_NET_ERROR = CAST_INT(CallResult::NET_ERROR); +constexpr int32_t INT_CALL_SUCCESS = static_cast(CallResult::SUCCESS); +constexpr int32_t INT_CALL_FAIL = static_cast(CallResult::FAIL); +constexpr int32_t INT_UN_SUPPORT = static_cast(CallResult::UN_SUPPORT); +constexpr int32_t INT_FORBIDDEN = static_cast(CallResult::FORBIDDEN); +constexpr int32_t INT_CALL_IPC_ERR = static_cast(CallResult::IPC_ERR); +constexpr int32_t INT_APP_NOT_GRANTED = static_cast(CallResult::APP_NOT_GRANTED); +constexpr int32_t INT_NOT_SYSTEM_APP = static_cast(CallResult::NOT_SYSTEM_APP); +constexpr int32_t INT_PARAM_ERR = static_cast(CallResult::PARAM_ERR); +constexpr int32_t INT_DEV_UPG_INFO_ERR = static_cast(CallResult::DEV_UPG_INFO_ERR); +constexpr int32_t INT_TIME_OUT = static_cast(CallResult::TIME_OUT); +constexpr int32_t INT_DB_ERROR = static_cast(CallResult::DB_ERROR); +constexpr int32_t INT_IO_ERROR = static_cast(CallResult::IO_ERROR); +constexpr int32_t INT_NET_ERROR = static_cast(CallResult::NET_ERROR); } // namespace OHOS::UpdateEngine #endif // UPDATE_SERVICE_CALL_RESULT_H -- Gitee From b7b0f5fd2e515ce9f0c12f5e01e573f594ce4e45 Mon Sep 17 00:00:00 2001 From: Monster Date: Sun, 4 Feb 2024 14:00:35 +0800 Subject: [PATCH 77/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- interfaces/inner_api/engine/BUILD.gn | 1 + 1 file changed, 1 insertion(+) diff --git a/interfaces/inner_api/engine/BUILD.gn b/interfaces/inner_api/engine/BUILD.gn index d442f05d..61207081 100644 --- a/interfaces/inner_api/engine/BUILD.gn +++ b/interfaces/inner_api/engine/BUILD.gn @@ -24,6 +24,7 @@ ohos_prebuilt_etc("updater_sa.rc") { config("updateengine_inner_library_native_config") { include_dirs = [ + "$updateengine_root_path/foundations/ability/utils/include", "$updateengine_root_path/foundations/model/base", "$updateengine_root_path/interfaces/inner_api/include", "//third_party/json/include", -- Gitee From 4579221798050454e767932a04f02b48da5de2e7 Mon Sep 17 00:00:00 2001 From: Monster Date: Sun, 4 Feb 2024 14:20:33 +0800 Subject: [PATCH 78/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- .../ability/utils/include/dupdate_json_utils.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/foundations/ability/utils/include/dupdate_json_utils.h b/foundations/ability/utils/include/dupdate_json_utils.h index 3c1375f2..ce0387ed 100644 --- a/foundations/ability/utils/include/dupdate_json_utils.h +++ b/foundations/ability/utils/include/dupdate_json_utils.h @@ -40,13 +40,13 @@ public: static int32_t GetValueAndSetTo(const nlohmann::json &jsonObject, const std::string &key, T &value) { if (jsonObject.find(key) == jsonObject.end()) { - return CAST_INT(JsonParseError::MISSING_PROP); + return static_cast(JsonParseError::MISSING_PROP); } if (!CheckType(jsonObject.at(key), value)) { - return CAST_INT(JsonParseError::TYPE_ERROR); + return static_cast(JsonParseError::TYPE_ERROR); } GetValue(jsonObject, key, value); - return CAST_INT(JsonParseError::ERR_OK); + return static_cast(JsonParseError::ERR_OK); } static bool ParseAndGetJsonObject(const std::string &jsonStr, nlohmann::json &root) @@ -71,13 +71,13 @@ public: nlohmann::json &value) { if (jsonObject.find(key) == jsonObject.end()) { - return CAST_INT(JsonParseError::MISSING_PROP); + return static_cast(JsonParseError::MISSING_PROP); } if (!jsonObject.at(key).is_array()) { - return CAST_INT(JsonParseError::TYPE_ERROR); + return static_cast(JsonParseError::TYPE_ERROR); } jsonObject.at(key).get_to(value); - return CAST_INT(JsonParseError::ERR_OK); + return static_cast(JsonParseError::ERR_OK); } static void SetJsonToVector(nlohmann::json &jsonObject, std::vector &vector) @@ -119,14 +119,14 @@ public: template static int32_t JsonStrToStruct(const std::string &jsonStr, T &value) { if (jsonStr.empty()) { - return CAST_INT(JsonParseError::COMMOM_ERROR); + return static_cast(JsonParseError::COMMOM_ERROR); } nlohmann::json jsonObj = nlohmann::json::parse(jsonStr, nullptr, false); if (!jsonObj.is_discarded() && CheckType(jsonObj, value)) { value = jsonObj.get(); - return CAST_INT(JsonParseError::ERR_OK); + return static_cast(JsonParseError::ERR_OK); } - return CAST_INT(JsonParseError::TYPE_ERROR); + return static_cast(JsonParseError::TYPE_ERROR); } private: -- Gitee From 82b3ebf3c59b17c454431cf3ee2959a0874d04b2 Mon Sep 17 00:00:00 2001 From: Monster Date: Sun, 4 Feb 2024 14:23:14 +0800 Subject: [PATCH 79/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- foundations/ability/utils/include/anonymous_utils.h | 2 -- foundations/ability/utils/include/dupdate_json_utils.h | 2 -- 2 files changed, 4 deletions(-) diff --git a/foundations/ability/utils/include/anonymous_utils.h b/foundations/ability/utils/include/anonymous_utils.h index 5f55322f..61d77029 100644 --- a/foundations/ability/utils/include/anonymous_utils.h +++ b/foundations/ability/utils/include/anonymous_utils.h @@ -21,8 +21,6 @@ #include #include -#include "update_log.h" - namespace OHOS { namespace UpdateEngine { static const int32_t ENCRYPT_LENGTH = 4; // 需要替换*的长度 diff --git a/foundations/ability/utils/include/dupdate_json_utils.h b/foundations/ability/utils/include/dupdate_json_utils.h index ce0387ed..44aa1128 100644 --- a/foundations/ability/utils/include/dupdate_json_utils.h +++ b/foundations/ability/utils/include/dupdate_json_utils.h @@ -22,8 +22,6 @@ #include "nlohmann/json.hpp" -#include "update_define.h" - namespace OHOS::UpdateEngine { enum class JsonParseError { ERR_OK = 0, -- Gitee From 33bff69a4e357ed29f9cf591028ccdd01e16f28b Mon Sep 17 00:00:00 2001 From: Monster Date: Sun, 4 Feb 2024 14:51:48 +0800 Subject: [PATCH 80/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- .../utils/include/dupdate_json_utils.h | 20 +++++++------ foundations/model/base/call_result.h | 28 +++++++++---------- interfaces/inner_api/engine/BUILD.gn | 5 ++-- 3 files changed, 27 insertions(+), 26 deletions(-) diff --git a/foundations/ability/utils/include/dupdate_json_utils.h b/foundations/ability/utils/include/dupdate_json_utils.h index 44aa1128..3c1375f2 100644 --- a/foundations/ability/utils/include/dupdate_json_utils.h +++ b/foundations/ability/utils/include/dupdate_json_utils.h @@ -22,6 +22,8 @@ #include "nlohmann/json.hpp" +#include "update_define.h" + namespace OHOS::UpdateEngine { enum class JsonParseError { ERR_OK = 0, @@ -38,13 +40,13 @@ public: static int32_t GetValueAndSetTo(const nlohmann::json &jsonObject, const std::string &key, T &value) { if (jsonObject.find(key) == jsonObject.end()) { - return static_cast(JsonParseError::MISSING_PROP); + return CAST_INT(JsonParseError::MISSING_PROP); } if (!CheckType(jsonObject.at(key), value)) { - return static_cast(JsonParseError::TYPE_ERROR); + return CAST_INT(JsonParseError::TYPE_ERROR); } GetValue(jsonObject, key, value); - return static_cast(JsonParseError::ERR_OK); + return CAST_INT(JsonParseError::ERR_OK); } static bool ParseAndGetJsonObject(const std::string &jsonStr, nlohmann::json &root) @@ -69,13 +71,13 @@ public: nlohmann::json &value) { if (jsonObject.find(key) == jsonObject.end()) { - return static_cast(JsonParseError::MISSING_PROP); + return CAST_INT(JsonParseError::MISSING_PROP); } if (!jsonObject.at(key).is_array()) { - return static_cast(JsonParseError::TYPE_ERROR); + return CAST_INT(JsonParseError::TYPE_ERROR); } jsonObject.at(key).get_to(value); - return static_cast(JsonParseError::ERR_OK); + return CAST_INT(JsonParseError::ERR_OK); } static void SetJsonToVector(nlohmann::json &jsonObject, std::vector &vector) @@ -117,14 +119,14 @@ public: template static int32_t JsonStrToStruct(const std::string &jsonStr, T &value) { if (jsonStr.empty()) { - return static_cast(JsonParseError::COMMOM_ERROR); + return CAST_INT(JsonParseError::COMMOM_ERROR); } nlohmann::json jsonObj = nlohmann::json::parse(jsonStr, nullptr, false); if (!jsonObj.is_discarded() && CheckType(jsonObj, value)) { value = jsonObj.get(); - return static_cast(JsonParseError::ERR_OK); + return CAST_INT(JsonParseError::ERR_OK); } - return static_cast(JsonParseError::TYPE_ERROR); + return CAST_INT(JsonParseError::TYPE_ERROR); } private: diff --git a/foundations/model/base/call_result.h b/foundations/model/base/call_result.h index e3ddbbfe..e32cff45 100644 --- a/foundations/model/base/call_result.h +++ b/foundations/model/base/call_result.h @@ -16,7 +16,7 @@ #ifndef UPDATE_SERVICE_CALL_RESULT_H #define UPDATE_SERVICE_CALL_RESULT_H -#include +#include "update_define.h" namespace OHOS::UpdateEngine { constexpr int CALL_RESULT_OFFSET = 2000; @@ -40,18 +40,18 @@ enum class CallResult { NET_ERROR = 503 }; -constexpr int32_t INT_CALL_SUCCESS = static_cast(CallResult::SUCCESS); -constexpr int32_t INT_CALL_FAIL = static_cast(CallResult::FAIL); -constexpr int32_t INT_UN_SUPPORT = static_cast(CallResult::UN_SUPPORT); -constexpr int32_t INT_FORBIDDEN = static_cast(CallResult::FORBIDDEN); -constexpr int32_t INT_CALL_IPC_ERR = static_cast(CallResult::IPC_ERR); -constexpr int32_t INT_APP_NOT_GRANTED = static_cast(CallResult::APP_NOT_GRANTED); -constexpr int32_t INT_NOT_SYSTEM_APP = static_cast(CallResult::NOT_SYSTEM_APP); -constexpr int32_t INT_PARAM_ERR = static_cast(CallResult::PARAM_ERR); -constexpr int32_t INT_DEV_UPG_INFO_ERR = static_cast(CallResult::DEV_UPG_INFO_ERR); -constexpr int32_t INT_TIME_OUT = static_cast(CallResult::TIME_OUT); -constexpr int32_t INT_DB_ERROR = static_cast(CallResult::DB_ERROR); -constexpr int32_t INT_IO_ERROR = static_cast(CallResult::IO_ERROR); -constexpr int32_t INT_NET_ERROR = static_cast(CallResult::NET_ERROR); +constexpr int32_t INT_CALL_SUCCESS = CAST_INT(CallResult::SUCCESS); +constexpr int32_t INT_CALL_FAIL = CAST_INT(CallResult::FAIL); +constexpr int32_t INT_UN_SUPPORT = CAST_INT(CallResult::UN_SUPPORT); +constexpr int32_t INT_FORBIDDEN = CAST_INT(CallResult::FORBIDDEN); +constexpr int32_t INT_CALL_IPC_ERR = CAST_INT(CallResult::IPC_ERR); +constexpr int32_t INT_APP_NOT_GRANTED = CAST_INT(CallResult::APP_NOT_GRANTED); +constexpr int32_t INT_NOT_SYSTEM_APP = CAST_INT(CallResult::NOT_SYSTEM_APP); +constexpr int32_t INT_PARAM_ERR = CAST_INT(CallResult::PARAM_ERR); +constexpr int32_t INT_DEV_UPG_INFO_ERR = CAST_INT(CallResult::DEV_UPG_INFO_ERR); +constexpr int32_t INT_TIME_OUT = CAST_INT(CallResult::TIME_OUT); +constexpr int32_t INT_DB_ERROR = CAST_INT(CallResult::DB_ERROR); +constexpr int32_t INT_IO_ERROR = CAST_INT(CallResult::IO_ERROR); +constexpr int32_t INT_NET_ERROR = CAST_INT(CallResult::NET_ERROR); } // namespace OHOS::UpdateEngine #endif // UPDATE_SERVICE_CALL_RESULT_H diff --git a/interfaces/inner_api/engine/BUILD.gn b/interfaces/inner_api/engine/BUILD.gn index 61207081..54d2c871 100644 --- a/interfaces/inner_api/engine/BUILD.gn +++ b/interfaces/inner_api/engine/BUILD.gn @@ -24,8 +24,6 @@ ohos_prebuilt_etc("updater_sa.rc") { config("updateengine_inner_library_native_config") { include_dirs = [ - "$updateengine_root_path/foundations/ability/utils/include", - "$updateengine_root_path/foundations/model/base", "$updateengine_root_path/interfaces/inner_api/include", "//third_party/json/include", ] @@ -61,8 +59,9 @@ ohos_shared_library("$updateengine_inner_library_name") { public_configs = [ ":updateengine_inner_library_native_config" ] + public_deps = [ "$updateengine_root_path/foundations:foundations" ] + deps = [ - "$updateengine_root_path/foundations:foundations", "$updateengine_root_path/interfaces/inner_api/modulemgr:update_module_mgr", "//third_party/bounds_checking_function:libsec_static", ] -- Gitee From a2a25206953aa83164484e6d3e669fbc1608eedb Mon Sep 17 00:00:00 2001 From: Monster Date: Sun, 4 Feb 2024 15:07:33 +0800 Subject: [PATCH 81/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- interfaces/inner_api/engine/BUILD.gn | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/interfaces/inner_api/engine/BUILD.gn b/interfaces/inner_api/engine/BUILD.gn index 54d2c871..32f0006a 100644 --- a/interfaces/inner_api/engine/BUILD.gn +++ b/interfaces/inner_api/engine/BUILD.gn @@ -14,6 +14,7 @@ import("//base/update/updateservice/updateengine.gni") import("//build/ohos.gni") import("../feature/feature.gni") +import("../../foundations/foundations.gni") ohos_prebuilt_etc("updater_sa.rc") { source = "etc/updater_sa.rc" @@ -28,6 +29,7 @@ config("updateengine_inner_library_native_config") { "//third_party/json/include", ] include_dirs += feature_include + include_dirs += foundations_include } ohos_shared_library("$updateengine_inner_library_name") { @@ -59,9 +61,8 @@ ohos_shared_library("$updateengine_inner_library_name") { public_configs = [ ":updateengine_inner_library_native_config" ] - public_deps = [ "$updateengine_root_path/foundations:foundations" ] - deps = [ + "$updateengine_root_path/foundations:foundations", "$updateengine_root_path/interfaces/inner_api/modulemgr:update_module_mgr", "//third_party/bounds_checking_function:libsec_static", ] -- Gitee From aed146f73d4aa250adb52301b4a1678c2604b344 Mon Sep 17 00:00:00 2001 From: Monster Date: Sun, 4 Feb 2024 15:17:12 +0800 Subject: [PATCH 82/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- interfaces/inner_api/engine/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interfaces/inner_api/engine/BUILD.gn b/interfaces/inner_api/engine/BUILD.gn index 32f0006a..fa75cd6c 100644 --- a/interfaces/inner_api/engine/BUILD.gn +++ b/interfaces/inner_api/engine/BUILD.gn @@ -14,7 +14,7 @@ import("//base/update/updateservice/updateengine.gni") import("//build/ohos.gni") import("../feature/feature.gni") -import("../../foundations/foundations.gni") +import("../../../foundations/foundations.gni") ohos_prebuilt_etc("updater_sa.rc") { source = "etc/updater_sa.rc" -- Gitee From f56c39a57f5bfc2e1a70d40b073085b658b1124f Mon Sep 17 00:00:00 2001 From: Monster Date: Sun, 4 Feb 2024 15:29:55 +0800 Subject: [PATCH 83/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- foundations/foundations.gni | 10 +++++----- foundations/model/{model.gni => base_model.gni} | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) rename foundations/model/{model.gni => base_model.gni} (84%) diff --git a/foundations/foundations.gni b/foundations/foundations.gni index 38763f06..296b43e7 100644 --- a/foundations/foundations.gni +++ b/foundations/foundations.gni @@ -16,7 +16,7 @@ import("ability/log/log.gni") import("ability/sa_loader/sa_loader.gni") import("ability/sys_event/sys_event.gni") import("ability/utils/utils.gni") -import("model/model.gni") +import("model/base_model.gni") foundations_external_deps = [] foundations_external_deps += define_external_deps @@ -24,7 +24,7 @@ foundations_external_deps += update_log_external_deps foundations_external_deps += sa_loader_external_deps foundations_external_deps += sys_event_external_deps foundations_external_deps += utils_external_deps -foundations_external_deps += model_external_deps +foundations_external_deps += base_model_external_deps foundations_deps = [] foundations_deps += define_deps @@ -32,7 +32,7 @@ foundations_deps += update_log_deps foundations_deps += sa_loader_deps foundations_deps += sys_event_deps foundations_deps += utils_deps -foundations_deps += model_deps +foundations_deps += base_model_deps foundations_include = [] foundations_include += define_include @@ -40,7 +40,7 @@ foundations_include += update_log_include foundations_include += sa_loader_include foundations_include += sys_event_include foundations_include += utils_include -foundations_include += model_include +foundations_include += base_model_include foundations_sources = [] foundations_sources += define_src @@ -48,4 +48,4 @@ foundations_sources += update_log_src foundations_sources += sa_loader_src foundations_sources += sys_event_src foundations_sources += utils_src -foundations_sources += model_src +foundations_sources += base_model_src diff --git a/foundations/model/model.gni b/foundations/model/base_model.gni similarity index 84% rename from foundations/model/model.gni rename to foundations/model/base_model.gni index 91a42e5e..1fde3811 100644 --- a/foundations/model/model.gni +++ b/foundations/model/base_model.gni @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -model_external_deps = [] -model_deps = [] -model_include = [ "model/base" ] -model_src = [] +base_model_external_deps = [] +base_model_deps = [] +base_model_include = [ "model/base" ] +base_model_src = [] -- Gitee From 7fb94b45ad0d849406f2d024f2ec908938016a40 Mon Sep 17 00:00:00 2001 From: Monster Date: Sun, 4 Feb 2024 15:57:43 +0800 Subject: [PATCH 84/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- interfaces/inner_api/engine/BUILD.gn | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/interfaces/inner_api/engine/BUILD.gn b/interfaces/inner_api/engine/BUILD.gn index fa75cd6c..67968df6 100644 --- a/interfaces/inner_api/engine/BUILD.gn +++ b/interfaces/inner_api/engine/BUILD.gn @@ -13,8 +13,8 @@ import("//base/update/updateservice/updateengine.gni") import("//build/ohos.gni") -import("../feature/feature.gni") import("../../../foundations/foundations.gni") +import("../feature/feature.gni") ohos_prebuilt_etc("updater_sa.rc") { source = "etc/updater_sa.rc" @@ -77,6 +77,7 @@ ohos_shared_library("$updateengine_inner_library_name") { ] include_dirs += feature_include + include_dirs += foundations_include sources += feature_sources deps += feature_deps external_deps += feature_external_deps -- Gitee From b74abad8e0f3df2abab9a0a1c137033027ddce24 Mon Sep 17 00:00:00 2001 From: Monster Date: Sun, 4 Feb 2024 16:35:50 +0800 Subject: [PATCH 85/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- interfaces/inner_api/engine/BUILD.gn | 1 - .../inner_api/include/update_service_kits.h | 18 +++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/interfaces/inner_api/engine/BUILD.gn b/interfaces/inner_api/engine/BUILD.gn index 67968df6..47130345 100644 --- a/interfaces/inner_api/engine/BUILD.gn +++ b/interfaces/inner_api/engine/BUILD.gn @@ -77,7 +77,6 @@ ohos_shared_library("$updateengine_inner_library_name") { ] include_dirs += feature_include - include_dirs += foundations_include sources += feature_sources deps += feature_deps external_deps += feature_external_deps diff --git a/interfaces/inner_api/include/update_service_kits.h b/interfaces/inner_api/include/update_service_kits.h index 33b9c771..f3c8122a 100644 --- a/interfaces/inner_api/include/update_service_kits.h +++ b/interfaces/inner_api/include/update_service_kits.h @@ -17,8 +17,24 @@ #define UPDATE_SERVICE_KITS_H #include -#include "iupdate_service.h" + +#include "business_error.h" +#include "check_result.h" +#include "clear_options.h" +#include "current_version_info.h" +#include "description_options.h" +#include "download_options.h" +#include "iupdate_callback.h" +#include "pause_download_options.h" +#include "resume_download_options.h" +#include "new_version_info.h" #include "update_callback_info.h" +#include "upgrade_info.h" +#include "upgrade_options.h" +#include "upgrade_policy.h" +#include "task_info.h" +#include "version_description_info.h" +#include "version_digest_info.h" namespace OHOS::UpdateEngine { class UpdateServiceKits { -- Gitee From 3b60852866fd849ac92ca83bb4b9caf506eb83d9 Mon Sep 17 00:00:00 2001 From: Monster Date: Sun, 4 Feb 2024 16:43:33 +0800 Subject: [PATCH 86/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- foundations/model/base_model.gni | 2 +- foundations/model/{base => include}/business_error.h | 0 foundations/model/{base => include}/call_result.h | 0 foundations/model/{base => include}/device_type.h | 0 foundations/model/{base => include}/error_message.h | 0 foundations/model/{base => include}/network_type.h | 0 6 files changed, 1 insertion(+), 1 deletion(-) rename foundations/model/{base => include}/business_error.h (100%) rename foundations/model/{base => include}/call_result.h (100%) rename foundations/model/{base => include}/device_type.h (100%) rename foundations/model/{base => include}/error_message.h (100%) rename foundations/model/{base => include}/network_type.h (100%) diff --git a/foundations/model/base_model.gni b/foundations/model/base_model.gni index 1fde3811..17c42957 100644 --- a/foundations/model/base_model.gni +++ b/foundations/model/base_model.gni @@ -13,5 +13,5 @@ base_model_external_deps = [] base_model_deps = [] -base_model_include = [ "model/base" ] +base_model_include = [ "model/include" ] base_model_src = [] diff --git a/foundations/model/base/business_error.h b/foundations/model/include/business_error.h similarity index 100% rename from foundations/model/base/business_error.h rename to foundations/model/include/business_error.h diff --git a/foundations/model/base/call_result.h b/foundations/model/include/call_result.h similarity index 100% rename from foundations/model/base/call_result.h rename to foundations/model/include/call_result.h diff --git a/foundations/model/base/device_type.h b/foundations/model/include/device_type.h similarity index 100% rename from foundations/model/base/device_type.h rename to foundations/model/include/device_type.h diff --git a/foundations/model/base/error_message.h b/foundations/model/include/error_message.h similarity index 100% rename from foundations/model/base/error_message.h rename to foundations/model/include/error_message.h diff --git a/foundations/model/base/network_type.h b/foundations/model/include/network_type.h similarity index 100% rename from foundations/model/base/network_type.h rename to foundations/model/include/network_type.h -- Gitee From 2b2e33f3070562d0c364f64bb010b853d09ff932 Mon Sep 17 00:00:00 2001 From: Monster Date: Sun, 4 Feb 2024 17:06:39 +0800 Subject: [PATCH 87/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- foundations/BUILD.gn | 2 +- foundations/ability/define/define.gni | 4 +++- foundations/ability/log/log.gni | 6 ++++-- foundations/ability/sa_loader/sa_loader.gni | 4 ++-- foundations/ability/sys_event/sys_event.gni | 4 +++- foundations/ability/utils/utils.gni | 4 +++- foundations/foundations.gni | 12 ++++++------ foundations/model/base_model.gni | 4 +++- interfaces/inner_api/engine/BUILD.gn | 2 +- 9 files changed, 26 insertions(+), 16 deletions(-) diff --git a/foundations/BUILD.gn b/foundations/BUILD.gn index 05632620..b5a55d26 100644 --- a/foundations/BUILD.gn +++ b/foundations/BUILD.gn @@ -12,8 +12,8 @@ # limitations under the License. import("//base/update/updateservice/updateengine.gni") +import("//base/update/updateservice/foundations/foundations.gni") import("//build/ohos.gni") -import("foundations.gni") config("update_service_foundations_config") { include_dirs = foundations_include diff --git a/foundations/ability/define/define.gni b/foundations/ability/define/define.gni index 760a8b7b..46cf15bd 100644 --- a/foundations/ability/define/define.gni +++ b/foundations/ability/define/define.gni @@ -11,7 +11,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/update/updateservice/updateengine.gni") + define_external_deps = [] define_deps = [] -define_include = [ "ability/define/include" ] +define_include = [ "$updateengine_root_path/foundations/ability/define/include" ] define_src = [] diff --git a/foundations/ability/log/log.gni b/foundations/ability/log/log.gni index fee6103f..bb805646 100644 --- a/foundations/ability/log/log.gni +++ b/foundations/ability/log/log.gni @@ -11,10 +11,12 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/update/updateservice/updateengine.gni") + update_log_external_deps = [ "hilog:libhilog", "updater:libupdaterlog_shared", ] update_log_deps = [] -update_log_include = [ "ability/log/include" ] -update_log_src = [ "ability/log/src/update_log.cpp" ] +update_log_include = [ "$updateengine_root_path/foundations/ability/log/include" ] +update_log_src = [ "$updateengine_root_path/foundations/ability/log/src/update_log.cpp" ] diff --git a/foundations/ability/sa_loader/sa_loader.gni b/foundations/ability/sa_loader/sa_loader.gni index ee3c7169..7355380e 100644 --- a/foundations/ability/sa_loader/sa_loader.gni +++ b/foundations/ability/sa_loader/sa_loader.gni @@ -24,5 +24,5 @@ if (ability_ability_runtime_enable) { } sa_loader_deps = [] -sa_loader_include = [ "ability/sa_loader/include" ] -sa_loader_src = [ "ability/sa_loader/src/load_sa_service.cpp" ] +sa_loader_include = [ "$updateengine_root_path/foundations/ability/sa_loader/include" ] +sa_loader_src = [ "$updateengine_root_path/foundations/ability/sa_loader/src/load_sa_service.cpp" ] diff --git a/foundations/ability/sys_event/sys_event.gni b/foundations/ability/sys_event/sys_event.gni index 574a3e53..2d3d353e 100644 --- a/foundations/ability/sys_event/sys_event.gni +++ b/foundations/ability/sys_event/sys_event.gni @@ -11,7 +11,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/update/updateservice/updateengine.gni") + sys_event_external_deps = [] sys_event_deps = [] -sys_event_include = [ "ability/sys_event/include" ] +sys_event_include = [ "$updateengine_root_path/foundations/ability/sys_event/include" ] sys_event_src = [] diff --git a/foundations/ability/utils/utils.gni b/foundations/ability/utils/utils.gni index 9cfebd01..b4a33b7d 100644 --- a/foundations/ability/utils/utils.gni +++ b/foundations/ability/utils/utils.gni @@ -11,7 +11,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/update/updateservice/updateengine.gni") + utils_external_deps = [ "json:nlohmann_json_static" ] utils_deps = [] -utils_include = [ "ability/utils/include" ] +utils_include = [ "$updateengine_root_path/foundations/ability/utils/include" ] utils_src = [] diff --git a/foundations/foundations.gni b/foundations/foundations.gni index 296b43e7..23cc2c21 100644 --- a/foundations/foundations.gni +++ b/foundations/foundations.gni @@ -11,12 +11,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("ability/define/define.gni") -import("ability/log/log.gni") -import("ability/sa_loader/sa_loader.gni") -import("ability/sys_event/sys_event.gni") -import("ability/utils/utils.gni") -import("model/base_model.gni") +import("//base/update/updateservice/foundations/ability/define/define.gni") +import("//base/update/updateservice/foundations/ability/log/log.gni") +import("//base/update/updateservice/foundations/ability/sa_loader/sa_loader.gni") +import("//base/update/updateservice/foundations/ability/sys_event/sys_event.gni") +import("//base/update/updateservice/foundations/ability/utils/utils.gni") +import("//base/update/updateservice/foundations/model/base_model.gni") foundations_external_deps = [] foundations_external_deps += define_external_deps diff --git a/foundations/model/base_model.gni b/foundations/model/base_model.gni index 17c42957..c96c7107 100644 --- a/foundations/model/base_model.gni +++ b/foundations/model/base_model.gni @@ -11,7 +11,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//base/update/updateservice/updateengine.gni") + base_model_external_deps = [] base_model_deps = [] -base_model_include = [ "model/include" ] +base_model_include = [ "$updateengine_root_path/foundations/model/include" ] base_model_src = [] diff --git a/interfaces/inner_api/engine/BUILD.gn b/interfaces/inner_api/engine/BUILD.gn index 47130345..cbc350cf 100644 --- a/interfaces/inner_api/engine/BUILD.gn +++ b/interfaces/inner_api/engine/BUILD.gn @@ -12,8 +12,8 @@ # limitations under the License. import("//base/update/updateservice/updateengine.gni") +import("//base/update/updateservice/foundations/foundations.gni") import("//build/ohos.gni") -import("../../../foundations/foundations.gni") import("../feature/feature.gni") ohos_prebuilt_etc("updater_sa.rc") { -- Gitee From 442ea6a326c58acea50c6d71e04339ce98312b9b Mon Sep 17 00:00:00 2001 From: Monster Date: Sun, 4 Feb 2024 17:08:37 +0800 Subject: [PATCH 88/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- foundations/BUILD.gn | 2 +- interfaces/inner_api/engine/BUILD.gn | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/foundations/BUILD.gn b/foundations/BUILD.gn index b5a55d26..315c2f6e 100644 --- a/foundations/BUILD.gn +++ b/foundations/BUILD.gn @@ -11,8 +11,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//base/update/updateservice/updateengine.gni") import("//base/update/updateservice/foundations/foundations.gni") +import("//base/update/updateservice/updateengine.gni") import("//build/ohos.gni") config("update_service_foundations_config") { diff --git a/interfaces/inner_api/engine/BUILD.gn b/interfaces/inner_api/engine/BUILD.gn index cbc350cf..c4d02d57 100644 --- a/interfaces/inner_api/engine/BUILD.gn +++ b/interfaces/inner_api/engine/BUILD.gn @@ -11,8 +11,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//base/update/updateservice/updateengine.gni") import("//base/update/updateservice/foundations/foundations.gni") +import("//base/update/updateservice/updateengine.gni") import("//build/ohos.gni") import("../feature/feature.gni") -- Gitee From 4b912352e94856901dfb87321147254100ab9f87 Mon Sep 17 00:00:00 2001 From: Monster Date: Mon, 5 Feb 2024 09:11:39 +0800 Subject: [PATCH 89/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9gni=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- foundations/ability/sa_loader/sa_loader.gni | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/foundations/ability/sa_loader/sa_loader.gni b/foundations/ability/sa_loader/sa_loader.gni index 7355380e..02290adf 100644 --- a/foundations/ability/sa_loader/sa_loader.gni +++ b/foundations/ability/sa_loader/sa_loader.gni @@ -24,5 +24,6 @@ if (ability_ability_runtime_enable) { } sa_loader_deps = [] -sa_loader_include = [ "$updateengine_root_path/foundations/ability/sa_loader/include" ] +sa_loader_include = + [ "$updateengine_root_path/foundations/ability/sa_loader/include" ] sa_loader_src = [ "$updateengine_root_path/foundations/ability/sa_loader/src/load_sa_service.cpp" ] -- Gitee From febdac91c433fbf6f3fe833cc6c35bd96174734c Mon Sep 17 00:00:00 2001 From: Monster Date: Mon, 5 Feb 2024 09:21:50 +0800 Subject: [PATCH 90/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9gni=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- foundations/ability/define/define.gni | 3 ++- foundations/ability/log/log.gni | 3 ++- foundations/ability/sys_event/sys_event.gni | 3 ++- foundations/ability/utils/utils.gni | 3 ++- foundations/model/base_model.gni | 3 ++- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/foundations/ability/define/define.gni b/foundations/ability/define/define.gni index 46cf15bd..0e9bb9cd 100644 --- a/foundations/ability/define/define.gni +++ b/foundations/ability/define/define.gni @@ -15,5 +15,6 @@ import("//base/update/updateservice/updateengine.gni") define_external_deps = [] define_deps = [] -define_include = [ "$updateengine_root_path/foundations/ability/define/include" ] +define_include = + [ "$updateengine_root_path/foundations/ability/define/include" ] define_src = [] diff --git a/foundations/ability/log/log.gni b/foundations/ability/log/log.gni index bb805646..51216d82 100644 --- a/foundations/ability/log/log.gni +++ b/foundations/ability/log/log.gni @@ -18,5 +18,6 @@ update_log_external_deps = [ "updater:libupdaterlog_shared", ] update_log_deps = [] -update_log_include = [ "$updateengine_root_path/foundations/ability/log/include" ] +update_log_include = + [ "$updateengine_root_path/foundations/ability/log/include" ] update_log_src = [ "$updateengine_root_path/foundations/ability/log/src/update_log.cpp" ] diff --git a/foundations/ability/sys_event/sys_event.gni b/foundations/ability/sys_event/sys_event.gni index 2d3d353e..45658017 100644 --- a/foundations/ability/sys_event/sys_event.gni +++ b/foundations/ability/sys_event/sys_event.gni @@ -15,5 +15,6 @@ import("//base/update/updateservice/updateengine.gni") sys_event_external_deps = [] sys_event_deps = [] -sys_event_include = [ "$updateengine_root_path/foundations/ability/sys_event/include" ] +sys_event_include = + [ "$updateengine_root_path/foundations/ability/sys_event/include" ] sys_event_src = [] diff --git a/foundations/ability/utils/utils.gni b/foundations/ability/utils/utils.gni index b4a33b7d..fb0e0b04 100644 --- a/foundations/ability/utils/utils.gni +++ b/foundations/ability/utils/utils.gni @@ -15,5 +15,6 @@ import("//base/update/updateservice/updateengine.gni") utils_external_deps = [ "json:nlohmann_json_static" ] utils_deps = [] -utils_include = [ "$updateengine_root_path/foundations/ability/utils/include" ] +utils_include = + [ "$updateengine_root_path/foundations/ability/utils/include" ] utils_src = [] diff --git a/foundations/model/base_model.gni b/foundations/model/base_model.gni index c96c7107..c11a0575 100644 --- a/foundations/model/base_model.gni +++ b/foundations/model/base_model.gni @@ -15,5 +15,6 @@ import("//base/update/updateservice/updateengine.gni") base_model_external_deps = [] base_model_deps = [] -base_model_include = [ "$updateengine_root_path/foundations/model/include" ] +base_model_include = + [ "$updateengine_root_path/foundations/model/include" ] base_model_src = [] -- Gitee From ad61bd350507aff3bae5c4807d6b41d9648498b4 Mon Sep 17 00:00:00 2001 From: Monster Date: Mon, 5 Feb 2024 09:46:10 +0800 Subject: [PATCH 91/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9gni=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- foundations/ability/utils/utils.gni | 3 +-- foundations/model/base_model.gni | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/foundations/ability/utils/utils.gni b/foundations/ability/utils/utils.gni index fb0e0b04..b4a33b7d 100644 --- a/foundations/ability/utils/utils.gni +++ b/foundations/ability/utils/utils.gni @@ -15,6 +15,5 @@ import("//base/update/updateservice/updateengine.gni") utils_external_deps = [ "json:nlohmann_json_static" ] utils_deps = [] -utils_include = - [ "$updateengine_root_path/foundations/ability/utils/include" ] +utils_include = [ "$updateengine_root_path/foundations/ability/utils/include" ] utils_src = [] diff --git a/foundations/model/base_model.gni b/foundations/model/base_model.gni index c11a0575..c96c7107 100644 --- a/foundations/model/base_model.gni +++ b/foundations/model/base_model.gni @@ -15,6 +15,5 @@ import("//base/update/updateservice/updateengine.gni") base_model_external_deps = [] base_model_deps = [] -base_model_include = - [ "$updateengine_root_path/foundations/model/include" ] +base_model_include = [ "$updateengine_root_path/foundations/model/include" ] base_model_src = [] -- Gitee From 43367e7ea792607d620cbb7528f4a2c51ac0625b Mon Sep 17 00:00:00 2001 From: Monster Date: Mon, 5 Feb 2024 09:57:14 +0800 Subject: [PATCH 92/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9gni=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- foundations/foundations.gni | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/foundations/foundations.gni b/foundations/foundations.gni index 23cc2c21..61536735 100644 --- a/foundations/foundations.gni +++ b/foundations/foundations.gni @@ -13,8 +13,10 @@ import("//base/update/updateservice/foundations/ability/define/define.gni") import("//base/update/updateservice/foundations/ability/log/log.gni") -import("//base/update/updateservice/foundations/ability/sa_loader/sa_loader.gni") -import("//base/update/updateservice/foundations/ability/sys_event/sys_event.gni") +import( + "//base/update/updateservice/foundations/ability/sa_loader/sa_loader.gni") +import( + "//base/update/updateservice/foundations/ability/sys_event/sys_event.gni") import("//base/update/updateservice/foundations/ability/utils/utils.gni") import("//base/update/updateservice/foundations/model/base_model.gni") -- Gitee From 61cfe74479f5c961d49a308585ce13dc128d56fd Mon Sep 17 00:00:00 2001 From: Monster Date: Mon, 5 Feb 2024 15:55:27 +0800 Subject: [PATCH 93/98] =?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: Monster --- bundle.json | 2 +- foundations/BUILD.gn | 2 +- frameworks/js/napi/update/BUILD.gn | 2 +- interfaces/inner_api/engine/BUILD.gn | 2 +- .../inner_api/feature/update/model/model.gni | 1 - .../update/model/upgrade_info/business_type.h | 14 ++++---------- services/engine/engine_sa.gni | 2 +- 7 files changed, 9 insertions(+), 16 deletions(-) diff --git a/bundle.json b/bundle.json index cc765dfe..843296aa 100644 --- a/bundle.json +++ b/bundle.json @@ -72,7 +72,7 @@ "header_base": "//base/update/updateservice/foundations", "header_files": [] }, - "name": "//base/update/updateservice/foundations:foundations" + "name": "//base/update/updateservice/foundations:update_foundations" }, { "header": { diff --git a/foundations/BUILD.gn b/foundations/BUILD.gn index 315c2f6e..6cdc3b98 100644 --- a/foundations/BUILD.gn +++ b/foundations/BUILD.gn @@ -19,7 +19,7 @@ config("update_service_foundations_config") { include_dirs = foundations_include } -ohos_shared_library("foundations") { +ohos_shared_library("update_foundations") { sanitize = { cfi = true cfi_cross_dso = true diff --git a/frameworks/js/napi/update/BUILD.gn b/frameworks/js/napi/update/BUILD.gn index 3868678c..c356937e 100644 --- a/frameworks/js/napi/update/BUILD.gn +++ b/frameworks/js/napi/update/BUILD.gn @@ -50,7 +50,7 @@ ohos_shared_library("$updateengine_client_library_name") { include_dirs += session_include_dirs deps = [ - "$updateengine_root_path/foundations:foundations", + "$updateengine_root_path/foundations:update_foundations", "$updateengine_root_path/interfaces/inner_api/engine:$updateengine_inner_library_name", ] diff --git a/interfaces/inner_api/engine/BUILD.gn b/interfaces/inner_api/engine/BUILD.gn index c4d02d57..00814291 100644 --- a/interfaces/inner_api/engine/BUILD.gn +++ b/interfaces/inner_api/engine/BUILD.gn @@ -62,7 +62,7 @@ ohos_shared_library("$updateengine_inner_library_name") { public_configs = [ ":updateengine_inner_library_native_config" ] deps = [ - "$updateengine_root_path/foundations:foundations", + "$updateengine_root_path/foundations:update_foundations", "$updateengine_root_path/interfaces/inner_api/modulemgr:update_module_mgr", "//third_party/bounds_checking_function:libsec_static", ] diff --git a/interfaces/inner_api/feature/update/model/model.gni b/interfaces/inner_api/feature/update/model/model.gni index 12d344c6..2dba0c79 100644 --- a/interfaces/inner_api/feature/update/model/model.gni +++ b/interfaces/inner_api/feature/update/model/model.gni @@ -27,7 +27,6 @@ model_include = [ "../feature/update/model/task", "../feature/update/model/upgrade", "../feature/update/model/upgrade_info", - "../feature/update/model/upgrade", "../feature/update/model/version_info", "../feature/update/model/version_info/current_version", "../feature/update/model/version_info/description", diff --git a/interfaces/inner_api/feature/update/model/upgrade_info/business_type.h b/interfaces/inner_api/feature/update/model/upgrade_info/business_type.h index 618ed9c3..72ccfc03 100644 --- a/interfaces/inner_api/feature/update/model/upgrade_info/business_type.h +++ b/interfaces/inner_api/feature/update/model/upgrade_info/business_type.h @@ -30,18 +30,12 @@ struct BusinessType : public BaseJsonStruct { bool operator<(const BusinessType &businessType) const { - if (vendor < businessType.vendor) { - return true; - } - if (vendor > businessType.vendor) { - return false; + if (vendor != businessType.vendor) { + return vendor < businessType.vendor; } - if (CAST_INT(subType) < CAST_INT(businessType.subType)) { - return true; - } - if (CAST_INT(subType) > CAST_INT(businessType.subType)) { - return true; + if (subType != businessType.subType) { + return CAST_INT(subType) < CAST_INT(businessType.subType); } return false; diff --git a/services/engine/engine_sa.gni b/services/engine/engine_sa.gni index ba4442d9..b70f1f28 100644 --- a/services/engine/engine_sa.gni +++ b/services/engine/engine_sa.gni @@ -125,7 +125,7 @@ sa_include_dirs += [ "//base/update/updateservice/interfaces/innner_api/modulemgr/include" ] sa_deps = [ - "$updateengine_root_path/foundations:foundations", + "$updateengine_root_path/foundations:update_foundations", "$updateengine_root_path/interfaces/inner_api/engine:$updateengine_inner_library_name", "$updateengine_root_path/interfaces/inner_api/modulemgr:update_module_mgr", "//base/update/updater/services/fs_manager:libfsmanager", # factory_reset_GetBlockDeviceByMountPoint_"fs_manager/mount.h" -- Gitee From ec01329a1a37c47b9df6044e15a1a2b3fc522176 Mon Sep 17 00:00:00 2001 From: Monster Date: Tue, 6 Feb 2024 14:01:27 +0800 Subject: [PATCH 94/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=86=B2=E7=AA=81?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Monster --- .../model/include/{device_type.h => update_device_type.h} | 0 .../inner_api/feature/update/model/subscribe/subscribe_info.h | 2 +- .../inner_api/feature/update/model/upgrade_info/upgrade_info.h | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename foundations/model/include/{device_type.h => update_device_type.h} (100%) diff --git a/foundations/model/include/device_type.h b/foundations/model/include/update_device_type.h similarity index 100% rename from foundations/model/include/device_type.h rename to foundations/model/include/update_device_type.h diff --git a/interfaces/inner_api/feature/update/model/subscribe/subscribe_info.h b/interfaces/inner_api/feature/update/model/subscribe/subscribe_info.h index d72b1abf..24b1dd03 100644 --- a/interfaces/inner_api/feature/update/model/subscribe/subscribe_info.h +++ b/interfaces/inner_api/feature/update/model/subscribe/subscribe_info.h @@ -20,7 +20,7 @@ #include "base_json_struct.h" #include "business_type.h" -#include "device_type.h" +#include "update_device_type.h" namespace OHOS::UpdateEngine { const std::string OUC_PACKAGE_NAME = "com.ohos.updateapp"; diff --git a/interfaces/inner_api/feature/update/model/upgrade_info/upgrade_info.h b/interfaces/inner_api/feature/update/model/upgrade_info/upgrade_info.h index 171bb8eb..c604c500 100644 --- a/interfaces/inner_api/feature/update/model/upgrade_info/upgrade_info.h +++ b/interfaces/inner_api/feature/update/model/upgrade_info/upgrade_info.h @@ -19,7 +19,7 @@ #include #include "business_type.h" -#include "device_type.h" +#include "update_device_type.h" namespace OHOS::UpdateEngine { const std::string LOCAL_UPGRADE_INFO = "LocalUpgradeInfo"; -- Gitee From 3d3bba26e0bf32e7d579111bacc793b4f75738a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E9=9C=86=E5=A8=81?= <2158863620@qq.com> Date: Wed, 7 Feb 2024 03:37:13 +0000 Subject: [PATCH 95/98] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dmini=5Fsystem=5Fstandar?= =?UTF-8?q?d=E6=9C=80=E5=B0=8F=E7=B3=BB=E7=BB=9F=E6=B5=81=E6=B0=B4?= =?UTF-8?q?=E7=BA=BF=E6=9E=84=E5=BB=BA=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 谢霆威 <2158863620@qq.com> --- services/utils/include/dupdate_net_manager.h | 1 + 1 file changed, 1 insertion(+) diff --git a/services/utils/include/dupdate_net_manager.h b/services/utils/include/dupdate_net_manager.h index 8ab584df..5576988b 100644 --- a/services/utils/include/dupdate_net_manager.h +++ b/services/utils/include/dupdate_net_manager.h @@ -19,6 +19,7 @@ #include "singleton.h" #include +#include #include "dupdate_inet_observer.h" #ifdef NETMANAGER_BASE_ENABLE -- Gitee From b4d4372f1592feec1a05f7e85ed46c9e0bdf9480 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E9=9C=86=E5=A8=81?= <2158863620@qq.com> Date: Wed, 7 Feb 2024 08:38:25 +0000 Subject: [PATCH 96/98] update services/utils/include/dupdate_net_manager.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 谢霆威 <2158863620@qq.com> --- services/utils/include/dupdate_net_manager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/utils/include/dupdate_net_manager.h b/services/utils/include/dupdate_net_manager.h index 5576988b..2c6c5b4e 100644 --- a/services/utils/include/dupdate_net_manager.h +++ b/services/utils/include/dupdate_net_manager.h @@ -18,8 +18,8 @@ #include "singleton.h" -#include #include +#include #include "dupdate_inet_observer.h" #ifdef NETMANAGER_BASE_ENABLE -- Gitee From 6f789a4c685fd11d96d824595127d8ff91483cca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=9B=9B=E5=B9=B3?= Date: Wed, 7 Feb 2024 09:53:50 +0000 Subject: [PATCH 97/98] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E5=91=8A=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 黄四平 --- .../upgrade/install/src/firmware_sys_installer_install.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/firmware/upgrade/install/src/firmware_sys_installer_install.cpp b/services/firmware/upgrade/install/src/firmware_sys_installer_install.cpp index a6a50e69..826e1313 100644 --- a/services/firmware/upgrade/install/src/firmware_sys_installer_install.cpp +++ b/services/firmware/upgrade/install/src/firmware_sys_installer_install.cpp @@ -43,14 +43,14 @@ bool SysInstallerInstall::PerformInstall(const std::vector &c if (componentList.empty()) { return false; } - int32_t successCount = 0; + uint32_t successCount = 0; for (const auto &component : componentList) { onInstallCallback_.onFirmwareStatus(UpgradeStatus::INSTALLING); if (DoSysInstall(component) == OHOS_SUCCESS) { successCount ++; } } - return successCount == componentList.size(); + return successCount == static_cast(componentList.size()); } int32_t SysInstallerInstall::DoSysInstall(const FirmwareComponent &firmwareComponent) -- Gitee From 1bc5504446decaf19c8c2cd0de2ccd2c5b63403b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=9B=9B=E5=B9=B3?= Date: Thu, 8 Feb 2024 08:17:26 +0000 Subject: [PATCH 98/98] =?UTF-8?q?SA=E7=BC=96=E8=AF=91=E9=9C=80=E6=B1=82?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 黄四平 --- services/engine/engine_sa.gni | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/services/engine/engine_sa.gni b/services/engine/engine_sa.gni index b70f1f28..d9a52e5b 100644 --- a/services/engine/engine_sa.gni +++ b/services/engine/engine_sa.gni @@ -110,6 +110,7 @@ sa_include_dirs = [ "//third_party/glib", "//third_party/openssl/include", "//third_party/cJSON/", + "//third_party/json/include", ] if (!relational_store_native_rdb_enable) { @@ -128,11 +129,8 @@ sa_deps = [ "$updateengine_root_path/foundations:update_foundations", "$updateengine_root_path/interfaces/inner_api/engine:$updateengine_inner_library_name", "$updateengine_root_path/interfaces/inner_api/modulemgr:update_module_mgr", - "//base/update/updater/services/fs_manager:libfsmanager", # factory_reset_GetBlockDeviceByMountPoint_"fs_manager/mount.h" "//third_party/cJSON:cjson", "//third_party/curl:curl", - "//third_party/glib:glib_packages", - "//third_party/jsoncpp:jsoncpp", "//third_party/libxml2:libxml2", "//third_party/mbedtls:mbedtls_shared", "//third_party/openssl:libcrypto_shared", -- Gitee