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

Commit 110f9a12 authored by Salvador Martinez's avatar Salvador Martinez
Browse files

Move showing notification to background thread

The new notification logic can result in an IPC so to avoid
doing this on the main thread we should just handle all the
battery warning logic in the background.

Test: SysUI tests still pass
Bug: 72622147
Change-Id: I0c1ad9ebde2ea8d0404d9f6fd019e8620419e61d
parent 8a972cf3
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ import android.util.Slog;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.logging.MetricsLogger;
import com.android.settingslib.utils.ThreadUtils;
import com.android.systemui.Dependency;
import com.android.systemui.R;
import com.android.systemui.SystemUI;
@@ -242,7 +243,9 @@ public class PowerUI extends SystemUI {
                }

                // Show the correct version of low battery warning if needed
                ThreadUtils.postOnBackgroundThread(() -> {
                    maybeShowBatteryWarning(plugged, oldPlugged, oldBucket, bucket);
                });

            } else if (Intent.ACTION_SCREEN_OFF.equals(action)) {
                mScreenOffTime = SystemClock.elapsedRealtime();