From 7c64953243d66fdd1bf9a2956dbdb4802d452418 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E7=BD=97=E6=AD=A3?= <1732036298@qq.com> Date: Tue, 22 Oct 2024 08:20:20 +0000 Subject: [PATCH] Merge #1239 into sdk602patch0911 from refs/changes/1239/head MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Code review from 罗正 * refs/changes/1239/head: (12 commits squashed) - 来电界面,禁止双击进入AI - 录音列表视图修改为右滑退出到录音主视图 - Merge branch 'sdk602patch0911' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0911 - 1.一个分区模式下修改音乐和录音文件夹 2.录音添加空间判断管理 3.录音添加”空间已满弹窗“:在总时长大于20分钟或总数大于等于99,录音总空间大于等于10M,弹出 4.判断录音空间大小是否超出采用指令队列读职 5.修改底层录音文件audio_capture_wrapper.cpp大小参数使之录取一个录音最长时间在20分钟左右 - 修改音乐播放器函数名英文错误拼写 - 如果手表在播放本地音乐,AI界面点击开始对话会暂停本地音乐播放,避免混音 - Merge branch 'sdk602patch0911' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0911 - Merge branch 'sdk602patch0911' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0911 - Merge branch 'sdk602patch0911' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0911 - 优化查找手表的播放音频逻辑 - 修复录音播放完后等待一段时间再去点击录音播放,需要点击两次bug - 修复音乐播放器在切换到手机音乐无法调节音量bug Signed-off-by: 罗正 <1732036298@qq.com> Reviewed-by: snickersun@163.com Merged-by: snickersun@163.com CR-link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/1239 --- .../nativeui/player/src/PlayersPresenter.cpp | 12 +++++++----- .../fd230app/nativeui/record/src/RecordingModel.cpp | 12 +++++++++++- .../service/msg_center/src/msg_center_customer.cpp | 2 +- .../msg_center/src/notify/findwatch_notification.cpp | 8 +++++--- 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersPresenter.cpp index 9aeb21bce..2e6639bb2 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersPresenter.cpp @@ -747,11 +747,13 @@ void ButtonOnClickListener::SoundButtonOnClick() return; } /* -------------------------------------------------------------------------- */ - if (PlayersModel::GetInstance()->get_avrcp_ct_or_tg_is_connected() && - PlayersModel::GetInstance()->get_a2dp_sink_playing_state()) //若ct或tg端是已连接状态且当前a2dp_sink是已播放状态 - { - playersView->ChangeView(PlayersView::MAIN_MUSICPLAYER_VIEW, PlayersView::MUSIC_PLAYER_TIP_VIEW); // 跳转到提示界面 - return; + if(PlayersModel::GetInstance()->GetMusicSource() == false) { //如果当前是本地音乐 + if (PlayersModel::GetInstance()->get_avrcp_ct_or_tg_is_connected() && + PlayersModel::GetInstance()->get_a2dp_sink_playing_state()) //若ct或tg端是已连接状态且当前a2dp_sink是已播放状态 + { + playersView->ChangeView(PlayersView::MAIN_MUSICPLAYER_VIEW, PlayersView::MUSIC_PLAYER_TIP_VIEW); // 跳转到提示界面 + return; + } } /* -------------------------------------------------------------------------- */ playersView->ChangeView(PlayersView::MAIN_MUSICPLAYER_VIEW, PlayersView::MUSIC_VOLUME_CONTROL_VIEW); diff --git a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingModel.cpp index 8fc509443..b977038b9 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingModel.cpp @@ -385,7 +385,11 @@ namespace OHOS RecordingPlayerView::GetInstance()->SetPlayerButtonState(UICheckBox::UNSELECTED); } } - AudioManager::GetInstance().DeactivateAudioInterrupt(interrupt); + if (AudioManager::GetInstance().DeactivateAudioInterrupt(interrupt) != 0) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DeactivateAudioInterrupt err"); + return OHOS_FAILURE; + } return OHOS_SUCCESS; } else if (state == PlayerStates::PLAYER_STOPPED) @@ -410,6 +414,12 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Reset err, ret:%d", ret); return OHOS_FAILURE; } + if (AudioManager::GetInstance().DeactivateAudioInterrupt(interrupt) != 0) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DeactivateAudioInterrupt err"); + return OHOS_FAILURE; + } + IsActivateAudioInterrupt = false; return OHOS_SUCCESS; } diff --git a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp index 646c1058a..e0e16f1b0 100644 --- a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp @@ -1259,7 +1259,7 @@ void MsgCenterNotifyCanCelFindWatchProc(const Topic topic, Request* req) unused(topic); unused(req); WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyCanCelFindWatchProc !"); - FindWatchViewEventListener::GetInstance().PopInterCancelMusic(); + // FindWatchViewEventListener::GetInstance().PopInterCancelMusic(); if (FindWatchViewEventListener::GetInstance().GetFindWatchNotifyFlag() == true) { NotificationManager::GetInstance()->StopNotify(); } diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp index 0f6e1288b..a6481f7db 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-25 17:33:47 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-10-18 18:02:00 + * @LastEditTime: 2024-10-22 10:23:38 * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp * @details:实现查找手表的功能一般需要手表和智能手机之间的配合,通常是通过手机上的应用(App)或其他设备发送指令给手表,触发手表的查找功能。 * 以下是基本的实现步骤: @@ -69,7 +69,7 @@ namespace OHOS #ifdef SUPPORT_BLE_SERVICE setFindWatchFlag(2); // 表示已找到手表 #endif - FindWatchRingPlayStop(); + // FindWatchRingPlayStop(); NotificationManager::GetInstance()->StopNotify(); SetFindWatchNotifyFlag(false); // ResumeScreenBrightness(); @@ -96,7 +96,7 @@ namespace OHOS #ifdef SUPPORT_BLE_SERVICE setFindWatchFlag(2); // 表示已找到手表 #endif - FindWatchRingPlayStop(); + // FindWatchRingPlayStop(); NotificationManager::GetInstance()->StopNotify(); SetFindWatchNotifyFlag(false); // ResumeScreenBrightness(); @@ -292,6 +292,7 @@ namespace OHOS */ int FindWatchViewEventListener::FindWatchRingPlayStart(const char *path) { + FindWatchRingPlayStop(); // 如果playerCtr上音频资源没被释放,先释放 FindWatchRingPlayerInit(((path == nullptr) ? RingMusicName : path)); FindWatchRingPlayerStat(); return OHOS_SUCCESS; @@ -476,6 +477,7 @@ namespace OHOS FindWatchGroupView = nullptr; } + FindWatchViewEventListener::GetInstance().FindWatchRingPlayStop(); FindWatchViewEventListener::GetInstance().ResumeScreenBrightness(); FindWatchViewEventListener::GetInstance().FindWatch_StopTimer(); } -- 2.17.1