Loading services/core/java/com/android/server/audio/AudioDeviceBroker.java +1 −1 Original line number Diff line number Diff line Loading @@ -1914,7 +1914,7 @@ import java.util.concurrent.atomic.AtomicBoolean; return null; } UUID getDeviceSensorUuid(AudioDeviceAttributes device) { @Nullable UUID getDeviceSensorUuid(AudioDeviceAttributes device) { synchronized (mDeviceStateLock) { return mDeviceInventory.getDeviceSensorUuid(device); } Loading services/core/java/com/android/server/audio/AudioDeviceInventory.java +2 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.audio; import android.annotation.NonNull; import android.annotation.Nullable; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothProfile; Loading Loading @@ -1495,7 +1496,7 @@ public class AudioDeviceInventory { mDevRoleCapturePresetDispatchers.finishBroadcast(); } UUID getDeviceSensorUuid(AudioDeviceAttributes device) { @Nullable UUID getDeviceSensorUuid(AudioDeviceAttributes device) { final String key = DeviceInfo.makeDeviceListKey(device.getInternalType(), device.getAddress()); synchronized (mDevicesLock) { Loading services/core/java/com/android/server/audio/SpatializerHelper.java +15 −3 Original line number Diff line number Diff line Loading @@ -353,6 +353,14 @@ public class SpatializerHelper { mASA.getDevicesForAttributes( DEFAULT_ATTRIBUTES, false /* forVolume */).toArray(ROUTING_DEVICES); // check validity of routing information if (ROUTING_DEVICES[0] == null) { logloge("onRoutingUpdated: device is null, no Spatial Audio"); setDispatchAvailableState(false); // not changing the spatializer level as this is likely a transient state return; } // is media routed to a new device? if (isWireless(ROUTING_DEVICES[0].getType())) { addWirelessDeviceIfNew(ROUTING_DEVICES[0]); Loading Loading @@ -1098,7 +1106,7 @@ public class SpatializerHelper { logDeviceState(deviceState, "setHeadTrackerEnabled"); // check current routing to see if it affects the headtracking mode if (ROUTING_DEVICES[0].getType() == ada.getType() if (ROUTING_DEVICES[0] != null && ROUTING_DEVICES[0].getType() == ada.getType() && ROUTING_DEVICES[0].getAddress().equals(ada.getAddress())) { setDesiredHeadTrackingMode(enabled ? mDesiredHeadTrackingModeWhenEnabled : Spatializer.HEAD_TRACKING_MODE_DISABLED); Loading Loading @@ -1633,7 +1641,11 @@ public class SpatializerHelper { private int getHeadSensorHandleUpdateTracker() { int headHandle = -1; UUID routingDeviceUuid = mAudioService.getDeviceSensorUuid(ROUTING_DEVICES[0]); final AudioDeviceAttributes currentDevice = ROUTING_DEVICES[0]; if (currentDevice == null) { return headHandle; } UUID routingDeviceUuid = mAudioService.getDeviceSensorUuid(currentDevice); // We limit only to Sensor.TYPE_HEAD_TRACKER here to avoid confusion // with gaming sensors. (Note that Sensor.TYPE_ROTATION_VECTOR // and Sensor.TYPE_GAME_ROTATION_VECTOR are supported internally by Loading @@ -1644,7 +1656,7 @@ public class SpatializerHelper { final UUID uuid = sensor.getUuid(); if (uuid.equals(routingDeviceUuid)) { headHandle = sensor.getHandle(); if (!setHasHeadTracker(ROUTING_DEVICES[0])) { if (!setHasHeadTracker(currentDevice)) { headHandle = -1; } break; Loading Loading
services/core/java/com/android/server/audio/AudioDeviceBroker.java +1 −1 Original line number Diff line number Diff line Loading @@ -1914,7 +1914,7 @@ import java.util.concurrent.atomic.AtomicBoolean; return null; } UUID getDeviceSensorUuid(AudioDeviceAttributes device) { @Nullable UUID getDeviceSensorUuid(AudioDeviceAttributes device) { synchronized (mDeviceStateLock) { return mDeviceInventory.getDeviceSensorUuid(device); } Loading
services/core/java/com/android/server/audio/AudioDeviceInventory.java +2 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.audio; import android.annotation.NonNull; import android.annotation.Nullable; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothProfile; Loading Loading @@ -1495,7 +1496,7 @@ public class AudioDeviceInventory { mDevRoleCapturePresetDispatchers.finishBroadcast(); } UUID getDeviceSensorUuid(AudioDeviceAttributes device) { @Nullable UUID getDeviceSensorUuid(AudioDeviceAttributes device) { final String key = DeviceInfo.makeDeviceListKey(device.getInternalType(), device.getAddress()); synchronized (mDevicesLock) { Loading
services/core/java/com/android/server/audio/SpatializerHelper.java +15 −3 Original line number Diff line number Diff line Loading @@ -353,6 +353,14 @@ public class SpatializerHelper { mASA.getDevicesForAttributes( DEFAULT_ATTRIBUTES, false /* forVolume */).toArray(ROUTING_DEVICES); // check validity of routing information if (ROUTING_DEVICES[0] == null) { logloge("onRoutingUpdated: device is null, no Spatial Audio"); setDispatchAvailableState(false); // not changing the spatializer level as this is likely a transient state return; } // is media routed to a new device? if (isWireless(ROUTING_DEVICES[0].getType())) { addWirelessDeviceIfNew(ROUTING_DEVICES[0]); Loading Loading @@ -1098,7 +1106,7 @@ public class SpatializerHelper { logDeviceState(deviceState, "setHeadTrackerEnabled"); // check current routing to see if it affects the headtracking mode if (ROUTING_DEVICES[0].getType() == ada.getType() if (ROUTING_DEVICES[0] != null && ROUTING_DEVICES[0].getType() == ada.getType() && ROUTING_DEVICES[0].getAddress().equals(ada.getAddress())) { setDesiredHeadTrackingMode(enabled ? mDesiredHeadTrackingModeWhenEnabled : Spatializer.HEAD_TRACKING_MODE_DISABLED); Loading Loading @@ -1633,7 +1641,11 @@ public class SpatializerHelper { private int getHeadSensorHandleUpdateTracker() { int headHandle = -1; UUID routingDeviceUuid = mAudioService.getDeviceSensorUuid(ROUTING_DEVICES[0]); final AudioDeviceAttributes currentDevice = ROUTING_DEVICES[0]; if (currentDevice == null) { return headHandle; } UUID routingDeviceUuid = mAudioService.getDeviceSensorUuid(currentDevice); // We limit only to Sensor.TYPE_HEAD_TRACKER here to avoid confusion // with gaming sensors. (Note that Sensor.TYPE_ROTATION_VECTOR // and Sensor.TYPE_GAME_ROTATION_VECTOR are supported internally by Loading @@ -1644,7 +1656,7 @@ public class SpatializerHelper { final UUID uuid = sensor.getUuid(); if (uuid.equals(routingDeviceUuid)) { headHandle = sensor.getHandle(); if (!setHasHeadTracker(ROUTING_DEVICES[0])) { if (!setHasHeadTracker(currentDevice)) { headHandle = -1; } break; Loading