Commit 36b43780 by olly Committed by Oliver Woodman

Catch correct exception from Context.startService

Issue: #7306
PiperOrigin-RevId: 309392633
parent e11ae734
...@@ -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