1 /* 2 * Copyright (C) 2021 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 android.car.testapi; 18 19 import android.car.media.CarAudioPatchHandle; 20 import android.car.media.ICarAudio; 21 import android.media.AudioDeviceAttributes; 22 import android.os.IBinder; 23 24 import java.util.Collections; 25 import java.util.List; 26 27 /** 28 * Fake service that is used by {@link FakeCar} to provide an implementation of {@link ICarAudio}. 29 * The reason we couldn't use a mock version of this service is that {@link AudioDeviceAttributes} 30 * is annotated with @hide, and Mockito fails to create a mock instance. 31 */ 32 final class FakeCarAudioService extends ICarAudio.Stub { 33 @Override isAudioFeatureEnabled(int feature)34 public boolean isAudioFeatureEnabled(int feature) { 35 return false; 36 } 37 38 @Override setGroupVolume(int zoneId, int groupId, int index, int flags)39 public void setGroupVolume(int zoneId, int groupId, int index, int flags) { 40 } 41 42 @Override getGroupMaxVolume(int zoneId, int groupId)43 public int getGroupMaxVolume(int zoneId, int groupId) { 44 return 0; 45 } 46 47 @Override getGroupMinVolume(int zoneId, int groupId)48 public int getGroupMinVolume(int zoneId, int groupId) { 49 return 0; 50 } 51 52 @Override getGroupVolume(int zoneId, int groupId)53 public int getGroupVolume(int zoneId, int groupId) { 54 return 0; 55 } 56 57 @Override setFadeTowardFront(float value)58 public void setFadeTowardFront(float value) { 59 } 60 61 @Override setBalanceTowardRight(float value)62 public void setBalanceTowardRight(float value) { 63 } 64 65 @Override getExternalSources()66 public String[] getExternalSources() { 67 return new String[] {}; 68 } 69 70 @Override createAudioPatch(String sourceAddress, int usage, int gainInMillibels)71 public CarAudioPatchHandle createAudioPatch(String sourceAddress, int usage, 72 int gainInMillibels) { 73 return null; 74 } 75 76 @Override releaseAudioPatch(CarAudioPatchHandle patch)77 public void releaseAudioPatch(CarAudioPatchHandle patch) { 78 } 79 80 @Override getVolumeGroupCount(int zoneId)81 public int getVolumeGroupCount(int zoneId) { 82 return 0; 83 } 84 85 @Override getVolumeGroupIdForUsage(int zoneId, int usage)86 public int getVolumeGroupIdForUsage(int zoneId, int usage) { 87 return 0; 88 } 89 90 @Override getUsagesForVolumeGroupId(int zoneId, int groupId)91 public int[] getUsagesForVolumeGroupId(int zoneId, int groupId) { 92 return new int[] {}; 93 } 94 95 @Override getAudioZoneIds()96 public int[] getAudioZoneIds() { 97 return new int[] {}; 98 } 99 100 @Override getZoneIdForUid(int uid)101 public int getZoneIdForUid(int uid) { 102 return 0; 103 } 104 105 @Override setZoneIdForUid(int zoneId, int uid)106 public boolean setZoneIdForUid(int zoneId, int uid) { 107 return false; 108 } 109 110 @Override clearZoneIdForUid(int uid)111 public boolean clearZoneIdForUid(int uid) { 112 return false; 113 } 114 115 @Override isVolumeGroupMuted(int zoneId, int groupId)116 public boolean isVolumeGroupMuted(int zoneId, int groupId) { 117 return false; 118 } 119 120 @Override setVolumeGroupMute(int zoneId, int groupId, boolean mute, int flags)121 public void setVolumeGroupMute(int zoneId, int groupId, boolean mute, int flags) { 122 } 123 124 @Override getOutputDeviceAddressForUsage(int zoneId, int usage)125 public String getOutputDeviceAddressForUsage(int zoneId, int usage) { 126 return ""; 127 } 128 129 @Override getInputDevicesForZoneId(int zoneId)130 public List<AudioDeviceAttributes> getInputDevicesForZoneId(int zoneId) { 131 return Collections.emptyList(); 132 } 133 134 @Override isPlaybackOnVolumeGroupActive(int volumeGroupId, int audioZoneId)135 public boolean isPlaybackOnVolumeGroupActive(int volumeGroupId, int audioZoneId) { 136 return false; 137 } 138 139 @Override registerVolumeCallback(IBinder binder)140 public void registerVolumeCallback(IBinder binder) { 141 } 142 143 @Override unregisterVolumeCallback(IBinder binder)144 public void unregisterVolumeCallback(IBinder binder) { 145 } 146 } 147