Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 91cb8db2 authored by Łukasz Rymanowski's avatar Łukasz Rymanowski
Browse files

Remove leaudio_add_sampling_frequencies flag

Bug: 322482347
Bug: 323287937
Test: mmm packages/modules/Bluetooth
Change-Id: Id5933218a3521600b77487b65804dcc68fef68d1
parent b379e520
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -67,14 +67,6 @@ flag {
    bug: "322387487"
}

flag {
    name: "leaudio_add_sampling_frequencies"
    is_exported: true
    namespace: "bluetooth"
    description: "Adds missing frequencies defined by the Bluetooth SIG"
    bug: "323287937"
}

flag {
    name: "leaudio_callback_on_group_stream_status"
    is_exported: true
+7 −7
Original line number Diff line number Diff line
@@ -977,19 +977,19 @@ package android.bluetooth {
    field public static final int FRAME_DURATION_10000 = 2; // 0x2
    field public static final int FRAME_DURATION_7500 = 1; // 0x1
    field public static final int FRAME_DURATION_NONE = 0; // 0x0
    field @FlaggedApi("com.android.bluetooth.flags.leaudio_add_sampling_frequencies") public static final int SAMPLE_RATE_11025 = 2; // 0x2
    field public static final int SAMPLE_RATE_11025 = 2; // 0x2
    field public static final int SAMPLE_RATE_16000 = 4; // 0x4
    field @FlaggedApi("com.android.bluetooth.flags.leaudio_add_sampling_frequencies") public static final int SAMPLE_RATE_176400 = 1024; // 0x400
    field @FlaggedApi("com.android.bluetooth.flags.leaudio_add_sampling_frequencies") public static final int SAMPLE_RATE_192000 = 2048; // 0x800
    field @FlaggedApi("com.android.bluetooth.flags.leaudio_add_sampling_frequencies") public static final int SAMPLE_RATE_22050 = 8; // 0x8
    field public static final int SAMPLE_RATE_176400 = 1024; // 0x400
    field public static final int SAMPLE_RATE_192000 = 2048; // 0x800
    field public static final int SAMPLE_RATE_22050 = 8; // 0x8
    field public static final int SAMPLE_RATE_24000 = 16; // 0x10
    field public static final int SAMPLE_RATE_32000 = 32; // 0x20
    field @FlaggedApi("com.android.bluetooth.flags.leaudio_add_sampling_frequencies") public static final int SAMPLE_RATE_384000 = 4096; // 0x1000
    field public static final int SAMPLE_RATE_384000 = 4096; // 0x1000
    field public static final int SAMPLE_RATE_44100 = 64; // 0x40
    field public static final int SAMPLE_RATE_48000 = 128; // 0x80
    field public static final int SAMPLE_RATE_8000 = 1; // 0x1
    field @FlaggedApi("com.android.bluetooth.flags.leaudio_add_sampling_frequencies") public static final int SAMPLE_RATE_88200 = 256; // 0x100
    field @FlaggedApi("com.android.bluetooth.flags.leaudio_add_sampling_frequencies") public static final int SAMPLE_RATE_96000 = 512; // 0x200
    field public static final int SAMPLE_RATE_88200 = 256; // 0x100
    field public static final int SAMPLE_RATE_96000 = 512; // 0x200
    field public static final int SAMPLE_RATE_NONE = 0; // 0x0
    field public static final int SOURCE_CODEC_TYPE_INVALID = 1000000; // 0xf4240
    field public static final int SOURCE_CODEC_TYPE_LC3 = 0; // 0x0
+0 −7
Original line number Diff line number Diff line
@@ -103,14 +103,12 @@ public final class BluetoothLeAudioCodecConfig implements Parcelable {
    public static final int SAMPLE_RATE_8000 = 0x01 << 0;

    /** Codec sample rate 11025 Hz. */
    @FlaggedApi(Flags.FLAG_LEAUDIO_ADD_SAMPLING_FREQUENCIES)
    public static final int SAMPLE_RATE_11025 = 0x01 << 1;

    /** Codec sample rate 16000 Hz. */
    public static final int SAMPLE_RATE_16000 = 0x01 << 2;

    /** Codec sample rate 22050 Hz. */
    @FlaggedApi(Flags.FLAG_LEAUDIO_ADD_SAMPLING_FREQUENCIES)
    public static final int SAMPLE_RATE_22050 = 0x01 << 3;

    /** Codec sample rate 24000 Hz. */
@@ -126,23 +124,18 @@ public final class BluetoothLeAudioCodecConfig implements Parcelable {
    public static final int SAMPLE_RATE_48000 = 0x01 << 7;

    /** Codec sample rate 88200 Hz. */
    @FlaggedApi(Flags.FLAG_LEAUDIO_ADD_SAMPLING_FREQUENCIES)
    public static final int SAMPLE_RATE_88200 = 0x01 << 8;

    /** Codec sample rate 96000 Hz. */
    @FlaggedApi(Flags.FLAG_LEAUDIO_ADD_SAMPLING_FREQUENCIES)
    public static final int SAMPLE_RATE_96000 = 0x01 << 9;

    /** Codec sample rate 176400 Hz. */
    @FlaggedApi(Flags.FLAG_LEAUDIO_ADD_SAMPLING_FREQUENCIES)
    public static final int SAMPLE_RATE_176400 = 0x01 << 10;

    /** Codec sample rate 192000 Hz. */
    @FlaggedApi(Flags.FLAG_LEAUDIO_ADD_SAMPLING_FREQUENCIES)
    public static final int SAMPLE_RATE_192000 = 0x01 << 11;

    /** Codec sample rate 384000 Hz. */
    @FlaggedApi(Flags.FLAG_LEAUDIO_ADD_SAMPLING_FREQUENCIES)
    public static final int SAMPLE_RATE_384000 = 0x01 << 12;

    /** @hide */
+43 −52
Original line number Diff line number Diff line
@@ -20,12 +20,19 @@ import static android.bluetooth.BluetoothLeAudioCodecConfig.FRAME_DURATION_10000
import static android.bluetooth.BluetoothLeAudioCodecConfig.FRAME_DURATION_7500;
import static android.bluetooth.BluetoothLeAudioCodecConfig.FRAME_DURATION_NONE;
import static android.bluetooth.BluetoothLeAudioCodecConfig.FrameDuration;
import static android.bluetooth.BluetoothLeAudioCodecConfig.SAMPLE_RATE_11025;
import static android.bluetooth.BluetoothLeAudioCodecConfig.SAMPLE_RATE_16000;
import static android.bluetooth.BluetoothLeAudioCodecConfig.SAMPLE_RATE_176400;
import static android.bluetooth.BluetoothLeAudioCodecConfig.SAMPLE_RATE_192000;
import static android.bluetooth.BluetoothLeAudioCodecConfig.SAMPLE_RATE_22050;
import static android.bluetooth.BluetoothLeAudioCodecConfig.SAMPLE_RATE_24000;
import static android.bluetooth.BluetoothLeAudioCodecConfig.SAMPLE_RATE_32000;
import static android.bluetooth.BluetoothLeAudioCodecConfig.SAMPLE_RATE_384000;
import static android.bluetooth.BluetoothLeAudioCodecConfig.SAMPLE_RATE_44100;
import static android.bluetooth.BluetoothLeAudioCodecConfig.SAMPLE_RATE_48000;
import static android.bluetooth.BluetoothLeAudioCodecConfig.SAMPLE_RATE_8000;
import static android.bluetooth.BluetoothLeAudioCodecConfig.SAMPLE_RATE_88200;
import static android.bluetooth.BluetoothLeAudioCodecConfig.SAMPLE_RATE_96000;
import static android.bluetooth.BluetoothLeAudioCodecConfig.SAMPLE_RATE_NONE;
import static android.bluetooth.BluetoothLeAudioCodecConfig.SampleRate;

@@ -38,8 +45,6 @@ import android.bluetooth.BluetoothUtils.TypeValueEntry;
import android.os.Parcel;
import android.os.Parcelable;

import com.android.bluetooth.flags.Flags;

import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
@@ -392,26 +397,20 @@ public final class BluetoothLeAudioCodecConfigMetadata implements Parcelable {
        public Builder setSampleRate(@SampleRate int sampleRate) {
            if (sampleRate != SAMPLE_RATE_NONE
                    && sampleRate != SAMPLE_RATE_8000
                    && sampleRate != SAMPLE_RATE_11025
                    && sampleRate != SAMPLE_RATE_16000
                    && sampleRate != SAMPLE_RATE_22050
                    && sampleRate != SAMPLE_RATE_24000
                    && sampleRate != SAMPLE_RATE_32000
                    && sampleRate != SAMPLE_RATE_44100
                    && sampleRate != SAMPLE_RATE_48000) {

                if (Flags.leaudioAddSamplingFrequencies()) {
                    if (sampleRate != BluetoothLeAudioCodecConfig.SAMPLE_RATE_11025
                            && sampleRate != BluetoothLeAudioCodecConfig.SAMPLE_RATE_22050
                            && sampleRate != BluetoothLeAudioCodecConfig.SAMPLE_RATE_88200
                            && sampleRate != BluetoothLeAudioCodecConfig.SAMPLE_RATE_96000
                            && sampleRate != BluetoothLeAudioCodecConfig.SAMPLE_RATE_176400
                            && sampleRate != BluetoothLeAudioCodecConfig.SAMPLE_RATE_192000
                            && sampleRate != BluetoothLeAudioCodecConfig.SAMPLE_RATE_384000) {
                        throw new IllegalArgumentException("Invalid sample rate " + sampleRate);
                    }
                } else {
                    && sampleRate != SAMPLE_RATE_48000
                    && sampleRate != SAMPLE_RATE_88200
                    && sampleRate != SAMPLE_RATE_96000
                    && sampleRate != SAMPLE_RATE_176400
                    && sampleRate != SAMPLE_RATE_192000
                    && sampleRate != SAMPLE_RATE_384000) {
                        throw new IllegalArgumentException("Invalid sample rate " + sampleRate);
            }
            }
            mSampleRate = sampleRate;
            return this;
        }
@@ -528,8 +527,12 @@ public final class BluetoothLeAudioCodecConfigMetadata implements Parcelable {
        switch (samplingFrequencyValue) {
            case CONFIG_SAMPLING_FREQUENCY_8000:
                return SAMPLE_RATE_8000;
            case CONFIG_SAMPLING_FREQUENCY_11025:
                return SAMPLE_RATE_11025;
            case CONFIG_SAMPLING_FREQUENCY_16000:
                return SAMPLE_RATE_16000;
            case CONFIG_SAMPLING_FREQUENCY_22050:
                return SAMPLE_RATE_22050;
            case CONFIG_SAMPLING_FREQUENCY_24000:
                return SAMPLE_RATE_24000;
            case CONFIG_SAMPLING_FREQUENCY_32000:
@@ -538,25 +541,17 @@ public final class BluetoothLeAudioCodecConfigMetadata implements Parcelable {
                return SAMPLE_RATE_44100;
            case CONFIG_SAMPLING_FREQUENCY_48000:
                return SAMPLE_RATE_48000;
            default:
                if (Flags.leaudioAddSamplingFrequencies()) {
                    switch (samplingFrequencyValue) {
                        case CONFIG_SAMPLING_FREQUENCY_11025:
                            return BluetoothLeAudioCodecConfig.SAMPLE_RATE_11025;
                        case CONFIG_SAMPLING_FREQUENCY_22050:
                            return BluetoothLeAudioCodecConfig.SAMPLE_RATE_22050;
            case CONFIG_SAMPLING_FREQUENCY_88200:
                            return BluetoothLeAudioCodecConfig.SAMPLE_RATE_88200;
                return SAMPLE_RATE_88200;
            case CONFIG_SAMPLING_FREQUENCY_96000:
                            return BluetoothLeAudioCodecConfig.SAMPLE_RATE_96000;
                return SAMPLE_RATE_96000;
            case CONFIG_SAMPLING_FREQUENCY_176400:
                            return BluetoothLeAudioCodecConfig.SAMPLE_RATE_176400;
                return SAMPLE_RATE_176400;
            case CONFIG_SAMPLING_FREQUENCY_192000:
                            return BluetoothLeAudioCodecConfig.SAMPLE_RATE_192000;
                return SAMPLE_RATE_192000;
            case CONFIG_SAMPLING_FREQUENCY_384000:
                            return BluetoothLeAudioCodecConfig.SAMPLE_RATE_384000;
                    }
                }
                return SAMPLE_RATE_384000;
            default:
                return SAMPLE_RATE_NONE;
        }
    }
@@ -565,8 +560,12 @@ public final class BluetoothLeAudioCodecConfigMetadata implements Parcelable {
        switch (sampleRateBitSet) {
            case SAMPLE_RATE_8000:
                return CONFIG_SAMPLING_FREQUENCY_8000;
            case SAMPLE_RATE_11025:
                return CONFIG_SAMPLING_FREQUENCY_11025;
            case SAMPLE_RATE_16000:
                return CONFIG_SAMPLING_FREQUENCY_16000;
            case SAMPLE_RATE_22050:
                return CONFIG_SAMPLING_FREQUENCY_22050;
            case SAMPLE_RATE_24000:
                return CONFIG_SAMPLING_FREQUENCY_24000;
            case SAMPLE_RATE_32000:
@@ -575,25 +574,17 @@ public final class BluetoothLeAudioCodecConfigMetadata implements Parcelable {
                return CONFIG_SAMPLING_FREQUENCY_44100;
            case SAMPLE_RATE_48000:
                return CONFIG_SAMPLING_FREQUENCY_48000;
            default:
                if (Flags.leaudioAddSamplingFrequencies()) {
                    switch (sampleRateBitSet) {
                        case BluetoothLeAudioCodecConfig.SAMPLE_RATE_11025:
                            return CONFIG_SAMPLING_FREQUENCY_11025;
                        case BluetoothLeAudioCodecConfig.SAMPLE_RATE_22050:
                            return CONFIG_SAMPLING_FREQUENCY_22050;
                        case BluetoothLeAudioCodecConfig.SAMPLE_RATE_88200:
            case SAMPLE_RATE_88200:
                return CONFIG_SAMPLING_FREQUENCY_88200;
                        case BluetoothLeAudioCodecConfig.SAMPLE_RATE_96000:
            case SAMPLE_RATE_96000:
                return CONFIG_SAMPLING_FREQUENCY_96000;
                        case BluetoothLeAudioCodecConfig.SAMPLE_RATE_176400:
            case SAMPLE_RATE_176400:
                return CONFIG_SAMPLING_FREQUENCY_176400;
                        case BluetoothLeAudioCodecConfig.SAMPLE_RATE_192000:
            case SAMPLE_RATE_192000:
                return CONFIG_SAMPLING_FREQUENCY_192000;
                        case BluetoothLeAudioCodecConfig.SAMPLE_RATE_384000:
            case SAMPLE_RATE_384000:
                return CONFIG_SAMPLING_FREQUENCY_384000;
                    }
                }
            default:
                return CONFIG_SAMPLING_FREQUENCY_UNKNOWN;
        }
    }