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

Commit 1b685804 authored by Etienne Ruffieux's avatar Etienne Ruffieux Committed by Gerrit Code Review
Browse files

Merge "Removed getMaxCodecType and made getcodecName static"

parents 1610c7c1 4d1eabb0
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -118,7 +118,7 @@ class A2dpCodecConfig {
    void enableOptionalCodecs(BluetoothDevice device, BluetoothCodecConfig currentCodecConfig) {
        if (currentCodecConfig != null && !currentCodecConfig.isMandatoryCodec()) {
            Log.i(TAG, "enableOptionalCodecs: already using optional codec "
                    + currentCodecConfig.getCodecName());
                    + BluetoothCodecConfig.getCodecName(currentCodecConfig.getCodecType()));
            return;
        }

@@ -245,7 +245,7 @@ class A2dpCodecConfig {

        BluetoothCodecConfig codecConfig;
        BluetoothCodecConfig[] codecConfigArray =
                new BluetoothCodecConfig[BluetoothCodecConfig.getMaxCodecType()];
                new BluetoothCodecConfig[6];
        codecConfig = new BluetoothCodecConfig.Builder()
                .setCodecType(BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC)
                .setCodecPriority(mA2dpSourceCodecPrioritySbc)
+2 −1
Original line number Diff line number Diff line
@@ -1583,7 +1583,8 @@ public class A2dpService extends ProfileService {
        if (mA2dpCodecConfig != null) {
            ProfileService.println(sb, "codecConfigPriorities:");
            for (BluetoothCodecConfig codecConfig : mA2dpCodecConfig.codecConfigPriorities()) {
                ProfileService.println(sb, "  " + codecConfig.getCodecName() + ": "
                ProfileService.println(sb, "  " + BluetoothCodecConfig.getCodecName(
                        codecConfig.getCodecType()) + ": "
                        + codecConfig.getCodecPriority());
            }
            ProfileService.println(sb, "mA2dpOffloadEnabled: " + mA2dpOffloadEnabled);
+2 −2
Original line number Diff line number Diff line
@@ -607,7 +607,7 @@ public class A2dpCodecConfigTest {
    @Test
    public void testDisableOptionalCodecs() {
        BluetoothCodecConfig[] codecConfigsArray =
                new BluetoothCodecConfig[BluetoothCodecConfig.getMaxCodecType()];
                new BluetoothCodecConfig[6];
        codecConfigsArray[0] = buildBluetoothCodecConfig(
                BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC,
                BluetoothCodecConfig.CODEC_PRIORITY_HIGHEST,
@@ -640,7 +640,7 @@ public class A2dpCodecConfigTest {
    @Test
    public void testEnableOptionalCodecs() {
        BluetoothCodecConfig[] codecConfigsArray =
                new BluetoothCodecConfig[BluetoothCodecConfig.getMaxCodecType()];
                new BluetoothCodecConfig[6];
        codecConfigsArray[0] = buildBluetoothCodecConfig(
                BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC,
                SBC_PRIORITY_DEFAULT,
+0 −1
Original line number Diff line number Diff line
@@ -422,7 +422,6 @@ package android.bluetooth {
    method public long getCodecSpecific3();
    method public long getCodecSpecific4();
    method public int getCodecType();
    method public static int getMaxCodecType();
    method public int getSampleRate();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final int BITS_PER_SAMPLE_16 = 1; // 0x1
+5 −13
Original line number Diff line number Diff line
@@ -84,8 +84,7 @@ public final class BluetoothCodecConfig implements Parcelable {
    public static final int SOURCE_CODEC_TYPE_INVALID = 1000 * 1000;

    /**
     * Represents the count of valid source codec types. Can be accessed via
     * {@link #getMaxCodecType}.
     * Represents the count of valid source codec types.
     */
    private static final int SOURCE_CODEC_TYPE_MAX = 6;

@@ -390,7 +389,7 @@ public final class BluetoothCodecConfig implements Parcelable {
            channelModeStr = appendCapabilityToString(channelModeStr, "STEREO");
        }

        return "{codecName:" + getCodecName()
        return "{codecName:" + getCodecName(mCodecType)
                + ",mCodecType:" + mCodecType
                + ",mCodecPriority:" + mCodecPriority
                + ",mSampleRate:" + String.format("0x%x", mSampleRate)
@@ -450,8 +449,8 @@ public final class BluetoothCodecConfig implements Parcelable {
     * Returns the codec name converted to {@link String}.
     * @hide
     */
    public @NonNull String getCodecName() {
        switch (mCodecType) {
    public static @NonNull String getCodecName(@SourceCodecType int codecType) {
        switch (codecType) {
            case SOURCE_CODEC_TYPE_SBC:
                return "SBC";
            case SOURCE_CODEC_TYPE_AAC:
@@ -469,7 +468,7 @@ public final class BluetoothCodecConfig implements Parcelable {
            default:
                break;
        }
        return "UNKNOWN CODEC(" + mCodecType + ")";
        return "UNKNOWN CODEC(" + codecType + ")";
    }

    /**
@@ -479,13 +478,6 @@ public final class BluetoothCodecConfig implements Parcelable {
        return mCodecType;
    }

    /**
     * Returns the valid codec types count.
     */
    public static int getMaxCodecType() {
        return SOURCE_CODEC_TYPE_MAX;
    }

    /**
     * Checks whether the codec is mandatory.
     * <p> The actual mandatory codec type for Android Bluetooth audio is SBC.
Loading