Pass in active device to all BluetoothA2dp APIs in
packages/apps/Settings as null input is no longer supported Bug: 147287141 Test: Manual Change-Id: If43934374914c657080ffd0509f8095d988cc550
This commit is contained in:
@@ -80,7 +80,7 @@ public abstract class AbstractBluetoothDialogPreferenceController extends
|
||||
}
|
||||
writeConfigurationValues(index);
|
||||
final BluetoothCodecConfig codecConfig = mBluetoothA2dpConfigStore.createCodecConfig();
|
||||
bluetoothA2dp.setCodecConfigPreference(null, codecConfig);
|
||||
bluetoothA2dp.setCodecConfigPreference(bluetoothA2dp.getActiveDevice(), codecConfig);
|
||||
mPreference.setSummary(((BaseBluetoothDialogPreference) mPreference).generateSummary(
|
||||
index));
|
||||
}
|
||||
@@ -146,7 +146,8 @@ public abstract class AbstractBluetoothDialogPreferenceController extends
|
||||
if (bluetoothA2dp == null) {
|
||||
return null;
|
||||
}
|
||||
final BluetoothCodecStatus codecStatus = bluetoothA2dp.getCodecStatus(null);
|
||||
final BluetoothCodecStatus codecStatus =
|
||||
bluetoothA2dp.getCodecStatus(bluetoothA2dp.getActiveDevice());
|
||||
if (codecStatus == null) {
|
||||
Log.d(TAG, "Unable to get current codec config. Codec status is null");
|
||||
return null;
|
||||
@@ -177,7 +178,8 @@ public abstract class AbstractBluetoothDialogPreferenceController extends
|
||||
* @return {@link BluetoothCodecConfig}.
|
||||
*/
|
||||
protected BluetoothCodecConfig getSelectableByCodecType(int codecTypeValue) {
|
||||
final BluetoothCodecConfig[] configs = getSelectableConfigs(null);
|
||||
final BluetoothCodecConfig[] configs = getSelectableConfigs(
|
||||
mBluetoothA2dp.getActiveDevice());
|
||||
if (configs == null) {
|
||||
Log.d(TAG, "Unable to get selectable config. Selectable configs is empty.");
|
||||
return null;
|
||||
|
@@ -83,9 +83,9 @@ public class BluetoothCodecDialogPreferenceController extends
|
||||
return index;
|
||||
}
|
||||
// Check HD audio is enabled, display the available list.
|
||||
if (bluetoothA2dp.getOptionalCodecsEnabled(activeDevice)
|
||||
if (bluetoothA2dp.isOptionalCodecsEnabled(activeDevice)
|
||||
== BluetoothA2dp.OPTIONAL_CODECS_PREF_ENABLED) {
|
||||
BluetoothCodecConfig[] configs = getSelectableConfigs(null);
|
||||
BluetoothCodecConfig[] configs = getSelectableConfigs(bluetoothA2dp.getActiveDevice());
|
||||
if (configs != null) {
|
||||
return getIndexFromConfig(configs);
|
||||
}
|
||||
@@ -101,7 +101,8 @@ public class BluetoothCodecDialogPreferenceController extends
|
||||
int codecPriorityValue = BluetoothCodecConfig.CODEC_PRIORITY_DEFAULT;
|
||||
switch (index) {
|
||||
case 0:
|
||||
codecTypeValue = getHighestCodec(getSelectableConfigs(null));
|
||||
codecTypeValue = getHighestCodec(getSelectableConfigs(
|
||||
mBluetoothA2dp.getActiveDevice()));
|
||||
codecPriorityValue = BluetoothCodecConfig.CODEC_PRIORITY_HIGHEST;
|
||||
break;
|
||||
case 1:
|
||||
|
@@ -58,11 +58,11 @@ public class BluetoothHDAudioPreferenceController extends AbstractBluetoothPrefe
|
||||
mPreference.setEnabled(false);
|
||||
return;
|
||||
}
|
||||
final boolean supported = (bluetoothA2dp.supportsOptionalCodecs(activeDevice)
|
||||
final boolean supported = (bluetoothA2dp.isOptionalCodecsSupported(activeDevice)
|
||||
== BluetoothA2dp.OPTIONAL_CODECS_SUPPORTED);
|
||||
mPreference.setEnabled(supported);
|
||||
if (supported) {
|
||||
final boolean isEnabled = bluetoothA2dp.getOptionalCodecsEnabled(activeDevice)
|
||||
final boolean isEnabled = bluetoothA2dp.isOptionalCodecsEnabled(activeDevice)
|
||||
== BluetoothA2dp.OPTIONAL_CODECS_PREF_ENABLED;
|
||||
((SwitchPreference) mPreference).setChecked(isEnabled);
|
||||
}
|
||||
|
Reference in New Issue
Block a user