OSDN Git Service

camera2: Avoid setting null metering regions in LEGACY.
authorRuben Brunk <rubenbrunk@google.com>
Sun, 21 Sep 2014 22:04:30 +0000 (15:04 -0700)
committerRuben Brunk <rubenbrunk@google.com>
Sun, 21 Sep 2014 23:09:34 +0000 (16:09 -0700)
Bug: 17587491

- If a single region with zero weight is set, revert to default
  metering region rather than attempting to set a null to
  avoid setParameters failure.

Change-Id: Iccd4d53d5a2134a9d744eafb731f464b653a154d

core/java/android/hardware/camera2/legacy/LegacyRequestMapper.java

index 8b91107..72d2d81 100644 (file)
@@ -497,6 +497,11 @@ public class LegacyRequestMapper {
             }
         }
 
+        if (meteringRectangleList.size() == 0) {
+            Log.w(TAG, "Only received metering rectangles with weight 0.");
+            return Arrays.asList(ParameterUtils.CAMERA_AREA_DEFAULT);
+        }
+
         // Ignore any regions beyond our maximum supported count
         int countMeteringAreas =
                 Math.min(maxNumMeteringAreas, meteringRectangleList.size());