uapi_stop_tts函数调用优化,解决在打断对话时候未及时调用问题 2105/1 2105/head 2106/target/1
authorluozheng <1732036298@qq.com>
Wed, 20 Aug 2025 03:49:12 +0000 (11:49 +0800)
committerluozheng <1732036298@qq.com>
Wed, 20 Aug 2025 03:49:12 +0000 (11:49 +0800)
code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp
code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp

index 83c078e..4e425ef 100644 (file)
@@ -1775,13 +1775,13 @@ namespace OHOS
     static osTimerId_t g_uapi_stop_tts_Handle = nullptr;
     static void AI4G_UAPI_STOP_TTS_CallbackProc(int data)
     {
-        uapi_stop_tts();
         AiVoiceModel::GetInstance().stop_uapi_stop_tts_timer();
     }
 
     static void AI4G_UAPI_STOP_TTS_Callback(int data)
     {
-        GraphicService::GetInstance()->PostGraphicEvent(std::bind(AI4G_UAPI_STOP_TTS_CallbackProc, data));
+        AI4G_UAPI_STOP_TTS_CallbackProc(data);
+        // GraphicService::GetInstance()->PostGraphicEvent(std::bind(AI4G_UAPI_STOP_TTS_CallbackProc, data));
     }
 
     void AiVoiceModel::start_uapi_stop_tts_timer(uint32_t interval)
@@ -1832,6 +1832,8 @@ namespace OHOS
                 WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "osTimerDelete failed, ret = %lx!!", ret);
             }
             g_uapi_stop_tts_Handle = nullptr;
+            uapi_stop_tts();
+            // uapi_UI_start_asr(1);
         }
     }
 
index b5c3d97..42062b2 100644 (file)
@@ -348,6 +348,7 @@ namespace OHOS
             AiVoiceModel::GetInstance().SetIsLimitDisplayed(false);
             AiVoiceModel::GetInstance().stop_ai4g_tts_play_timer();
             AiVoiceModel::GetInstance().stop_update_ai_answer_timer();
+            AiVoiceModel::GetInstance().stop_uapi_stop_tts_timer();
             break;
             
         case AIVOICE_4GSERVICECON_VIEW:
@@ -587,6 +588,7 @@ namespace OHOS
                 if (model->GetSelect4gorbt() == AI_SELECT_4G)
                 {
                     AiVoiceModel::GetInstance().stop_ai4g_tts_play_timer();
+                    AiVoiceModel::GetInstance().stop_uapi_stop_tts_timer();
                     // usleep(50000);
                     set_clear_queue_stream(1);
                     LOS_Msleep(100);
@@ -604,6 +606,7 @@ namespace OHOS
                 if (model->GetSelect4gorbt() == AI_SELECT_4G)
                 {
                     AiVoiceModel::GetInstance().stop_ai4g_tts_play_timer();
+                    AiVoiceModel::GetInstance().stop_uapi_stop_tts_timer();
                     set_clear_queue_stream(1);
                     LOS_Msleep(100);
                     dinit_ai_task();