From 7260947e8751d1be364fe08c188447b26435225b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=82=AC?= Date: Fri, 25 Oct 2024 15:02:38 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=83=8C=E6=9D=BF=E7=83=A7=E7=89=87?= =?UTF-8?q?=E5=8D=87=E7=BA=A7=E6=97=B6=EF=BC=8C=E4=B8=8D=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=E7=94=B5=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/updater_main.cpp | 10 ++++++++++ services/updater_main.h | 1 + 2 files changed, 11 insertions(+) diff --git a/services/updater_main.cpp b/services/updater_main.cpp index c8fed0fe..e106381c 100644 --- a/services/updater_main.cpp +++ b/services/updater_main.cpp @@ -239,12 +239,22 @@ bool GetBatteryCapacity(int &capacity) return false; } +__attribute__((weak)) bool IsSpareBoardBoot(void) +{ + LOG(INFO) << "no need check spareboardboot"; + return false; +} + bool IsBatteryCapacitySufficient() { if (Utils::CheckUpdateMode(OTA_MODE)) { LOG(INFO) << "this is OTA update, on need to determine the battery"; return true; } + if (IsSpareBoardBoot()) { + LOG(INFO) << "this is spare board boot, no need to determine the battery"; + return true; + } static constexpr auto levelIdx = "lowBatteryLevel"; static constexpr auto jsonPath = "/etc/product_cfg.json"; diff --git a/services/updater_main.h b/services/updater_main.h index 29e0e41e..699df7ee 100644 --- a/services/updater_main.h +++ b/services/updater_main.h @@ -68,6 +68,7 @@ UpdaterStatus ProcessOtherOption([[maybe_unused]] const std::string &option, bool PreStartBinaryEntry([[maybe_unused]] const std::string &path); int32_t VerifySpecialPkgs([[maybe_unused]]UpdaterParams &upParams); void UpdaterVerifyFailEntry(bool verifyret); +bool IsSpareBoardBoot(void); bool IsNeedWipe(); #ifdef __cplusplus #if __cplusplus -- Gitee From 12fc3130698889c334f47e8403c3e3741e63bd9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=82=AC?= Date: Fri, 25 Oct 2024 15:02:38 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E8=83=8C=E6=9D=BF=E7=83=A7=E7=89=87?= =?UTF-8?q?=E5=8D=87=E7=BA=A7=E6=97=B6=EF=BC=8C=E4=B8=8D=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=E7=94=B5=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 黄悬 --- services/updater_main.cpp | 10 ++++++++++ services/updater_main.h | 1 + 2 files changed, 11 insertions(+) diff --git a/services/updater_main.cpp b/services/updater_main.cpp index c8fed0fe..e106381c 100644 --- a/services/updater_main.cpp +++ b/services/updater_main.cpp @@ -239,12 +239,22 @@ bool GetBatteryCapacity(int &capacity) return false; } +__attribute__((weak)) bool IsSpareBoardBoot(void) +{ + LOG(INFO) << "no need check spareboardboot"; + return false; +} + bool IsBatteryCapacitySufficient() { if (Utils::CheckUpdateMode(OTA_MODE)) { LOG(INFO) << "this is OTA update, on need to determine the battery"; return true; } + if (IsSpareBoardBoot()) { + LOG(INFO) << "this is spare board boot, no need to determine the battery"; + return true; + } static constexpr auto levelIdx = "lowBatteryLevel"; static constexpr auto jsonPath = "/etc/product_cfg.json"; diff --git a/services/updater_main.h b/services/updater_main.h index 29e0e41e..699df7ee 100644 --- a/services/updater_main.h +++ b/services/updater_main.h @@ -68,6 +68,7 @@ UpdaterStatus ProcessOtherOption([[maybe_unused]] const std::string &option, bool PreStartBinaryEntry([[maybe_unused]] const std::string &path); int32_t VerifySpecialPkgs([[maybe_unused]]UpdaterParams &upParams); void UpdaterVerifyFailEntry(bool verifyret); +bool IsSpareBoardBoot(void); bool IsNeedWipe(); #ifdef __cplusplus #if __cplusplus -- Gitee From b0f4ac0223439e1d8c3011bddfc7ef288ecff105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=82=AC?= Date: Fri, 25 Oct 2024 09:29:31 +0000 Subject: [PATCH 3/3] =?UTF-8?q?=E5=A4=87=E6=9D=BF=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E8=B7=B3=E8=BF=87=E7=94=B5=E6=B1=A0=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 黄悬 --- services/updater_main.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/updater_main.h b/services/updater_main.h index 699df7ee..52b29d9f 100644 --- a/services/updater_main.h +++ b/services/updater_main.h @@ -68,7 +68,7 @@ UpdaterStatus ProcessOtherOption([[maybe_unused]] const std::string &option, bool PreStartBinaryEntry([[maybe_unused]] const std::string &path); int32_t VerifySpecialPkgs([[maybe_unused]]UpdaterParams &upParams); void UpdaterVerifyFailEntry(bool verifyret); -bool IsSpareBoardBoot(void); +bool IsSpareBoardBoot(void); bool IsNeedWipe(); #ifdef __cplusplus #if __cplusplus -- Gitee