增加必要时间同步操作
authorxue <2144439972@qq.com>
Thu, 27 Nov 2025 09:37:32 +0000 (17:37 +0800)
committerxue <2144439972@qq.com>
Thu, 27 Nov 2025 09:37:32 +0000 (17:37 +0800)
code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp
code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdPresenter.cpp

index 7c05ed4..e89ccd7 100644 (file)
@@ -1545,6 +1545,10 @@ extern "C" {
             {
                 if (init_falg == false) 
                 {
+                    #if defined(SUPPORT_CAT1_SERVICE) || defined(SUPPORT_PPP_SERVICE)
+                    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HandlePowerKey: restart_time_sync");
+                    restart_time_sync();
+                    #endif
                     //发送获取绑定用户ID
                     do_ln_http_server_send_data(LN_HTTP_SERVICE_CMD_GET_USER_ID, NULL, 0);
                     // 网络连接成功,调用HTTP服务获取设备Token
@@ -1649,6 +1653,7 @@ extern "C" {
                         currentSubView == ThunderBirdDialogueView::THUNDERBIRD_DIALOGUEVIEW_LISTENING) {
                         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "聆听界面超时,自动跳转到说话界面");
                         view->ChangeView(currentView, THUNDERBIRD_DIALOGUEVIEW, ThunderBirdDialogueView::THUNDERBIRD_DIALOGUEVIEW_STATUS_SHOW);
+                        ThunderBirdDialogueView::GetInstance()->DialogueFirst = true;
                         ln_ws_end_audio_chat();//结束对话
                         // 退出对话模式时恢复表情
                         AI_ForceInterrupt();
@@ -1664,6 +1669,7 @@ extern "C" {
                         currentSubView == ThunderBirdDialogueView::THUNDERBIRD_DIALOGUEVIEW_SPEAKING) {
                         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "播放界面超时,自动跳转到状态界面");
                         view->ChangeView(currentView, THUNDERBIRD_DIALOGUEVIEW, ThunderBirdDialogueView::THUNDERBIRD_DIALOGUEVIEW_STATUS_SHOW);
+                        ThunderBirdDialogueView::GetInstance()->DialogueFirst = true;
                         ln_ws_end_audio_chat();//结束对话
                         // 退出对话模式时恢复表情
                         AI_ForceInterrupt();
@@ -2737,10 +2743,10 @@ extern "C" {
             int16_t currentView = view->GetCurrentView();
             int16_t currentSubView = view->GetCurrentSubView();
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::HandleAudioRecordingStart: currentView=%d, currentSubView=%d", currentView, currentSubView);
-            
             // 如果当前在对话界面,且不在聆听状态,则跳转到聆听状态
-            if (currentView == THUNDERBIRD_DIALOGUEVIEW && 
-                currentSubView == ThunderBirdDialogueView::THUNDERBIRD_DIALOGUEVIEW_SPEAKING) {
+            if ((currentView == THUNDERBIRD_DIALOGUEVIEW && 
+                currentSubView == ThunderBirdDialogueView::THUNDERBIRD_DIALOGUEVIEW_SPEAKING) 
+                || ThunderBirdDialogueView::GetInstance()->DialogueFirst == false) {
                 WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "录音开始,跳转到聆听状态");
                 view->ChangeView(currentView, THUNDERBIRD_DIALOGUEVIEW, ThunderBirdDialogueView::THUNDERBIRD_DIALOGUEVIEW_LISTENING);
                 ThunderBirdDialogueView::GetInstance()->UpdateDialogueText("超认真聆听中");
index e2aa845..5736366 100644 (file)
@@ -901,6 +901,10 @@ namespace OHOS
      */
     void ThunderBirdPresenter::HandleFuncKeyLongPress(void)
     {
+        #if defined(SUPPORT_CAT1_SERVICE) || defined(SUPPORT_PPP_SERVICE)
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HandleFuncKeyLongPress: restart_time_sync");
+        restart_time_sync();
+        #endif
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdPresenter::HandleFuncKeyLongPress - FUNC key long press detected");
         // 长按FUNC键2秒的处理逻辑
         // 触发对话模式切换
@@ -947,6 +951,10 @@ namespace OHOS
                 
                 // 音频已初始化,直接跳转界面
                 ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_DIALOGUEVIEW, ThunderBirdDialogueView::THUNDERBIRD_DIALOGUEVIEW_LISTENING);
+                if(ThunderBirdDialogueView::GetInstance()->DialogueFirst == true)
+                {
+                    ThunderBirdDialogueView::GetInstance()->dialogue_first();
+                }
                 if(currentView == THUNDERBIRD_GUIDEVIEW)
                 {
                     ThunderBirdDialogueView::GetInstance()->Isband(false);
@@ -996,6 +1004,7 @@ namespace OHOS
                 
                 // 停止实际的音频播放
                 // ai_media_play_stop();
+                ThunderBirdDialogueView::GetInstance()->DialogueFirst = true;
                 WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThunderBirdPresenter::HandleFuncKeyLongPress: Stopped AI audio playback");
                 ln_ws_end_audio_chat();//结束对话