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

Commit 410b5a6f authored by Bryce Lee's avatar Bryce Lee
Browse files

Unbind from overlay before checking attached.

Currently, DreamService#finish exits early if the window is not
attached. The unbind from the dream overlay service follows this
condition. As a result, it is possible that the service is not
unbound if the window was never attached. This changelist addresses
This potential connection leak by having the unbind precede the
check.

Fixed: 227498355
Test: manual
Change-Id: I7a73258cea5219bea96f4de3b90b4b5a66478fde
parent b46b98ee
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1038,14 +1038,14 @@ public class DreamService extends Service implements Window.Callback {
        }
        mFinished = true;

        mOverlayConnection.unbind(this);

        if (mDreamToken == null) {
            Slog.w(mTag, "Finish was called before the dream was attached.");
            stopSelf();
            return;
        }

        mOverlayConnection.unbind(this);

        try {
            // finishSelf will unbind the dream controller from the dream service. This will
            // trigger DreamService.this.onDestroy and DreamService.this will die.