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

Commit 0b2e23a4 authored by Adrian Roos's avatar Adrian Roos
Browse files

DozeService: Fix crash if StatusBar not yet initialized

Fixes a bug where a crashing SystemUI may crash again after restarting
if the services restart in an unexpected order.

Bug: 34044765
Test: Crash SystemUI, observe that it doesn't crash again right away.
Change-Id: Id6f781ba29ff11be0850b1883ca2942f15e76324
parent 772ff11c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -152,7 +152,7 @@ public class DozeFactory {
        }
    }

    private static DozeHost getHost(DozeService service) {
    public static DozeHost getHost(DozeService service) {
        Application appCandidate = service.getApplication();
        final SystemUIApplication app = (SystemUIApplication) appCandidate;
        return app.getComponent(DozeHost.class);
+8 −1
Original line number Diff line number Diff line
@@ -42,6 +42,11 @@ public class DozeService extends DreamService implements DozeMachine.Service {

        setWindowless(true);

        if (DozeFactory.getHost(this) == null) {
            finish();
            return;
        }

        DozeProvider provider = PluginManager.getInstance(this)
                .getOneShotPlugin(DozeProvider.ACTION, DozeProvider.VERSION);
        mDozeMachine = new DozeFactory(provider).assembleMachine(this);
@@ -62,6 +67,8 @@ public class DozeService extends DreamService implements DozeMachine.Service {

    @Override
    protected void dumpOnHandler(FileDescriptor fd, PrintWriter pw, String[] args) {
        if (mDozeMachine != null) {
            mDozeMachine.dump(pw);
        }
    }
}