From: Caisking Date: Fri, 5 Sep 2025 09:41:09 +0000 (+0800) Subject: 修复app连接时回调未注册导致的死机 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=012e883bd3e1f478358d628be13ddb823ae01015;p=mirrors%2FFD230.git 修复app连接时回调未注册导致的死机 --- diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp b/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp index 2bfe381f0..082577308 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp +++ b/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp @@ -603,7 +603,7 @@ namespace OHOS // 初始化所有预加载slice InitAllNativeSlices(); - CallerLogModel::GetInstance()->InitPhoneService(); + // CallerLogModel::GetInstance()->InitPhoneService(); //可能初始化没有这么快 GoalModel::GetInstance().GoalModelInitdata(); // 活动数据初始化 // PresenterTask::GetInstance()->Init(); PlayersModel::GetInstance()->AudioInit(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp b/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp index f82c016f8..2e258e361 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp @@ -641,14 +641,14 @@ static void BtDisconnectedPro(void) { g_btConnState = PROFILE_STATE_DISCONNECTED; //(void)memset_s(g_bdAddr.addr, BD_ADDR_LEN, 0, BD_ADDR_LEN); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[BtDisconnectedPro] g_bdAddr: "); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[BtDisconnectedPro] g_bdAddr: "); CatBdAddr(&g_bdAddr); // 通知APP蓝牙断开连接 PhoneServiceErrorCallback(ERROR_BT, PROFILE_STATE_DISCONNECTED); CallListInit(); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BtDisconnectedPro callState:%d", g_currCallState); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BtDisconnectedPro callState:%d", g_currCallState); if (g_currCallState == HFP_HF_CALL_STATE_INCOMING) { /* 处理呼入阶段,取消手表配对 */ hfp_hf_calls_info_t call = {0}; @@ -704,11 +704,13 @@ static void ConnStateChanged(const bd_addr_t *bdAddr, profile_connect_state_t st WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ConnStateChanged] BT disconnecting"); break; case PROFILE_STATE_DISCONNECTED: // 蓝牙断开连接 - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ConnStateChanged] BT disconnected"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[ConnStateChanged] BT disconnected"); BtDisconnectedPro(); //if(0==OHOS::uapi_a2dp_snk_get_device_connect_state() && 0==uapi_hfp_connect_state()) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BT_DISCONNECTED_TO_UI"); SendMsgToUIService(BT_DISCONNECTED_TO_UI, 0, nullptr, 0); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BT_DISCONNECTED_TO_MSGCENTER"); //SendMsgToMsgCenterService(BT_DISCONNECTED_TO_MSGCENTER, 0, nullptr, 0); } uapi_save_runtime_log(RUNTIME_LOG_BR_DISCONNECT_HFP); @@ -1849,6 +1851,7 @@ void PhoneServiceInit(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[PhoneServiceInit] start"); g_scoFlag = HFP_SCO_STATE_DISCONNECTED; + OHOS::CallerLogModel::GetInstance()->InitPhoneService(); AudioInit(); InitMutex(); CallLogCreatDir();