Merge "SpatializerHelper: Fix device compatibility with spatial audio"

This commit is contained in:
Andy Hung
2022-09-08 17:21:09 +00:00
committed by Gerrit Code Review

View File

@@ -709,8 +709,11 @@ public class SpatializerHelper {
} }
private boolean isDeviceCompatibleWithSpatializationModes(@NonNull AudioDeviceAttributes ada) { private boolean isDeviceCompatibleWithSpatializationModes(@NonNull AudioDeviceAttributes ada) {
// modeForDevice will be neither transaural or binaural for devices that do not support
// spatial audio. For instance mono devices like earpiece, speaker safe or sco must
// not be included.
final byte modeForDevice = (byte) SPAT_MODE_FOR_DEVICE_TYPE.get(ada.getType(), final byte modeForDevice = (byte) SPAT_MODE_FOR_DEVICE_TYPE.get(ada.getType(),
/*default when type not found*/ SpatializationMode.SPATIALIZER_BINAURAL); /*default when type not found*/ -1);
if ((modeForDevice == SpatializationMode.SPATIALIZER_BINAURAL && mBinauralSupported) if ((modeForDevice == SpatializationMode.SPATIALIZER_BINAURAL && mBinauralSupported)
|| (modeForDevice == SpatializationMode.SPATIALIZER_TRANSAURAL || (modeForDevice == SpatializationMode.SPATIALIZER_TRANSAURAL
&& mTransauralSupported)) { && mTransauralSupported)) {
@@ -1532,8 +1535,8 @@ public class SpatializerHelper {
@Override @Override
public String toString() { public String toString() {
return "type:" + mDeviceType + " addr:" + mDeviceAddress + " enabled:" + mEnabled return "type: " + mDeviceType + " addr: " + mDeviceAddress + " enabled: " + mEnabled
+ " HT:" + mHasHeadTracker + " HTenabled:" + mHeadTrackerEnabled; + " HT: " + mHasHeadTracker + " HTenabled: " + mHeadTrackerEnabled;
} }
String toPersistableString() { String toPersistableString() {