From: hcj_ <1224667075@qq.com> Date: Tue, 7 May 2024 07:14:05 +0000 (+0800) Subject: 修改系统升级bug X-Git-Tag: release_V1.2.70_20241020_135402~1113^2~17 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=refs%2Fchanges%2F135%2Fhead;p=mirrors%2FFD230.git 修改系统升级bug --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemView.h b/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemView.h index c906f84ca..b00cafc60 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/system/include/SystemView.h @@ -27,6 +27,7 @@ namespace OHOS { static constexpr const char *ABOUT_THE_WATCH = "AboutTheWatchButton"; // 关于手表 static constexpr const char *SYSTEM_UPGRADE = "SystemUpgradeButtonExt"; // 系统升级 + static constexpr const char *SYSTEM_UPGRADE_t = "SystemUpgradeButtonExt_t"; // 点击系统升级 static constexpr const char *WATCH_QR_CODE = "WatchqrcodeButton"; // 手表二维码 static constexpr const char *SYSTEM_LANGUAGE = "SystemLanguageButton"; // 系统语言 static constexpr const char *FACTORY_RESET = "FactoryResetButton"; // 恢复出厂设置 diff --git a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemPresenter.cpp index 96c45f3c3..013774d32 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemPresenter.cpp @@ -194,7 +194,7 @@ namespace OHOS } - if (strcmp(view.GetViewId(), SYSTEM_UPGRADE) == 0) //点击是否立即升级 + if (strcmp(view.GetViewId(), SYSTEM_UPGRADE_t) == 0) //点击是否立即升级 { SystemupgradeView::GetInstance()->statr_down_fwpkg(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/system/src/Systemupgrade.cpp b/code/sdk/application/wearable/fd230app/nativeui/system/src/Systemupgrade.cpp index 1558a10b8..24a88426d 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/system/src/Systemupgrade.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/system/src/Systemupgrade.cpp @@ -190,6 +190,7 @@ namespace OHOS if(fp==NULL) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "open fail"); + if(SystemupgradeView::GetInstance()) SystemupgradeView::GetInstance()->set_string_value(NULL,false); return; } @@ -208,6 +209,7 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "fread %d",ret); fclose(fp); free(buf); + if(SystemupgradeView::GetInstance()) SystemupgradeView::GetInstance()->set_string_value(NULL,false); return; } @@ -277,7 +279,7 @@ namespace OHOS sprintf(msg_buf,"%s",msg); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s",msg); - + if(SystemupgradeView::GetInstance()) SystemupgradeView::GetInstance()->set_string_value(msg_buf,falg); //RootView::GetInstance()->Invalidate(); @@ -436,7 +438,11 @@ namespace OHOS &connection); PRINT("custom_start_ota_download %d \r\n",rett); if(rett!=0) - SystemupgradeView::GetInstance()->set_string_value(NULL,false); + { + if(SystemupgradeView::GetInstance()) + SystemupgradeView::GetInstance()->set_string_value(NULL,false); + } + // SystemupgradeView::GetInstance()->init_fail(0); return ERRCODE_SUCC; } @@ -649,10 +655,16 @@ namespace OHOS { newVersion->SetText(str); } - newVersionTitle->SetText("有最新固件版本"); + if(newVersion) newVersion->SetVisible(true); - newVersionTitle->SetVisible(true); + + if(newVersionTitle) + { + newVersionTitle->SetText("有最新固件版本"); + newVersionTitle->SetVisible(true); + } + //new_label->SetVisible(true); is_new_version=true; @@ -662,13 +674,20 @@ namespace OHOS if(str!=NULL) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "str %s",str); - newVersion->SetText(str); - newVersion->SetVisible(true); + if(newVersion) + { + newVersion->SetText(str); + newVersion->SetVisible(true); + } + } + if(newVersion) + { + newVersionTitle->SetText("获取升级失败"); + newVersionTitle->SetVisible(true); + } - newVersionTitle->SetText("获取升级失败"); - newVersionTitle->SetVisible(true); is_new_version=false; } @@ -1000,7 +1019,7 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SystemUpgradeButtonExt new fail!"); } SystemUpgradeButton_->SetPosition(163, 400, 180, 80); - SystemUpgradeButton_->SetViewId(SYSTEM_UPGRADE); + SystemUpgradeButton_->SetViewId(SYSTEM_UPGRADE_t); SystemUpgradeButton_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919); SystemUpgradeButton_->SetText("确认升级"); SystemUpgradeButton_->SetAlign(TEXT_ALIGNMENT_LEFT);