From 96a42b1bbe2005832b552077b8126d635ce9596c Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Wed, 25 Sep 2019 14:40:18 +0200 Subject: Fixed HTTP redirects in ExoPlayer --- .../antennapod/core/service/playback/ExoPlayerWrapper.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'core/src/main/java') diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/ExoPlayerWrapper.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/ExoPlayerWrapper.java index f20525f73..0fc165183 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/ExoPlayerWrapper.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/ExoPlayerWrapper.java @@ -22,6 +22,8 @@ import com.google.android.exoplayer2.trackselection.DefaultTrackSelector; import com.google.android.exoplayer2.trackselection.TrackSelectionArray; import com.google.android.exoplayer2.upstream.DataSource; import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory; +import com.google.android.exoplayer2.upstream.DefaultHttpDataSource; +import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory; import com.google.android.exoplayer2.util.Util; import org.antennapod.audio.MediaPlayer; @@ -180,8 +182,12 @@ public class ExoPlayerWrapper implements IPlayer { @Override public void setDataSource(String s) throws IllegalArgumentException, IllegalStateException { - DataSource.Factory dataSourceFactory = - new DefaultDataSourceFactory(mContext, Util.getUserAgent(mContext, mContext.getPackageName()), null); + DefaultHttpDataSourceFactory httpDataSourceFactory = new DefaultHttpDataSourceFactory( + Util.getUserAgent(mContext, mContext.getPackageName()), null, + DefaultHttpDataSource.DEFAULT_CONNECT_TIMEOUT_MILLIS, + DefaultHttpDataSource.DEFAULT_READ_TIMEOUT_MILLIS, + true); + DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(mContext, null, httpDataSourceFactory); ExtractorMediaSource.Factory f = new ExtractorMediaSource.Factory(dataSourceFactory); mediaSource = f.createMediaSource(Uri.parse(s)); } -- cgit v1.2.3 From 2b8b262499db329ef529cf68ffa2c1b17c09f40d Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Wed, 25 Sep 2019 14:45:47 +0200 Subject: Fixed crashes when leaving search fragments --- .../core/util/exception/RxJavaErrorHandlerSetup.java | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'core/src/main/java') diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/exception/RxJavaErrorHandlerSetup.java b/core/src/main/java/de/danoeh/antennapod/core/util/exception/RxJavaErrorHandlerSetup.java index 12f0c1c6e..223104d2e 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/exception/RxJavaErrorHandlerSetup.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/exception/RxJavaErrorHandlerSetup.java @@ -1,12 +1,9 @@ package de.danoeh.antennapod.core.util.exception; import android.util.Log; -import de.danoeh.antennapod.core.gpoddernet.GpodnetServiceException; import io.reactivex.exceptions.UndeliverableException; import io.reactivex.plugins.RxJavaPlugins; -import java.io.InterruptedIOException; - public class RxJavaErrorHandlerSetup { private RxJavaErrorHandlerSetup() { @@ -14,21 +11,14 @@ public class RxJavaErrorHandlerSetup { } public static void setupRxJavaErrorHandler() { - RxJavaPlugins.setErrorHandler(originalCause -> { - Throwable e = originalCause; + RxJavaPlugins.setErrorHandler(e -> { if (e instanceof UndeliverableException) { - e = e.getCause(); - } - if (e instanceof GpodnetServiceException) { - e = e.getCause(); - } - if (e instanceof InterruptedException || e instanceof InterruptedIOException) { - // fine, some blocking code was interrupted by a dispose call - Log.d("RxJavaErrorHandler", "Ignored exception: " + Log.getStackTraceString(originalCause)); + // Probably just disposed because the fragment was left + Log.d("RxJavaErrorHandler", "Ignored exception: " + Log.getStackTraceString(e)); return; } Thread.currentThread().getUncaughtExceptionHandler() - .uncaughtException(Thread.currentThread(), originalCause); + .uncaughtException(Thread.currentThread(), e); }); } } -- cgit v1.2.3 From 0c0e50d3ae2a0446e14f21231615089d798ae3fd Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Fri, 27 Sep 2019 12:03:36 +0200 Subject: Fixed another phantom service is running notification Steps to reproduce: - Send STOP key two times - Service starts foreground but does not stop again because stateManager does not know about foreground state --- .../de/danoeh/antennapod/core/service/playback/PlaybackService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/src/main/java') diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java index e479a7711..7d23b4c4c 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java @@ -451,7 +451,7 @@ public class PlaybackService extends MediaBrowserServiceCompat { notificationBuilder.loadIcon(getPlayable()); } } - startForeground(NOTIFICATION_ID, notificationBuilder.build()); + stateManager.startForeground(NOTIFICATION_ID, notificationBuilder.build()); } NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this); -- cgit v1.2.3