优化ota
authorxue <2144439972@qq.com>
Thu, 25 Sep 2025 06:12:19 +0000 (14:12 +0800)
committerxue <2144439972@qq.com>
Thu, 25 Sep 2025 06:12:19 +0000 (14:12 +0800)
18 files changed:
code/sdk/application/wearable/ln/nativeapp/nativeui/ota/include/OtaFailedView.h
code/sdk/application/wearable/ln/nativeapp/nativeui/ota/include/OtaSuccessView.h
code/sdk/application/wearable/ln/nativeapp/nativeui/ota/include/OtaView.h
code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaCountdownView.cpp
code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaFailedView.cpp
code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaLowBatteryView.cpp
code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaMemoryErrorView.cpp
code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaModel.cpp
code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaNetworkErrorView.cpp
code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaNightUpdateSuccessView.cpp
code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaNightUpdateView.cpp
code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaNormalView.cpp
code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaObviousView.cpp
code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaPresenter.cpp
code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaSuccessView.cpp
code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaUpdateNowView.cpp
code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaUpdatingView.cpp
code/sdk/application/wearable/ln/nativeapp/nativeui/ota/src/OtaView.cpp

index 5f1c83a..83ad733 100644 (file)
@@ -35,6 +35,7 @@ namespace OHOS
         UILabelExt *RemindLabel{nullptr};
         UIImageView *RemindIcon{nullptr};
         UIImageView *RemindIcon2{nullptr};
+        UIImageView *RemindIcon1{nullptr};
     };
 }
 
index 1fd3430..5915a35 100644 (file)
@@ -31,8 +31,10 @@ namespace OHOS
         UIViewGroup *group{nullptr};
         UIImageView *background{nullptr};
         UILabelExt *TextLabel{nullptr};
+        UILabelExt *LittleTextLabel{nullptr};
         UILabelExt *RemindLabel{nullptr};
         UIImageView *RemindIcon{nullptr};
+        UIImageView *RemindIcon1{nullptr};
     };
 }
 
index 9b99c53..adc2f7b 100644 (file)
@@ -87,11 +87,16 @@ namespace OHOS
         void ClearAll();
         UIViewGroup* CreateIndependentStatusBar(); // 创建独立的状态栏
         
+        // 各个子界面的UI创建方法
+        UIViewGroup* CreateOtaNormalView();        // 创建正常升级界面
+        UIViewGroup* CreateOtaUpdatingView();      // 创建更新中界面
+        
 
 
         int16_t currentView_;
         UIViewGroup *group[MAX_OTA_VIEW]{nullptr};
         UIScrollView *ScrollView_{nullptr};
+        UIImageView *backgroundImageView{nullptr};  // 最底层背景图片
 
         UIViewGroup *group1{nullptr};
         UILabelExt *timeLabel{nullptr};
index 48ff60e..e9dc58e 100644 (file)
@@ -46,14 +46,8 @@ namespace OHOS
         }
 
         // 创建背景
-        background = new UIImageView();
-        if (background) {
-            background->SetAutoEnable(false);
-            background->SetPosition(0, 0, 360, 360);
-            background->SetResizeMode(UIImageView::COVER);
-            background->SetSrc("/user/res/yellowbg.bin");
-            group->Add(background);
-        }
+        // 背景图已移至OtaView.cpp作为最底层背景
+        
 
         // 创建文本标签
         TextLabel = new UILabelExt();
index 439a761..dbab9c7 100644 (file)
@@ -43,20 +43,12 @@ namespace OHOS
             group->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
         }
 
-        // 创建背景
-        background = new UIImageView();
-        if (background) {
-            background->SetAutoEnable(false);
-            background->SetPosition(0, 0, 360, 360);
-            background->SetResizeMode(UIImageView::COVER);
-            background->SetSrc("/user/res/yellowbg.bin");
-            group->Add(background);
-        }
+        // 背景图已移至OtaView.cpp作为最底层背景
 
         // 创建文本标签
         TextLabel = new UILabelExt();
         if (TextLabel) {
-            TextLabel->SetPosition(90, 102, 180, 42);
+            TextLabel->SetPosition(127, 122, 150, 42);
             TextLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
             TextLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 24);
             TextLabel->SetStyle(STYLE_TEXT_COLOR, 0xffffffff);
@@ -68,11 +60,8 @@ namespace OHOS
         // 创建小文本标签
         LittleTextLabel = new UILabelExt();
         if (LittleTextLabel) {
-            LittleTextLabel->SetPosition(60, 162, 240, 28);
-            LittleTextLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
-            LittleTextLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 18);
-            LittleTextLabel->SetStyle(STYLE_TEXT_COLOR, 0xffcccccc);
-            LittleTextLabel->SetText("更新过程中出现错误");
+            LittleTextLabel->SetPosition(70, 184, 220, 28);
+            LittleTextLabel->SetText("请检查网络和电量后重试");
             LittleTextLabel->SetVisible(true);
             group->Add(LittleTextLabel);
         }
@@ -99,6 +88,13 @@ namespace OHOS
             RemindIcon->SetVisible(true);
             group->Add(RemindIcon);
         }
+        if (RemindIcon1)
+        {
+            RemindIcon1->SetPosition(83, 124, 36, 36);
+            RemindIcon1->SetSrc("/user/res/warning.bin");
+            RemindIcon1->SetVisible(true);
+            group->Add(RemindIcon1);
+        }
 
         // 创建第二个提示图标
         RemindIcon2 = new UIImageView();
@@ -122,12 +118,12 @@ namespace OHOS
             group = nullptr;
         }
         
-        if (background) { delete background; background = nullptr; }
+        // background已移至OtaView.cpp,无需在此清理
         if (TextLabel) { delete TextLabel; TextLabel = nullptr; }
         if (LittleTextLabel) { delete LittleTextLabel; LittleTextLabel = nullptr; }
-        if (TextLabel) { delete TextLabel; TextLabel = nullptr; }
         if (RemindLabel) { delete RemindLabel; RemindLabel = nullptr; }
         if (RemindIcon) { delete RemindIcon; RemindIcon = nullptr; }
         if (RemindIcon2) { delete RemindIcon2; RemindIcon2 = nullptr; }
+        if (RemindIcon1) { delete RemindIcon1; RemindIcon1 = nullptr; }
     }
 }
index 43da117..651c249 100644 (file)
@@ -43,14 +43,8 @@ namespace OHOS
         }
 
         // 创建背景
-        background = new UIImageView();
-        if (background) {
-            background->SetAutoEnable(false);
-            background->SetPosition(0, 0, 360, 360);
-            background->SetResizeMode(UIImageView::COVER);
-            background->SetSrc("/user/res/yellowbg.bin");
-            group->Add(background);
-        }
+        // 背景图已移至OtaView.cpp作为最底层背景
+        
 
         // 创建文本标签
         TextLabel = new UILabelExt();
index 33cc037..162ddd9 100644 (file)
@@ -43,14 +43,8 @@ namespace OHOS
         }
 
         // 创建背景
-        background = new UIImageView();
-        if (background) {
-            background->SetAutoEnable(false);
-            background->SetPosition(0, 0, 360, 360);
-            background->SetResizeMode(UIImageView::COVER);
-            background->SetSrc("/user/res/yellowbg.bin");
-            group->Add(background);
-        }
+        // 背景图已移至OtaView.cpp作为最底层背景
+        
 
         // 创建文本标签
         TextLabel = new UILabelExt();
index b8add05..8b7940a 100644 (file)
@@ -140,6 +140,8 @@ namespace OHOS
         // 检查内存是否足够(至少100MB)
         // TODO: 实现实际的内存检查
         // int freeMemory = get_free_memory();
+        const char* memoryInfo = get_system_memory_info();
+        printf("memoryInfo: %s\r\n", memoryInfo);
         int freeMemory = 200; // 暂时返回200MB可用内存
         return (freeMemory >= 100);
     }
index 42ab949..a1e07b6 100644 (file)
@@ -43,14 +43,8 @@ namespace OHOS
         }
 
         // 创建背景
-        background = new UIImageView();
-        if (background) {
-            background->SetAutoEnable(false);
-            background->SetPosition(0, 0, 360, 360);
-            background->SetResizeMode(UIImageView::COVER);
-            background->SetSrc("/user/res/yellowbg.bin");
-            group->Add(background);
-        }
+        // 背景图已移至OtaView.cpp作为最底层背景
+        
 
         // 创建文本标签
         TextLabel = new UILabelExt();
index ff75906..bcbfdb7 100644 (file)
@@ -44,14 +44,8 @@ namespace OHOS
         }
 
         // 创建背景
-        background = new UIImageView();
-        if (background) {
-            background->SetAutoEnable(false);
-            background->SetPosition(0, 0, 360, 360);
-            background->SetResizeMode(UIImageView::COVER);
-            background->SetSrc("/user/res/yellowbg.bin");
-            group->Add(background);
-        }
+        // 背景图已移至OtaView.cpp作为最底层背景
+        
 
         // 创建文本标签
         TextLabel = new UILabelExt();
index 6b3dcfc..1f020ee 100644 (file)
@@ -44,14 +44,8 @@ namespace OHOS
         }
 
         // 创建背景
-        background = new UIImageView();
-        if (background) {
-            background->SetAutoEnable(false);
-            background->SetPosition(0, 0, 360, 360);
-            background->SetResizeMode(UIImageView::COVER);
-            background->SetSrc("/user/res/yellowbg.bin");
-            group->Add(background);
-        }
+        // 背景图已移至OtaView.cpp作为最底层背景
+        
 
         // 创建文本标签
         TextLabel = new UILabelExt();
index fd1c66f..cbe21bf 100644 (file)
@@ -42,15 +42,7 @@ namespace OHOS
             group->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
         }
 
-        // 创建背景
-        background = new UIImageView();
-        if (background) {
-            background->SetAutoEnable(false);
-            background->SetPosition(0, 0, 360, 360);
-            background->SetResizeMode(UIImageView::COVER);
-            background->SetSrc("/user/res/yellowbg.bin");
-            group->Add(background);
-        }
+        // 背景图已移至OtaView.cpp作为最底层背景
         // 创建文本标签
         TextLabel = new UILabelExt();
         if (TextLabel) {
@@ -133,10 +125,7 @@ namespace OHOS
         }
         
         // 显式删除所有UI组件
-        if (background) {
-            delete background;
-            background = nullptr;
-        }
+        // background已移至OtaView.cpp,无需在此清理
         if (TextLabel) {
             delete TextLabel;
             TextLabel = nullptr;
index be22c56..51ddb48 100644 (file)
@@ -43,15 +43,7 @@ namespace OHOS
             group->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
         }
 
-        // 创建背景
-        background = new UIImageView();
-        if (background) {
-            background->SetAutoEnable(false);
-            background->SetPosition(0, 0, 360, 360);
-            background->SetResizeMode(UIImageView::COVER);
-            background->SetSrc("/user/res/yellowbg.bin");
-            group->Add(background);
-        }
+        // 背景图已移至OtaView.cpp作为最底层背景
 
         // 创建文本标签
         TextLabel = new UILabelExt();
@@ -123,7 +115,7 @@ namespace OHOS
             group = nullptr;
         }
         
-        if (background) { delete background; background = nullptr; }
+        // background已移至OtaView.cpp,无需在此清理
         if (TextLabel) { delete TextLabel; TextLabel = nullptr; }
         if (LittleTextLabel) { delete LittleTextLabel; LittleTextLabel = nullptr; }
         if (TextLabel) { delete TextLabel; TextLabel = nullptr; }
index 42ab8af..4495bbf 100644 (file)
@@ -267,31 +267,42 @@ namespace OHOS
                     else if (currentView == OtaView::OTA_VIEW_NIGHT_UPDATE) {
                       //夜间升级
                         //夜间升级操作
-
                         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) {
                       //夜间升级成功
                         NativeAbility::GetInstance().SwitchSlice(VIEW_THUNDER_BIRD);
                     }
+                    //倒计时界面确认,开始升级,定时器停止,进入升级中界面
+                    else if (currentView == OtaView::OTA_VIEW_COUNTDOWN) {
+                        do_ln_http_server_send_data(LN_HTTP_SERVICE_CMD_OTA_DOWNLOAD, NULL, 0);
+                        OtaModel::GetInstance()->StopCountdownTimer();
+                        OtaView::GetInstance()->ChangeView(OtaView::OTA_VIEW_COUNTDOWN, OtaView::OTA_VIEW_UPDATING);
+                    }
+                    //升级失败界面重试
+                    else if (currentView == OtaView::OTA_VIEW_UPDATE_FAILED) {
+                        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "升级失败界面重试");
+                        OtaView::GetInstance()->ChangeView(OtaView::OTA_VIEW_UPDATE_FAILED, OtaView::OTA_VIEW_COUNTDOWN);
+                    }
                     break;
 
                 case static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_VENDOR_DOWN)://VENDOR_DOWN键
                 if (currentView == OtaView::OTA_VIEW_NORMAL) {
                     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "普通升级界面跳转升级中");
-
                     OtaView::GetInstance()->ChangeView(OtaView::OTA_VIEW_NORMAL, OtaView::OTA_VIEW_NIGHT_UPDATE);
                 }
                 else if (currentView == OtaView::OTA_VIEW_UPDATE_NOW) {
                     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "强制升级界面跳转升级中");
-
                     OtaView::GetInstance()->ChangeView(OtaView::OTA_VIEW_UPDATE_NOW, OtaView::OTA_VIEW_NIGHT_UPDATE);
                 }
-                else if (currentView == OtaView::OTA_VIEW_NIGHT_UPDATE) {
+                else if (currentView == OtaView::OTA_VIEW_NIGHT_UPDATE_SUCCESS || currentView == OtaView::OTA_VIEW_NIGHT_UPDATE || currentView == OtaView::OTA_VIEW_COUNTDOWN) {
                     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "夜间升级界面跳转普通升级");
                     NativeAbility::GetInstance().SwitchSlice(VIEW_THUNDER_BIRD);
                 }
-                
+                else if (currentView == OtaView::OTA_VIEW_NETWORK_ERROR || currentView == OtaView::OTA_VIEW_LOW_BATTERY || currentView == OtaView::OTA_VIEW_MEMORY_ERROR ||currentView == OtaView::OTA_VIEW_UPDATE_FAILED) {
+                    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "网络异常、电量不足、内存不足界面跳转普通升级");
+                    NativeAbility::GetInstance().SwitchSlice(VIEW_THUNDER_BIRD);
+                }
                        
                     break;
             }    
index ff5bf86..5987916 100644 (file)
@@ -45,27 +45,28 @@ namespace OHOS
         }
 
         // 创建背景
-        background = new UIImageView();
-        if (background) {
-            background->SetAutoEnable(false);
-            background->SetPosition(0, 0, 360, 360);
-            background->SetResizeMode(UIImageView::COVER);
-            background->SetSrc("/user/res/yellowbg.bin");
-            group->Add(background);
-        }
+        // 背景图已移至OtaView.cpp作为最底层背景
+        
 
         // 创建文本标签
         TextLabel = new UILabelExt();
         if (TextLabel) {
-            TextLabel->SetPosition(90, 102, 180, 84);
+            TextLabel->SetPosition(127, 122, 164, 42);
             TextLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
             TextLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 24);
             TextLabel->SetStyle(STYLE_TEXT_COLOR, 0xffffffff);
-            TextLabel->SetText("设定成功!\n记得充好电哦");
             TextLabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
+            TextLabel->SetText("更新成功");
             TextLabel->SetVisible(true);
             group->Add(TextLabel);
         }
+        if (LittleTextLabel)
+        {
+            LittleTextLabel->SetPosition(80, 184, 220, 28);
+            LittleTextLabel->SetText("你的设备已是最新版本");
+            LittleTextLabel->SetVisible(true);
+            group->Add(LittleTextLabel);
+        }
 
         // 创建提示标签
         RemindLabel = new UILabelExt();
@@ -78,18 +79,20 @@ namespace OHOS
             RemindLabel->SetVisible(true);
             group->Add(RemindLabel);
         }
-
-        // 创建提示图标
-        RemindIcon = new UIImageView();
-        if (RemindIcon) {
-            RemindIcon->SetAutoEnable(false);
+        if (RemindIcon)
+        {
             RemindIcon->SetPosition(160, 277, 22, 22);
-            RemindIcon->SetResizeMode(UIImageView::CONTAIN);
-            RemindIcon->SetSrc("/user/res/volume_down.bin");
+            RemindIcon->SetSrc("/user/res/volume_up.bin");
             RemindIcon->SetVisible(true);
             group->Add(RemindIcon);
         }
-        
+        if (RemindIcon1)
+        {
+            RemindIcon1->SetPosition(98, 124, 36, 36);
+            RemindIcon1->SetSrc("/user/res/completed.bin");
+            RemindIcon1->SetVisible(true);
+            group->Add(RemindIcon1);
+        }
         return group;
     }
 
@@ -101,10 +104,12 @@ namespace OHOS
             group = nullptr;
         }
         
-        if (background) { delete background; background = nullptr; }
+        // background已移至OtaView.cpp,无需在此清理
         if (TextLabel) { delete TextLabel; TextLabel = nullptr; }
+        if (LittleTextLabel) { delete LittleTextLabel; LittleTextLabel = nullptr; }
         if (RemindLabel) { delete RemindLabel; RemindLabel = nullptr; }
         if (RemindIcon) { delete RemindIcon; RemindIcon = nullptr; }
+        if (RemindIcon1) { delete RemindIcon1; RemindIcon1 = nullptr; }
     }
 
 }
index b9486bc..c41183e 100644 (file)
@@ -43,14 +43,8 @@ namespace OHOS
         }
 
         // 创建背景
-        background = new UIImageView();
-        if (background) {
-            background->SetAutoEnable(false);
-            background->SetPosition(0, 0, 360, 360);
-            background->SetResizeMode(UIImageView::COVER);
-            background->SetSrc("/user/res/yellowbg.bin");
-            group->Add(background);
-        }
+        // 背景图已移至OtaView.cpp作为最底层背景
+        
 
         // 创建文本标签
         TextLabel = new UILabelExt();
@@ -120,7 +114,7 @@ namespace OHOS
             group = nullptr;
         }
         
-        if (background) { delete background; background = nullptr; }
+        // background已移至OtaView.cpp,无需在此清理
         if (TextLabel) { delete TextLabel; TextLabel = nullptr; }
         if (LittleTextLabel) { delete LittleTextLabel; LittleTextLabel = nullptr; }
         if (TextLabel) { delete TextLabel; TextLabel = nullptr; }
index c9b0e25..442e237 100644 (file)
@@ -45,36 +45,29 @@ namespace OHOS
             group->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
         }
 
-        // 创建背景
-        background = new UIImageView();
-        if (background) {
-            background->SetAutoEnable(false);
-            background->SetResizeMode(UIImageView::CONTAIN);
-            background->SetPosition(0, 0, 360, 360);
-            background->SetResizeMode(UIImageView::COVER);
-            background->SetSrc("/user/res/yellowbg.bin");
-            group->Add(background);
-        }
+        // 背景图已移至OtaView.cpp作为最底层背景
 
         // 创建标题标签
         titleLabel = new UILabelExt();
         if (titleLabel) {
+            titleLabel->SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS); 
+            titleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+            titleLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
             titleLabel->SetPosition(90, 108, 180, 82);
             titleLabel->SetText("更新中\n请勿关闭设备");
             titleLabel->SetVisible(true);
             group->Add(titleLabel);
         }
-
         // 创建进度条
         progressBar = new UIBoxProgress();
         if (progressBar) {
-            progressBar->SetPosition(80, 150, 200, 20);
-            progressBar->SetValidWidth(200);
-            progressBar->SetValidHeight(20);
+            progressBar->SetPosition(56, 279, 248, 4);
             progressBar->SetRange(100, 0);
-            progressBar->SetStyle(STYLE_BORDER_RADIUS, 10);
-            progressBar->SetBackgroundStyle(STYLE_BACKGROUND_COLOR, 0xff333333);
-            progressBar->SetForegroundStyle(STYLE_BACKGROUND_COLOR, 0xff45A5FF);
+            progressBar->SetBackgroundStyle(STYLE_BACKGROUND_OPA, 0xff);
+            progressBar->SetBackgroundStyle(STYLE_BACKGROUND_COLOR, 0xffb4a9a0);
+            progressBar->SetForegroundStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);
+            progressBar->SetForegroundStyle(STYLE_TEXT_COLOR, 0xff000000);
+            progressBar->SetForegroundStyle(STYLE_LINE_COLOR, 0xff45A5FF);
             progressBar->SetValue(0);
             group->Add(progressBar);
         }
@@ -82,7 +75,7 @@ namespace OHOS
         // 创建进度百分比标签
         LittleTextLabel = new UILabelExt();
         if (LittleTextLabel) {
-            LittleTextLabel->SetPosition(56, 180, 44, 28);
+            LittleTextLabel->SetPosition(56, 243, 44, 28);
             LittleTextLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
             LittleTextLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 18);
             LittleTextLabel->SetStyle(STYLE_TEXT_COLOR, 0xffffffff);
@@ -114,7 +107,7 @@ namespace OHOS
             group = nullptr;
         }
         
-        if (background) { delete background; background = nullptr; }
+        // background已移至OtaView.cpp,无需在此清理
         if (titleLabel) { delete titleLabel; titleLabel = nullptr; }
         if (LittleTextLabel) { delete LittleTextLabel; LittleTextLabel = nullptr; }
         if (RemindLabel) { delete RemindLabel; RemindLabel = nullptr; }
index 4272320..2b6b696 100644 (file)
@@ -66,6 +66,17 @@ namespace OHOS
             AddViewToRootContainer(ScrollView_);
         }
 
+        // 创建最底层背景图片
+        backgroundImageView = new UIImageView();
+        if (backgroundImageView) {
+            backgroundImageView->SetAutoEnable(false);
+            backgroundImageView->SetPosition(0, 0, 360, 360);
+            backgroundImageView->SetResizeMode(UIImageView::COVER);
+            backgroundImageView->SetSrc("/user/res/yellowbg.bin");
+            ScrollView_->Add(backgroundImageView);
+            WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Background image added to ScrollView");
+        }
+
         int otaStatus = ThunderBirdModel::GetInstance()->GetOtaStatus();
         if(otaStatus == OTA_UI_STATUS_OPTIONAL_START)//选择升级
         {
@@ -336,7 +347,9 @@ namespace OHOS
             group[hideView]->SetVisible(false);
         }
         ClickFunc(showView);
+        group[showView]->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
         group[showView]->SetVisible(true);
+        
         ScrollView_->Invalidate();
     }
 
@@ -348,15 +361,77 @@ namespace OHOS
 
     void OtaView::ClearAll()
     {
-        // 清理所有视图组
+        // 清理所有视图组 - 先从ScrollView中移除,然后让各个view对象自己清理
         for (int i = 0; i < MAX_OTA_VIEW; i++) {
             if (group[i]) {
-                group[i]->RemoveAll();
-                delete group[i];
+                // 先从ScrollView中移除
+                if (ScrollView_) {
+                    ScrollView_->Remove(group[i]);
+                }
+                // 不在这里删除group[i],让各个view对象自己清理
                 group[i] = nullptr;
             }
         }
         
+        // 清理状态栏相关视图
+        if (group1) {
+            // 先从ScrollView中移除
+            if (ScrollView_) {
+                ScrollView_->Remove(group1);
+            }
+            // 清理状态栏子视图
+            if (timeLabel) {
+                group1->Remove(timeLabel);
+                delete timeLabel;
+                timeLabel = nullptr;
+            }
+            if (NoSignal) {
+                group1->Remove(NoSignal);
+                delete NoSignal;
+                NoSignal = nullptr;
+            }
+            for (int i = 0; i < 4; i++) {
+                if (showSignalStrength[i]) {
+                    group1->Remove(showSignalStrength[i]);
+                    delete showSignalStrength[i];
+                    showSignalStrength[i] = nullptr;
+                }
+            }
+            if (batteryimage) {
+                group1->Remove(batteryimage);
+                delete batteryimage;
+                batteryimage = nullptr;
+            }
+            if (progress) {
+                group1->Remove(progress);
+                delete progress;
+                progress = nullptr;
+            }
+            if (batteryLabel) {
+                group1->Remove(batteryLabel);
+                delete batteryLabel;
+                batteryLabel = nullptr;
+            }
+            if (chargeBatteryicon) {
+                group1->Remove(chargeBatteryicon);
+                delete chargeBatteryicon;
+                chargeBatteryicon = nullptr;
+            }
+            // 最后删除group1
+            group1->RemoveAll();
+            delete group1;
+            group1 = nullptr;
+        }
+        
+        // 清理背景图片
+        if (backgroundImageView) {
+            if (ScrollView_) {
+                ScrollView_->Remove(backgroundImageView);
+            }
+            delete backgroundImageView;
+            backgroundImageView = nullptr;
+        }
+        
         // 清理滚动视图
         if (ScrollView_) {
             ScrollView_->RemoveAll();
@@ -364,7 +439,7 @@ namespace OHOS
             ScrollView_ = nullptr;
         }
         
-        // Clean up all view pointers
+        // Clean up all view pointers - these will clean up their own UI components
         if (g_pOtaNormalView) {
             delete g_pOtaNormalView;
             g_pOtaNormalView = nullptr;
@@ -413,8 +488,6 @@ namespace OHOS
             delete g_pOtaNightUpdateSuccessView;
             g_pOtaNightUpdateSuccessView = nullptr;
         }
-        
-
     }
 
 
@@ -629,6 +702,19 @@ namespace OHOS
         // 更新电池进度条
         progress->SetValue(batteryLevel);
 
+        // 根据充电状态和电量设置进度条颜色
+       
+        if (isCharging) {
+            // 充电时显示绿色
+            progress->SetForegroundStyle(STYLE_BACKGROUND_COLOR, Color::Green().full); // 绿色
+        } else if (batteryLevel <= 20) {
+            // 电量低于20%显示红色
+            progress->SetForegroundStyle(STYLE_BACKGROUND_COLOR, Color::Red().full); // 红色
+        } else {
+            // 正常状态显示蓝色
+            progress->SetForegroundStyle(STYLE_BACKGROUND_COLOR, Color::Blue().full); // 蓝色
+        }
+
         // 更新充电图标显示
         chargeBatteryicon->SetVisible(isCharging);
     }