Merge "Remove SERVICE_FOREGROUND_TIMEOUT_MSG when scheduling service restart." into tm-dev am: dccf3ec68b
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17190178 Change-Id: I423272fcdcc4928ab1bffdbfb03100dbef76883a
This commit is contained in:
@@ -3801,6 +3801,18 @@ public final class ActiveServices {
|
|||||||
@GuardedBy("mAm")
|
@GuardedBy("mAm")
|
||||||
void performScheduleRestartLocked(ServiceRecord r, @NonNull String scheduling,
|
void performScheduleRestartLocked(ServiceRecord r, @NonNull String scheduling,
|
||||||
@NonNull String reason, @UptimeMillisLong long now) {
|
@NonNull String reason, @UptimeMillisLong long now) {
|
||||||
|
|
||||||
|
// If the service is waiting to become a foreground service, remove the pending
|
||||||
|
// SERVICE_FOREGROUND_TIMEOUT_MSG msg, and set fgWaiting to false, so next time the service
|
||||||
|
// is brought up, scheduleServiceForegroundTransitionTimeoutLocked() can be called again and
|
||||||
|
// a new SERVICE_FOREGROUND_TIMEOUT_MSG is scheduled in SERVICE_START_FOREGROUND_TIMEOUT
|
||||||
|
// again.
|
||||||
|
if (r.fgRequired && r.fgWaiting) {
|
||||||
|
mAm.mHandler.removeMessages(
|
||||||
|
ActivityManagerService.SERVICE_FOREGROUND_TIMEOUT_MSG, r);
|
||||||
|
r.fgWaiting = false;
|
||||||
|
}
|
||||||
|
|
||||||
mAm.mHandler.removeCallbacks(r.restarter);
|
mAm.mHandler.removeCallbacks(r.restarter);
|
||||||
mAm.mHandler.postAtTime(r.restarter, r.nextRestartTime);
|
mAm.mHandler.postAtTime(r.restarter, r.nextRestartTime);
|
||||||
r.nextRestartTime = now + r.restartDelay;
|
r.nextRestartTime = now + r.restartDelay;
|
||||||
@@ -5678,7 +5690,7 @@ public final class ActiveServices {
|
|||||||
void serviceForegroundTimeout(ServiceRecord r) {
|
void serviceForegroundTimeout(ServiceRecord r) {
|
||||||
ProcessRecord app;
|
ProcessRecord app;
|
||||||
synchronized (mAm) {
|
synchronized (mAm) {
|
||||||
if (!r.fgRequired || r.destroying) {
|
if (!r.fgRequired || !r.fgWaiting || r.destroying) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user