Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e1ea9b00 authored by Dmitri Plotnikov's avatar Dmitri Plotnikov
Browse files

Ignore RejectedExecutionException that may occur during system shutdown

Bug: 225081542
Test: apct/device_boot_health_check_extra
Change-Id: Ic4bee60d1205258a5440bf87df65caf5ba2c41b8
parent 2cd6dc76
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
@@ -404,8 +405,10 @@ public class BatteryExternalStatsWorker implements BatteryStatsImpl.ExternalStat
     * within the task, never wait on the resulting Future. This will result in a deadlock.
     */
    public synchronized void scheduleRunnable(Runnable runnable) {
        if (!mExecutorService.isShutdown()) {
        try {
            mExecutorService.submit(runnable);
        } catch (RejectedExecutionException e) {
            Slog.e(TAG, "Couldn't schedule " + runnable, e);
        }
    }