1 /*
2  * Copyright (C) 2022 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.car.audio;
18 
19 import android.car.media.CarVolumeGroupEvent;
20 import android.car.media.CarVolumeGroupInfo;
21 import android.media.AudioAttributes;
22 
23 import java.util.List;
24 import java.util.Objects;
25 
26 final class CarVolumeInfoWrapper {
27     private final CarAudioService mCarAudioService;
28 
CarVolumeInfoWrapper(CarAudioService carAudioService)29     CarVolumeInfoWrapper(CarAudioService carAudioService) {
30         mCarAudioService = Objects.requireNonNull(carAudioService,
31                 "Car Audio Service Can not be null");
32     }
33 
getSuggestedAudioContextForZone(int zoneId)34     public int getSuggestedAudioContextForZone(int zoneId) {
35         return mCarAudioService.getSuggestedAudioContextForZone(zoneId);
36     }
37 
getVolumeGroupIdForAudioZone(int zoneId)38     public int getVolumeGroupIdForAudioZone(int zoneId) {
39         return mCarAudioService.getVolumeGroupIdForAudioContext(zoneId,
40                 getSuggestedAudioContextForZone(zoneId));
41     }
42 
getGroupVolume(int zoneId, int groupId)43     public int getGroupVolume(int zoneId, int groupId) {
44         return mCarAudioService.getGroupVolume(zoneId, groupId);
45     }
46 
getGroupMinVolume(int zoneId, int groupId)47     public int getGroupMinVolume(int zoneId, int groupId) {
48         return mCarAudioService.getGroupMinVolume(zoneId, groupId);
49     }
50 
getGroupMaxVolume(int zoneId, int groupId)51     public int getGroupMaxVolume(int zoneId, int groupId) {
52         return mCarAudioService.getGroupMaxVolume(zoneId, groupId);
53     }
54 
isVolumeGroupMuted(int zoneId, int groupId)55     public boolean isVolumeGroupMuted(int zoneId, int groupId) {
56         return mCarAudioService.isVolumeGroupMuted(zoneId, groupId);
57     }
58 
getMutedVolumeGroups(int zoneId)59     public List<CarVolumeGroupInfo> getMutedVolumeGroups(int zoneId) {
60         return mCarAudioService.getMutedVolumeGroups(zoneId);
61     }
62 
getVolumeGroupInfo(int zoneId, int groupId)63     public CarVolumeGroupInfo getVolumeGroupInfo(int zoneId, int groupId) {
64         return mCarAudioService.getVolumeGroupInfo(zoneId, groupId);
65     }
66 
getVolumeGroupIdForAudioAttribute(int audioZoneId, AudioAttributes attributes)67     public int getVolumeGroupIdForAudioAttribute(int audioZoneId, AudioAttributes attributes) {
68         return mCarAudioService.getVolumeGroupIdForAudioAttribute(audioZoneId, attributes);
69     }
70 
getVolumeGroupInfosForZone(int zoneId)71     public List<CarVolumeGroupInfo> getVolumeGroupInfosForZone(int zoneId) {
72         return mCarAudioService.getVolumeGroupInfosForZone(zoneId);
73     }
74 
getActiveAudioAttributesForZone(int zoneId)75     public List<AudioAttributes> getActiveAudioAttributesForZone(int zoneId) {
76         return mCarAudioService.getActiveAudioAttributesForZone(zoneId);
77     }
78 
getCallStateForZone(int zoneId)79     public int getCallStateForZone(int zoneId) {
80         return mCarAudioService.getCallStateForZone(zoneId);
81     }
82 
onAudioVolumeGroupChanged(int zoneId, String groupName, int flags)83     public void onAudioVolumeGroupChanged(int zoneId, String groupName, int flags) {
84         mCarAudioService.onAudioVolumeGroupChanged(zoneId, groupName, flags);
85     }
86 
onVolumeGroupEvent(List<CarVolumeGroupEvent> events)87     public void onVolumeGroupEvent(List<CarVolumeGroupEvent> events) {
88         mCarAudioService.onVolumeGroupEvent(events);
89     }
90 }
91