diff options
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/qs/tiles/FlashlightTile.java | 5 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/policy/FlashlightController.java | 4 |
2 files changed, 9 insertions, 0 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 e4e379058399..12c8c44412ac 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/FlashlightTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/FlashlightTile.java @@ -69,6 +69,11 @@ public class FlashlightTile extends QSTile<QSTile.BooleanState> implements } @Override + public boolean isAvailable() { + return mFlashlightController.hasFlashlight(); + } + + @Override protected void handleClick() { if (ActivityManager.isUserAMonkey()) { return; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/FlashlightController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/FlashlightController.java index 29a8f67e4cfe..9a21a1e378e6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/FlashlightController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/FlashlightController.java @@ -93,6 +93,10 @@ public class FlashlightController { } } + public boolean hasFlashlight() { + return mCameraId != null; + } + public synchronized boolean isEnabled() { return mFlashlightEnabled; } |