diff --git a/services/audio/include/audio_control_manager.h b/services/audio/include/audio_control_manager.h index 15b0017462d1a0ef47add9b52446e16fbea5c616..c852913a9e3b91f2afcdbd7b521fc6a4a844cb09 100644 --- a/services/audio/include/audio_control_manager.h +++ b/services/audio/include/audio_control_manager.h @@ -88,6 +88,7 @@ public: bool StopSoundtone(); bool PlaySoundtone(); void PlayCallEndedTone(CallEndedType type); + void HandleNotNormalRingerMode(CallEndedType type); bool IsDistributeCallSinkStatus(); void SetRingToneVolume(float volume); bool IsScoTemporarilyDisabled(); diff --git a/services/audio/src/audio_control_manager.cpp b/services/audio/src/audio_control_manager.cpp index bc9b95abe8c6d3a7c5854f1f5d09eb416e649408..82d94527c269e38506a97f35af22a6615d8d1105 100644 --- a/services/audio/src/audio_control_manager.cpp +++ b/services/audio/src/audio_control_manager.cpp @@ -838,7 +838,7 @@ void AudioControlManager::PlayCallEndedTone(CallEndedType type) } AudioStandard::AudioRingerMode ringMode = DelayedSingleton::GetInstance()->GetRingerMode(); if (ringMode != AudioStandard::AudioRingerMode::RINGER_MODE_NORMAL) { - TELEPHONY_LOGE("ringer mode is not normal"); + HandleNotNormalRingerMode(type); return; } switch (type) { @@ -877,6 +877,21 @@ void AudioControlManager::PlayCallEndedTone(CallEndedType type) } } +void AudioControlManager::HandleNotNormalRingerMode(CallEndedType type) +{ + TELEPHONY_LOGE("ringer mode is not normal"); + switch (type) { + case CallEndedType::CALL_ENDED_NORMALLY: + if (toneState_ == ToneState::TONEING) { + StopCallTone(); + TELEPHONY_LOGI("ringer mode is not normal, stop call tone!"); + } + break; + default: + break; + } +} + std::set> AudioControlManager::GetCallList() { std::lock_guard lock(mutex_);