Merge "Catch IllegalStateException when updating Bluetooth A2DP codec info" am: ad62fd52c9
am: 14eb8cfe57
am: 8e81cf1310
am: 2a70967e41
Change-Id: Icc13b2847d8a7b6f0800bd067ac3fe3e01c478ec
This commit is contained in:
@@ -1801,6 +1801,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
||||
BluetoothCodecConfig[] codecsLocalCapabilities = null;
|
||||
BluetoothCodecConfig[] codecsSelectableCapabilities = null;
|
||||
String streaming;
|
||||
Resources resources = null;
|
||||
|
||||
synchronized (mBluetoothA2dpLock) {
|
||||
if (mBluetoothA2dp != null) {
|
||||
@@ -1815,6 +1816,15 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
||||
if (codecConfig == null)
|
||||
return;
|
||||
|
||||
try {
|
||||
resources = getResources();
|
||||
} catch (IllegalStateException e) {
|
||||
return;
|
||||
}
|
||||
if (resources == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Update the Codec Type
|
||||
index = -1;
|
||||
switch (codecConfig.getCodecType()) {
|
||||
@@ -1838,8 +1848,8 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
||||
break;
|
||||
}
|
||||
if (index >= 0) {
|
||||
summaries = getResources().getStringArray(R.array.bluetooth_a2dp_codec_summaries);
|
||||
streaming = getResources().getString(R.string.bluetooth_select_a2dp_codec_streaming_label, summaries[index]);
|
||||
summaries = resources.getStringArray(R.array.bluetooth_a2dp_codec_summaries);
|
||||
streaming = resources.getString(R.string.bluetooth_select_a2dp_codec_streaming_label, summaries[index]);
|
||||
mBluetoothSelectA2dpCodec.setSummary(streaming);
|
||||
}
|
||||
|
||||
@@ -1865,8 +1875,8 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
||||
break;
|
||||
}
|
||||
if (index >= 0) {
|
||||
summaries = getResources().getStringArray(R.array.bluetooth_a2dp_codec_sample_rate_summaries);
|
||||
streaming = getResources().getString(R.string.bluetooth_select_a2dp_codec_streaming_label, summaries[index]);
|
||||
summaries = resources.getStringArray(R.array.bluetooth_a2dp_codec_sample_rate_summaries);
|
||||
streaming = resources.getString(R.string.bluetooth_select_a2dp_codec_streaming_label, summaries[index]);
|
||||
mBluetoothSelectA2dpSampleRate.setSummary(streaming);
|
||||
}
|
||||
|
||||
@@ -1887,8 +1897,8 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
||||
break;
|
||||
}
|
||||
if (index >= 0) {
|
||||
summaries = getResources().getStringArray(R.array.bluetooth_a2dp_codec_bits_per_sample_summaries);
|
||||
streaming = getResources().getString(R.string.bluetooth_select_a2dp_codec_streaming_label, summaries[index]);
|
||||
summaries = resources.getStringArray(R.array.bluetooth_a2dp_codec_bits_per_sample_summaries);
|
||||
streaming = resources.getString(R.string.bluetooth_select_a2dp_codec_streaming_label, summaries[index]);
|
||||
mBluetoothSelectA2dpBitsPerSample.setSummary(streaming);
|
||||
}
|
||||
|
||||
@@ -1906,8 +1916,8 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
||||
break;
|
||||
}
|
||||
if (index >= 0) {
|
||||
summaries = getResources().getStringArray(R.array.bluetooth_a2dp_codec_channel_mode_summaries);
|
||||
streaming = getResources().getString(R.string.bluetooth_select_a2dp_codec_streaming_label, summaries[index]);
|
||||
summaries = resources.getStringArray(R.array.bluetooth_a2dp_codec_channel_mode_summaries);
|
||||
streaming = resources.getString(R.string.bluetooth_select_a2dp_codec_streaming_label, summaries[index]);
|
||||
mBluetoothSelectA2dpChannelMode.setSummary(streaming);
|
||||
}
|
||||
|
||||
@@ -1932,8 +1942,8 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
||||
break;
|
||||
}
|
||||
if (index >= 0) {
|
||||
summaries = getResources().getStringArray(R.array.bluetooth_a2dp_codec_ldac_playback_quality_summaries);
|
||||
streaming = getResources().getString(R.string.bluetooth_select_a2dp_codec_streaming_label, summaries[index]);
|
||||
summaries = resources.getStringArray(R.array.bluetooth_a2dp_codec_ldac_playback_quality_summaries);
|
||||
streaming = resources.getString(R.string.bluetooth_select_a2dp_codec_streaming_label, summaries[index]);
|
||||
mBluetoothSelectA2dpLdacPlaybackQuality.setSummary(streaming);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user