From: hcj <1224667075@qq.com> Date: Wed, 7 Jan 2026 08:00:00 +0000 (+0800) Subject: 蓝牙死机问题修改 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=8ff88d48d857e7e9edc1ee894262d5ae64295042;p=mirrors%2FFD230.git 蓝牙死机问题修改 --- diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/bluetooth/src/BluetoothEarPhoneView.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/bluetooth/src/BluetoothEarPhoneView.cpp index 5c85b6d00..f4a1249de 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/bluetooth/src/BluetoothEarPhoneView.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/bluetooth/src/BluetoothEarPhoneView.cpp @@ -224,7 +224,7 @@ void BluetoothEarPhoneView::BtEnable() WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BluetoothEarPhoneView::BtEnable Bt is Discovering"); return; } else { - results = gap_br_set_inquiry_paramters(DEVICE_MAJOR_CLASS_AUDIO_VIDEO, 0); + results = gap_br_set_inquiry_paramters(DEVICE_MAJOR_CLASS_AUDIO_VIDEO|SERVICE_AUDIO|SERVICE_TELEPHONY, 0); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "gap_br_set_inquiry_paramters results %d", results); results = gap_br_start_discovery(); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "gap_br_start_discovery results %d", results); diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/bluetooth/src/BluetoothModel.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/bluetooth/src/BluetoothModel.cpp index 758ef4478..ce2e140a1 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/bluetooth/src/BluetoothModel.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/bluetooth/src/BluetoothModel.cpp @@ -1177,10 +1177,6 @@ static void A2dpSrcConnectstateChanged(bd_addr_t *bdAddr, int connState) uint32_t ret = avrcp_ct_connect(bdAddr); WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "avrcp_ct_connect ret = 0x%x", ret); - if(AI_IsVoiceServiceRunning()){ - ln_ws_audio_deinit(); - } - set_a2dp_is_connect(true); PhoneAudioManagerSetDeviceConnState(OUT_BLUETOOTH_A2DP, AUDIO_DEVICE_CONNECTED); GraphicService::GetInstance()->PostGraphicEvent(std::bind(ACLConnectionSuss, *bdAddr)); @@ -1191,14 +1187,8 @@ static void A2dpSrcConnectstateChanged(bd_addr_t *bdAddr, int connState) if (connState == PROFILE_STATE_DISCONNECTED) { - - if(AI_IsVoiceServiceRunning()){ - ln_ws_audio_deinit(); - LOS_Msleep(100);//增加延时确保销毁彻底 - } - PhoneAudioManagerSetDeviceConnState(OUT_BLUETOOTH_A2DP, AUDIO_DEVICE_DISCONNECTED); - + set_a2dp_is_connect(false); diff --git a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/src/track_handle.c b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/src/track_handle.c index ce6e3b985..0373b57dd 100644 --- a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/src/track_handle.c +++ b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/src/track_handle.c @@ -362,14 +362,19 @@ int32_t SetTrackOutputDevice(uintptr_t handle, int32_t deviceId, const AudioStre if (context->state == IDLE) { context->userAudioOutDevice = (uint32_t)deviceId; } else if (context->state == RUNNING) { - (void)context->callback(context->caller, AUDIO_EVENT_OUTPUT_DEVICE_CHANGED, NULL); - if (ChangeRouteInner(context, deviceId) != AUDIO_SUCCESS) { - goto ERR; - } - } else if (context->state == PAUSE) { - context->routeChangedDevice = (uint32_t)deviceId; - } else { - ALOGE("bad state[%d]", context->state); + if(context->callback==NULL) + { + ALOGE("callbak is NULL!"); + goto ERR; + } + (void)context->callback(context->caller, AUDIO_EVENT_OUTPUT_DEVICE_CHANGED, NULL); + if (ChangeRouteInner(context, deviceId) != AUDIO_SUCCESS) { + goto ERR; + } + } else if (context->state == PAUSE) { + context->routeChangedDevice = (uint32_t)deviceId; + } else { + ALOGE("bad state[%d]", context->state); goto ERR; } MediaMutexUnLock(context->deviceChangeMutex);