Change sendVolumeKeyEvent condition

[Description]
In 5c03084e32
CEC volume control is changed to use full volume control

However, if ARC is not connected due to :
 - AVR connecting to non-ARC port of TV
 - Specific AVR configuration

System audio mode is on, but volume control feature doesn't work

We should check system audio and volume control status instead of check
whether current device is a full volume device when trying to notify CEC
framework about the volume change event

[Test Report]
Test with TV connecting AVR : Denon 2400/ SR6013
- connected to non ARC port, volume control PASS
- connected to ARC port, volume control PASS

Run CTS PASS
- android.hdmicec.cts.common.HdmiCecSystemAudioControlTest
- android.hdmicec.cts.tv.HdmiCecRemoteControlPassThroughTest
(#cect_11_1_13_4_RemoteControlMessagesToAudioSystem)

Bug: 253189182
Change-Id: If4b3ad7b1af6246e0ff935e1eb1401f1736e5ff2
This commit is contained in:
daren.liao
2022-09-27 16:52:19 +08:00
committed by Hannah.Hsu
parent a750dcaaa6
commit 92bfccd902

View File

@@ -3409,16 +3409,15 @@ public class AudioService extends IAudioService.Stub
synchronized (mHdmiClientLock) {
if (mHdmiManager != null) {
// At most one of mHdmiPlaybackClient and mHdmiTvClient should be non-null
HdmiClient fullVolumeHdmiClient = mHdmiPlaybackClient;
HdmiClient hdmiClient = mHdmiPlaybackClient;
if (mHdmiTvClient != null) {
fullVolumeHdmiClient = mHdmiTvClient;
hdmiClient = mHdmiTvClient;
}
if (fullVolumeHdmiClient != null
if (((mHdmiPlaybackClient != null && isFullVolumeDevice(device))
|| (mHdmiTvClient != null && mHdmiSystemAudioSupported))
&& mHdmiCecVolumeControlEnabled
&& streamTypeAlias == AudioSystem.STREAM_MUSIC
// vol change on a full volume device
&& isFullVolumeDevice(device)) {
&& streamTypeAlias == AudioSystem.STREAM_MUSIC) {
int keyCode = KeyEvent.KEYCODE_UNKNOWN;
switch (direction) {
case AudioManager.ADJUST_RAISE:
@@ -3442,14 +3441,14 @@ public class AudioService extends IAudioService.Stub
try {
switch (keyEventMode) {
case AudioDeviceVolumeManager.ADJUST_MODE_NORMAL:
fullVolumeHdmiClient.sendVolumeKeyEvent(keyCode, true);
fullVolumeHdmiClient.sendVolumeKeyEvent(keyCode, false);
hdmiClient.sendVolumeKeyEvent(keyCode, true);
hdmiClient.sendVolumeKeyEvent(keyCode, false);
break;
case AudioDeviceVolumeManager.ADJUST_MODE_START:
fullVolumeHdmiClient.sendVolumeKeyEvent(keyCode, true);
hdmiClient.sendVolumeKeyEvent(keyCode, true);
break;
case AudioDeviceVolumeManager.ADJUST_MODE_END:
fullVolumeHdmiClient.sendVolumeKeyEvent(keyCode, false);
hdmiClient.sendVolumeKeyEvent(keyCode, false);
break;
default:
Log.e(TAG, "Invalid keyEventMode " + keyEventMode);