From 2fa2fb73b771512e6c15bec3bfcf1c98b654ed9f Mon Sep 17 00:00:00 2001 From: olly Date: Fri, 1 May 2020 13:17:27 +0100 Subject: [PATCH] Catch correct exception from Context.startService Issue: #7306 PiperOrigin-RevId: 309392633 --- RELEASENOTES.md | 3 ++- .../com/google/android/exoplayer2/offline/DownloadService.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 95e2a0581f..ba6d416506 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -17,11 +17,12 @@ EMSG tracks ([#7273](https://github.com/google/ExoPlayer/issues/7273)). * MPEG-TS: Fix issue where SEI NAL units were incorrectly dropped from H.265 samples ([#7113](https://github.com/google/ExoPlayer/issues/7113)). -* Text +* Text * Use anti-aliasing and bitmap filtering when displaying bitmap subtitles ([#6950](https://github.com/google/ExoPlayer/pull/6950)). * AV1 extension: Add a heuristic to determine the default number of threads used for AV1 playback using the extension. +* DownloadService: Fix "Not allowed to start service" `IllegalStateException`. ### 2.11.4 (2020-04-08) ### diff --git a/library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadService.java b/library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadService.java index 819478b80e..f78e9bb545 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadService.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadService.java @@ -1022,7 +1022,7 @@ public abstract class DownloadService extends Service { try { Intent intent = getIntent(context, serviceClass, DownloadService.ACTION_INIT); context.startService(intent); - } catch (IllegalArgumentException e) { + } catch (IllegalStateException e) { // The process is classed as idle by the platform. Starting a background service is not // allowed in this state. Log.w(TAG, "Failed to restart DownloadService (process is idle).");