1 /* 2 * Copyright (C) 2023 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.server.hdmi; 18 19 import android.hardware.hdmi.DeviceFeatures; 20 import android.hardware.hdmi.HdmiControlManager; 21 import android.hardware.hdmi.HdmiDeviceInfo; 22 import android.media.AudioDeviceAttributes; 23 import android.media.AudioManager; 24 25 import org.junit.Test; 26 27 /** 28 * Base class for tests for absolute volume behavior on Playback devices. Contains tests that are 29 * relevant to Playback devices but not to TVs. 30 * 31 * Subclasses contain tests for the following pairs of (local device, System Audio device): 32 * (Playback, TV): {@link PlaybackDeviceToTvAvbTest} 33 * (Playback, Audio System): {@link PlaybackDeviceToAudioSystemAvbTest} 34 */ 35 public abstract class BasePlaybackDeviceAvbTest extends BaseAbsoluteVolumeBehaviorTest { 36 37 @Override createLocalDevice(HdmiControlService hdmiControlService)38 protected HdmiCecLocalDevice createLocalDevice(HdmiControlService hdmiControlService) { 39 return new HdmiCecLocalDevicePlayback(hdmiControlService); 40 } 41 42 @Override getPhysicalAddress()43 protected int getPhysicalAddress() { 44 return 0x1100; 45 } 46 47 @Override getDeviceType()48 protected int getDeviceType() { 49 return HdmiDeviceInfo.DEVICE_PLAYBACK; 50 } 51 52 @Override getAudioOutputDevice()53 protected AudioDeviceAttributes getAudioOutputDevice() { 54 return HdmiControlService.AUDIO_OUTPUT_DEVICE_HDMI; 55 } 56 57 /** 58 * Unlike TVs, Playback devices don't start the process for adopting adjust-only AVB 59 * if the System Audio device doesn't support <Set Audio Volume Level> 60 */ 61 @Test savlNotSupported_allOtherConditionsMet_giveAudioStatusNotSent()62 public void savlNotSupported_allOtherConditionsMet_giveAudioStatusNotSent() { 63 mAudioManager.setDeviceVolumeBehavior(getAudioOutputDevice(), 64 AudioManager.DEVICE_VOLUME_BEHAVIOR_FULL); 65 setCecVolumeControlSetting(HdmiControlManager.VOLUME_CONTROL_ENABLED); 66 enableSystemAudioModeIfNeeded(); 67 68 receiveSetAudioVolumeLevelSupport(DeviceFeatures.FEATURE_NOT_SUPPORTED); 69 verifyGiveAudioStatusNeverSent(); 70 } 71 } 72