Unmute when turning system audio mode on.

ag/5428480

This is useful for devices that disables muting.
When TV sends out muting to the device but the device later turns system
audio mode back on, it should still unmute itself.

Disabling muting should only disable self mute. But still support
unmute.

Test: manual
Bug: 118890232
Change-Id: Ief4435c786262a1981a29627b837ef0a4831157a
This commit is contained in:
Amy
2018-11-02 17:53:21 -07:00
committed by shubang
parent 51c6a63eee
commit 61fc25f7b4

View File

@@ -753,16 +753,18 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDeviceSource {
// PROPERTY_SYSTEM_AUDIO_MODE_MUTING_ENABLE is false when device never needs to be muted.
boolean currentMuteStatus =
mService.getAudioManager().isStreamMute(AudioManager.STREAM_MUSIC);
if (SystemProperties.getBoolean(
Constants.PROPERTY_SYSTEM_AUDIO_MODE_MUTING_ENABLE, true)
&& currentMuteStatus == newSystemAudioMode) {
mService.getAudioManager()
.adjustStreamVolume(
AudioManager.STREAM_MUSIC,
newSystemAudioMode
? AudioManager.ADJUST_UNMUTE
: AudioManager.ADJUST_MUTE,
0);
if (currentMuteStatus == newSystemAudioMode) {
if (SystemProperties.getBoolean(
Constants.PROPERTY_SYSTEM_AUDIO_MODE_MUTING_ENABLE, true)
|| newSystemAudioMode) {
mService.getAudioManager()
.adjustStreamVolume(
AudioManager.STREAM_MUSIC,
newSystemAudioMode
? AudioManager.ADJUST_UNMUTE
: AudioManager.ADJUST_MUTE,
0);
}
}
updateAudioManagerForSystemAudio(newSystemAudioMode);
synchronized (mLock) {