Fix flashlight availability.

Bug: 26981482
Change-Id: I62059b3b7f18520ae8735f3f3557411991bee909
This commit is contained in:
Jason Monk
2016-02-29 10:03:13 -05:00
parent 3f3d42e0d4
commit 72d7bc4a09
2 changed files with 9 additions and 0 deletions

View File

@@ -68,6 +68,11 @@ public class FlashlightTile extends QSTile<QSTile.BooleanState> implements
return new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA);
}
@Override
public boolean isAvailable() {
return mFlashlightController.hasFlashlight();
}
@Override
protected void handleClick() {
if (ActivityManager.isUserAMonkey()) {

View File

@@ -93,6 +93,10 @@ public class FlashlightController {
}
}
public boolean hasFlashlight() {
return mCameraId != null;
}
public synchronized boolean isEnabled() {
return mFlashlightEnabled;
}