Search in sources :

Example 1 with BluetoothCodecStatus

use of android.bluetooth.BluetoothCodecStatus in project android_packages_apps_Settings by LineageOS.

the class DevelopmentSettings method updateBluetoothA2dpConfigurationValues.

private void updateBluetoothA2dpConfigurationValues() {
    int index;
    String[] summaries;
    BluetoothCodecStatus codecStatus = null;
    BluetoothCodecConfig codecConfig = null;
    BluetoothCodecConfig[] codecsLocalCapabilities = null;
    BluetoothCodecConfig[] codecsSelectableCapabilities = null;
    String streaming;
    Resources resources = null;
    synchronized (mBluetoothA2dpLock) {
        if (mBluetoothA2dp != null) {
            codecStatus = mBluetoothA2dp.getCodecStatus();
            if (codecStatus != null) {
                codecConfig = codecStatus.getCodecConfig();
                codecsLocalCapabilities = codecStatus.getCodecsLocalCapabilities();
                codecsSelectableCapabilities = codecStatus.getCodecsSelectableCapabilities();
            }
        }
    }
    if (codecConfig == null) {
        return;
    }
    try {
        resources = getResources();
    } catch (IllegalStateException e) {
        return;
    }
    if (resources == null) {
        return;
    }
    // Update the Codec Type
    index = -1;
    switch(codecConfig.getCodecType()) {
        case BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC:
            index = 1;
            break;
        case BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC:
            index = 2;
            break;
        case BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX:
            index = 3;
            break;
        case BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX_HD:
            index = 4;
            break;
        case BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC:
            index = 5;
            break;
        case BluetoothCodecConfig.SOURCE_CODEC_TYPE_INVALID:
        default:
            break;
    }
    if (index >= 0 && mBluetoothSelectA2dpCodec != null) {
        summaries = resources.getStringArray(R.array.bluetooth_a2dp_codec_summaries);
        streaming = resources.getString(R.string.bluetooth_select_a2dp_codec_streaming_label, summaries[index]);
        mBluetoothSelectA2dpCodec.setSummary(streaming);
    }
    // Update the Sample Rate
    index = -1;
    switch(codecConfig.getSampleRate()) {
        case BluetoothCodecConfig.SAMPLE_RATE_44100:
            index = 1;
            break;
        case BluetoothCodecConfig.SAMPLE_RATE_48000:
            index = 2;
            break;
        case BluetoothCodecConfig.SAMPLE_RATE_88200:
            index = 3;
            break;
        case BluetoothCodecConfig.SAMPLE_RATE_96000:
            index = 4;
            break;
        case BluetoothCodecConfig.SAMPLE_RATE_176400:
        case BluetoothCodecConfig.SAMPLE_RATE_192000:
        case BluetoothCodecConfig.SAMPLE_RATE_NONE:
        default:
            break;
    }
    if (index >= 0 && mBluetoothSelectA2dpSampleRate != null) {
        summaries = resources.getStringArray(R.array.bluetooth_a2dp_codec_sample_rate_summaries);
        streaming = resources.getString(R.string.bluetooth_select_a2dp_codec_streaming_label, summaries[index]);
        mBluetoothSelectA2dpSampleRate.setSummary(streaming);
    }
    // Update the Bits Per Sample
    index = -1;
    switch(codecConfig.getBitsPerSample()) {
        case BluetoothCodecConfig.BITS_PER_SAMPLE_16:
            index = 1;
            break;
        case BluetoothCodecConfig.BITS_PER_SAMPLE_24:
            index = 2;
            break;
        case BluetoothCodecConfig.BITS_PER_SAMPLE_32:
            index = 3;
            break;
        case BluetoothCodecConfig.BITS_PER_SAMPLE_NONE:
        default:
            break;
    }
    if (index >= 0 && mBluetoothSelectA2dpBitsPerSample != null) {
        summaries = resources.getStringArray(R.array.bluetooth_a2dp_codec_bits_per_sample_summaries);
        streaming = resources.getString(R.string.bluetooth_select_a2dp_codec_streaming_label, summaries[index]);
        mBluetoothSelectA2dpBitsPerSample.setSummary(streaming);
    }
    // Update the Channel Mode
    index = -1;
    switch(codecConfig.getChannelMode()) {
        case BluetoothCodecConfig.CHANNEL_MODE_MONO:
            index = 1;
            break;
        case BluetoothCodecConfig.CHANNEL_MODE_STEREO:
            index = 2;
            break;
        case BluetoothCodecConfig.CHANNEL_MODE_NONE:
        default:
            break;
    }
    if (index >= 0 && mBluetoothSelectA2dpChannelMode != null) {
        summaries = resources.getStringArray(R.array.bluetooth_a2dp_codec_channel_mode_summaries);
        streaming = resources.getString(R.string.bluetooth_select_a2dp_codec_streaming_label, summaries[index]);
        mBluetoothSelectA2dpChannelMode.setSummary(streaming);
    }
    // Update the LDAC Playback Quality
    // The actual values are 0, 1, 2 - those are extracted
    // as mod-10 remainders of a larger value.
    // The reason is because within BluetoothCodecConfig we cannot use
    // a codec-specific value of zero.
    index = (int) codecConfig.getCodecSpecific1();
    if (index > 0) {
        index %= 10;
    } else {
        index = -1;
    }
    switch(index) {
        case 0:
        case 1:
        case 2:
        case 3:
            break;
        default:
            index = -1;
            break;
    }
    if (index >= 0 && mBluetoothSelectA2dpLdacPlaybackQuality != null) {
        summaries = resources.getStringArray(R.array.bluetooth_a2dp_codec_ldac_playback_quality_summaries);
        streaming = resources.getString(R.string.bluetooth_select_a2dp_codec_streaming_label, summaries[index]);
        mBluetoothSelectA2dpLdacPlaybackQuality.setSummary(streaming);
    }
}
Also used : BluetoothCodecStatus(android.bluetooth.BluetoothCodecStatus) BluetoothCodecConfig(android.bluetooth.BluetoothCodecConfig) Resources(android.content.res.Resources)

Example 2 with BluetoothCodecStatus

use of android.bluetooth.BluetoothCodecStatus in project android_packages_apps_Settings by omnirom.

the class DevelopmentSettings method updateBluetoothA2dpConfigurationValues.

private void updateBluetoothA2dpConfigurationValues() {
    int index;
    String[] summaries;
    BluetoothCodecStatus codecStatus = null;
    BluetoothCodecConfig codecConfig = null;
    BluetoothCodecConfig[] codecsLocalCapabilities = null;
    BluetoothCodecConfig[] codecsSelectableCapabilities = null;
    String streaming;
    Resources resources = null;
    synchronized (mBluetoothA2dpLock) {
        if (mBluetoothA2dp != null) {
            codecStatus = mBluetoothA2dp.getCodecStatus();
            if (codecStatus != null) {
                codecConfig = codecStatus.getCodecConfig();
                codecsLocalCapabilities = codecStatus.getCodecsLocalCapabilities();
                codecsSelectableCapabilities = codecStatus.getCodecsSelectableCapabilities();
            }
        }
    }
    if (codecConfig == null) {
        return;
    }
    try {
        resources = getResources();
    } catch (IllegalStateException e) {
        return;
    }
    if (resources == null) {
        return;
    }
    // Update the Codec Type
    index = -1;
    switch(codecConfig.getCodecType()) {
        case BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC:
            index = 1;
            break;
        case BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC:
            index = 2;
            break;
        case BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX:
            index = 3;
            break;
        case BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX_HD:
            index = 4;
            break;
        case BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC:
            index = 5;
            break;
        case BluetoothCodecConfig.SOURCE_CODEC_TYPE_INVALID:
        default:
            break;
    }
    if (index >= 0 && mBluetoothSelectA2dpCodec != null) {
        summaries = resources.getStringArray(R.array.bluetooth_a2dp_codec_summaries);
        streaming = resources.getString(R.string.bluetooth_select_a2dp_codec_streaming_label, summaries[index]);
        mBluetoothSelectA2dpCodec.setSummary(streaming);
    }
    // Update the Sample Rate
    index = -1;
    switch(codecConfig.getSampleRate()) {
        case BluetoothCodecConfig.SAMPLE_RATE_44100:
            index = 1;
            break;
        case BluetoothCodecConfig.SAMPLE_RATE_48000:
            index = 2;
            break;
        case BluetoothCodecConfig.SAMPLE_RATE_88200:
            index = 3;
            break;
        case BluetoothCodecConfig.SAMPLE_RATE_96000:
            index = 4;
            break;
        case BluetoothCodecConfig.SAMPLE_RATE_176400:
        case BluetoothCodecConfig.SAMPLE_RATE_192000:
        case BluetoothCodecConfig.SAMPLE_RATE_NONE:
        default:
            break;
    }
    if (index >= 0 && mBluetoothSelectA2dpSampleRate != null) {
        summaries = resources.getStringArray(R.array.bluetooth_a2dp_codec_sample_rate_summaries);
        streaming = resources.getString(R.string.bluetooth_select_a2dp_codec_streaming_label, summaries[index]);
        mBluetoothSelectA2dpSampleRate.setSummary(streaming);
    }
    // Update the Bits Per Sample
    index = -1;
    switch(codecConfig.getBitsPerSample()) {
        case BluetoothCodecConfig.BITS_PER_SAMPLE_16:
            index = 1;
            break;
        case BluetoothCodecConfig.BITS_PER_SAMPLE_24:
            index = 2;
            break;
        case BluetoothCodecConfig.BITS_PER_SAMPLE_32:
            index = 3;
            break;
        case BluetoothCodecConfig.BITS_PER_SAMPLE_NONE:
        default:
            break;
    }
    if (index >= 0 && mBluetoothSelectA2dpBitsPerSample != null) {
        summaries = resources.getStringArray(R.array.bluetooth_a2dp_codec_bits_per_sample_summaries);
        streaming = resources.getString(R.string.bluetooth_select_a2dp_codec_streaming_label, summaries[index]);
        mBluetoothSelectA2dpBitsPerSample.setSummary(streaming);
    }
    // Update the Channel Mode
    index = -1;
    switch(codecConfig.getChannelMode()) {
        case BluetoothCodecConfig.CHANNEL_MODE_MONO:
            index = 1;
            break;
        case BluetoothCodecConfig.CHANNEL_MODE_STEREO:
            index = 2;
            break;
        case BluetoothCodecConfig.CHANNEL_MODE_NONE:
        default:
            break;
    }
    if (index >= 0 && mBluetoothSelectA2dpChannelMode != null) {
        summaries = resources.getStringArray(R.array.bluetooth_a2dp_codec_channel_mode_summaries);
        streaming = resources.getString(R.string.bluetooth_select_a2dp_codec_streaming_label, summaries[index]);
        mBluetoothSelectA2dpChannelMode.setSummary(streaming);
    }
    // Update the LDAC Playback Quality
    // The actual values are 0, 1, 2 - those are extracted
    // as mod-10 remainders of a larger value.
    // The reason is because within BluetoothCodecConfig we cannot use
    // a codec-specific value of zero.
    index = (int) codecConfig.getCodecSpecific1();
    if (index > 0) {
        index %= 10;
    } else {
        index = -1;
    }
    switch(index) {
        case 0:
        case 1:
        case 2:
        case 3:
            break;
        default:
            index = -1;
            break;
    }
    if (index >= 0 && mBluetoothSelectA2dpLdacPlaybackQuality != null) {
        summaries = resources.getStringArray(R.array.bluetooth_a2dp_codec_ldac_playback_quality_summaries);
        streaming = resources.getString(R.string.bluetooth_select_a2dp_codec_streaming_label, summaries[index]);
        mBluetoothSelectA2dpLdacPlaybackQuality.setSummary(streaming);
    }
}
Also used : BluetoothCodecStatus(android.bluetooth.BluetoothCodecStatus) BluetoothCodecConfig(android.bluetooth.BluetoothCodecConfig) Resources(android.content.res.Resources)

Example 3 with BluetoothCodecStatus

use of android.bluetooth.BluetoothCodecStatus in project android_packages_apps_Settings by SudaMod.

the class DevelopmentSettings method updateBluetoothA2dpConfigurationValues.

private void updateBluetoothA2dpConfigurationValues() {
    int index;
    String[] summaries;
    BluetoothCodecStatus codecStatus = null;
    BluetoothCodecConfig codecConfig = null;
    BluetoothCodecConfig[] codecsLocalCapabilities = null;
    BluetoothCodecConfig[] codecsSelectableCapabilities = null;
    String streaming;
    Resources resources = null;
    synchronized (mBluetoothA2dpLock) {
        if (mBluetoothA2dp != null) {
            codecStatus = mBluetoothA2dp.getCodecStatus();
            if (codecStatus != null) {
                codecConfig = codecStatus.getCodecConfig();
                codecsLocalCapabilities = codecStatus.getCodecsLocalCapabilities();
                codecsSelectableCapabilities = codecStatus.getCodecsSelectableCapabilities();
            }
        }
    }
    if (codecConfig == null) {
        return;
    }
    try {
        resources = getResources();
    } catch (IllegalStateException e) {
        return;
    }
    if (resources == null) {
        return;
    }
    // Update the Codec Type
    index = -1;
    switch(codecConfig.getCodecType()) {
        case BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC:
            index = 1;
            break;
        case BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC:
            index = 2;
            break;
        case BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX:
            index = 3;
            break;
        case BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX_HD:
            index = 4;
            break;
        case BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC:
            index = 5;
            break;
        case BluetoothCodecConfig.SOURCE_CODEC_TYPE_INVALID:
        default:
            break;
    }
    if (index >= 0 && mBluetoothSelectA2dpCodec != null) {
        summaries = resources.getStringArray(R.array.bluetooth_a2dp_codec_summaries);
        streaming = resources.getString(R.string.bluetooth_select_a2dp_codec_streaming_label, summaries[index]);
        mBluetoothSelectA2dpCodec.setSummary(streaming);
    }
    // Update the Sample Rate
    index = -1;
    switch(codecConfig.getSampleRate()) {
        case BluetoothCodecConfig.SAMPLE_RATE_44100:
            index = 1;
            break;
        case BluetoothCodecConfig.SAMPLE_RATE_48000:
            index = 2;
            break;
        case BluetoothCodecConfig.SAMPLE_RATE_88200:
            index = 3;
            break;
        case BluetoothCodecConfig.SAMPLE_RATE_96000:
            index = 4;
            break;
        case BluetoothCodecConfig.SAMPLE_RATE_176400:
        case BluetoothCodecConfig.SAMPLE_RATE_192000:
        case BluetoothCodecConfig.SAMPLE_RATE_NONE:
        default:
            break;
    }
    if (index >= 0 && mBluetoothSelectA2dpSampleRate != null) {
        summaries = resources.getStringArray(R.array.bluetooth_a2dp_codec_sample_rate_summaries);
        streaming = resources.getString(R.string.bluetooth_select_a2dp_codec_streaming_label, summaries[index]);
        mBluetoothSelectA2dpSampleRate.setSummary(streaming);
    }
    // Update the Bits Per Sample
    index = -1;
    switch(codecConfig.getBitsPerSample()) {
        case BluetoothCodecConfig.BITS_PER_SAMPLE_16:
            index = 1;
            break;
        case BluetoothCodecConfig.BITS_PER_SAMPLE_24:
            index = 2;
            break;
        case BluetoothCodecConfig.BITS_PER_SAMPLE_32:
            index = 3;
            break;
        case BluetoothCodecConfig.BITS_PER_SAMPLE_NONE:
        default:
            break;
    }
    if (index >= 0 && mBluetoothSelectA2dpBitsPerSample != null) {
        summaries = resources.getStringArray(R.array.bluetooth_a2dp_codec_bits_per_sample_summaries);
        streaming = resources.getString(R.string.bluetooth_select_a2dp_codec_streaming_label, summaries[index]);
        mBluetoothSelectA2dpBitsPerSample.setSummary(streaming);
    }
    // Update the Channel Mode
    index = -1;
    switch(codecConfig.getChannelMode()) {
        case BluetoothCodecConfig.CHANNEL_MODE_MONO:
            index = 1;
            break;
        case BluetoothCodecConfig.CHANNEL_MODE_STEREO:
            index = 2;
            break;
        case BluetoothCodecConfig.CHANNEL_MODE_NONE:
        default:
            break;
    }
    if (index >= 0 && mBluetoothSelectA2dpChannelMode != null) {
        summaries = resources.getStringArray(R.array.bluetooth_a2dp_codec_channel_mode_summaries);
        streaming = resources.getString(R.string.bluetooth_select_a2dp_codec_streaming_label, summaries[index]);
        mBluetoothSelectA2dpChannelMode.setSummary(streaming);
    }
    // Update the LDAC Playback Quality
    // The actual values are 0, 1, 2 - those are extracted
    // as mod-10 remainders of a larger value.
    // The reason is because within BluetoothCodecConfig we cannot use
    // a codec-specific value of zero.
    index = (int) codecConfig.getCodecSpecific1();
    if (index > 0) {
        index %= 10;
    } else {
        index = -1;
    }
    switch(index) {
        case 0:
        case 1:
        case 2:
        case 3:
            break;
        default:
            index = -1;
            break;
    }
    if (index >= 0 && mBluetoothSelectA2dpLdacPlaybackQuality != null) {
        summaries = resources.getStringArray(R.array.bluetooth_a2dp_codec_ldac_playback_quality_summaries);
        streaming = resources.getString(R.string.bluetooth_select_a2dp_codec_streaming_label, summaries[index]);
        mBluetoothSelectA2dpLdacPlaybackQuality.setSummary(streaming);
    }
}
Also used : BluetoothCodecStatus(android.bluetooth.BluetoothCodecStatus) BluetoothCodecConfig(android.bluetooth.BluetoothCodecConfig) Resources(android.content.res.Resources)

Example 4 with BluetoothCodecStatus

use of android.bluetooth.BluetoothCodecStatus in project android_packages_apps_Settings by DirtyUnicorns.

the class DevelopmentSettings method updateBluetoothA2dpConfigurationValues.

private void updateBluetoothA2dpConfigurationValues() {
    int index;
    String[] summaries;
    BluetoothCodecStatus codecStatus = null;
    BluetoothCodecConfig codecConfig = null;
    BluetoothCodecConfig[] codecsLocalCapabilities = null;
    BluetoothCodecConfig[] codecsSelectableCapabilities = null;
    String streaming;
    Resources resources = null;
    synchronized (mBluetoothA2dpLock) {
        if (mBluetoothA2dp != null) {
            codecStatus = mBluetoothA2dp.getCodecStatus();
            if (codecStatus != null) {
                codecConfig = codecStatus.getCodecConfig();
                codecsLocalCapabilities = codecStatus.getCodecsLocalCapabilities();
                codecsSelectableCapabilities = codecStatus.getCodecsSelectableCapabilities();
            }
        }
    }
    if (codecConfig == null) {
        return;
    }
    try {
        resources = getResources();
    } catch (IllegalStateException e) {
        return;
    }
    if (resources == null) {
        return;
    }
    // Update the Codec Type
    index = -1;
    switch(codecConfig.getCodecType()) {
        case BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC:
            index = 1;
            break;
        case BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC:
            index = 2;
            break;
        case BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX:
            index = 3;
            break;
        case BluetoothCodecConfig.SOURCE_CODEC_TYPE_APTX_HD:
            index = 4;
            break;
        case BluetoothCodecConfig.SOURCE_CODEC_TYPE_LDAC:
            index = 5;
            break;
        case BluetoothCodecConfig.SOURCE_CODEC_TYPE_INVALID:
        default:
            break;
    }
    if (index >= 0 && mBluetoothSelectA2dpCodec != null) {
        summaries = resources.getStringArray(R.array.bluetooth_a2dp_codec_summaries);
        streaming = resources.getString(R.string.bluetooth_select_a2dp_codec_streaming_label, summaries[index]);
        mBluetoothSelectA2dpCodec.setSummary(streaming);
    }
    // Update the Sample Rate
    index = -1;
    switch(codecConfig.getSampleRate()) {
        case BluetoothCodecConfig.SAMPLE_RATE_44100:
            index = 1;
            break;
        case BluetoothCodecConfig.SAMPLE_RATE_48000:
            index = 2;
            break;
        case BluetoothCodecConfig.SAMPLE_RATE_88200:
            index = 3;
            break;
        case BluetoothCodecConfig.SAMPLE_RATE_96000:
            index = 4;
            break;
        case BluetoothCodecConfig.SAMPLE_RATE_176400:
        case BluetoothCodecConfig.SAMPLE_RATE_192000:
        case BluetoothCodecConfig.SAMPLE_RATE_NONE:
        default:
            break;
    }
    if (index >= 0 && mBluetoothSelectA2dpSampleRate != null) {
        summaries = resources.getStringArray(R.array.bluetooth_a2dp_codec_sample_rate_summaries);
        streaming = resources.getString(R.string.bluetooth_select_a2dp_codec_streaming_label, summaries[index]);
        mBluetoothSelectA2dpSampleRate.setSummary(streaming);
    }
    // Update the Bits Per Sample
    index = -1;
    switch(codecConfig.getBitsPerSample()) {
        case BluetoothCodecConfig.BITS_PER_SAMPLE_16:
            index = 1;
            break;
        case BluetoothCodecConfig.BITS_PER_SAMPLE_24:
            index = 2;
            break;
        case BluetoothCodecConfig.BITS_PER_SAMPLE_32:
            index = 3;
            break;
        case BluetoothCodecConfig.BITS_PER_SAMPLE_NONE:
        default:
            break;
    }
    if (index >= 0 && mBluetoothSelectA2dpBitsPerSample != null) {
        summaries = resources.getStringArray(R.array.bluetooth_a2dp_codec_bits_per_sample_summaries);
        streaming = resources.getString(R.string.bluetooth_select_a2dp_codec_streaming_label, summaries[index]);
        mBluetoothSelectA2dpBitsPerSample.setSummary(streaming);
    }
    // Update the Channel Mode
    index = -1;
    switch(codecConfig.getChannelMode()) {
        case BluetoothCodecConfig.CHANNEL_MODE_MONO:
            index = 1;
            break;
        case BluetoothCodecConfig.CHANNEL_MODE_STEREO:
            index = 2;
            break;
        case BluetoothCodecConfig.CHANNEL_MODE_NONE:
        default:
            break;
    }
    if (index >= 0 && mBluetoothSelectA2dpChannelMode != null) {
        summaries = resources.getStringArray(R.array.bluetooth_a2dp_codec_channel_mode_summaries);
        streaming = resources.getString(R.string.bluetooth_select_a2dp_codec_streaming_label, summaries[index]);
        mBluetoothSelectA2dpChannelMode.setSummary(streaming);
    }
    // Update the LDAC Playback Quality
    // The actual values are 0, 1, 2 - those are extracted
    // as mod-10 remainders of a larger value.
    // The reason is because within BluetoothCodecConfig we cannot use
    // a codec-specific value of zero.
    index = (int) codecConfig.getCodecSpecific1();
    if (index > 0) {
        index %= 10;
    } else {
        index = -1;
    }
    switch(index) {
        case 0:
        case 1:
        case 2:
        case 3:
            break;
        default:
            index = -1;
            break;
    }
    if (index >= 0 && mBluetoothSelectA2dpLdacPlaybackQuality != null) {
        summaries = resources.getStringArray(R.array.bluetooth_a2dp_codec_ldac_playback_quality_summaries);
        streaming = resources.getString(R.string.bluetooth_select_a2dp_codec_streaming_label, summaries[index]);
        mBluetoothSelectA2dpLdacPlaybackQuality.setSummary(streaming);
    }
}
Also used : BluetoothCodecStatus(android.bluetooth.BluetoothCodecStatus) BluetoothCodecConfig(android.bluetooth.BluetoothCodecConfig) Resources(android.content.res.Resources)

Example 5 with BluetoothCodecStatus

use of android.bluetooth.BluetoothCodecStatus in project android_packages_apps_Settings by omnirom.

the class AbstractBluetoothA2dpPreferenceController method getCodecConfig.

@VisibleForTesting
BluetoothCodecConfig getCodecConfig(BluetoothDevice device) {
    if (mBluetoothA2dp != null) {
        BluetoothDevice bluetoothDevice = (device != null) ? device : mBluetoothA2dp.getActiveDevice();
        if (bluetoothDevice == null) {
            return null;
        }
        BluetoothCodecStatus codecStatus = mBluetoothA2dp.getCodecStatus(bluetoothDevice);
        if (codecStatus != null) {
            return codecStatus.getCodecConfig();
        }
    }
    return null;
}
Also used : BluetoothDevice(android.bluetooth.BluetoothDevice) BluetoothCodecStatus(android.bluetooth.BluetoothCodecStatus) VisibleForTesting(androidx.annotation.VisibleForTesting)

Aggregations

BluetoothCodecStatus (android.bluetooth.BluetoothCodecStatus)26 BluetoothCodecConfig (android.bluetooth.BluetoothCodecConfig)17 Test (org.junit.Test)17 Resources (android.content.res.Resources)6 BluetoothDevice (android.bluetooth.BluetoothDevice)3 ArrayList (java.util.ArrayList)3 BluetoothA2dp (android.bluetooth.BluetoothA2dp)2 VisibleForTesting (androidx.annotation.VisibleForTesting)1