Fix printing of FPS ranges in log messages

This commit is contained in:
Sean Owen 2014-02-12 23:31:36 +00:00
parent e3d6c3e49f
commit 39780fb86f

View file

@ -217,7 +217,7 @@ final class CameraConfigurationManager {
float step = parameters.getExposureCompensationStep();
int desiredCompensation;
if (newSetting) {
// Light on; set low exposue compensation
// Light on; set low exposure compensation
desiredCompensation = Math.max((int) (MIN_EXPOSURE_COMPENSATION / step), minExposure);
} else {
// Light off; set high compensation
@ -235,7 +235,7 @@ final class CameraConfigurationManager {
private static void setBestPreviewFPS(Camera.Parameters parameters) {
// Required for Glass compatibility; also improves battery/CPU performance a tad
List<int[]> supportedPreviewFpsRanges = parameters.getSupportedPreviewFpsRange();
Log.i(TAG, "Supported FPS ranges: " + supportedPreviewFpsRanges);
Log.i(TAG, "Supported FPS ranges: " + toString(supportedPreviewFpsRanges));
if (supportedPreviewFpsRanges != null && !supportedPreviewFpsRanges.isEmpty()) {
int[] minimumSuitableFpsRange = null;
for (int[] fpsRange : supportedPreviewFpsRanges) {
@ -260,6 +260,24 @@ final class CameraConfigurationManager {
}
}
// Actually prints the arrays properly:
private static String toString(Collection<int[]> arrays) {
if (arrays == null || arrays.isEmpty()) {
return "[]";
}
StringBuilder buffer = new StringBuilder();
buffer.append('[');
Iterator<int[]> it = arrays.iterator();
while (it.hasNext()) {
buffer.append(Arrays.toString(it.next()));
if (it.hasNext()) {
buffer.append(", ");
}
}
buffer.append(']');
return buffer.toString();
}
private Point findBestPreviewSizeValue(Camera.Parameters parameters, Point screenResolution) {
List<Camera.Size> rawSupportedSizes = parameters.getSupportedPreviewSizes();