修复退出提醒关闭声音
authorxue <2144439972@qq.com>
Wed, 17 Dec 2025 06:02:31 +0000 (14:02 +0800)
committerxue <2144439972@qq.com>
Wed, 17 Dec 2025 06:02:31 +0000 (14:02 +0800)
code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp
code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdPresenter.cpp
code/sdk/zhihui/leiniao/imsl_ln/ln_api_schedule.c

index 21e6546..a45bd5b 100644 (file)
@@ -1852,6 +1852,10 @@ extern "C" {
                     else if (currentView == THUNDERBIRD_REMINDERVIEW && 
                              currentSubView == ThunderBirdReminderView::THUNDERBIRD_REMINDERVIEW_TASK_REMINDER) {
                         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "任务提醒界面超时,返回原任务");
+                        //设置提醒音量为0
+                        GraphicService::GetInstance()->PostGraphicEvent([]() {
+                            ln_schedule_reminder_set_volume_zero();
+                        });
                         ThunderBirdModel::GetInstance()->HighFrequence();
                         ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_DIALOGUEVIEW, ThunderBirdDialogueView::THUNDERBIRD_DIALOGUEVIEW_STATUS_SHOW);
                         //关闭语音初始化
index b53e79d..e83cb5e 100644 (file)
@@ -27,6 +27,7 @@
 #include "wearable_log.h"
 #include "graphic_service.h"
 #include "ln_api.h"
+#include "ln_audio_simple.h"
 #include "power_display_service.h"
 #include "ai_media.h"
 #ifdef __cplusplus
@@ -881,16 +882,21 @@ namespace OHOS
         switch (currentSubView) {
             //通知界面-关闭通知
             case ThunderBirdReminderView::THUNDERBIRD_REMINDERVIEW_TASK_REMINDER://事项提醒界面-关闭通知
+            {
                 //回原界面
                 ThunderBirdModel::GetInstance()->StopCountUpTimer(); // 手动跳转时关闭定时器
-                //关闭语音初始化
-                AI_ForceInterrupt();
-                ln_ws_send_voice_chat_interrupt("日程提醒");
-                do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_AUDIO_DEINIT, NULL, 0);
-                ThunderBirdModel::GetInstance()->HighFrequence();
+                //设置提醒音量为0(异步执行,避免阻塞按键处理,特别是在连网状态下)
+                GraphicService::GetInstance()->PostGraphicEvent([]() {
+                    ln_schedule_reminder_set_volume_zero();
+                });
                 ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_DIALOGUEVIEW, ThunderBirdDialogueView::THUNDERBIRD_DIALOGUEVIEW_STATUS_SHOW);
-
+                //关闭语音初始化
+                // AI_ForceInterrupt();
+                // ln_ws_send_voice_chat_interrupt("日程提醒");
+                // do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_AUDIO_DEINIT, NULL, 0);
+                // ThunderBirdModel::GetInstance()->HighFrequence();
                 break;
+            }
             case ThunderBirdReminderView::THUNDERBIRD_REMINDERVIEW_DIALOGUE_NOT_ENOUGH://提醒界面-对话不足
                 AI_ForceInterrupt();
                 ln_ws_send_voice_chat_interrupt("体力流量不足");
index a5aa9df..8768053 100644 (file)
@@ -84,6 +84,15 @@ void ln_clear_schedule_reminder_config(void)
     g_schedule_reminder_config.scheduleId = 0;
 }
 
+/* 设置提醒音量为0(静音提醒音频,避免阻塞) */
+void ln_schedule_reminder_set_volume_zero(void)
+{
+    // 直接将 ALARM_CLOCK 音量设置为0,静音提醒音频
+    // 这是一个轻量级操作,不会阻塞,比停止播放更高效
+    AudioServiceSetVolume(AUDIO_STREAM_ALARM_CLOCK, 0);
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[SCHEDULE_REMINDER] Set ALARM_CLOCK volume to 0 (mute reminder audio)\n");
+}
+
 static void play_mp3_audio_from_file(char *file_path)
 {
     FILE *file = fopen(file_path, "rb");