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 e4e3790583994..12c8c44412ac9 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/FlashlightTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/FlashlightTile.java @@ -68,6 +68,11 @@ public class FlashlightTile extends QSTile implements return new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA); } + @Override + public boolean isAvailable() { + return mFlashlightController.hasFlashlight(); + } + @Override protected void handleClick() { if (ActivityManager.isUserAMonkey()) { 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 29a8f67e4cfed..9a21a1e378e6d 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; }