From 000750be141f673cc27a4502a2e2aa5494ef72eb Mon Sep 17 00:00:00 2001 From: xue <2144439972@qq.com> Date: Mon, 2 Mar 2026 19:10:48 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E6=94=B9=E6=8F=90=E9=86=92=E8=B6=85?= =?utf8?q?=E6=97=B6=E9=80=BB=E8=BE=91=E4=B8=BA=E9=9F=B3=E9=A2=91=E7=BB=93?= =?utf8?q?=E6=9D=9F=E8=AE=A1=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../thunderbird/include/ThunderBirdModel.h | 2 ++ .../thunderbird/src/ThunderBirdModel.cpp | 16 ++++++++++++++++ .../thunderbird/src/ThunderBirdReminderView.cpp | 2 +- code/sdk/zhihui/leiniao/imsl_ln/ln_api.c | 2 ++ .../leiniao/ln_api_cpp/ln_api_interface.cpp | 6 ++++++ .../zhihui/leiniao/ln_api_cpp/ln_api_interface.h | 3 +++ 6 files changed, 30 insertions(+), 1 deletion(-) diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdModel.h b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdModel.h index db519315c..afc36ee66 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdModel.h +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdModel.h @@ -39,6 +39,8 @@ namespace OHOS void StartOtaCountdown(uint32_t startVal); void StopOtaCountdown(void); void StartCountUpTimer(uint32_t targetSeconds); + /** 仅当当前在提醒界面时启动 3 秒退出定时器(供 LN_HTTP_SERVICE_CMD_AUDIO_STOP 使用,避免哄睡结束误触) */ + void StartCountUpTimerForDialogueExitIfInSpeaking(void); void StopCountUpTimer(void); void StartFactoryResetTimer(uint32_t delaySeconds); void StopFactoryResetTimer(void); diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp index 151adf415..763a5c1eb 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp @@ -352,6 +352,22 @@ extern "C" { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Count up timer stopped"); } + + // ---------------------- 仅当当前在提醒界面时启动 3 秒退出定时器(供 LN_HTTP_SERVICE_CMD_AUDIO_STOP 使用,避免哄睡结束误触) ---------------------- + void ThunderBirdModel::StartCountUpTimerForDialogueExitIfInSpeaking(void) + { + ThunderBirdMainView *view = ThunderBirdMainView::GetInstance(); + if (view == nullptr) return; + int16_t currentView = view->GetCurrentView(); + int16_t currentSubView = view->GetCurrentSubView(); + if(currentView == THUNDERBIRD_REMINDERVIEW && + currentSubView == ThunderBirdReminderView::THUNDERBIRD_REMINDERVIEW_TASK_REMINDER) { + StartCountUpTimer(3); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "StartCountUpTimerForDialogueExitIfInSpeaking: 在对话说话/聆听界面,启动3秒退出定时器"); + } + // 哄睡/提醒等其它界面不启动,避免误触 + } + int ThunderBirdModel::GetCountUpValue() const { return m_countUpValue; diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdReminderView.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdReminderView.cpp index a4c60a4ba..51e4e26d0 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdReminderView.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdReminderView.cpp @@ -154,7 +154,7 @@ namespace OHOS case THUNDERBIRD_REMINDERVIEW_TASK_REMINDER: { ThunderBirdModel::GetInstance()->LowFrequence(); - ThunderBirdModel::GetInstance()->StartCountUpTimer(10); + // ThunderBirdModel::GetInstance()->StartCountUpTimer(20); if (RemindIcon) { // 图标位置:整体居中的左侧 diff --git a/code/sdk/zhihui/leiniao/imsl_ln/ln_api.c b/code/sdk/zhihui/leiniao/imsl_ln/ln_api.c index dccb58e58..26beecc91 100644 --- a/code/sdk/zhihui/leiniao/imsl_ln/ln_api.c +++ b/code/sdk/zhihui/leiniao/imsl_ln/ln_api.c @@ -1408,6 +1408,8 @@ static void ln_http_server_send_task(void const *arg) printf("[LN_HTTP_SERVICE] LN_HTTP_SERVICE_CMD_AUDIO_STOP:停止音频播放并清理资源\n"); // 清理 ln_audio_simple 的音频资源 ln_audio_simple_stop(); + // 播放结束后 3 秒退出对话(在 GUI 线程启动定时器) + ln_audio_stop_start_dialogue_exit_timer(); } if (mail.data != NULL) { diff --git a/code/sdk/zhihui/leiniao/ln_api_cpp/ln_api_interface.cpp b/code/sdk/zhihui/leiniao/ln_api_cpp/ln_api_interface.cpp index 2593e4450..694ecbb8f 100644 --- a/code/sdk/zhihui/leiniao/ln_api_cpp/ln_api_interface.cpp +++ b/code/sdk/zhihui/leiniao/ln_api_cpp/ln_api_interface.cpp @@ -65,6 +65,12 @@ void do_restore_factory_setting(void) OHOS::ThunderBirdModel::GetInstance()->restore_factory_settings(); } +// 音频 stop 时调用:仅当在对话说话/聆听界面时在 GUI 线程启动 3 秒退出定时器(哄睡/提醒结束不触发) +void ln_audio_stop_start_dialogue_exit_timer(void) +{ + OHOS::ThunderBirdModel::GetInstance()->StartCountUpTimerForDialogueExitIfInSpeaking(); +} + // 设置帧率 void do_set_fps(uint32_t fps) { diff --git a/code/sdk/zhihui/leiniao/ln_api_cpp/ln_api_interface.h b/code/sdk/zhihui/leiniao/ln_api_cpp/ln_api_interface.h index f1e407a76..8bc8e44b5 100644 --- a/code/sdk/zhihui/leiniao/ln_api_cpp/ln_api_interface.h +++ b/code/sdk/zhihui/leiniao/ln_api_cpp/ln_api_interface.h @@ -47,6 +47,9 @@ void push_ota_progress(int progress); //恢复出厂操作 void do_restore_factory_setting(void); +/** 音频 stop 时由 ln_api 调用:在 GUI 线程启动 3 秒退出对话定时器(播放结束后 3 秒退出) */ +void ln_audio_stop_start_dialogue_exit_timer(void); + //帧率控制操作 void do_set_fps(uint32_t fps); uint32_t do_get_fps(void); -- 2.17.1