diff --git a/packages/camera/camera_android/CHANGELOG.md b/packages/camera/camera_android/CHANGELOG.md
index c4c772bfd608..89514a155755 100644
--- a/packages/camera/camera_android/CHANGELOG.md
+++ b/packages/camera/camera_android/CHANGELOG.md
@@ -1,6 +1,11 @@
+## 0.10.6
+
+* Fixes Java warnings.
+
## 0.10.5
* Allows camera to be switched while video recording.
+
## 0.10.4+3
* Clarifies explanation of endorsement in README.
diff --git a/packages/camera/camera_android/android/build.gradle b/packages/camera/camera_android/android/build.gradle
index 8e2775a0e263..d93d06aaf4d3 100644
--- a/packages/camera/camera_android/android/build.gradle
+++ b/packages/camera/camera_android/android/build.gradle
@@ -38,7 +38,6 @@ android {
checkAllWarnings true
warningsAsErrors true
disable 'AndroidGradlePluginVersion', 'InvalidPackage', 'GradleDependency'
- baseline file("lint-baseline.xml")
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
diff --git a/packages/camera/camera_android/android/lint-baseline.xml b/packages/camera/camera_android/android/lint-baseline.xml
deleted file mode 100644
index b0fc2e758dff..000000000000
--- a/packages/camera/camera_android/android/lint-baseline.xml
+++ /dev/null
@@ -1,3106 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/Camera.java b/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/Camera.java
index 500407009c5a..954458f5d5eb 100644
--- a/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/Camera.java
+++ b/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/Camera.java
@@ -96,7 +96,7 @@ class Camera
* Holds all of the camera features/settings and will be used to update the request builder when
* one changes.
*/
- private CameraFeatures cameraFeatures;
+ CameraFeatures cameraFeatures;
private String imageFormatGroup;
@@ -116,28 +116,28 @@ class Camera
private final ResolutionPreset resolutionPreset;
private final boolean enableAudio;
private final Context applicationContext;
- private final DartMessenger dartMessenger;
+ final DartMessenger dartMessenger;
private CameraProperties cameraProperties;
private final CameraFeatureFactory cameraFeatureFactory;
private final Activity activity;
/** A {@link CameraCaptureSession.CaptureCallback} that handles events related to JPEG capture. */
private final CameraCaptureCallback cameraCaptureCallback;
/** A {@link Handler} for running tasks in the background. */
- private Handler backgroundHandler;
+ Handler backgroundHandler;
/** An additional thread for running tasks that shouldn't block the UI. */
private HandlerThread backgroundHandlerThread;
- private CameraDeviceWrapper cameraDevice;
- private CameraCaptureSession captureSession;
+ CameraDeviceWrapper cameraDevice;
+ CameraCaptureSession captureSession;
private ImageReader pictureImageReader;
- private ImageReader imageStreamReader;
+ ImageReader imageStreamReader;
/** {@link CaptureRequest.Builder} for the camera preview */
- private CaptureRequest.Builder previewRequestBuilder;
+ CaptureRequest.Builder previewRequestBuilder;
private MediaRecorder mediaRecorder;
/** True when recording video. */
- private boolean recordingVideo;
+ boolean recordingVideo;
/** True when the preview is paused. */
private boolean pausedPreview;
@@ -148,13 +148,13 @@ class Camera
/** Holds the last known capture properties */
private CameraCaptureProperties captureProps;
- private MethodChannel.Result flutterResult;
+ MethodChannel.Result flutterResult;
/** A CameraDeviceWrapper implementation that forwards calls to a CameraDevice. */
private class DefaultCameraDeviceWrapper implements CameraDeviceWrapper {
private final CameraDevice cameraDevice;
- private DefaultCameraDeviceWrapper(CameraDevice cameraDevice) {
+ DefaultCameraDeviceWrapper(CameraDevice cameraDevice) {
this.cameraDevice = cameraDevice;
}
@@ -171,7 +171,6 @@ public void createCaptureSession(SessionConfiguration config) throws CameraAcces
cameraDevice.createCaptureSession(config);
}
- @TargetApi(VERSION_CODES.LOLLIPOP)
@SuppressWarnings("deprecation")
@Override
public void createCaptureSession(
@@ -235,9 +234,11 @@ public void onPrecapture() {
*
* @param requestBuilder request builder to update.
*/
- private void updateBuilderSettings(CaptureRequest.Builder requestBuilder) {
+ void updateBuilderSettings(CaptureRequest.Builder requestBuilder) {
for (CameraFeature> feature : cameraFeatures.getAllFeatures()) {
- Log.d(TAG, "Updating builder with feature: " + feature.getDebugName());
+ if (BuildConfig.DEBUG) {
+ Log.d(TAG, "Updating builder with feature: " + feature.getDebugName());
+ }
feature.updateBuilder(requestBuilder);
}
}
@@ -331,7 +332,9 @@ public void onOpened(@NonNull CameraDevice device) {
cameraFeatures.getFocusPoint().checkIsSupported());
} catch (Exception e) {
- Log.i(TAG, "open | onOpened error: " + e.getMessage());
+ if (BuildConfig.DEBUG) {
+ Log.i(TAG, "open | onOpened error: " + e.getMessage());
+ }
dartMessenger.sendCameraErrorEvent(e.getMessage());
close();
}
@@ -489,7 +492,6 @@ private void createCaptureSessionWithSessionConfig(
callback));
}
- @TargetApi(VERSION_CODES.LOLLIPOP)
@SuppressWarnings("deprecation")
private void createCaptureSession(
List surfaces, CameraCaptureSession.StateCallback callback)
@@ -498,7 +500,7 @@ private void createCaptureSession(
}
// Send a repeating request to refresh capture session.
- private void refreshPreviewCaptureSession(
+ void refreshPreviewCaptureSession(
@Nullable Runnable onSuccessCallback, @NonNull ErrorCallback onErrorCallback) {
Log.i(TAG, "refreshPreviewCaptureSession");
@@ -722,7 +724,7 @@ private void lockAutoFocus() {
}
/** Cancel and reset auto focus state and refresh the preview session. */
- private void unlockAutoFocus() {
+ void unlockAutoFocus() {
Log.i(TAG, "unlockAutoFocus");
if (captureSession == null) {
Log.i(TAG, "[unlockAutoFocus] captureSession null, returning");
@@ -1194,7 +1196,7 @@ public void onCancel(Object o) {
});
}
- private void setImageStreamImageAvailableListener(final EventChannel.EventSink imageStreamSink) {
+ void setImageStreamImageAvailableListener(final EventChannel.EventSink imageStreamSink) {
imageStreamReader.setOnImageAvailableListener(
reader -> {
Image img = reader.acquireNextImage();
@@ -1234,7 +1236,7 @@ private void setImageStreamImageAvailableListener(final EventChannel.EventSink i
backgroundHandler);
}
- private void closeCaptureSession() {
+ void closeCaptureSession() {
if (captureSession != null) {
Log.i(TAG, "closeCaptureSession");
diff --git a/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/CameraPlugin.java b/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/CameraPlugin.java
index 067ed0295e2e..308d4283aa27 100644
--- a/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/CameraPlugin.java
+++ b/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/CameraPlugin.java
@@ -5,7 +5,6 @@
package io.flutter.plugins.camera;
import android.app.Activity;
-import android.os.Build;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import io.flutter.embedding.engine.plugins.FlutterPlugin;
@@ -45,7 +44,8 @@ public CameraPlugin() {}
* won't react to changes in activity or context, unlike {@link CameraPlugin}.
*/
@SuppressWarnings("deprecation")
- public static void registerWith(io.flutter.plugin.common.PluginRegistry.Registrar registrar) {
+ public static void registerWith(
+ @NonNull io.flutter.plugin.common.PluginRegistry.Registrar registrar) {
CameraPlugin plugin = new CameraPlugin();
plugin.maybeStartListening(
registrar.activity(),
@@ -97,11 +97,6 @@ private void maybeStartListening(
BinaryMessenger messenger,
PermissionsRegistry permissionsRegistry,
TextureRegistry textureRegistry) {
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
- // If the sdk is less than 21 (min sdk for Camera2) we don't register the plugin.
- return;
- }
-
methodCallHandler =
new MethodCallHandlerImpl(
activity, messenger, new CameraPermissions(), permissionsRegistry, textureRegistry);
diff --git a/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/CameraProperties.java b/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/CameraProperties.java
index 7e061a24aabc..2c3eda880deb 100644
--- a/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/CameraProperties.java
+++ b/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/CameraProperties.java
@@ -8,6 +8,8 @@
import android.os.Build.VERSION_CODES;
import android.util.Range;
import android.util.Size;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
/** An interface allowing access to the different characteristics of the device's camera. */
@@ -18,6 +20,7 @@ public interface CameraProperties {
*
* @return String The name of the camera device.
*/
+ @NonNull
String getCameraName();
/**
@@ -30,6 +33,7 @@ public interface CameraProperties {
* @return android.util.Range[] List of frame rate ranges supported by this camera
* device.
*/
+ @NonNull
Range[] getControlAutoExposureAvailableTargetFpsRanges();
/**
@@ -43,6 +47,7 @@ public interface CameraProperties {
* @return android.util.Range Maximum and minimum exposure compensation supported by this
* camera device.
*/
+ @NonNull
Range getControlAutoExposureCompensationRange();
/**
@@ -64,6 +69,7 @@ public interface CameraProperties {
*
* @return int[] List of auto-focus modes supported by this camera device.
*/
+ @NonNull
int[] getControlAutoFocusAvailableModes();
/**
@@ -75,6 +81,7 @@ public interface CameraProperties {
* @return Integer Maximum number of metering regions that can be used by the auto-exposure
* routine.
*/
+ @NonNull
Integer getControlMaxRegionsAutoExposure();
/**
@@ -85,6 +92,7 @@ public interface CameraProperties {
*
* @return Integer Maximum number of metering regions that can be used by the auto-focus routine.
*/
+ @NonNull
Integer getControlMaxRegionsAutoFocus();
/**
@@ -97,6 +105,7 @@ public interface CameraProperties {
* @return int[] List of distortion correction modes supported by this camera device.
*/
@RequiresApi(api = VERSION_CODES.P)
+ @Nullable
int[] getDistortionCorrectionAvailableModes();
/**
@@ -107,6 +116,7 @@ public interface CameraProperties {
*
* @return Boolean Whether this camera device has a flash unit.
*/
+ @NonNull
Boolean getFlashInfoAvailable();
/**
@@ -136,6 +146,7 @@ public interface CameraProperties {
* @return Float Shortest distance from front most surface of the lens that can be brought into
* sharp focus.
*/
+ @Nullable
Float getLensInfoMinimumFocusDistance();
/**
@@ -148,6 +159,7 @@ public interface CameraProperties {
* @return Float Maximum ratio between both active area width and crop region width, and active
* area height and crop region height.
*/
+ @NonNull
Float getScalerAvailableMaxDigitalZoom();
/**
@@ -159,6 +171,7 @@ public interface CameraProperties {
*
* @return Float Minimum ratio between the default zoom ratio and the minimum possible zoom.
*/
+ @Nullable
@RequiresApi(api = VERSION_CODES.R)
Float getScalerMinZoomRatio();
@@ -171,6 +184,7 @@ public interface CameraProperties {
*
* @return Float Maximum ratio between the default zoom ratio and the maximum possible zoom.
*/
+ @Nullable
@RequiresApi(api = VERSION_CODES.R)
Float getScalerMaxZoomRatio();
@@ -184,6 +198,7 @@ public interface CameraProperties {
* @return android.graphics.Rect area of the image sensor which corresponds to active pixels after
* any geometric distortion correction has been applied.
*/
+ @NonNull
Rect getSensorInfoActiveArraySize();
/**
@@ -195,6 +210,7 @@ public interface CameraProperties {
* @return android.util.Size Dimensions of the full pixel array, possibly including black
* calibration pixels.
*/
+ @NonNull
Size getSensorInfoPixelArraySize();
/**
@@ -209,6 +225,7 @@ public interface CameraProperties {
* to the application of any geometric distortion correction.
*/
@RequiresApi(api = VERSION_CODES.M)
+ @NonNull
Rect getSensorInfoPreCorrectionActiveArraySize();
/**
@@ -254,5 +271,6 @@ public interface CameraProperties {
*
* @return int[] List of noise reduction modes that are supported by this camera device.
*/
+ @NonNull
int[] getAvailableNoiseReductionModes();
}
diff --git a/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/CameraPropertiesImpl.java b/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/CameraPropertiesImpl.java
index 66bb2901b629..dc8e9b736f2c 100644
--- a/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/CameraPropertiesImpl.java
+++ b/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/CameraPropertiesImpl.java
@@ -12,6 +12,8 @@
import android.util.Range;
import android.util.Rational;
import android.util.Size;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
/**
@@ -22,22 +24,25 @@ public class CameraPropertiesImpl implements CameraProperties {
private final CameraCharacteristics cameraCharacteristics;
private final String cameraName;
- public CameraPropertiesImpl(String cameraName, CameraManager cameraManager)
+ public CameraPropertiesImpl(@NonNull String cameraName, @NonNull CameraManager cameraManager)
throws CameraAccessException {
this.cameraName = cameraName;
this.cameraCharacteristics = cameraManager.getCameraCharacteristics(cameraName);
}
+ @NonNull
@Override
public String getCameraName() {
return cameraName;
}
+ @NonNull
@Override
public Range[] getControlAutoExposureAvailableTargetFpsRanges() {
return cameraCharacteristics.get(CameraCharacteristics.CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES);
}
+ @NonNull
@Override
public Range getControlAutoExposureCompensationRange() {
return cameraCharacteristics.get(CameraCharacteristics.CONTROL_AE_COMPENSATION_RANGE);
@@ -51,27 +56,32 @@ public double getControlAutoExposureCompensationStep() {
return rational == null ? 0.0 : rational.doubleValue();
}
+ @NonNull
@Override
public int[] getControlAutoFocusAvailableModes() {
return cameraCharacteristics.get(CameraCharacteristics.CONTROL_AF_AVAILABLE_MODES);
}
+ @NonNull
@Override
public Integer getControlMaxRegionsAutoExposure() {
return cameraCharacteristics.get(CameraCharacteristics.CONTROL_MAX_REGIONS_AE);
}
+ @NonNull
@Override
public Integer getControlMaxRegionsAutoFocus() {
return cameraCharacteristics.get(CameraCharacteristics.CONTROL_MAX_REGIONS_AF);
}
@RequiresApi(api = VERSION_CODES.P)
+ @Nullable
@Override
public int[] getDistortionCorrectionAvailableModes() {
return cameraCharacteristics.get(CameraCharacteristics.DISTORTION_CORRECTION_AVAILABLE_MODES);
}
+ @NonNull
@Override
public Boolean getFlashInfoAvailable() {
return cameraCharacteristics.get(CameraCharacteristics.FLASH_INFO_AVAILABLE);
@@ -82,39 +92,56 @@ public int getLensFacing() {
return cameraCharacteristics.get(CameraCharacteristics.LENS_FACING);
}
+ @Nullable
@Override
public Float getLensInfoMinimumFocusDistance() {
return cameraCharacteristics.get(CameraCharacteristics.LENS_INFO_MINIMUM_FOCUS_DISTANCE);
}
+ @NonNull
@Override
public Float getScalerAvailableMaxDigitalZoom() {
return cameraCharacteristics.get(CameraCharacteristics.SCALER_AVAILABLE_MAX_DIGITAL_ZOOM);
}
@RequiresApi(api = VERSION_CODES.R)
+ @Nullable
@Override
public Float getScalerMaxZoomRatio() {
- return cameraCharacteristics.get(CameraCharacteristics.CONTROL_ZOOM_RATIO_RANGE).getUpper();
+ final Range range =
+ cameraCharacteristics.get(CameraCharacteristics.CONTROL_ZOOM_RATIO_RANGE);
+ if (range != null) {
+ return range.getUpper();
+ }
+ return null;
}
@RequiresApi(api = VERSION_CODES.R)
+ @Nullable
@Override
public Float getScalerMinZoomRatio() {
- return cameraCharacteristics.get(CameraCharacteristics.CONTROL_ZOOM_RATIO_RANGE).getLower();
+ final Range range =
+ cameraCharacteristics.get(CameraCharacteristics.CONTROL_ZOOM_RATIO_RANGE);
+ if (range != null) {
+ return range.getLower();
+ }
+ return null;
}
+ @NonNull
@Override
public Rect getSensorInfoActiveArraySize() {
return cameraCharacteristics.get(CameraCharacteristics.SENSOR_INFO_ACTIVE_ARRAY_SIZE);
}
+ @NonNull
@Override
public Size getSensorInfoPixelArraySize() {
return cameraCharacteristics.get(CameraCharacteristics.SENSOR_INFO_PIXEL_ARRAY_SIZE);
}
@RequiresApi(api = VERSION_CODES.M)
+ @NonNull
@Override
public Rect getSensorInfoPreCorrectionActiveArraySize() {
return cameraCharacteristics.get(
@@ -131,6 +158,7 @@ public int getHardwareLevel() {
return cameraCharacteristics.get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL);
}
+ @NonNull
@Override
public int[] getAvailableNoiseReductionModes() {
return cameraCharacteristics.get(
diff --git a/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/CameraRegionUtils.java b/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/CameraRegionUtils.java
index 951a2797d68f..55ca63caed4e 100644
--- a/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/CameraRegionUtils.java
+++ b/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/CameraRegionUtils.java
@@ -29,6 +29,7 @@ public final class CameraRegionUtils {
* @param requestBuilder - The request builder for the current capture request.
* @return The boundaries for the current camera device.
*/
+ @NonNull
public static Size getCameraBoundaries(
@NonNull CameraProperties cameraProperties, @NonNull CaptureRequest.Builder requestBuilder) {
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.P
@@ -69,6 +70,7 @@ && supportsDistortionCorrection(cameraProperties)) {
* @return The dimensions of the metering rectangle based on the supplied coordinates and
* boundaries.
*/
+ @NonNull
public static MeteringRectangle convertPointToMeteringRectangle(
@NonNull Size boundaries,
double x,
diff --git a/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/CameraUtils.java b/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/CameraUtils.java
index 11b6eeaa5b50..d98984cbf2f5 100644
--- a/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/CameraUtils.java
+++ b/packages/camera/camera_android/android/src/main/java/io/flutter/plugins/camera/CameraUtils.java
@@ -10,6 +10,7 @@
import android.hardware.camera2.CameraCharacteristics;
import android.hardware.camera2.CameraManager;
import android.hardware.camera2.CameraMetadata;
+import androidx.annotation.NonNull;
import io.flutter.embedding.engine.systemchannels.PlatformChannel;
import java.util.ArrayList;
import java.util.HashMap;
@@ -91,7 +92,8 @@ static PlatformChannel.DeviceOrientation deserializeDeviceOrientation(String ori
* @return A map of all the available cameras, with their name as their key.
* @throws CameraAccessException when the camera could not be accessed.
*/
- public static List