From: hcj <1224667075@qq.com> Date: Mon, 28 Oct 2024 12:51:15 +0000 (+0800) Subject: 蓝牙来电静音 X-Git-Tag: fd230_release_V1.3.102~173 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=d3fa4ca80b34508961a38b5c9498d31656ad7023;p=mirrors%2FFD230.git 蓝牙来电静音 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/callerlog/src/CallerLogModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/callerlog/src/CallerLogModel.cpp index 74af04e7d..3ff0c24e7 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/callerlog/src/CallerLogModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/callerlog/src/CallerLogModel.cpp @@ -171,6 +171,8 @@ static void CallTimerCallbackProc(int data) return; } + + if(MainCallingView::GetInstance()->GetCallingView()) { if (MainCallingView::GetInstance()->GetCallingView()->GetCallingDurationLabel()) @@ -183,7 +185,6 @@ static void CallTimerCallbackProc(int data) } } - if( CallerLogModel::GetInstance()->GetCallSource() == CallerLogModel::CallSourceCat1 && NotificationManager::GetInstance()->GetWatchCallStatus()==true) { @@ -676,6 +677,15 @@ void UsingPhoneChangeStatusCallback(const PhoneCallInfo *phoneCall) DisshakeTimer(); + if(phoneCall->operate==OPERATE_INCOMING) + { + uapi_SetSpeaker_Mute(true); + } + else + { + uapi_SetSpeaker_Mute(false); + } + if (phoneCall->operate == OPERATE_WATCH_FINISH && GetCurrCallNum() == 0) { g_callOperate = OPERATE_WATCH_FINISH; WatchFinishHandle(); @@ -756,6 +766,14 @@ static void ScoConnectHandle(void) return; } + if(g_isCall==HFP_HF_CALL_STATE_INCOMING) + { + uapi_SetSpeaker_Mute(true); + } + else + { + uapi_SetSpeaker_Mute(false); + } WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ScoConnectHandle] g_isCall = %d", g_isCall); switch (g_isCall) { case HFP_HF_CALL_STATE_ACTIVE: @@ -785,6 +803,7 @@ static void ScoConnectHandle(void) break; case HFP_HF_CALL_STATE_INCOMING: CallerLogModel::GetInstance()->SetMakePhoneStatus(false); + break; case HFP_HF_CALL_STATE_HELD: CallerLogModel::GetInstance()->SetCallStatus(true); diff --git a/code/sdk/application/wearable/fd230app/nativeui/phoneservice/include/PhoneService.h b/code/sdk/application/wearable/fd230app/nativeui/phoneservice/include/PhoneService.h index 742fc10d8..4cd62dbfb 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phoneservice/include/PhoneService.h +++ b/code/sdk/application/wearable/fd230app/nativeui/phoneservice/include/PhoneService.h @@ -288,7 +288,7 @@ int32_t SetMicMutecat1(bool isMute); void AudioActInterrupt(AudioStreamType type); - +void uapi_SetSpeaker_Mute(bool isMute); 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 4e7b09998..1c9210e0a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp @@ -1465,7 +1465,6 @@ static void CallAudioHandle(const hfp_hf_calls_info_t *call) if (state == HFP_HF_CALL_STATE_INCOMING || state == HFP_HF_CALL_STATE_DIALING || state == HFP_HF_CALL_STATE_ALERTING) { // 电话呼入,支持播放手机铃声 if (call->in_band_ring) { - if(true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb() && (!uapi_sleep_mode_flag_get()) && true != OHOS::ConfigModel::GetInstance()->GetSilentMode()) { // 播放手机端铃声 PostGraphicEvent(AudioDn); @@ -2061,6 +2060,41 @@ void set_speaker_volume(unsigned char hfpVolume,int type) return; +} +static uint8_t SetSpeaker=false; + +void uapi_SetSpeaker_Mute(bool isMute) +{ + //return; + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[SetSpeakerMute] start!"); + + if(isMute==true && (true == OHOS::ConfigModel::GetInstance()->GetDnotdisturb() || + (uapi_sleep_mode_flag_get()) || true == OHOS::ConfigModel::GetInstance()->GetSilentMode())) + { + if(isMute!=SetSpeaker) + { + if(true== SetSpeakerMute(isMute)) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[SetSpeakerMute] true!"); + SetSpeaker=isMute; + } + } + + } + else if(isMute==false) + { + if(isMute!=SetSpeaker) + { + if(true== SetSpeakerMute(isMute)) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[SetSpeakerMute] false!"); + SetSpeaker=isMute; + } + } + } + + + } // 设置通话speaker静音