mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Enable lint errors in exoplayer tests
Follow-up to 76db936d68
PiperOrigin-RevId: 692925617
This commit is contained in:
parent
c3e72a87e5
commit
aebf822c3c
@ -34,6 +34,12 @@ android {
|
|||||||
test.assets.srcDir '../test_data/src/test/assets/'
|
test.assets.srcDir '../test_data/src/test/assets/'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lintOptions {
|
||||||
|
// TODO: b/353490583 - Move this to common_library_config.gradle once it's enabled for all
|
||||||
|
// libraries.
|
||||||
|
checkTestSources true
|
||||||
|
}
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
singleVariant('release') {
|
singleVariant('release') {
|
||||||
withSourcesJar()
|
withSourcesJar()
|
||||||
|
@ -160,7 +160,7 @@ public interface AudioSink {
|
|||||||
/** Configuration parameters used for an {@link AudioTrack}. */
|
/** Configuration parameters used for an {@link AudioTrack}. */
|
||||||
final class AudioTrackConfig {
|
final class AudioTrackConfig {
|
||||||
|
|
||||||
/* The {@link C.Encoding} of the audio data. */
|
/** The {@link C.Encoding} of the audio data. */
|
||||||
public final @C.Encoding int encoding;
|
public final @C.Encoding int encoding;
|
||||||
|
|
||||||
/** The sample rate of the audio data. */
|
/** The sample rate of the audio data. */
|
||||||
|
@ -51,7 +51,7 @@ import java.util.zip.Inflater;
|
|||||||
|
|
||||||
private ProjectionDecoder() {}
|
private ProjectionDecoder() {}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Decodes the projection data.
|
* Decodes the projection data.
|
||||||
*
|
*
|
||||||
* @param projectionData The projection data.
|
* @param projectionData The projection data.
|
||||||
|
@ -792,7 +792,7 @@ public class MediaExtractorCompatTest {
|
|||||||
@Override
|
@Override
|
||||||
public int read(ExtractorInput input, PositionHolder seekPosition) throws IOException {
|
public int read(ExtractorInput input, PositionHolder seekPosition) throws IOException {
|
||||||
if (nextReadActionIndex >= readActions.size()) {
|
if (nextReadActionIndex >= readActions.size()) {
|
||||||
return C.RESULT_END_OF_INPUT;
|
return Extractor.RESULT_END_OF_INPUT;
|
||||||
} else {
|
} else {
|
||||||
return readActions.get(nextReadActionIndex++).apply(input, seekPosition);
|
return readActions.get(nextReadActionIndex++).apply(input, seekPosition);
|
||||||
}
|
}
|
||||||
|
@ -346,6 +346,8 @@ public final class DefaultAudioSinkTest {
|
|||||||
new DefaultAudioSink.Builder()
|
new DefaultAudioSink.Builder()
|
||||||
.setAudioCapabilities(new AudioCapabilities(new int[] {C.ENCODING_AAC_LC}, 2))
|
.setAudioCapabilities(new AudioCapabilities(new int[] {C.ENCODING_AAC_LC}, 2))
|
||||||
.build();
|
.build();
|
||||||
|
// TODO: b/376880213 - Resolve this lint error.
|
||||||
|
@SuppressWarnings("WrongConstant")
|
||||||
Format aacLcFormat =
|
Format aacLcFormat =
|
||||||
STEREO_44_1_FORMAT
|
STEREO_44_1_FORMAT
|
||||||
.buildUpon()
|
.buildUpon()
|
||||||
|
@ -207,7 +207,7 @@ public class AsynchronousMediaCodecCallbackTest {
|
|||||||
MediaCodec.BufferInfo bufferInfo1 = new MediaCodec.BufferInfo();
|
MediaCodec.BufferInfo bufferInfo1 = new MediaCodec.BufferInfo();
|
||||||
asynchronousMediaCodecCallback.onOutputBufferAvailable(codec, 0, bufferInfo1);
|
asynchronousMediaCodecCallback.onOutputBufferAvailable(codec, 0, bufferInfo1);
|
||||||
MediaCodec.BufferInfo bufferInfo2 = new MediaCodec.BufferInfo();
|
MediaCodec.BufferInfo bufferInfo2 = new MediaCodec.BufferInfo();
|
||||||
bufferInfo2.set(1, 1, 1, 1);
|
bufferInfo2.set(1, 1, 1, MediaCodec.BUFFER_FLAG_KEY_FRAME);
|
||||||
asynchronousMediaCodecCallback.onOutputBufferAvailable(codec, 1, bufferInfo2);
|
asynchronousMediaCodecCallback.onOutputBufferAvailable(codec, 1, bufferInfo2);
|
||||||
|
|
||||||
MediaCodec.BufferInfo outBufferInfo = new MediaCodec.BufferInfo();
|
MediaCodec.BufferInfo outBufferInfo = new MediaCodec.BufferInfo();
|
||||||
|
@ -74,6 +74,7 @@ public class SilenceMediaSourceTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void builderSetDurationUs_nonPositiveValue_throwsIllegalStateException() {
|
public void builderSetDurationUs_nonPositiveValue_throwsIllegalStateException() {
|
||||||
|
@SuppressWarnings("Range") // Deliberately testing an invalid value
|
||||||
SilenceMediaSource.Factory factory = new SilenceMediaSource.Factory().setDurationUs(-1);
|
SilenceMediaSource.Factory factory = new SilenceMediaSource.Factory().setDurationUs(-1);
|
||||||
|
|
||||||
assertThrows(IllegalStateException.class, factory::createMediaSource);
|
assertThrows(IllegalStateException.class, factory::createMediaSource);
|
||||||
|
@ -2777,6 +2777,7 @@ public final class DefaultTrackSelectorTest {
|
|||||||
.build())
|
.build())
|
||||||
.build());
|
.build());
|
||||||
// Offload playback with gapless transitions is supported
|
// Offload playback with gapless transitions is supported
|
||||||
|
@SuppressWarnings("WrongConstant") // Combining these two values bit-wise is allowed
|
||||||
RendererCapabilities capabilitiesOffloadSupport =
|
RendererCapabilities capabilitiesOffloadSupport =
|
||||||
new FakeRendererCapabilities(
|
new FakeRendererCapabilities(
|
||||||
C.TRACK_TYPE_AUDIO,
|
C.TRACK_TYPE_AUDIO,
|
||||||
|
@ -732,7 +732,8 @@ public final class DefaultBandwidthMeterTest {
|
|||||||
setActiveNetworkInfo(networkInfo, TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE);
|
setActiveNetworkInfo(networkInfo, TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("StickyBroadcast")
|
// Adding the permission to the test AndroidManifest.xml doesn't work to appease lint.
|
||||||
|
@SuppressWarnings({"StickyBroadcast", "MissingPermission"})
|
||||||
private void setActiveNetworkInfo(NetworkInfo networkInfo, int networkTypeOverride) {
|
private void setActiveNetworkInfo(NetworkInfo networkInfo, int networkTypeOverride) {
|
||||||
// Set network info in ConnectivityManager and TelephonyDisplayInfo in TelephonyManager.
|
// Set network info in ConnectivityManager and TelephonyDisplayInfo in TelephonyManager.
|
||||||
Shadows.shadowOf(connectivityManager).setActiveNetworkInfo(networkInfo);
|
Shadows.shadowOf(connectivityManager).setActiveNetworkInfo(networkInfo);
|
||||||
|
@ -742,7 +742,8 @@ public final class ExperimentalBandwidthMeterTest {
|
|||||||
setActiveNetworkInfo(networkInfo, TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE);
|
setActiveNetworkInfo(networkInfo, TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("StickyBroadcast")
|
// Adding the permission to the test AndroidManifest.xml doesn't work to appease lint.
|
||||||
|
@SuppressWarnings({"StickyBroadcast", "MissingPermission"})
|
||||||
private void setActiveNetworkInfo(NetworkInfo networkInfo, int networkTypeOverride) {
|
private void setActiveNetworkInfo(NetworkInfo networkInfo, int networkTypeOverride) {
|
||||||
// Set network info in ConnectivityManager and TelephonyDisplayInfo in TelephonyManager.
|
// Set network info in ConnectivityManager and TelephonyDisplayInfo in TelephonyManager.
|
||||||
Shadows.shadowOf(connectivityManager).setActiveNetworkInfo(networkInfo);
|
Shadows.shadowOf(connectivityManager).setActiveNetworkInfo(networkInfo);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user