Merge "AbsoluteVolume change custom call to official API" am: d51c3f3a2c am: 29da6bb3e4 am: 548b9eaf35 am: 229680564c

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1862057

Change-Id: I3a6be3eca53834ee6ae181a40af5b8cbe49a43b3
This commit is contained in:
Treehugger Robot
2021-10-20 21:14:35 +00:00
committed by Automerger Merge Worker
3 changed files with 6 additions and 18 deletions

View File

@@ -5216,21 +5216,6 @@ public class AudioManager {
} }
} }
/**
* @hide
* Notifies AudioService that it is connected to an A2DP device that supports absolute volume,
* so that AudioService can send volume change events to the A2DP device, rather than handling
* them.
*/
public void avrcpSupportsAbsoluteVolume(String address, boolean support) {
final IAudioService service = getService();
try {
service.avrcpSupportsAbsoluteVolume(address, support);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}
/** /**
* {@hide} * {@hide}
*/ */

View File

@@ -176,8 +176,6 @@ interface IAudioService {
int getEncodedSurroundMode(int targetSdkVersion); int getEncodedSurroundMode(int targetSdkVersion);
oneway void avrcpSupportsAbsoluteVolume(String address, boolean support);
void setSpeakerphoneOn(IBinder cb, boolean on); void setSpeakerphoneOn(IBinder cb, boolean on);
boolean isSpeakerphoneOn(); boolean isSpeakerphoneOn();

View File

@@ -6185,6 +6185,11 @@ public class AudioService extends IAudioService.Stub
if (pkgName == null) { if (pkgName == null) {
pkgName = ""; pkgName = "";
} }
if (device.getType() == AudioDeviceInfo.TYPE_BLUETOOTH_A2DP) {
avrcpSupportsAbsoluteVolume(device.getAddress(),
deviceVolumeBehavior == AudioManager.DEVICE_VOLUME_BEHAVIOR_ABSOLUTE);
return;
}
int audioSystemDeviceOut = AudioDeviceInfo.convertDeviceTypeToInternalDevice( int audioSystemDeviceOut = AudioDeviceInfo.convertDeviceTypeToInternalDevice(
device.getType()); device.getType());
@@ -7862,7 +7867,7 @@ public class AudioService extends IAudioService.Stub
} }
} }
public void avrcpSupportsAbsoluteVolume(String address, boolean support) { private void avrcpSupportsAbsoluteVolume(String address, boolean support) {
// address is not used for now, but may be used when multiple a2dp devices are supported // address is not used for now, but may be used when multiple a2dp devices are supported
sVolumeLogger.log(new AudioEventLogger.StringEvent("avrcpSupportsAbsoluteVolume addr=" sVolumeLogger.log(new AudioEventLogger.StringEvent("avrcpSupportsAbsoluteVolume addr="
+ address + " support=" + support)); + address + " support=" + support));