mirror of
https://github.com/openharmony/multimedia_audio_standard.git
synced 2026-07-01 22:14:07 -04:00
[Change]GetVolume to return 0 when mute is true
Signed-off-by: Ashish <ashish.sawakar@huawei.com>
This commit is contained in:
@@ -222,6 +222,9 @@ int32_t AudioPolicyServer::SetStreamVolume(AudioStreamType streamType, float vol
|
||||
|
||||
float AudioPolicyServer::GetStreamVolume(AudioStreamType streamType)
|
||||
{
|
||||
if (GetStreamMute(streamType)) {
|
||||
return MIN_VOLUME_LEVEL;
|
||||
}
|
||||
return mPolicyService.GetStreamVolume(streamType);
|
||||
}
|
||||
|
||||
@@ -234,7 +237,18 @@ int32_t AudioPolicyServer::SetStreamMute(AudioStreamType streamType, bool mute)
|
||||
}
|
||||
}
|
||||
|
||||
return mPolicyService.SetStreamMute(streamType, mute);
|
||||
int result = mPolicyService.SetStreamMute(streamType, mute);
|
||||
for (auto it = volumeChangeCbsMap_.begin(); it != volumeChangeCbsMap_.end(); ++it) {
|
||||
std::shared_ptr<VolumeKeyEventCallback> volumeChangeCb = it->second;
|
||||
if (volumeChangeCb == nullptr) {
|
||||
AUDIO_ERR_LOG("volumeChangeCb: nullptr for client : %{public}d", it->first);
|
||||
continue;
|
||||
}
|
||||
AUDIO_DEBUG_LOG("AudioPolicyServer::SetStreamMute trigger volumeChangeCb clientPid : %{public}d", it->first);
|
||||
volumeChangeCb->OnVolumeKeyEvent(streamType, ConvertVolumeToInt(GetStreamVolume(streamType)), false);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int32_t AudioPolicyServer::SetStreamVolume(AudioStreamType streamType, float volume, bool isUpdateUi)
|
||||
|
||||
Reference in New Issue
Block a user