commit | 5b3f38ff47116f16c2ab6e169a57433b05fc7197 | [log] [tgz] |
---|---|---|
author | Jason Monk <jmonk@google.com> | Wed Jan 11 09:41:05 2017 -0500 |
committer | gitbuildkicker <android-build@google.com> | Wed Jan 11 14:28:09 2017 -0800 |
tree | 974843d91172e78ad86a80bdbabb60667fa47ca0 | |
parent | 8931dcee345f109eef8bff921a5416d381b9efb4 [diff] |
Fixes for FlashlightTile lifecycle Change-Id: I690440465ef5312d77a279e73eaa22ccbdfbcd53 Fixes: 33861261 Test: runtest systemui (cherry picked from commit 861e09ade26afbeef3bee746ce1d53e0ec82a50e)
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 d86aebf..416c7ce 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 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 @@ @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 008d837..f0cfa2c 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 @@ } cleanUpListenersLocked(l); mListeners.add(new WeakReference<>(l)); + l.onFlashlightAvailabilityChanged(mTorchAvailable); + l.onFlashlightChanged(mFlashlightEnabled); } }