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

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

Merge "Fixes for FlashlightTile lifecycle"

parents 5becc487 861e09ad
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -47,13 +47,11 @@ public class FlashlightTile extends QSTile<QSTile.BooleanState> implements
    public FlashlightTile(Host host) {
        super(host);
        mFlashlightController = host.getFlashlightController();
        mFlashlightController.addCallback(this);
    }

    @Override
    protected void handleDestroy() {
        super.handleDestroy();
        mFlashlightController.removeCallback(this);
    }

    @Override
@@ -63,6 +61,11 @@ public class FlashlightTile extends QSTile<QSTile.BooleanState> implements

    @Override
    public void setListening(boolean listening) {
        if (listening) {
            mFlashlightController.addCallback(this);
        } else {
            mFlashlightController.removeCallback(this);
        }
    }

    @Override
+2 −0
Original line number Diff line number Diff line
@@ -121,6 +121,8 @@ public class FlashlightControllerImpl implements FlashlightController {
            }
            cleanUpListenersLocked(l);
            mListeners.add(new WeakReference<>(l));
            l.onFlashlightAvailabilityChanged(mTorchAvailable);
            l.onFlashlightChanged(mFlashlightEnabled);
        }
    }