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