diff options
| -rw-r--r-- | services/core/java/com/android/server/am/ActiveServices.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/services/core/java/com/android/server/am/ActiveServices.java b/services/core/java/com/android/server/am/ActiveServices.java index 96b1650d9575..02f4485d5b40 100644 --- a/services/core/java/com/android/server/am/ActiveServices.java +++ b/services/core/java/com/android/server/am/ActiveServices.java @@ -2118,11 +2118,6 @@ public final class ActiveServices { // anyway, so we just remove the SHORT_SERVICE type. foregroundServiceType &= ~FOREGROUND_SERVICE_TYPE_SHORT_SERVICE; } - if (!shouldAllowBootCompletedStart(r, foregroundServiceType)) { - throw new ForegroundServiceStartNotAllowedException("FGS type " - + ServiceInfo.foregroundServiceTypeToLabel(foregroundServiceType) - + " not allowed to start from BOOT_COMPLETED!"); - } boolean alreadyStartedOp = false; boolean stopProcStatsOp = false; @@ -2137,6 +2132,12 @@ public final class ActiveServices { mServiceFGAnrTimer.cancel(r); } + if (!shouldAllowBootCompletedStart(r, foregroundServiceType)) { + throw new ForegroundServiceStartNotAllowedException("FGS type " + + ServiceInfo.foregroundServiceTypeToLabel(foregroundServiceType) + + " not allowed to start from BOOT_COMPLETED!"); + } + final ProcessServiceRecord psr = r.app.mServices; try { boolean ignoreForeground = false; |