diff --git a/library/core/src/androidTest/AndroidManifest.xml b/library/core/src/androidTest/AndroidManifest.xml
index db8d89e66e..6ccd2b3429 100644
--- a/library/core/src/androidTest/AndroidManifest.xml
+++ b/library/core/src/androidTest/AndroidManifest.xml
@@ -27,8 +27,8 @@
tools:ignore="MissingApplicationIcon,HardcodedDebugMode"
android:usesCleartextTraffic="true">
+ android:authorities="com.google.android.exoplayer2.testutil.AssetContentProvider"
+ android:name="com.google.android.exoplayer2.testutil.AssetContentProvider"/>
{
- private static final String AUTHORITY = "com.google.android.exoplayer2.core.test";
+ private static final String AUTHORITY =
+ "com.google.android.exoplayer2.testutil.AssetContentProvider";
private static final String PARAM_PIPE_MODE = "pipe-mode";
public static Uri buildUri(String filePath, boolean pipeMode) {
@@ -45,7 +46,7 @@ public final class TestContentProvider extends ContentProvider
.authority(AUTHORITY)
.path(filePath);
if (pipeMode) {
- builder.appendQueryParameter(TestContentProvider.PARAM_PIPE_MODE, "1");
+ builder.appendQueryParameter(PARAM_PIPE_MODE, "1");
}
return builder.build();
}
@@ -116,8 +117,7 @@ public final class TestContentProvider extends ContentProvider
byte[] data = TestUtil.getByteArray(getContext(), getFileName(uri));
outputStream.write(data);
} catch (IOException e) {
- if (e.getCause() instanceof ErrnoException
- && ((ErrnoException) e.getCause()).errno == OsConstants.EPIPE) {
+ if (isBrokenPipe(e)) {
// Swallow the exception if it's caused by a broken pipe - this indicates the reader has
// closed the pipe and is therefore no longer interested in the data being written.
// [See internal b/186728171].
@@ -130,4 +130,10 @@ public final class TestContentProvider extends ContentProvider
private static String getFileName(Uri uri) {
return uri.getPath().replaceFirst("/", "");
}
+
+ private static boolean isBrokenPipe(IOException e) {
+ return Util.SDK_INT >= 21
+ && e.getCause() instanceof ErrnoException
+ && ((ErrnoException) e.getCause()).errno == OsConstants.EPIPE;
+ }
}