From f9b8dcc86295790744eb261c1940ac5e13f622e8 Mon Sep 17 00:00:00 2001 From: xue <2144439972@qq.com> Date: Mon, 8 Dec 2025 20:01:41 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E5=A4=8DotaBug?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeapp/nativeui/ota/src/OtaModel.cpp | 26 +++++++++++++++++-- .../nativeui/ota/src/OtaPresenter.cpp | 2 +- .../ln/nativeapp/nativeui/ota/src/OtaView.cpp | 11 ++++++++ 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaModel.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaModel.cpp index 00d94c60a..eb63180cf 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaModel.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaModel.cpp @@ -15,6 +15,9 @@ #include "ota/include/OtaView.h" #include "ota/include/OtaUpdatingView.h" #include "system/include/MemoryManager.h" +#include "thunderbird/include/ThunderBirdModel.h" +#include "NativeAbility.h" +#include "ln_api_interface.h" #ifdef SUPPORT_CAT1_SERVICE #include "cat1_pub_api.h" #endif @@ -473,11 +476,30 @@ namespace OHOS //下载成功通知 void OtaModel::HandleDownloadSuccess(int type) { - if(OtaDownloadView::GetInstance()) + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OtaModel::HandleDownloadSuccess type=%d", type); + + // 判断是表情下载还是屏保下载 + if(type == DOWNLOAD_FILE_TYPE_EMOJI || type == DOWNLOAD_FILE_TYPE_SCREEN_IMAGE) { + // 表情下载或屏保下载完成,跳转回主界面 + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OtaModel::HandleDownloadSuccess: 表情/屏保下载完成,跳转回主界面"); uapi_setScreenDuration(30000); // 重新设置30秒自动息屏 - OtaView::GetInstance()->ChangeView(OtaView::OTA_VIEW_DOWNLOAD, OtaView::OTA_VIEW_UPDATE_SUCCESS); + + // 清空下载文件类型 + ThunderBirdModel::GetInstance()->ClearDownloadFile(); + + // 跳转回主界面 + NativeAbility::GetInstance().SwitchSlice(VIEW_THUNDER_BIRD); + } + else + { + // OTA升级下载完成,跳转到OTA升级成功界面 + if(OtaDownloadView::GetInstance()) + { + uapi_setScreenDuration(30000); // 重新设置30秒自动息屏 + OtaView::GetInstance()->ChangeView(OtaView::OTA_VIEW_DOWNLOAD, OtaView::OTA_VIEW_UPDATE_SUCCESS); OtaSuccessView::GetInstance()->UpdateDownloadSuccess("下载成功"); + } } } diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaPresenter.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaPresenter.cpp index 3feb6a503..9e4aeef4e 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaPresenter.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaPresenter.cpp @@ -149,7 +149,7 @@ namespace OHOS OtaModel::GetInstance()->SetNightUpdateEnabled(true); OtaView::GetInstance()->ChangeView(OtaView::OTA_VIEW_NIGHT_UPDATE, OtaView::OTA_VIEW_NIGHT_UPDATE_SUCCESS); } - else if (currentView == OtaView::OTA_VIEW_NIGHT_UPDATE_SUCCESS) { + else if (currentView == OtaView::OTA_VIEW_NIGHT_UPDATE_SUCCESS || currentView == OtaView::OTA_VIEW_UPDATE_SUCCESS) { //夜间升级成功 // 清除夜间更新状态 diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaView.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaView.cpp index 0ed2f2f68..b82ff948e 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaView.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaView.cpp @@ -395,6 +395,17 @@ namespace OHOS } group[hideView]->SetVisible(false); } + else + { + // 当hideView == MAX_OTA_VIEW时,隐藏所有其他已创建的视图,避免显示混乱 + for (int i = 0; i < MAX_OTA_VIEW; i++) + { + if (group[i] != nullptr && i != showView) + { + group[i]->SetVisible(false); + } + } + } ClickFunc(showView); group[showView]->SetStyle(STYLE_BACKGROUND_OPA, 0x00); group[showView]->SetVisible(true); -- 2.17.1