debug界面添加显示亮屏时长和长亮屏状态页面
authorluozheng <1732036298@qq.com>
Mon, 4 Nov 2024 10:43:40 +0000 (18:43 +0800)
committerluozheng <1732036298@qq.com>
Mon, 4 Nov 2024 10:43:40 +0000 (18:43 +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 8eec1dd..24b95ea 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-19 15:52:33
+ * @LastEditTime: 2024-11-04 17:36:14
  * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/include/notify/debug_output_notification.h
  */
 #ifndef DEBUG_OUTPUT_NOTIFICATION_H
@@ -44,6 +44,7 @@ namespace OHOS
         std::string get_nextday_log(void);
         std::string get_heart_rate(void);
         std::string get_popup_windows_log(void);
+        std::string get_system_screen_time(void);
 
       private:
         DebugOutputViewEventListener();
index 0da2390..3914017 100644 (file)
@@ -55,7 +55,7 @@
 #include <string>  
 #include <cstring>  
 #include <cstdint> 
-
+#include "displaybrightness/include/DisplayBrightnessModel.h"
 namespace OHOS
 {
     /**************************************************************************************************** */
@@ -143,6 +143,8 @@ namespace OHOS
         debugOutputItemInfo[index++] = {index, "heart_rate_data"};
         // 弹窗日志
         debugOutputItemInfo[index++] = {index, "popup_windows_log"};
+        //当前系统亮屏时长
+        debugOutputItemInfo[index++] = {index, "current_screen_time"};
         usedLen = index;
         /* -------------------------------- Add data -------------------------------- */
         for (uint8_t i = 0; i < usedLen; i++)
@@ -540,6 +542,18 @@ namespace OHOS
         return str.str(); // 返回拼接后的字符串
     }
 
+    std::string DebugOutputViewEventListener::get_system_screen_time(void)
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DebugOutputViewEventListener::get_system_screen_time");
+
+        std::ostringstream str;
+        str << "当前系统亮屏时长:";
+        std::string timestr =  std::to_string(DisplayBrightnessModel::GetInstance()->GetScreenDurationTime() / 1000)+ "秒";
+        str<<"["<<timestr<<"]\n";
+        str<<"系统是否处于长亮屏状态:";
+        str<<"["<<std::to_string(uapi_dev_runtime_get_screen_always_on_status())<<"]\n";
+        return str.str();
+    }
     bool DebugOutputViewEventListener::OnClick(OHOS::UIView &view, const OHOS::ClickEvent &event)
     {
         std::string viewId = view.GetViewId();
@@ -610,6 +624,9 @@ namespace OHOS
         case 11:
             str = get_popup_windows_log();
             break;
+         case 12:
+            str = get_system_screen_time();
+            break;
         default:
             str = "--";
             break;
@@ -887,7 +904,7 @@ namespace OHOS
             DebugScrollView[0]->SetTouchable(true);
             DebugScrollView[0]->SetThrowDrag(true);
             DebugScrollView[0]->SetScrollBlankSize(70);
-            DebugScrollView[0]->SetReboundSize(30);
+            // DebugScrollView[0]->SetReboundSize(30);
             DebugGroupView->Add(DebugScrollView[0]);
             /* -------------------------------------------------------------------------- */
             if (debugOutputAdapter == nullptr)
@@ -917,12 +934,13 @@ namespace OHOS
                     return nullptr;
                 }
             }
-            debugOutputList->SetPosition(0, 120, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
+            debugOutputList->SetPosition(0, 120, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION - 120);
             debugOutputList->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);
+            debugOutputList->SetThrowDrag(true);
             debugOutputList->EnableAutoAlign(true);      // 设置此列表的自动对齐状态。当滚动停止时,子视图被选中,其位置自动与预设位置对齐
-            debugOutputList->SetThrowDrag(true);         // 设置手指抬起屏幕后是否继续滚动。
-            debugOutputList->SetMaxScrollDistance(1000); // 设置手指抬起屏幕后的最大滚动距离。
-            debugOutputList->SetSwipeACCLevel(200);      /*设置手指抬起屏幕后的补偿距离。*/
+            // debugOutputList->SetThrowDrag(true);         // 设置手指抬起屏幕后是否继续滚动。
+            // debugOutputList->SetMaxScrollDistance(1000); // 设置手指抬起屏幕后的最大滚动距离。
+            // debugOutputList->SetSwipeACCLevel(200);      /*设置手指抬起屏幕后的补偿距离。*/
             debugOutputList->SetAdapter(debugOutputAdapter);
             debugOutputList->RefreshList();
             // debugOutputList->SetReboundSize(30);
@@ -947,7 +965,8 @@ namespace OHOS
             debugOutputbleServiceLabelButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME_EN, 30);
             debugOutputbleServiceLabelButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff000000, UIButton::PRESSED);
             debugOutputbleServiceLabelButton->SetOnClickListener(clickListener);
-            DebugScrollView[0]->Add(debugOutputbleServiceLabelButton);
+            debugOutputbleServiceLabelButton->SetVisible(false);
+            // DebugScrollView[0]->Add(debugOutputbleServiceLabelButton);
             /* -------------------------------------------------------------------------- */
             NotificationManager::GetInstance()->RegisterNotifyCleanupFunction(FreeDebugOutputMainView);
             /* -------------------------------------------------------------------------- */