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

Commit 86e1d8f3 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Keep PluginManager reference to avoid NPE"

parents 3b9fb703 c8a01350
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ public class DozeService extends DreamService

    private DozeMachine mDozeMachine;
    private DozeServicePlugin mDozePlugin;
    private PluginManager mPluginManager;

    public DozeService() {
        setDebug(DEBUG);
@@ -53,14 +54,14 @@ public class DozeService extends DreamService
            finish();
            return;
        }
        Dependency.get(PluginManager.class).addPluginListener(this,
                DozeServicePlugin.class, false /* Allow multiple */);
        mPluginManager = Dependency.get(PluginManager.class);
        mPluginManager.addPluginListener(this, DozeServicePlugin.class, false /* allowMultiple */);
        mDozeMachine = new DozeFactory().assembleMachine(this);
    }

    @Override
    public void onDestroy() {
        Dependency.get(PluginManager.class).removePluginListener(this);
        mPluginManager.removePluginListener(this);
        super.onDestroy();
        mDozeMachine = null;
    }