From 1e12b87007ecda73fc882fc39c6446714df3147b Mon Sep 17 00:00:00 2001 From: chenzihan Date: Wed, 2 Jul 2025 11:13:53 +0800 Subject: [PATCH 1/4] Signed-off-by: chenzihan fix:add LoadABPtnInfo --- services/ptable_parse/ptable.cpp | 22 ++++++++++++++++++++++ services/ptable_parse/ptable.h | 3 +++ 2 files changed, 25 insertions(+) diff --git a/services/ptable_parse/ptable.cpp b/services/ptable_parse/ptable.cpp index d91e4b2a..fdf0a8fc 100644 --- a/services/ptable_parse/ptable.cpp +++ b/services/ptable_parse/ptable.cpp @@ -48,11 +48,33 @@ bool Ptable::CorrectBufByPtnList(uint8_t *imageBuf, uint64_t imgBufSize, const s return false; } +std::vector GetABPartitionList() const +{ + return abPartitionList_; +} + uint32_t Ptable::GetPtablePartitionNum() const { return partitionInfo_.size(); } +bool LoadABPtnInfo() +{ + if (ptnInfo.empty()) { + LOG(ERROR) << "gei partiotion failed! abPartitionList_ is empty"; + return false; + } + for ( auto &partition : partitionInfo_) { + if (partition.partType == Ptable::PartType::A_TYPE) { + std::string partitionName = partition.dispName.substr( + 0, partition.dispName.size() - PARTITION_AB_SUFFIX_SIZE); + LOG(INFO) << "get AB partition. name = " << partitionName; + abPartitionList_.push_back(partitionName); + } + } + return true; +} + bool Ptable::LoadPtnInfo(const std::vector &ptnInfo) { if (ptnInfo.empty()) { diff --git a/services/ptable_parse/ptable.h b/services/ptable_parse/ptable.h index 7bab2056..b54a6881 100644 --- a/services/ptable_parse/ptable.h +++ b/services/ptable_parse/ptable.h @@ -72,6 +72,7 @@ public: uint64_t devDensity; }; std::vector GetPtablePartitionInfo() const; + std::vector GetABPartitionList() const; uint32_t GetPtablePartitionNum() const; void SetReservedSize(uint64_t reservedSize); bool InitPtable(); @@ -81,6 +82,7 @@ public: bool GetPartionInfoByName(const std::string &partitionName, PtnInfo &ptnInfo, int32_t &index); std::vector& GetPtablePartitionInfoInstance(); bool LoadPtnInfo(const std::vector& ptnInfo); + bool LoadABPtnInfo(); bool WritePartitionBufToFile(uint8_t *ptbImgBuffer, const uint32_t imgBufSize); bool ReadPartitionFileToBuffer(uint8_t *ptbImgBuffer, uint32_t &imgBufSize); void DeletePartitionTmpFile(); @@ -212,6 +214,7 @@ public: }; std::vector partitionInfo_; + std::vector abPartitionList_; PtableData ptableData_; uint64_t reservedSize_ {0}; -- Gitee From 780d765ed463893445c94e77f2741f8348b5fb38 Mon Sep 17 00:00:00 2001 From: chenzihan Date: Wed, 2 Jul 2025 11:23:40 +0800 Subject: [PATCH 2/4] Signed-off-by: chenzihan fix: add sync process --- services/updater_main.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/services/updater_main.cpp b/services/updater_main.cpp index 13731085..e1dcb250 100644 --- a/services/updater_main.cpp +++ b/services/updater_main.cpp @@ -914,7 +914,7 @@ static void ShowSuccessUi(UpdaterParams &upParams, UpdaterStatus &status) } UPDATER_UI_INSTANCE.ShowSuccessPage(); } - + __attribute__((weak)) UpdaterStatus CheckAndSetSlot([[maybe_unused]]UpdaterParams &upParams) { LOG(INFO) << "not need check and set slot"; @@ -924,6 +924,12 @@ __attribute__((weak)) UpdaterStatus CheckAndSetSlot([[maybe_unused]]UpdaterParam return UPDATE_SUCCESS; } +__attribute__((weak)) bool PostUpdateSyncProcess() +{ + LOG(INFO) << "not need sync process"; + return true; +} + static void PostUpdate(UpdaterParams &upParams, UpdaterStatus &status, const std::vector& updateList, const std::string& type) { @@ -1003,6 +1009,7 @@ static UpdaterStatus PreSdcardUpdatePackages(UpdaterParams &upParams) static void PostSdcardUpdatePackages(UpdaterParams &upParams, UpdaterStatus &status) { + (void)PostUpdateSyncProcess(); ClearUpdateSlotParam(); ClearUpdateSuffixParam(); if (Utils::CheckUpdateMode(Updater::SDCARD_INTRAL_MODE)) { @@ -1071,6 +1078,9 @@ UpdaterStatus InstallUpdaterPackages(UpdaterParams &upParams) status = DoUpdatePackages(upParams); } PostUpdatePackages(upParams, status); + if (upParams.miscCmd == "boot_eupdater") { + (void)PostUpdateSyncProcess(); + } UpdaterInit::GetInstance().InvokeEvent(UPDATER_POST_UPDATE_PACKAGE_EVENT); return status; } -- Gitee From 7eff0f53ef268b9120f0de41d8b32d710773426a Mon Sep 17 00:00:00 2001 From: chenzihan Date: Wed, 2 Jul 2025 11:29:23 +0800 Subject: [PATCH 3/4] Signed-off-by: chenzihan fix:add --- services/updater_main.cpp | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/services/updater_main.cpp b/services/updater_main.cpp index e1dcb250..13731085 100644 --- a/services/updater_main.cpp +++ b/services/updater_main.cpp @@ -914,7 +914,7 @@ static void ShowSuccessUi(UpdaterParams &upParams, UpdaterStatus &status) } UPDATER_UI_INSTANCE.ShowSuccessPage(); } - + __attribute__((weak)) UpdaterStatus CheckAndSetSlot([[maybe_unused]]UpdaterParams &upParams) { LOG(INFO) << "not need check and set slot"; @@ -924,12 +924,6 @@ __attribute__((weak)) UpdaterStatus CheckAndSetSlot([[maybe_unused]]UpdaterParam return UPDATE_SUCCESS; } -__attribute__((weak)) bool PostUpdateSyncProcess() -{ - LOG(INFO) << "not need sync process"; - return true; -} - static void PostUpdate(UpdaterParams &upParams, UpdaterStatus &status, const std::vector& updateList, const std::string& type) { @@ -1009,7 +1003,6 @@ static UpdaterStatus PreSdcardUpdatePackages(UpdaterParams &upParams) static void PostSdcardUpdatePackages(UpdaterParams &upParams, UpdaterStatus &status) { - (void)PostUpdateSyncProcess(); ClearUpdateSlotParam(); ClearUpdateSuffixParam(); if (Utils::CheckUpdateMode(Updater::SDCARD_INTRAL_MODE)) { @@ -1078,9 +1071,6 @@ UpdaterStatus InstallUpdaterPackages(UpdaterParams &upParams) status = DoUpdatePackages(upParams); } PostUpdatePackages(upParams, status); - if (upParams.miscCmd == "boot_eupdater") { - (void)PostUpdateSyncProcess(); - } UpdaterInit::GetInstance().InvokeEvent(UPDATER_POST_UPDATE_PACKAGE_EVENT); return status; } -- Gitee From 901d18ca79c3306926a08d4f7ddbe9f004e58dbe Mon Sep 17 00:00:00 2001 From: chenzihan Date: Wed, 2 Jul 2025 11:47:56 +0800 Subject: [PATCH 4/4] Signed-off-by: chenzihan fix:add --- services/ptable_parse/ptable.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/services/ptable_parse/ptable.cpp b/services/ptable_parse/ptable.cpp index fdf0a8fc..c379f813 100644 --- a/services/ptable_parse/ptable.cpp +++ b/services/ptable_parse/ptable.cpp @@ -48,7 +48,7 @@ bool Ptable::CorrectBufByPtnList(uint8_t *imageBuf, uint64_t imgBufSize, const s return false; } -std::vector GetABPartitionList() const +std::vector Ptable::GetABPartitionList() const { return abPartitionList_; } @@ -58,16 +58,16 @@ uint32_t Ptable::GetPtablePartitionNum() const return partitionInfo_.size(); } -bool LoadABPtnInfo() +bool Ptable::LoadABPtnInfo() { - if (ptnInfo.empty()) { + if (abPartitionList_.empty()) { LOG(ERROR) << "gei partiotion failed! abPartitionList_ is empty"; return false; } for ( auto &partition : partitionInfo_) { if (partition.partType == Ptable::PartType::A_TYPE) { std::string partitionName = partition.dispName.substr( - 0, partition.dispName.size() - PARTITION_AB_SUFFIX_SIZE); + 0, partition.dispName.size() - Ptable::PARTITION_AB_SUFFIX_SIZE); LOG(INFO) << "get AB partition. name = " << partitionName; abPartitionList_.push_back(partitionName); } -- Gitee