优化开发调试专用窗口弹窗 1082/1
authorluozheng <1732036298@qq.com>
Thu, 3 Oct 2024 05:34:32 +0000 (13:34 +0800)
committerluozheng <1732036298@qq.com>
Thu, 3 Oct 2024 05:34:32 +0000 (13:34 +0800)
code/sdk/application/wearable/service/msg_center/include/notify/debug_output_notification/debug_output_notification.h
code/sdk/application/wearable/service/msg_center/src/notify/debug_output_notification/debug_output_notification.cpp

index 8081923..b8d622e 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-10-02 14:12:12
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-10-03 11:08:44
+ * @LastEditTime: 2024-10-03 13:29:50
  * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/include/notify/debug_output_notification.h
  */
 #ifndef DEBUG_OUTPUT_NOTIFICATION_H
@@ -27,6 +27,7 @@ namespace OHOS
         bool ClickFunc(int16_t interface);
         bool CheckViewParam(int16_t hideView, int16_t showView);
         void ChangeView(int16_t hideView, int16_t showView);
+        void DestroyTempView(int16_t hideView);
         void SetCurViewIndex(int16_t viewNum);
         int GetCurViewIndex(void);
         void InitDebugOutputItem();
index 5456611..14ed910 100644 (file)
@@ -101,9 +101,37 @@ namespace OHOS
         return result;
     }
 
-    std::string DebugOutputViewEventListener::get_runtime_status_t(void)
+    std::string DebugOutputViewEventListener::get_runtime_status_t()
     {
-        std::string result;
+        std::string result = "enter_safemode:" + std::to_string(uapi_dev_runtime_get_safemode_flag()) + " ";
+        result += "in_silent_mode: ";
+        result += "in_lowpower_mode: ";
+        result += "stepcount: ";
+        result += "vibmod:" + std::to_string(uapi_dev_runtime_get_vibmod()) + " ";
+        result += "current_dial_name:" + std::string(uapi_dev_runtime_get_dialname()) + " ";
+        result += "time_hour_show_model:" + std::to_string(uapi_dev_runtime_get_time_hour_show_model()) + " ";
+        result += "sleep_monitoring_status:" + std::to_string(uapi_dev_runtime_get_sleep_monitoring_status()) + " ";
+        result += "sleep_status:" + std::to_string(uapi_dev_runtime_get_sleep_status()) + " ";
+        result += "nap_status:" + std::to_string(uapi_dev_runtime_get_nap_status()) + " ";
+        result += "nap_monitoring_status:" + std::to_string(uapi_dev_runtime_get_nap_monitoring_status()) + " ";
+        result += "sedentary_status:" + std::to_string(uapi_dev_runtime_get_sedentary_status()) + " ";
+        result += "drinkremind_status:" + std::to_string(uapi_dev_runtime_get_drinkremind_status()) + " ";
+        result += "train_status:" + std::to_string(uapi_dev_runtime_get_train_status()) + " ";
+        result += "saveele_status:" + std::to_string(uapi_dev_runtime_get_saveele_status()) + " ";
+        result += "lock_status:" + std::to_string(uapi_dev_runtime_get_lock_status()) + " ";
+        result += "motion_recognition_status:" + std::to_string(uapi_dev_runtime_get_motion_recognition_status()) + " ";
+        result += "sleep_mode_flag:" + std::to_string(uapi_sleep_mode_flag_get()) + " ";
+        result += "absolute_static_state:" + std::to_string(uapi_dev_runtime_get_absolute_static_status()) + " ";
+        result += "checkres_status:" + std::to_string(uapi_dev_runtime_get_checkres_status()) + " ";
+        result += "repair_download_status:" + std::to_string(uapi_dev_runtime_get_repair_download_status()) + " ";
+        result += "hrs_passivity_status:" + std::to_string(uapi_dev_runtime_get_hrs_passivity_flag()) + " ";
+        result += "mmc_status:" + std::to_string(uapi_dev_runtime_get_mmc_status_flag()) + " ";
+        result += "rwlock_status:" + std::to_string(uapi_dev_runtime_get_rwlock_status()) + " ";
+        result += "lock_flag_training:" + std::to_string(uapi_dev_runtime_get_train_storage_status()) + " ";
+        result += "lock_flag_heartrate:" + std::to_string(uapi_dev_runtime_get_heartrate_storage_status()) + " ";
+        result += "lock_flag_blood:" + std::to_string(uapi_dev_runtime_get_bloodoxygen_storage_status()) + " ";
+        result += "lock_flag_sleep:" + std::to_string(uapi_dev_runtime_get_sleep_storage_status());
+
         return result;
     }
 
@@ -117,16 +145,16 @@ namespace OHOS
         else
         {
             DebugOutputItemView *debugOutputItemView = static_cast<DebugOutputItemView *>(&view);
-            int viewIndex = debugOutputItemView->GetViewIndex();
+            viewIndex = debugOutputItemView->GetViewIndex();
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "viewIndex:%d", viewIndex);
             ChangeView(0, 1);
-            if (debugOutputLabel == nullptr)
-            {
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "debugOutputLabel is nullptr");
-                return false;
-            }
             SetCurViewIndex(viewIndex);
         }
+        if (debugOutputLabel == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "debugOutputLabel is nullptr");
+            return false;
+        }
         std::string str;
         switch (viewIndex)
         {
@@ -146,10 +174,9 @@ namespace OHOS
         default:
             break;
         }
-
         if (debugOutputLabelButton)
         {
-            debugOutputLabelButton->SetHeight(debugOutputLabel->GetY() + debugOutputLabel->GetHeight() + 20);
+            debugOutputLabelButton->SetY(debugOutputLabel->GetY() + debugOutputLabel->GetHeight() + 20);
             debugOutputLabelButton->Invalidate();
         }
         debugOutputLabel->Invalidate();
@@ -228,6 +255,27 @@ namespace OHOS
         return true;
     }
 
+    void DebugOutputViewEventListener::DestroyTempView(int16_t hideView)
+    {
+        if (hideView == 1)
+        {
+            DebugGroupView->Remove(DebugScrollView[hideView]);
+            if (DebugScrollView[hideView] != nullptr)
+            {
+                DebugScrollView[hideView]->RemoveAll();
+
+                delete debugOutputLabel;
+                debugOutputLabel = nullptr;
+
+                delete debugOutputLabelButton;
+                debugOutputLabelButton = nullptr;
+
+                delete DebugScrollView[1];
+                DebugScrollView[1] = nullptr;
+            }
+        }
+    }
+
     void DebugOutputViewEventListener::ChangeView(int16_t hideView, int16_t showView)
     {
         if (!CheckViewParam(hideView, showView))
@@ -238,6 +286,7 @@ namespace OHOS
         DebugScrollView[hideView]->SetVisible(false);
         ClickFunc(showView);
         DebugScrollView[showView]->SetVisible(true);
+        DestroyTempView(hideView);
         RootView::GetInstance()->Invalidate();
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "hideView:%d -> showView:%d success!!", hideView, showView);
     }
@@ -454,19 +503,6 @@ namespace OHOS
                 delete DebugScrollView[0];
                 DebugScrollView[0] = nullptr;
             }
-            if (DebugScrollView[1] != nullptr)
-            {
-                DebugScrollView[1]->RemoveAll();
-
-                delete debugOutputLabel;
-                debugOutputLabel = nullptr;
-
-                delete debugOutputLabelButton;
-                debugOutputLabelButton = nullptr;
-
-                delete DebugScrollView[1];
-                DebugScrollView[1] = nullptr;
-            }
             RootView::GetInstance()->Remove(DebugGroupView);
             delete DebugGroupView;
             DebugGroupView = nullptr;