Commit 87cd644d by tonihei Committed by Andrew Lewis

Add remaining proguard config tests.

This ensures we have full test coverage for proguard configs now.
The only configs not covered by tests are:
 - IMA and OkHttp which copy recommended configs from the respective
   library. I couldn't reproduce failures by removing them (and thus
   couldn't write a test that ensures they are correct).
 - Some dontwarn lines that just suppress warnings.

In addition, this change fixes a couple of related issues:
 - Moved AV1 proguard config to correct module.
 - Removed mentioning of deprecated ExtractorMediaSource from README
 - Suppressed warning from IMA code that prevent proguarding under
   strict rules
 - Fixed wrong proguard exclusion in VP9 module.
 - Moved FLAC exclusion (DefaultExtractorsFactory) to correct module.
 - Added AlertDialog suppression for de-jetified code.
 - Removed unusued dependency from UI module that causes large APK
   size increase.

#exofixit
#minor-release

PiperOrigin-RevId: 344427532
parent 1d4d5887
...@@ -5,3 +5,7 @@ ...@@ -5,3 +5,7 @@
native <methods>; native <methods>;
} }
# Some members of this class are being accessed from native methods. Keep them unobfuscated.
-keep class com.google.android.exoplayer2.video.VideoDecoderOutputBuffer {
*;
}
...@@ -15,10 +15,12 @@ ...@@ -15,10 +15,12 @@
*/ */
package com.google.android.exoplayer2.ext.av1; package com.google.android.exoplayer2.ext.av1;
import static androidx.annotation.VisibleForTesting.PACKAGE_PRIVATE;
import static java.lang.Runtime.getRuntime; import static java.lang.Runtime.getRuntime;
import android.view.Surface; import android.view.Surface;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.decoder.DecoderInputBuffer; import com.google.android.exoplayer2.decoder.DecoderInputBuffer;
import com.google.android.exoplayer2.decoder.SimpleDecoder; import com.google.android.exoplayer2.decoder.SimpleDecoder;
...@@ -28,7 +30,8 @@ import com.google.android.exoplayer2.video.VideoDecoderOutputBuffer; ...@@ -28,7 +30,8 @@ import com.google.android.exoplayer2.video.VideoDecoderOutputBuffer;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
/** Gav1 decoder. */ /** Gav1 decoder. */
/* package */ final class Gav1Decoder @VisibleForTesting(otherwise = PACKAGE_PRIVATE)
public final class Gav1Decoder
extends SimpleDecoder<VideoDecoderInputBuffer, VideoDecoderOutputBuffer, Gav1DecoderException> { extends SimpleDecoder<VideoDecoderInputBuffer, VideoDecoderOutputBuffer, Gav1DecoderException> {
// LINT.IfChange // LINT.IfChange
......
../../proguard-rules.txt
\ No newline at end of file
...@@ -68,7 +68,7 @@ renderer. ...@@ -68,7 +68,7 @@ renderer.
### Using `FlacExtractor` ### ### Using `FlacExtractor` ###
`FlacExtractor` is used via `ExtractorMediaSource`. If you're using `FlacExtractor` is used via `ProgressiveMediaSource`. If you're using
`DefaultExtractorsFactory`, `FlacExtractor` will automatically be used to read `DefaultExtractorsFactory`, `FlacExtractor` will automatically be used to read
`.flac` files. If you're not using `DefaultExtractorsFactory`, return a `.flac` files. If you're not using `DefaultExtractorsFactory`, return a
`FlacExtractor` from your `ExtractorsFactory.createExtractors` implementation. `FlacExtractor` from your `ExtractorsFactory.createExtractors` implementation.
......
...@@ -15,7 +15,10 @@ ...@@ -15,7 +15,10 @@
*/ */
package com.google.android.exoplayer2.ext.flac; package com.google.android.exoplayer2.ext.flac;
import static androidx.annotation.VisibleForTesting.PACKAGE_PRIVATE;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import com.google.android.exoplayer2.Format; import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.ParserException; import com.google.android.exoplayer2.ParserException;
import com.google.android.exoplayer2.decoder.DecoderInputBuffer; import com.google.android.exoplayer2.decoder.DecoderInputBuffer;
...@@ -27,11 +30,10 @@ import java.io.IOException; ...@@ -27,11 +30,10 @@ import java.io.IOException;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.util.List; import java.util.List;
/** /** Flac decoder. */
* Flac decoder. @VisibleForTesting(otherwise = PACKAGE_PRIVATE)
*/ public final class FlacDecoder
/* package */ final class FlacDecoder extends extends SimpleDecoder<DecoderInputBuffer, SimpleOutputBuffer, FlacDecoderException> {
SimpleDecoder<DecoderInputBuffer, SimpleOutputBuffer, FlacDecoderException> {
private final FlacStreamMetadata streamMetadata; private final FlacStreamMetadata streamMetadata;
private final FlacDecoderJni decoderJni; private final FlacDecoderJni decoderJni;
......
# Proguard rules specific to the IMA extension. # Proguard rules specific to the IMA extension.
-dontwarn com.google.ads.interactivemedia.**
-keep class com.google.ads.interactivemedia.** { *; } -keep class com.google.ads.interactivemedia.** { *; }
-keep interface com.google.ads.interactivemedia.** { *; } -keep interface com.google.ads.interactivemedia.** { *; }
-keep class com.google.obf.** { *; } -keep class com.google.obf.** { *; }
......
...@@ -15,7 +15,10 @@ ...@@ -15,7 +15,10 @@
*/ */
package com.google.android.exoplayer2.ext.opus; package com.google.android.exoplayer2.ext.opus;
import static androidx.annotation.VisibleForTesting.PACKAGE_PRIVATE;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.audio.OpusUtil; import com.google.android.exoplayer2.audio.OpusUtil;
import com.google.android.exoplayer2.decoder.CryptoInfo; import com.google.android.exoplayer2.decoder.CryptoInfo;
...@@ -30,7 +33,8 @@ import java.nio.ByteBuffer; ...@@ -30,7 +33,8 @@ import java.nio.ByteBuffer;
import java.util.List; import java.util.List;
/** Opus decoder. */ /** Opus decoder. */
/* package */ final class OpusDecoder @VisibleForTesting(otherwise = PACKAGE_PRIVATE)
public final class OpusDecoder
extends SimpleDecoder<DecoderInputBuffer, SimpleOutputBuffer, OpusDecoderException> { extends SimpleDecoder<DecoderInputBuffer, SimpleOutputBuffer, OpusDecoderException> {
private static final int NO_ERROR = 0; private static final int NO_ERROR = 0;
......
...@@ -6,6 +6,6 @@ ...@@ -6,6 +6,6 @@
} }
# Some members of this class are being accessed from native methods. Keep them unobfuscated. # Some members of this class are being accessed from native methods. Keep them unobfuscated.
-keep class com.google.android.exoplayer2.ext.vp9.VpxOutputBuffer { -keep class com.google.android.exoplayer2.video.VideoDecoderOutputBuffer {
*; *;
} }
...@@ -15,8 +15,11 @@ ...@@ -15,8 +15,11 @@
*/ */
package com.google.android.exoplayer2.ext.vp9; package com.google.android.exoplayer2.ext.vp9;
import static androidx.annotation.VisibleForTesting.PACKAGE_PRIVATE;
import android.view.Surface; import android.view.Surface;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.decoder.CryptoInfo; import com.google.android.exoplayer2.decoder.CryptoInfo;
import com.google.android.exoplayer2.decoder.DecoderInputBuffer; import com.google.android.exoplayer2.decoder.DecoderInputBuffer;
...@@ -30,7 +33,8 @@ import com.google.android.exoplayer2.video.VideoDecoderOutputBuffer; ...@@ -30,7 +33,8 @@ import com.google.android.exoplayer2.video.VideoDecoderOutputBuffer;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
/** Vpx decoder. */ /** Vpx decoder. */
/* package */ final class VpxDecoder @VisibleForTesting(otherwise = PACKAGE_PRIVATE)
public final class VpxDecoder
extends SimpleDecoder<VideoDecoderInputBuffer, VideoDecoderOutputBuffer, VpxDecoderException> { extends SimpleDecoder<VideoDecoderInputBuffer, VideoDecoderOutputBuffer, VpxDecoderException> {
// These constants should match the codes returned from vpxDecode and vpxSecureDecode functions in // These constants should match the codes returned from vpxDecode and vpxSecureDecode functions in
......
...@@ -5,17 +5,6 @@ ...@@ -5,17 +5,6 @@
public static android.net.Uri buildRawResourceUri(int); public static android.net.Uri buildRawResourceUri(int);
} }
# Methods accessed via reflection in DefaultExtractorsFactory
-dontnote com.google.android.exoplayer2.ext.flac.FlacLibrary
-keepclassmembers class com.google.android.exoplayer2.ext.flac.FlacLibrary {
public static boolean isAvailable();
}
# Some members of this class are being accessed from native methods. Keep them unobfuscated.
-keep class com.google.android.exoplayer2.video.VideoDecoderOutputBuffer {
*;
}
# Constructors accessed via reflection in DefaultRenderersFactory # Constructors accessed via reflection in DefaultRenderersFactory
-dontnote com.google.android.exoplayer2.ext.vp9.LibvpxVideoRenderer -dontnote com.google.android.exoplayer2.ext.vp9.LibvpxVideoRenderer
-keepclassmembers class com.google.android.exoplayer2.ext.vp9.LibvpxVideoRenderer { -keepclassmembers class com.google.android.exoplayer2.ext.vp9.LibvpxVideoRenderer {
......
# Proguard rules specific to the extractor module. # Proguard rules specific to the extractor module.
# Constructors accessed via reflection in DefaultExtractorsFactory # Methods accessed via reflection in DefaultExtractorsFactory
-dontnote com.google.android.exoplayer2.ext.flac.FlacExtractor -dontnote com.google.android.exoplayer2.ext.flac.FlacExtractor
-keepclassmembers class com.google.android.exoplayer2.ext.flac.FlacExtractor { -keepclassmembers class com.google.android.exoplayer2.ext.flac.FlacExtractor {
<init>(int); <init>(int);
} }
-dontnote com.google.android.exoplayer2.ext.flac.FlacLibrary
-keepclassmembers class com.google.android.exoplayer2.ext.flac.FlacLibrary {
public static boolean isAvailable();
}
# Don't warn about checkerframework and Kotlin annotations # Don't warn about checkerframework and Kotlin annotations
-dontwarn org.checkerframework.** -dontwarn org.checkerframework.**
......
...@@ -11,6 +11,16 @@ ...@@ -11,6 +11,16 @@
public androidx.appcompat.app.AlertDialog$Builder setNegativeButton(int, android.content.DialogInterface$OnClickListener); public androidx.appcompat.app.AlertDialog$Builder setNegativeButton(int, android.content.DialogInterface$OnClickListener);
public androidx.appcompat.app.AlertDialog create(); public androidx.appcompat.app.AlertDialog create();
} }
-dontnote android.support.v7.app.AlertDialog.Builder
-keepclassmembers class android.support.v7.app.AlertDialog$Builder {
<init>(android.content.Context, int);
public android.content.Context getContext();
public android.support.v7.app.AlertDialog$Builder setTitle(java.lang.CharSequence);
public android.support.v7.app.AlertDialog$Builder setView(android.view.View);
public android.support.v7.app.AlertDialog$Builder setPositiveButton(int, android.content.DialogInterface$OnClickListener);
public android.support.v7.app.AlertDialog$Builder setNegativeButton(int, android.content.DialogInterface$OnClickListener);
public android.support.v7.app.AlertDialog create();
}
# Don't warn about checkerframework and Kotlin annotations # Don't warn about checkerframework and Kotlin annotations
-dontwarn org.checkerframework.** -dontwarn org.checkerframework.**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment