From 05ed3b510cc6580eb4cc6780328d2e4ad488a999 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=82=AC?= Date: Thu, 5 Sep 2024 07:55:23 +0000 Subject: [PATCH 1/2] =?UTF-8?q?update=20services/updater=5Fui.cpp.=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9ESD=E5=8D=A1=E5=8D=87=E7=BA=A7=E4=B8=8D?= =?UTF-8?q?=E6=B8=85=E9=99=A4=E7=94=A8=E6=88=B7=E6=95=B0=E6=8D=AE=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/updater_ui.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/services/updater_ui.cpp b/services/updater_ui.cpp index f2ba83da..685f494d 100644 --- a/services/updater_ui.cpp +++ b/services/updater_ui.cpp @@ -119,6 +119,35 @@ DEFINE_ASYN_CALLBACK(OnLabelSDCardNoDelayEvt) Utils::UpdaterDoReboot(""); } +DEFINE_ASYN_CALLBACK(OnLabelSDUpdateResEvt) +{ + LOG(INFO) << "On Label SDCard To Reserve Userdata"; + if (!GetFacade().SetMode(UPDATERMODE_SDCARD)) { + return; + } + Utils::UsSleep(CALLBACK_DELAY); + UpdaterParams upParams; + upParams.updateMode = SDCARD_UPDATE; + Utils::SetMessageToMisc("boot-updater", 0, "sdcard_intral_update"); // set retain userdata + if (!Utils::CheckUpdateMode(Updater::SDCARD_INTRAL_MODE)) { + LOG(ERROE) << "sdcard_intral_update write to misc failed"; + GetFacade().ShowFailedPage(); + return; + } + LOG(INFO) << "sdcard_intral_update write to misc success"; + if (auto res = UpdaterFromSdcard(upParams); res != UPDATE_SUCCESS) { + Utils::RemoveUpdateInfoFromMisc("sdcard_update"); + GetFacade().ShowLogRes(res == UPDATE_CORRUPT ? TR(LOGRES_VERIFY_FAILED) : TR(LOGRES_UPDATE_FAILED)); + GetFacade().ShowFailedPage(); + return; + } + GetFacade().ShowLogRes(TR(LABEL_UPD_OK_DONE)); + GetFacade().ShowSuccessPage(); + Utils::UsSleep(SUCCESS_DELAY); + PostUpdater(true); + Utils::UpdaterDoReboot(""); +} +} DEFINE_SYNC_CALLBACK(OnLabelCancelEvt) { LOG(INFO) << "On Label Cancel"; -- Gitee From ec6a93593e6a6fb4830fdb3d8b1464b0313e47df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=82=AC?= Date: Thu, 5 Sep 2024 08:11:29 +0000 Subject: [PATCH 2/2] update services/updater_ui.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 黄悬 --- services/updater_ui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/updater_ui.cpp b/services/updater_ui.cpp index 685f494d..a86ecf61 100644 --- a/services/updater_ui.cpp +++ b/services/updater_ui.cpp @@ -147,7 +147,7 @@ DEFINE_ASYN_CALLBACK(OnLabelSDUpdateResEvt) PostUpdater(true); Utils::UpdaterDoReboot(""); } -} + DEFINE_SYNC_CALLBACK(OnLabelCancelEvt) { LOG(INFO) << "On Label Cancel"; -- Gitee