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

Commit 8cd10b78 authored by Vance Yu's avatar Vance Yu
Browse files

Add system properties to config audio codec priority

Add and get audio codec priorities from  properties below
bluetooth.a2dp.source.sbc_priority.config
bluetooth.a2dp.source.aac_priority.config
bluetooth.a2dp.source.aptx_priority.config
bluetooth.a2dp.source.aptx_hd_priority.config
bluetooth.a2dp.source.ldac_priority.config
bluetooth.a2dp.source.lc3_priority.config

Bug: 270032693
Test: manually test in local build
Change-Id: Ia0aa8bdf03cb66b3d2957dee24a27669651eb123
parent 9712e53b
Loading
Loading
Loading
Loading
+19 −6
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.content.Context;
import android.content.res.Resources;
import android.content.res.Resources.NotFoundException;
import android.media.AudioManager;
import android.os.SystemProperties;
import android.util.Log;

import com.android.bluetooth.R;
@@ -189,7 +190,9 @@ class A2dpCodecConfig {

        int value;
        try {
            value = resources.getInteger(R.integer.a2dp_source_codec_priority_sbc);
            value = SystemProperties.getInt(
                "bluetooth.a2dp.source.sbc_priority.config",
                resources.getInteger(R.integer.a2dp_source_codec_priority_sbc));
        } catch (NotFoundException e) {
            value = BluetoothCodecConfig.CODEC_PRIORITY_DEFAULT;
        }
@@ -199,7 +202,9 @@ class A2dpCodecConfig {
        }

        try {
            value = resources.getInteger(R.integer.a2dp_source_codec_priority_aac);
            value = SystemProperties.getInt(
                "bluetooth.a2dp.source.aac_priority.config",
                resources.getInteger(R.integer.a2dp_source_codec_priority_aac));
        } catch (NotFoundException e) {
            value = BluetoothCodecConfig.CODEC_PRIORITY_DEFAULT;
        }
@@ -209,7 +214,9 @@ class A2dpCodecConfig {
        }

        try {
            value = resources.getInteger(R.integer.a2dp_source_codec_priority_aptx);
            value = SystemProperties.getInt(
                "bluetooth.a2dp.source.aptx_priority.config",
                resources.getInteger(R.integer.a2dp_source_codec_priority_aptx));
        } catch (NotFoundException e) {
            value = BluetoothCodecConfig.CODEC_PRIORITY_DEFAULT;
        }
@@ -219,7 +226,9 @@ class A2dpCodecConfig {
        }

        try {
            value = resources.getInteger(R.integer.a2dp_source_codec_priority_aptx_hd);
            value = SystemProperties.getInt(
                "bluetooth.a2dp.source.aptx_hd_priority.config",
                resources.getInteger(R.integer.a2dp_source_codec_priority_aptx_hd));
        } catch (NotFoundException e) {
            value = BluetoothCodecConfig.CODEC_PRIORITY_DEFAULT;
        }
@@ -229,7 +238,9 @@ class A2dpCodecConfig {
        }

        try {
            value = resources.getInteger(R.integer.a2dp_source_codec_priority_ldac);
            value = SystemProperties.getInt(
                "bluetooth.a2dp.source.ldac_priority.config",
                resources.getInteger(R.integer.a2dp_source_codec_priority_ldac));
        } catch (NotFoundException e) {
            value = BluetoothCodecConfig.CODEC_PRIORITY_DEFAULT;
        }
@@ -239,7 +250,9 @@ class A2dpCodecConfig {
        }

        try {
            value = resources.getInteger(R.integer.a2dp_source_codec_priority_lc3);
            value = SystemProperties.getInt(
                "bluetooth.a2dp.source.lc3_priority.config",
                resources.getInteger(R.integer.a2dp_source_codec_priority_lc3));
        } catch (NotFoundException e) {
            value = BluetoothCodecConfig.CODEC_PRIORITY_DEFAULT;
        }