Enable lint errors in tests for remaining playback modules

Also fix existing violations

This enables the lint for tests in:
* `decoder-iamf`
* `exoplayer-rtsp`
* `test-exoplayer-playback`
* `test-session-current`
* `ui-compose`

PiperOrigin-RevId: 702728438
This commit is contained in:
ibaker 2024-12-04 08:05:09 -08:00 committed by Copybara-Service
parent fb2d5f905d
commit 3e94bd6125
10 changed files with 18 additions and 31 deletions

View File

@ -28,11 +28,6 @@ android {
}
}
lintOptions {
// TODO: b/353490583 - Enable this once the violations are fixed.
checkTestSources false
}
// TODO(Internal: b/372449691): Remove packagingOptions once AGP is updated
// to version 8.5.1 or higher.
packagingOptions {

View File

@ -104,6 +104,9 @@ public class IamfPlaybackTest {
Looper.prepare();
if (Util.SDK_INT >= 32) { // Spatializer is only available on API 32 and above.
AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
// Lint can't follow the indirection from AudioFormat.ENCODING_PCM_16BIT to
// IamfDecoder.OUTPUT_PCM_ENCODING.
@SuppressWarnings("WrongConstant")
AudioFormat.Builder audioFormat =
new AudioFormat.Builder()
.setEncoding(IamfDecoder.OUTPUT_PCM_ENCODING)

View File

@ -24,11 +24,6 @@ android {
sourceSets.test.assets.srcDir '../test_data/src/test/assets/'
lintOptions {
// TODO: b/353490583 - Enable this once the violations are fixed.
checkTestSources false
}
publishing {
singleVariant('release') {
withSourcesJar()

View File

@ -76,7 +76,7 @@ public class RtspMediaTrackTest {
.setCodecs("avc1.64001F")
.setColorInfo(
new ColorInfo.Builder()
.setColorRange(1)
.setColorRange(C.COLOR_RANGE_FULL)
.setLumaBitdepth(8)
.setChromaBitdepth(8)
.build())
@ -255,7 +255,7 @@ public class RtspMediaTrackTest {
.setCodecs("avc1.64001F")
.setColorInfo(
new ColorInfo.Builder()
.setColorRange(1)
.setColorRange(C.COLOR_RANGE_FULL)
.setChromaBitdepth(8)
.setLumaBitdepth(8)
.build())

View File

@ -13,14 +13,7 @@
// limitations under the License.
apply from: "$gradle.ext.androidxMediaSettingsDir/common_library_config.gradle"
android {
namespace 'androidx.media3.test.exoplayer.playback'
lintOptions {
// TODO: b/353490583 - Enable this once the violations are fixed.
checkTestSources false
}
}
android.namespace 'androidx.media3.test.exoplayer.playback'
dependencies {
androidTestImplementation 'androidx.test:rules:' + androidxTestRulesVersion

View File

@ -696,7 +696,8 @@ public final class DashStreamingTest {
private boolean isPc() {
// See [internal b/162990153].
return testRule.getActivity().getPackageManager().hasSystemFeature(PackageManager.FEATURE_PC);
return Util.SDK_INT >= 27
&& testRule.getActivity().getPackageManager().hasSystemFeature(PackageManager.FEATURE_PC);
}
private static boolean shouldSkipAdaptiveTest(String mimeType) throws DecoderQueryException {

View File

@ -105,7 +105,9 @@ import java.util.List;
@SuppressWarnings("ResourceType")
public static boolean isL1WidevineAvailable(String mimeType) {
try (MediaDrm mediaDrm = new MediaDrm(WIDEVINE_UUID)) {
MediaDrm mediaDrm = null;
try {
mediaDrm = new MediaDrm(WIDEVINE_UUID);
// Force L3 if secure decoder is not available.
if (MediaCodecUtil.getDecoderInfo(mimeType, /* secure= */ true, /* tunneling= */ false)
== null) {
@ -115,6 +117,10 @@ import java.util.List;
return WIDEVINE_SECURITY_LEVEL_1.equals(securityProperty);
} catch (UnsupportedSchemeException | MediaCodecUtil.DecoderQueryException e) {
throw new IllegalStateException(e);
} finally {
if (mediaDrm != null) {
mediaDrm.close();
}
}
}

View File

@ -33,11 +33,6 @@ android {
}
sourceSets.main.assets.srcDir '../test_data/src/test/assets/'
lintOptions {
// TODO: b/353490583 - Enable this once the violations are fixed.
checkTestSources false
}
}
dependencies {

View File

@ -26,10 +26,6 @@ android {
buildFeatures {
compose true
}
lintOptions {
// TODO: b/353490583 - Enable this once the violations are fixed.
checkTestSources false
}
publishing {
singleVariant('release') {
withSourcesJar()

View File

@ -102,6 +102,9 @@ internal class TestPlayer : SimpleBasePlayer(Looper.myLooper()!!) {
}
fun removeCommands(vararg commands: @Player.Command Int) {
// It doesn't seem possible to propagate the @IntDef annotation through Kotlin's spread operator
// in a way that lint understands.
@SuppressWarnings("WrongConstant")
state =
state
.buildUpon()