diff options
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/qs/tiles/FlashlightTile.java | 7 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/policy/FlashlightControllerImpl.java | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/FlashlightTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/FlashlightTile.java index d86aebfd0255..416c7cef8e5d 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/FlashlightTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/FlashlightTile.java @@ -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 diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/FlashlightControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/FlashlightControllerImpl.java index 008d837da51c..f0cfa2c40931 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/FlashlightControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/FlashlightControllerImpl.java @@ -121,6 +121,8 @@ public class FlashlightControllerImpl implements FlashlightController { } cleanUpListenersLocked(l); mListeners.add(new WeakReference<>(l)); + l.onFlashlightAvailabilityChanged(mTorchAvailable); + l.onFlashlightChanged(mFlashlightEnabled); } } |