From 72d7bc4a09b9774ee59b53875c0e4eab682734cf Mon Sep 17 00:00:00 2001 From: Jason Monk Date: Mon, 29 Feb 2016 10:03:13 -0500 Subject: [PATCH] Fix flashlight availability. Bug: 26981482 Change-Id: I62059b3b7f18520ae8735f3f3557411991bee909 --- .../src/com/android/systemui/qs/tiles/FlashlightTile.java | 5 +++++ .../systemui/statusbar/policy/FlashlightController.java | 4 ++++ 2 files changed, 9 insertions(+) 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; }