!614 [Revert] GetVolume changes and adapt to new changes

Merge pull request !614 from AshishSawakar/revert_change
This commit is contained in:
openharmony_ci 2022-07-18 07:50:29 +00:00 committed by Gitee
commit f593be7f76
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -234,9 +234,6 @@ int32_t AudioPolicyServer::SetStreamVolume(AudioStreamType streamType, float vol
float AudioPolicyServer::GetStreamVolume(AudioStreamType streamType)
{
if (GetStreamMute(streamType)) {
return MIN_VOLUME_LEVEL;
}
return mPolicyService.GetStreamVolume(streamType);
}
@ -249,18 +246,7 @@ int32_t AudioPolicyServer::SetStreamMute(AudioStreamType streamType, bool 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;
return mPolicyService.SetStreamMute(streamType, mute);
}
int32_t AudioPolicyServer::SetStreamVolume(AudioStreamType streamType, float volume, bool isUpdateUi)