Add type argument when using ImmutableSet

This commit is contained in:
Tianyi Feng 2023-05-17 12:40:22 +00:00
parent b9a53da121
commit 162f5e827a

View File

@ -102,7 +102,7 @@ public final class AudioCapabilities {
return DEFAULT_AUDIO_CAPABILITIES; return DEFAULT_AUDIO_CAPABILITIES;
} }
ImmutableSet.Builder supportedEncodings = new ImmutableSet.Builder<>(); ImmutableSet.Builder<Integer> supportedEncodings = new ImmutableSet.Builder<>();
if (deviceMaySetExternalSurroundSoundGlobalSetting() if (deviceMaySetExternalSurroundSoundGlobalSetting()
&& Global.getInt(context.getContentResolver(), EXTERNAL_SURROUND_SOUND_KEY, 0) == 1) { && Global.getInt(context.getContentResolver(), EXTERNAL_SURROUND_SOUND_KEY, 0) == 1) {
supportedEncodings.addAll(Ints.asList(EXTERNAL_SURROUND_SOUND_ENCODINGS)); supportedEncodings.addAll(Ints.asList(EXTERNAL_SURROUND_SOUND_ENCODINGS));
@ -123,10 +123,10 @@ public final class AudioCapabilities {
AudioManager.EXTRA_MAX_CHANNEL_COUNT, /* defaultValue= */ DEFAULT_MAX_CHANNEL_COUNT)); AudioManager.EXTRA_MAX_CHANNEL_COUNT, /* defaultValue= */ DEFAULT_MAX_CHANNEL_COUNT));
} }
ImmutableSet supportedEncodingsSet = supportedEncodings.build(); ImmutableSet<Integer> supportedEncodingsSet = supportedEncodings.build();
if (!supportedEncodingsSet.isEmpty()) { if (!supportedEncodingsSet.isEmpty()) {
return new AudioCapabilities( return new AudioCapabilities(
Ints.toArray(supportedEncodingsSet), /* defaultValue= */ DEFAULT_MAX_CHANNEL_COUNT); Ints.toArray(supportedEncodingsSet), /* maxChannelCount= */ DEFAULT_MAX_CHANNEL_COUNT);
} }
return DEFAULT_AUDIO_CAPABILITIES; return DEFAULT_AUDIO_CAPABILITIES;
} }
@ -230,7 +230,7 @@ public final class AudioCapabilities {
channelCount = format.channelCount; channelCount = format.channelCount;
// Some DTS:X TVs reports ACTION_HDMI_AUDIO_PLUG.EXTRA_MAX_CHANNEL_COUNT as 8 // Some DTS:X TVs reports ACTION_HDMI_AUDIO_PLUG.EXTRA_MAX_CHANNEL_COUNT as 8
// instead of 10. See https://github.com/androidx/media/issues/396 // instead of 10. See https://github.com/androidx/media/issues/396
if (format.sampleMimeType == MimeTypes.AUDIO_DTS_X) { if (format.sampleMimeType.equals(MimeTypes.AUDIO_DTS_X)) {
if (channelCount > 10) { if (channelCount > 10) {
return null; return null;
} }