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

Commit 008bc544 authored by Lucas Silva's avatar Lucas Silva Committed by Android (Google) Code Review
Browse files

Merge "Fix system dream component race condition" into main

parents 62179cd7 b6aa47b6
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -495,6 +495,11 @@ public final class DreamManagerService extends SystemService {
        }
    }

    @GuardedBy("mLock")
    private boolean currentDreamCanDozeLocked() {
      return mCurrentDream != null && mCurrentDream.canDoze;
    }

    @VisibleForTesting
    boolean dreamConditionActiveInternal() {
        synchronized (mLock) {
@@ -808,7 +813,7 @@ public final class DreamManagerService extends SystemService {
            mSystemDreamComponent = componentName;
            reportKeepDreamingWhenUnpluggingChanged(shouldKeepDreamingWhenUnplugging());
            // Switch dream if currently dreaming and not dozing.
            if (isDreamingInternal() && !isDozingInternal()) {
            if (isDreamingInternal() && !currentDreamCanDozeLocked()) {
                startDreamInternal(false /*doze*/, (mSystemDreamComponent == null ? "clear" : "set")
                        + " system dream component" /*reason*/);
            }