From: luozheng <1732036298@qq.com> Date: Sat, 7 Dec 2024 08:14:09 +0000 (+0800) Subject: 解决连接耳机后耳机操控手表(上一首,下一首)音乐死机的问题 X-Git-Tag: v1.3.113-repair_tp~143^2~17 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F1503%2F1;p=mirrors%2FFD230.git 解决连接耳机后耳机操控手表(上一首,下一首)音乐死机的问题 --- diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp b/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp index ab8b95e77..0383f6a35 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp +++ b/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp @@ -305,6 +305,7 @@ extern "C" uint8_t uapi_dev_runtime_get_lock_status(void); #include "bleEvent.h" #include "../../../../../../drivers/peripheral/config/include/ConfigModelC.h" #include "vibrator_service.h" +#include namespace OHOS { @@ -563,6 +564,8 @@ namespace OHOS MessageModel::GetInstance().Init(); // 消息订阅监听 AssistantModel::GetInstance()->Init(); // 语音助手消息订阅 GoalModel::GetInstance().GoalModelInitdata(); + //音乐列表初始化,放在nativelauncher 初始化,防止手表连接耳机时,操控耳机控制手表音乐造成死机 + do_custom_fileoperate_service_check_msg(CUSTOM_FILEOPERATE_MSG_TYPE_MUSICNAME_READ, nullptr, 0); // 初始化默认首页 ScreenModels::GetInstance()->PreLoadAppimages(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothHeadsetEvent.cpp b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothHeadsetEvent.cpp index 6702977f9..fa26ec868 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothHeadsetEvent.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothHeadsetEvent.cpp @@ -111,6 +111,7 @@ void BtAvrcpTgNotifyVolumeChangedProc(uint8_t a2dp_volume) void UsingPressButtonStatusCallback(td_u32 keyOperation, td_u32 keyValue) { bt_avrcp_tg_evt_status_param event; + // printf("keyOperation = %d, keyValue = %d\n"); switch (keyOperation) { case AVRCP_KEY_VOLUME_UP: // 耳机控制手表加减音量不走key_operation事件 case AVRCP_KEY_VOLUME_DOWN: // 减小音量 diff --git a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersView.cpp b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersView.cpp index 8f2a9a7e4..aa2a8ee43 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersView.cpp @@ -1051,7 +1051,7 @@ namespace OHOS // PlayersListGroup::GetInstance()->SetUpListCase(); // PlayersModel::GetInstance()->PlayerInit(); - do_custom_fileoperate_service_check_msg(CUSTOM_FILEOPERATE_MSG_TYPE_MUSICNAME_READ, nullptr, 0); + // do_custom_fileoperate_service_check_msg(CUSTOM_FILEOPERATE_MSG_TYPE_MUSICNAME_READ, nullptr, 0); SetTouchable(true); SetDraggable(true); return true;