Merge #1495 into sdk602patch0911 from refs/changes/1495/head
author袁清梦 <3449750381@qq.com>
Fri, 6 Dec 2024 02:16:58 +0000 (02:16 +0000)
committer袁清梦 <3449750381@qq.com>
Fri, 6 Dec 2024 02:16:58 +0000 (02:16 +0000)
系统:优化视频表盘亮屏时序问题

* refs/changes/1495/head: (1 commits squashed)

  - 系统:优化视频表盘亮屏时序问题

Signed-off-by: Caisking <3449750381@qq.com>
Reviewed-by: Caisking <3449750381@qq.com>
Reviewed-by: 罗正 <1732036298@qq.com>
Reviewed-by: aliyun8003852482 <1224667075@qq.com>
Reviewed-by: snickersun@163.com <accounts_62b90f7fcf51ade33b6f628e@mail.teambition.com>
Reviewed-by: aliyun6865282430 <1624952103@qq.com>
Merged-by: Caisking <3449750381@qq.com>
link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/1495
code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp
code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialViewGroup.cpp
code/sdk/application/wearable/service/msg_center/src/notify/message_notification.cpp
code/sdk/application/wearable/service/power_manager/src/actions/display_action.c
code/sdk/drivers/peripheral/utils/custom_utils.c

index 35b0755..7a72e3a 100644 (file)
@@ -94,19 +94,31 @@ namespace OHOS
         }
     }
 
-    void MainPresenterSample::OnPause(void) {}
-
-    void MainPresenterSample::OnResume(void) 
-    {
-    #if IS_SUPPORT_BIND_VOTE
-        if (ConfigModel::GetInstance()->GetisFirstTimeStart() == true)
-        {
-            uapi_remove_bind_vote();//页面已经展示后的调用逻辑。取消绑定投票
-            ConfigModel::GetInstance()->SetisFirstTimeStart(false);
-        }
-    #endif
+    void MainPresenterSample::OnPause(void) {
+    //进行视频表盘的暂停
+    //  WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "暂停视频") ;
+    // DialSetting &setting = GetDialSetting();
+    // if (setting.dialFlag) {
+    //     DialModelTime::GetInstance()->UpdateTime();
+    //     dynamic_cast<DialViewGroup *>(view_->GetViewById(WATCH_FACE))->StopDial();
+    // }
+    }
+
+    void MainPresenterSample::OnResume(void) {
+#if IS_SUPPORT_BIND_VOTE
+    if (ConfigModel::GetInstance()->GetisFirstTimeStart() == true) {
+        uapi_remove_bind_vote(); //页面已经展示后的调用逻辑。取消绑定投票
+        ConfigModel::GetInstance()->SetisFirstTimeStart(false);
+    }
+#endif
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OnResume") ;
+    // //进行视频表盘的恢复
+    // DialSetting &setting = GetDialSetting();
+    // if (setting.dialFlag) {
+    //     DialModelTime::GetInstance()->UpdateTime();
+    //     dynamic_cast<DialViewGroup *>(view_->GetViewById(WATCH_FACE))->StartDial();
+    // }
     }
-
     void MainPresenterSample::OnStop(void)
     {
         if (isCompassSensorOpened_)
index cebaedb..762de71 100644 (file)
@@ -34,19 +34,25 @@ static DialVideoView *g_video = nullptr;
         {
             return;
         }
-        if (status == SCREEN_STATUS_OFF && g_video->IsPlayed())
+        // printf("uapi_dev_runtime_get_transmitting_status() %d\n",uapi_dev_runtime_get_transmitting_status());
+        // printf("ScreenStatusNotify status %d\n", status);
+        // printf("ScreenStatusNotify  g_video->IsPlayed() %d\n", g_video->IsPlayed());
+        if (status == SCREEN_STATUS_OFF)
         {
             g_video->PausePlay();
+            printf("暂停视频\n");
         }
         else if (status == SCREEN_STATUS_ON)
         {
             if (g_video->IsPaused())
             {
-                g_video->ResumePlay();
+              g_video->ResumePlay();
+              printf("恢复视频\n");
             }
             else if (!g_video->IsPlayed())
             {
-                g_video->StartPlay();
+              g_video->StartPlay();
+              printf("开始播放\n");
             }
         }
     }
index 22a30e9..c2e5beb 100644 (file)
@@ -42,12 +42,12 @@ const char *buttonImgSrc = "/user/res/466x100button.bin";
 #define DELETEBUTTON "delete_button"
 
 MessageViewEventListener::MessageViewEventListener() {
-  WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
+  WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,
                 "MessageViewEventListener::MessageViewEventListener");
 }
 
 MessageViewEventListener::~MessageViewEventListener() {
-  WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
+  WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,
                 "MessageViewEventListener::~MessageViewEventListener");
 }
 
@@ -57,7 +57,7 @@ MessageViewEventListener &MessageViewEventListener::GetInstance() {
 }
 bool MessageViewEventListener::OnRelease(UIView &view,
                                          const ReleaseEvent &event) {
-  WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MessageViewEventListener::OnRelease");
+  WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MessageViewEventListener::OnRelease");
   UNUSED(event);
   if (strcmp(view.GetViewId(), DELETEBUTTON) == 0) {
     NotificationManager::GetInstance()->StopNotify();
@@ -68,7 +68,7 @@ bool MessageViewEventListener::OnRelease(UIView &view,
   return true;
 }
 bool MessageViewEventListener::OnDrag(UIView &view, const DragEvent &event) {
-  WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MessageViewEventListener::OnDrag");
+  WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MessageViewEventListener::OnDrag");
   UNUSED(view);
   NotificationManager::GetInstance()->StopNotify();
   // 点击关闭之后通知list进行刷新
@@ -77,7 +77,7 @@ bool MessageViewEventListener::OnDrag(UIView &view, const DragEvent &event) {
 }
 
 bool MessageViewEventListener::OnDragEnd(UIView &view, const DragEvent &event) {
-  WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MessageViewEventListener::OnDragEnd");
+  WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MessageViewEventListener::OnDragEnd");
   if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) {
     NotificationManager::GetInstance()->StopNotify();
   }
@@ -86,14 +86,14 @@ bool MessageViewEventListener::OnDragEnd(UIView &view, const DragEvent &event) {
 
 /*创建信息弹窗*/
 UIViewGroup *CreateMessageView(void) {
-  WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateMessageView");
+  WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CreateMessageView");
   if (MessageGroupView == nullptr) {
     MessageGroupView = new UIViewGroup();
-    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,
                   "[CreateMessageView] MessageGroupView new %p",
                   MessageGroupView);
     if (MessageGroupView == nullptr) {
-      WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
+      WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,
                     "[CreateMessageView] MessageGroupView new fail!!");
       return nullptr;
     }
@@ -107,7 +107,7 @@ UIViewGroup *CreateMessageView(void) {
         static_cast<UIView::OnDragListener *>(
             &MessageViewEventListener::GetInstance());
     if (dragListener == nullptr) {
-      WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
+      WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,
                     "[CreateMessageView] dragListener new fail!!");
       return nullptr;
     }
@@ -126,14 +126,14 @@ UIViewGroup *CreateMessageView(void) {
     messageStr = "--";
   }
   /*初始化label*/
-  WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitView");
+  WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "InitView");
   /* --------------------------------------------------------------------------*/
   if (titleLabel == nullptr) {
     titleLabel = new UILabel();
-    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "titleLabel:: new UILabel %p",
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "titleLabel:: new UILabel %p",
                   titleLabel);
     if (titleLabel == nullptr) {
-      WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "titleLabel:: new UILabel fail");
+      WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "titleLabel:: new UILabel fail");
       return nullptr; // 内存分配失败,返回
     }
     titleLabel->SetPosition(83, 60, 300, 35);
@@ -146,16 +146,16 @@ UIViewGroup *CreateMessageView(void) {
     titleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
     titleLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
     titleLabel->SetVisible(true);
-    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "titleLabel is ok!");
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "titleLabel is ok!");
   }
   /* --------------------------------------------------------------------------
    */
   if (timeLabel == nullptr) {
     timeLabel = new UILabel();
-    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "timeLabel:: new UILabel %p",
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "timeLabel:: new UILabel %p",
                   timeLabel);
     if (timeLabel == nullptr) {
-      WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "timeLabel:: new UILabel fail");
+      WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "timeLabel:: new UILabel fail");
       return nullptr; // 内存分配失败,返回
     }
     timeLabel->SetPosition(73, 104, 320, 33);
@@ -167,17 +167,17 @@ UIViewGroup *CreateMessageView(void) {
     timeLabel->SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS);
     timeLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
     timeLabel->SetVisible(true);
-    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "timeLabel is ok!");
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "timeLabel is ok!");
   }
   /* --------------------------------------------------------------------------
    */
   /*初始化消息内容*/
   if (messageLabel == nullptr) {
     messageLabel = new UILabel();
-    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "messageLabel:: new UILabel %p",
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "messageLabel:: new UILabel %p",
                   messageLabel);
     if (messageLabel == nullptr) {
-      WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "messageLabel:: new UILabel fail");
+      WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "messageLabel:: new UILabel fail");
       return nullptr; // 内存分配失败,返回
     }
     messageLabel->SetPosition(53, 170, 360, 144);
@@ -188,12 +188,12 @@ UIViewGroup *CreateMessageView(void) {
     messageLabel->SetLineBreakMode(UILabel::LINE_BREAK_CLIP); // 换行裁剪
     messageLabel->SetAlign(TEXT_ALIGNMENT_CENTER,
                            TEXT_ALIGNMENT_CENTER); // 居中显示
-    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "messageLabel is ok");
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "messageLabel is ok");
   }
   /*加载清除按键*/
   if (deleteButton == nullptr) {
     deleteButton = new UILabelButtonExt();
-    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,
                   "deleteButton:: new UILabelButtonExt %p", deleteButton);
 
     if (deleteButton == nullptr) {
@@ -216,12 +216,12 @@ UIViewGroup *CreateMessageView(void) {
         static_cast<UIView::OnTouchListener *>(
             &MessageViewEventListener::GetInstance());
     if (TouchListener == nullptr) {
-      WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
+      WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,
                     "[CreateMessageView] TouchListener new fail!!");
       return nullptr;
     }
     deleteButton->SetOnTouchListener(TouchListener);
-    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "deleteButton");
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "deleteButton");
   }
   /* --------------------------------------------------------------------------
    */
@@ -241,13 +241,13 @@ UIViewGroup *CreateMessageView(void) {
   MessageViewEventListener::GetInstance()
       .Message_StartTimer(); // 开启一个3s后弹窗自动销毁定时器
 
-  WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Create MessageGroupView succeed!!");
+  WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Create MessageGroupView succeed!!");
   NotificationManager::GetInstance()->RegisterNotifyCleanupFunction(FreeMessageView);
   return MessageGroupView;
 }
 /*释放消息弹窗视图*/
 void FreeMessageView(void) {
-  WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "FreeMessageView(void)");
+  WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "FreeMessageView(void)");
 
   // //销毁定时器
   MessageViewEventListener::GetInstance().Message_StopTimer();
@@ -255,28 +255,28 @@ void FreeMessageView(void) {
   if (MessageGroupView != nullptr) {
     MessageGroupView->RemoveAll();
 
-    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "titleLabel %p", titleLabel);
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "titleLabel %p", titleLabel);
     delete titleLabel;
     titleLabel = nullptr;
 
-    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "timeLabel %p", timeLabel);
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "timeLabel %p", timeLabel);
     delete timeLabel;
     timeLabel = nullptr;
 
-    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "messageLabel %p", messageLabel);
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "messageLabel %p", messageLabel);
     delete messageLabel;
     messageLabel = nullptr;
 
-    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "deleteButton %p", deleteButton);
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "deleteButton %p", deleteButton);
     delete deleteButton;
     deleteButton = nullptr;
 
-    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MessageGroupView %p",
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MessageGroupView %p",
                   MessageGroupView);
 
     delete MessageGroupView;
     MessageGroupView = nullptr;
-    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Free MessageView succeed!!");
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Free MessageView succeed!!");
   }
   ScreenTurnOff();
   return;
@@ -289,7 +289,7 @@ static osTimerId_t g_timer = NULL;
 
 /*定时器到期时的处理*/
 static void Message_TimerCallbackProc(int data) {
-  WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Message_TimerCallbackProc");
+  WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Message_TimerCallbackProc");
   NotificationManager::GetInstance()->StopNotify();
   // 点击关闭之后通知list进行刷新
   SendMsgToUIService(UI_UPDATE_MESSAGE_DATA, 0, nullptr, 0);
@@ -308,12 +308,12 @@ static void Message_TimerCallback(int data) {
  *  @param interval 时间间隔,单位ms
  */
 void MessageViewEventListener::Message_StartTimer(uint32_t interval) {
-  WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
+  WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,
                 "MessageViewEventListener::Message_StartTimer");
   /* -------------------------- 1.检查定时器是否已经存在,如果存在则返回
    * ------------------------- */
   if (g_timer != NULL) {
-    WEARABLE_LOGE(
+    WEARABLE_LOGD(
         WEARABLE_LOG_MODULE_APP,
         "CountDownModel::CountDown_StartTimer Timer already exists!!");
     return;
@@ -325,7 +325,7 @@ void MessageViewEventListener::Message_StartTimer(uint32_t interval) {
       osTimerNew((osTimerFunc_t)Message_TimerCallback, osTimerOnce, NULL, NULL);
   // 检查定时器创建是否成功
   if (g_timer == NULL) {
-    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,
                   "CountDownModel::CountDown_StartTimer Timer create failed!!");
     return;
   }
@@ -340,7 +340,7 @@ void MessageViewEventListener::Message_StartTimer(uint32_t interval) {
   /* -------------------- 5.检查定时器启动是否成功,如果启动失败,删除定时器并置为
    * NULL -------------------- */
   if (ret != osOK) {
-    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,
                   "[CountDown_StartTimer] osTimerDelete failed, ret = %lx!!",
                   ret);
     if (g_timer != NULL) {
@@ -358,13 +358,13 @@ void MessageViewEventListener::Message_StartTimer(uint32_t interval) {
 void MessageViewEventListener::Message_StopTimer(void) {
   // 检查定时器是否存在
   if (g_timer != NULL) {
-    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,
                   "MessageViewEventListener::Message_StopTimer");
     osTimerStop(g_timer);
     // 删除定时器并置为 NULL
     osStatus_t ret = osTimerDelete(g_timer);
     if (ret != osOK) {
-      WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
+      WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,
                     "osTimerDelete failed, ret = %lx!!", ret);
     }
     g_timer = NULL;
index eb87742..acc67a0 100755 (executable)
@@ -183,6 +183,10 @@ static uint32_t action_display_lcd_on()
 #endif
     lcd_set_status(true);
     g_pms_lcd_on_first_flag = false;
+
+    //增加视频表盘的播放;
+    PRINT("开始亮屏\n");
+
     return ERRCODE_SUCC;
 }
 
@@ -202,6 +206,9 @@ static uint32_t action_display_lcd_off()
         POWER_DISPLAY_PRINT_ERR(0, "\r\nLCD has benn off\r\n");
         return ERRCODE_SUCC;
     }
+    //增加视频表盘的暂停;
+    PRINT("开始灭屏\n");
+    
     last_screen_off_timestamp = get_display_timestamp();
     caculate_screen_on_time();
 #if defined(ENABLE_UIKIT) || defined(ENABLE_LVGL)
index 2304ad2..e049c50 100644 (file)
@@ -29,6 +29,8 @@
 // #include "config/include/ConfigModelC.h"
 #include "upg_porting.h"
 
+#include "soc_lcd_api.h"
+
 #ifdef SUPPORT_TCPIP
 #include "lwip/tcpip.h"
 #endif
@@ -1315,16 +1317,25 @@ int32_t uapi_get_screen_state(void)
  * @brief 亮屏函数
  */
 void uapi_set_screen_on_api(void) {
+#if 0
     PRINT("执行亮屏函数!\n");
     const power_display_svr_api_t *display_api = power_display_svr_get_api();
     // display_api->set_screen_set_keepon_timeout(0);
-    PRINT("目前屏幕状态:%d\n",display_api->get_screen_state());
-    if (display_api->get_screen_state() != SCREEN_ON) {
-        PRINT("执行亮屏操作!\n");
-        display_api->turn_on_screen();
-        return;
+    PRINT("目前屏幕状态:%d %d\n", display_api->get_screen_state(), lcd_get_status());
+    if (display_api->get_screen_state() != SCREEN_ON || lcd_get_status() == false) {
+      PRINT("执行亮屏操作!\n");
+        uint32_t ret = display_api->turn_on_screen();
+        if (ret != ERRCODE_SUCC) {
+           PRINT("亮屏函数执行失败!%d\n",ret);
+        } else {
+          PRINT("亮屏函数执行成功!\n");
+            return;
+        }
     }
-    PRINT("亮屏函数执行失败!\n");
+    PRINT("屏幕状态为亮屏,不进行亮屏!\n");
+#endif
+  const power_display_svr_api_t *display_api = power_display_svr_get_api();
+  display_api->turn_on_screen();
     // 设置屏幕亮5000
     // display_api->set_screen_set_keepon_timeout(5000);
 }