Merge "Fix flashlight availability." into nyc-dev

This commit is contained in:
Jason Monk
2016-02-29 20:41:02 +00:00
committed by Android (Google) Code Review
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); return new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA);
} }
@Override
public boolean isAvailable() {
return mFlashlightController.hasFlashlight();
}
@Override @Override
protected void handleClick() { protected void handleClick() {
if (ActivityManager.isUserAMonkey()) { if (ActivityManager.isUserAMonkey()) {

View File

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