summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jason Monk <jmonk@google.com> 2016-02-29 20:41:02 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2016-02-29 20:41:03 +0000
commitf8d700ab83216ea7bd2637a2888089e4bf538210 (patch)
treead8c8f009e5a07947f8a1c6b28efcb54daa6a9b8
parent8e4341d9800f70bdd5bd51ca1b17088361c161ca (diff)
parent72d7bc4a09b9774ee59b53875c0e4eab682734cf (diff)
Merge "Fix flashlight availability." into nyc-dev
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/FlashlightTile.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/FlashlightController.java4
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;
}