OSDN Git Service

Fix flashlight availability.
authorJason Monk <jmonk@google.com>
Mon, 29 Feb 2016 15:03:13 +0000 (10:03 -0500)
committerJason Monk <jmonk@google.com>
Mon, 29 Feb 2016 19:09:30 +0000 (14:09 -0500)
Bug: 26981482
Change-Id: I62059b3b7f18520ae8735f3f3557411991bee909

packages/SystemUI/src/com/android/systemui/qs/tiles/FlashlightTile.java
packages/SystemUI/src/com/android/systemui/statusbar/policy/FlashlightController.java

index e4e3790..12c8c44 100644 (file)
@@ -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;
index 29a8f67..9a21a1e 100644 (file)
@@ -93,6 +93,10 @@ public class FlashlightController {
         }
     }
 
+    public boolean hasFlashlight() {
+        return mCameraId != null;
+    }
+
     public synchronized boolean isEnabled() {
         return mFlashlightEnabled;
     }