Catch correct exception from Context.startService

Issue: #7306
PiperOrigin-RevId: 309392633
This commit is contained in:
olly 2020-05-01 13:17:27 +01:00 committed by Oliver Woodman
parent e11ae734ed
commit 36b43780d3

View file

@ -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).");