Loading media/java/android/media/AudioDeviceAttributes.java +1 −1 Original line number Diff line number Diff line Loading @@ -177,7 +177,7 @@ public final class AudioDeviceAttributes implements Parcelable { * @param name the name of the device, or an empty string for devices without one */ public AudioDeviceAttributes(int nativeType, @NonNull String address, @NonNull String name) { mRole = (nativeType & AudioSystem.DEVICE_BIT_IN) != 0 ? ROLE_INPUT : ROLE_OUTPUT; mRole = AudioSystem.isInputDevice(nativeType) ? ROLE_INPUT : ROLE_OUTPUT; mType = AudioDeviceInfo.convertInternalDeviceToDeviceType(nativeType); mAddress = address; mName = name; Loading media/java/android/media/AudioManager.java +2 −2 Original line number Diff line number Diff line Loading @@ -6134,7 +6134,7 @@ public class AudioManager { */ public static boolean isOutputDevice(int device) { return (device & AudioSystem.DEVICE_BIT_IN) == 0; return !AudioSystem.isInputDevice(device); } /** Loading @@ -6143,7 +6143,7 @@ public class AudioManager { */ public static boolean isInputDevice(int device) { return (device & AudioSystem.DEVICE_BIT_IN) == AudioSystem.DEVICE_BIT_IN; return AudioSystem.isInputDevice(device); } Loading media/java/android/media/AudioSystem.java +6 −1 Original line number Diff line number Diff line Loading @@ -1304,6 +1304,11 @@ public class AudioSystem DEVICE_IN_ALL_BLE_SET.add(DEVICE_IN_BLE_HEADSET); } /** @hide */ public static boolean isInputDevice(int deviceType) { return (deviceType & DEVICE_BIT_IN) == DEVICE_BIT_IN; } /** @hide */ public static boolean isBluetoothDevice(int deviceType) { return isBluetoothA2dpOutDevice(deviceType) Loading Loading @@ -1602,7 +1607,7 @@ public class AudioSystem * @return a string describing the device type */ public static @NonNull String getDeviceName(int device) { if ((device & DEVICE_BIT_IN) != 0) { if (isInputDevice(device)) { return getInputDeviceName(device); } return getOutputDeviceName(device); Loading services/core/java/com/android/server/audio/AudioDeviceInventory.java +8 −3 Original line number Diff line number Diff line Loading @@ -1664,6 +1664,10 @@ public class AudioDeviceInventory { addAudioDeviceInInventoryIfNeeded(device, address, "", BtHelper.getBtDeviceCategory(address)); } AudioService.sDeviceLogger.enqueue(new EventLogger.StringEvent( "SCO " + (AudioSystem.isInputDevice(device) ? "source" : "sink") + " device addr=" + address + (connect ? " now available" : " made unavailable")).printLog(TAG)); } mmi.set(MediaMetrics.Property.STATE, MediaMetrics.Value.CONNECTED).record(); } else { Loading Loading @@ -1925,7 +1929,7 @@ public class AudioDeviceInventory { // TODO: return; } else { AudioService.sDeviceLogger.enqueue(new EventLogger.StringEvent( "A2DP device addr=" + Utils.anonymizeBluetoothAddress(address) "A2DP source device addr=" + Utils.anonymizeBluetoothAddress(address) + " now available").printLog(TAG)); } Loading Loading @@ -2382,7 +2386,8 @@ public class AudioDeviceInventory { // TODO: return; } else { AudioService.sDeviceLogger.enqueue(new EventLogger.StringEvent( "LE Audio device addr=" + Utils.anonymizeBluetoothAddress(address) "LE Audio " + (AudioSystem.isInputDevice(device) ? "source" : "sink") + " device addr=" + Utils.anonymizeBluetoothAddress(address) + " now available").printLog(TAG)); } // Reset LEA suspend state each time a new sink is connected Loading Loading @@ -2522,7 +2527,7 @@ public class AudioDeviceInventory { int delay = 0; Set<Integer> devices = new HashSet<>(); for (DeviceInfo di : mConnectedDevices.values()) { if (((di.mDeviceType & AudioSystem.DEVICE_BIT_IN) == 0) if (!AudioSystem.isInputDevice(di.mDeviceType) && BECOMING_NOISY_INTENT_DEVICES_SET.contains(di.mDeviceType)) { devices.add(di.mDeviceType); Log.i(TAG, "NOISY: adding 0x" + Integer.toHexString(di.mDeviceType)); Loading services/core/java/com/android/server/audio/AudioServiceEvents.java +2 −0 Original line number Diff line number Diff line Loading @@ -120,6 +120,8 @@ public class AudioServiceEvents { return new StringBuilder("setWiredDeviceConnectionState(") .append(" type:").append( Integer.toHexString(mState.mAttributes.getInternalType())) .append(" (").append(AudioSystem.isInputDevice( mState.mAttributes.getInternalType()) ? "source" : "sink").append(") ") .append(" state:").append(AudioSystem.deviceStateToString(mState.mState)) .append(" addr:").append(mState.mAttributes.getAddress()) .append(" name:").append(mState.mAttributes.getName()) Loading Loading
media/java/android/media/AudioDeviceAttributes.java +1 −1 Original line number Diff line number Diff line Loading @@ -177,7 +177,7 @@ public final class AudioDeviceAttributes implements Parcelable { * @param name the name of the device, or an empty string for devices without one */ public AudioDeviceAttributes(int nativeType, @NonNull String address, @NonNull String name) { mRole = (nativeType & AudioSystem.DEVICE_BIT_IN) != 0 ? ROLE_INPUT : ROLE_OUTPUT; mRole = AudioSystem.isInputDevice(nativeType) ? ROLE_INPUT : ROLE_OUTPUT; mType = AudioDeviceInfo.convertInternalDeviceToDeviceType(nativeType); mAddress = address; mName = name; Loading
media/java/android/media/AudioManager.java +2 −2 Original line number Diff line number Diff line Loading @@ -6134,7 +6134,7 @@ public class AudioManager { */ public static boolean isOutputDevice(int device) { return (device & AudioSystem.DEVICE_BIT_IN) == 0; return !AudioSystem.isInputDevice(device); } /** Loading @@ -6143,7 +6143,7 @@ public class AudioManager { */ public static boolean isInputDevice(int device) { return (device & AudioSystem.DEVICE_BIT_IN) == AudioSystem.DEVICE_BIT_IN; return AudioSystem.isInputDevice(device); } Loading
media/java/android/media/AudioSystem.java +6 −1 Original line number Diff line number Diff line Loading @@ -1304,6 +1304,11 @@ public class AudioSystem DEVICE_IN_ALL_BLE_SET.add(DEVICE_IN_BLE_HEADSET); } /** @hide */ public static boolean isInputDevice(int deviceType) { return (deviceType & DEVICE_BIT_IN) == DEVICE_BIT_IN; } /** @hide */ public static boolean isBluetoothDevice(int deviceType) { return isBluetoothA2dpOutDevice(deviceType) Loading Loading @@ -1602,7 +1607,7 @@ public class AudioSystem * @return a string describing the device type */ public static @NonNull String getDeviceName(int device) { if ((device & DEVICE_BIT_IN) != 0) { if (isInputDevice(device)) { return getInputDeviceName(device); } return getOutputDeviceName(device); Loading
services/core/java/com/android/server/audio/AudioDeviceInventory.java +8 −3 Original line number Diff line number Diff line Loading @@ -1664,6 +1664,10 @@ public class AudioDeviceInventory { addAudioDeviceInInventoryIfNeeded(device, address, "", BtHelper.getBtDeviceCategory(address)); } AudioService.sDeviceLogger.enqueue(new EventLogger.StringEvent( "SCO " + (AudioSystem.isInputDevice(device) ? "source" : "sink") + " device addr=" + address + (connect ? " now available" : " made unavailable")).printLog(TAG)); } mmi.set(MediaMetrics.Property.STATE, MediaMetrics.Value.CONNECTED).record(); } else { Loading Loading @@ -1925,7 +1929,7 @@ public class AudioDeviceInventory { // TODO: return; } else { AudioService.sDeviceLogger.enqueue(new EventLogger.StringEvent( "A2DP device addr=" + Utils.anonymizeBluetoothAddress(address) "A2DP source device addr=" + Utils.anonymizeBluetoothAddress(address) + " now available").printLog(TAG)); } Loading Loading @@ -2382,7 +2386,8 @@ public class AudioDeviceInventory { // TODO: return; } else { AudioService.sDeviceLogger.enqueue(new EventLogger.StringEvent( "LE Audio device addr=" + Utils.anonymizeBluetoothAddress(address) "LE Audio " + (AudioSystem.isInputDevice(device) ? "source" : "sink") + " device addr=" + Utils.anonymizeBluetoothAddress(address) + " now available").printLog(TAG)); } // Reset LEA suspend state each time a new sink is connected Loading Loading @@ -2522,7 +2527,7 @@ public class AudioDeviceInventory { int delay = 0; Set<Integer> devices = new HashSet<>(); for (DeviceInfo di : mConnectedDevices.values()) { if (((di.mDeviceType & AudioSystem.DEVICE_BIT_IN) == 0) if (!AudioSystem.isInputDevice(di.mDeviceType) && BECOMING_NOISY_INTENT_DEVICES_SET.contains(di.mDeviceType)) { devices.add(di.mDeviceType); Log.i(TAG, "NOISY: adding 0x" + Integer.toHexString(di.mDeviceType)); Loading
services/core/java/com/android/server/audio/AudioServiceEvents.java +2 −0 Original line number Diff line number Diff line Loading @@ -120,6 +120,8 @@ public class AudioServiceEvents { return new StringBuilder("setWiredDeviceConnectionState(") .append(" type:").append( Integer.toHexString(mState.mAttributes.getInternalType())) .append(" (").append(AudioSystem.isInputDevice( mState.mAttributes.getInternalType()) ? "source" : "sink").append(") ") .append(" state:").append(AudioSystem.deviceStateToString(mState.mState)) .append(" addr:").append(mState.mAttributes.getAddress()) .append(" name:").append(mState.mAttributes.getName()) Loading