Merge "Update the A2DP Codec Config API"

am: bd298a7a50

Change-Id: I5d3e3c0d3d6e3d679ad94779600a9e266f7f927b
This commit is contained in:
Pavlin Radoslavov
2017-01-31 19:08:11 +00:00
committed by android-build-merger

View File

@@ -28,6 +28,7 @@ import android.app.backup.IBackupManager;
import android.bluetooth.BluetoothA2dp; import android.bluetooth.BluetoothA2dp;
import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothCodecConfig; import android.bluetooth.BluetoothCodecConfig;
import android.bluetooth.BluetoothCodecStatus;
import android.bluetooth.BluetoothProfile; import android.bluetooth.BluetoothProfile;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.ComponentName; import android.content.ComponentName;
@@ -1819,12 +1820,18 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
private void updateBluetoothA2dpConfigurationValues() { private void updateBluetoothA2dpConfigurationValues() {
int index; int index;
String[] summaries; String[] summaries;
BluetoothCodecStatus codecStatus = null;
BluetoothCodecConfig codecConfig = null; BluetoothCodecConfig codecConfig = null;
BluetoothCodecConfig[] codecsLocalCapabilities = null;
BluetoothCodecConfig[] codecsSelectableCapabilities = null;
String streaming; String streaming;
synchronized (mBluetoothA2dpLock) { synchronized (mBluetoothA2dpLock) {
if (mBluetoothA2dp != null) { if (mBluetoothA2dp != null) {
codecConfig = mBluetoothA2dp.getCodecConfig(); codecStatus = mBluetoothA2dp.getCodecStatus();
codecConfig = codecStatus.getCodecConfig();
codecsLocalCapabilities = codecStatus.getCodecsLocalCapabilities();
codecsSelectableCapabilities = codecStatus.getCodecsSelectableCapabilities();
} }
} }
if (codecConfig == null) if (codecConfig == null)
@@ -2674,8 +2681,16 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
private BroadcastReceiver mBluetoothA2dpReceiver = new BroadcastReceiver() { private BroadcastReceiver mBluetoothA2dpReceiver = new BroadcastReceiver() {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
Log.d(TAG, "mBluetoothA2dpReceiver.onReceive intent=" + intent);
String action = intent.getAction();
if (BluetoothA2dp.ACTION_CODEC_CONFIG_CHANGED.equals(action)) {
BluetoothCodecStatus codecStatus =
(BluetoothCodecStatus)intent.getParcelableExtra(BluetoothCodecStatus.EXTRA_CODEC_STATUS);
Log.d(TAG, "Received BluetoothCodecStatus=" + codecStatus);
updateBluetoothA2dpConfigurationValues(); updateBluetoothA2dpConfigurationValues();
} }
}
}; };
private BluetoothProfile.ServiceListener mBluetoothA2dpServiceListener = private BluetoothProfile.ServiceListener mBluetoothA2dpServiceListener =