Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[camera] fix format
  • Loading branch information
Mairramer committed Apr 16, 2023
commit 71044377c261fa26647418a376838156ad882a53
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import io.flutter.plugins.camera.features.CameraFeature;
import io.flutter.plugins.camera.features.Point;
import io.flutter.plugins.camera.features.sensororientation.SensorOrientationFeature;
import java.util.Arrays;

/** Exposure point controls where in the frame exposure metering will come from. */
public class ExposurePointFeature extends CameraFeature<Point> {
Expand Down Expand Up @@ -78,7 +77,8 @@ public void updateBuilder(CaptureRequest.Builder requestBuilder) {
defaultExposureRectangle = requestBuilder.get(CaptureRequest.CONTROL_AE_REGIONS);
}
if (exposureRectangle != null) {
requestBuilder.set(CaptureRequest.CONTROL_AE_REGIONS, new MeteringRectangle[] {exposureRectangle});
requestBuilder.set(
CaptureRequest.CONTROL_AE_REGIONS, new MeteringRectangle[] {exposureRectangle});
} else if (shouldReset(requestBuilder)) {
requestBuilder.set(CaptureRequest.CONTROL_AE_REGIONS, defaultExposureRectangle);
}
Expand All @@ -104,7 +104,7 @@ private void buildExposureRectangle() {
}
}

public boolean shouldReset(CaptureRequest.Builder requestBuilder) {
public boolean shouldReset(CaptureRequest.Builder requestBuilder) {
MeteringRectangle[] currentRectangles = requestBuilder.get(CaptureRequest.CONTROL_AE_REGIONS);
return currentRectangles == null || currentRectangles.length == 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.isNull;
import static org.mockito.ArgumentMatchers.same;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
Expand All @@ -30,7 +28,6 @@
import org.junit.Test;
import org.mockito.MockedStatic;
import org.mockito.Mockito;
import java.util.Arrays;

public class ExposurePointFeatureTest {

Expand Down Expand Up @@ -321,7 +318,8 @@ public void testShouldResetReturnsFalse() {
CaptureRequest.Builder mockCaptureRequestBuilder = mock(CaptureRequest.Builder.class);
MeteringRectangle[] defaultRectangles = new MeteringRectangle[1];
defaultRectangles[0] = mock(MeteringRectangle.class);
when(mockCaptureRequestBuilder.get(CaptureRequest.CONTROL_AE_REGIONS)).thenReturn(defaultRectangles);
when(mockCaptureRequestBuilder.get(CaptureRequest.CONTROL_AE_REGIONS))
.thenReturn(defaultRectangles);
mockCaptureRequestBuilder.set(CaptureRequest.CONTROL_AE_REGIONS, defaultRectangles);

ExposurePointFeature exposurePointFeature = mock(ExposurePointFeature.class);
Expand All @@ -331,4 +329,4 @@ public void testShouldResetReturnsFalse() {

assertFalse(exposurePointFeature.shouldReset(mockCaptureRequestBuilder));
}
}
}