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

Commit e85f0e12 authored by Galia Peycheva's avatar Galia Peycheva
Browse files

Release doze lock when the dream component changes

Bug: 260094933
Bug: 266937746
Test: m
Change-Id: Ia46f1e91469886bb562860ff81385928dd718ef7
parent 663be784
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -244,8 +244,6 @@ final class DreamController {
                }

                mListener.onDreamStopped(dream.mToken);
            } else if (dream.mCanDoze && !mCurrentDream.mCanDoze) {
                mListener.stopDozing(dream.mToken);
            }

        } finally {
@@ -292,7 +290,6 @@ final class DreamController {
     */
    public interface Listener {
        void onDreamStopped(Binder token);
        void stopDozing(Binder token);
    }

    private final class DreamRecord implements DeathRecipient, ServiceConnection {
+5 −11
Original line number Diff line number Diff line
@@ -499,12 +499,7 @@ public final class DreamManagerService extends SystemService {
        }

        synchronized (mLock) {
            if (mCurrentDream == null) {
                return;
            }

            final boolean sameDream = mCurrentDream.token == token;
            if ((sameDream && mCurrentDream.isDozing) || (!sameDream && !mCurrentDream.isDozing)) {
            if (mCurrentDream != null && mCurrentDream.token == token && mCurrentDream.isDozing) {
                mCurrentDream.isDozing = false;
                mDozeWakeLock.release();
                mPowerManagerInternal.setDozeOverrideFromDreamManager(
@@ -665,6 +660,10 @@ public final class DreamManagerService extends SystemService {

        Slog.i(TAG, "Entering dreamland.");

        if (mCurrentDream != null && mCurrentDream.isDozing) {
            stopDozingInternal(mCurrentDream.token);
        }

        mCurrentDream = new DreamRecord(name, userId, isPreviewMode, canDoze);

        if (!mCurrentDream.name.equals(mAmbientDisplayComponent)) {
@@ -770,11 +769,6 @@ public final class DreamManagerService extends SystemService {
                }
            }
        }

        @Override
        public void stopDozing(Binder token) {
            stopDozingInternal(token);
        }
    };

    private final ContentObserver mDozeEnabledObserver = new ContentObserver(null) {