1 /* 2 * Copyright (C) 2015 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.media; 18 19 import android.car.CarOccupantZoneManager.OccupantZoneInfo; 20 import android.car.media.CarAudioPatchHandle; 21 import android.car.media.CarAudioZoneConfigInfo; 22 import android.car.media.CarVolumeGroupInfo; 23 import android.car.media.IAudioZoneConfigurationsChangeCallback; 24 import android.car.media.IAudioZonesMirrorStatusCallback; 25 import android.car.media.ICarVolumeEventCallback; 26 import android.car.media.IMediaAudioRequestStatusCallback; 27 import android.car.media.IPrimaryZoneMediaAudioRequestCallback; 28 import android.car.media.ISwitchAudioZoneConfigCallback; 29 import android.media.AudioAttributes; 30 import android.media.AudioDeviceAttributes; 31 32 /** 33 * Binder interface for {@link android.car.media.CarAudioManager}. 34 * Check {@link android.car.media.CarAudioManager} APIs for expected behavior of each call. 35 * 36 * @hide 37 */ 38 interface ICarAudio { isAudioFeatureEnabled(int feature)39 boolean isAudioFeatureEnabled(int feature); 40 setGroupVolume(int zoneId, int groupId, int index, int flags)41 void setGroupVolume(int zoneId, int groupId, int index, int flags); getGroupMaxVolume(int zoneId, int groupId)42 int getGroupMaxVolume(int zoneId, int groupId); getGroupMinVolume(int zoneId, int groupId)43 int getGroupMinVolume(int zoneId, int groupId); getGroupVolume(int zoneId, int groupId)44 int getGroupVolume(int zoneId, int groupId); 45 setFadeTowardFront(float value)46 void setFadeTowardFront(float value); setBalanceTowardRight(float value)47 void setBalanceTowardRight(float value); 48 getExternalSources()49 String[] getExternalSources(); createAudioPatch(in String sourceAddress, int usage, int gainInMillibels)50 CarAudioPatchHandle createAudioPatch(in String sourceAddress, int usage, int gainInMillibels); releaseAudioPatch(in CarAudioPatchHandle patch)51 void releaseAudioPatch(in CarAudioPatchHandle patch); 52 getVolumeGroupCount(int zoneId)53 int getVolumeGroupCount(int zoneId); getVolumeGroupIdForUsage(int zoneId, int usage)54 int getVolumeGroupIdForUsage(int zoneId, int usage); getUsagesForVolumeGroupId(int zoneId, int groupId)55 int[] getUsagesForVolumeGroupId(int zoneId, int groupId); 56 getAudioZoneIds()57 int[] getAudioZoneIds(); getZoneIdForUid(int uid)58 int getZoneIdForUid(int uid); setZoneIdForUid(int zoneId, int uid)59 boolean setZoneIdForUid(int zoneId, int uid); clearZoneIdForUid(int uid)60 boolean clearZoneIdForUid(int uid); 61 isVolumeGroupMuted(int zoneId, int groupId)62 boolean isVolumeGroupMuted(int zoneId, int groupId); setVolumeGroupMute(int zoneId, int groupId, boolean mute, int flags)63 void setVolumeGroupMute(int zoneId, int groupId, boolean mute, int flags); getVolumeGroupInfo(int zoneId, int groupId)64 CarVolumeGroupInfo getVolumeGroupInfo(int zoneId, int groupId); getVolumeGroupInfosForZone(int zoneId)65 List<CarVolumeGroupInfo> getVolumeGroupInfosForZone(int zoneId); 66 getAudioAttributesForVolumeGroup(in CarVolumeGroupInfo groupInfo)67 List<AudioAttributes> getAudioAttributesForVolumeGroup(in CarVolumeGroupInfo groupInfo); 68 getOutputDeviceAddressForUsage(int zoneId, int usage)69 String getOutputDeviceAddressForUsage(int zoneId, int usage); 70 getInputDevicesForZoneId(int zoneId)71 List<AudioDeviceAttributes> getInputDevicesForZoneId(int zoneId); 72 isPlaybackOnVolumeGroupActive(int volumeGroupId, int audioZoneId)73 boolean isPlaybackOnVolumeGroupActive(int volumeGroupId, int audioZoneId); 74 registerPrimaryZoneMediaAudioRequestCallback( in IPrimaryZoneMediaAudioRequestCallback callback)75 boolean registerPrimaryZoneMediaAudioRequestCallback( 76 in IPrimaryZoneMediaAudioRequestCallback callback); unregisterPrimaryZoneMediaAudioRequestCallback( in IPrimaryZoneMediaAudioRequestCallback callback)77 void unregisterPrimaryZoneMediaAudioRequestCallback( 78 in IPrimaryZoneMediaAudioRequestCallback callback); 79 requestMediaAudioOnPrimaryZone(in IMediaAudioRequestStatusCallback callback, in OccupantZoneInfo info)80 long requestMediaAudioOnPrimaryZone(in IMediaAudioRequestStatusCallback callback, 81 in OccupantZoneInfo info); cancelMediaAudioOnPrimaryZone(long requestId)82 boolean cancelMediaAudioOnPrimaryZone(long requestId); 83 allowMediaAudioOnPrimaryZone(in IBinder token, long requestId, boolean allow)84 boolean allowMediaAudioOnPrimaryZone(in IBinder token, long requestId, boolean allow); isMediaAudioAllowedInPrimaryZone(in OccupantZoneInfo info)85 boolean isMediaAudioAllowedInPrimaryZone(in OccupantZoneInfo info); resetMediaAudioOnPrimaryZone(in OccupantZoneInfo zone)86 boolean resetMediaAudioOnPrimaryZone(in OccupantZoneInfo zone); 87 getCurrentAudioZoneConfigInfo(int zoneId)88 CarAudioZoneConfigInfo getCurrentAudioZoneConfigInfo(int zoneId); getAudioZoneConfigInfos(int zoneId)89 List<CarAudioZoneConfigInfo> getAudioZoneConfigInfos(int zoneId); switchZoneToConfig(in CarAudioZoneConfigInfo zoneConfig, in ISwitchAudioZoneConfigCallback callback)90 void switchZoneToConfig(in CarAudioZoneConfigInfo zoneConfig, 91 in ISwitchAudioZoneConfigCallback callback); registerAudioZoneConfigsChangeCallback( in IAudioZoneConfigurationsChangeCallback callback)92 boolean registerAudioZoneConfigsChangeCallback( 93 in IAudioZoneConfigurationsChangeCallback callback); unregisterAudioZoneConfigsChangeCallback( in IAudioZoneConfigurationsChangeCallback callback)94 boolean unregisterAudioZoneConfigsChangeCallback( 95 in IAudioZoneConfigurationsChangeCallback callback); 96 registerAudioZonesMirrorStatusCallback(in IAudioZonesMirrorStatusCallback callback)97 boolean registerAudioZonesMirrorStatusCallback(in IAudioZonesMirrorStatusCallback callback); unregisterAudioZonesMirrorStatusCallback(in IAudioZonesMirrorStatusCallback callback)98 void unregisterAudioZonesMirrorStatusCallback(in IAudioZonesMirrorStatusCallback callback); canEnableAudioMirror()99 int canEnableAudioMirror(); enableMirrorForAudioZones(in int[] audioZones)100 long enableMirrorForAudioZones(in int[] audioZones); extendAudioMirrorRequest(long mirrorId, in int[] audioZones)101 void extendAudioMirrorRequest(long mirrorId, in int[] audioZones); disableAudioMirrorForZone(int zoneId)102 void disableAudioMirrorForZone(int zoneId); disableAudioMirror(long mirrorId)103 void disableAudioMirror(long mirrorId); getMirrorAudioZonesForAudioZone(int zoneId)104 int[] getMirrorAudioZonesForAudioZone(int zoneId); getMirrorAudioZonesForMirrorRequest(long mirrorId)105 int[] getMirrorAudioZonesForMirrorRequest(long mirrorId); 106 107 108 /** 109 * IBinder is ICarVolumeCallback but passed as IBinder due to aidl hidden. 110 */ registerVolumeCallback(in IBinder binder)111 void registerVolumeCallback(in IBinder binder); unregisterVolumeCallback(in IBinder binder)112 void unregisterVolumeCallback(in IBinder binder); 113 registerCarVolumeEventCallback(in ICarVolumeEventCallback callback)114 boolean registerCarVolumeEventCallback(in ICarVolumeEventCallback callback); unregisterCarVolumeEventCallback(in ICarVolumeEventCallback callback)115 boolean unregisterCarVolumeEventCallback(in ICarVolumeEventCallback callback); 116 } 117