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

Commit 1da50a20 authored by Bryce Lee's avatar Bryce Lee
Browse files

Unbind from dream overlay in onUnbind.

If a dream is unbound before finish, unbinding from the overlay service
will not occur before onDestroy. This will result in an exception from
unbinding from a non registered service. This change ensures the dream
service unbinds from the overlay service when unbound.

Test: atest DreamManagerServiceTests#testForceStopStubbornDream
Fixed: 229824204
Change-Id: Id708b9119c5498bf9632b21a539c3ca7f5506737
parent d5d0f0c2
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -999,6 +999,14 @@ public class DreamService extends Service implements Window.Callback {
        return mDreamServiceWrapper;
    }

    @Override
    public boolean onUnbind(Intent intent) {
        // We must unbind from any overlay connection if we are unbound before finishing.
        mOverlayConnection.unbind(this);

        return super.onUnbind(intent);
    }

    /**
     * Stops the dream and detaches from the window.
     * <p>