Commit 2fa2fb73 by olly Committed by Andrew Lewis

Catch correct exception from Context.startService

Issue: #7306
PiperOrigin-RevId: 309392633
parent c20b85ac
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
([#6950](https://github.com/google/ExoPlayer/pull/6950)). ([#6950](https://github.com/google/ExoPlayer/pull/6950)).
* AV1 extension: Add a heuristic to determine the default number of threads * AV1 extension: Add a heuristic to determine the default number of threads
used for AV1 playback using the extension. used for AV1 playback using the extension.
* DownloadService: Fix "Not allowed to start service" `IllegalStateException`.
### 2.11.4 (2020-04-08) ### ### 2.11.4 (2020-04-08) ###
......
...@@ -1022,7 +1022,7 @@ public abstract class DownloadService extends Service { ...@@ -1022,7 +1022,7 @@ public abstract class DownloadService extends Service {
try { try {
Intent intent = getIntent(context, serviceClass, DownloadService.ACTION_INIT); Intent intent = getIntent(context, serviceClass, DownloadService.ACTION_INIT);
context.startService(intent); context.startService(intent);
} catch (IllegalArgumentException e) { } catch (IllegalStateException e) {
// The process is classed as idle by the platform. Starting a background service is not // The process is classed as idle by the platform. Starting a background service is not
// allowed in this state. // allowed in this state.
Log.w(TAG, "Failed to restart DownloadService (process is idle)."); Log.w(TAG, "Failed to restart DownloadService (process is idle).");
......
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