Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 76bc5bd

Browse files
committed
Applied feedback from PR
1 parent f780742 commit 76bc5bd

File tree

2 files changed

+194
-7
lines changed

2 files changed

+194
-7
lines changed

packages/camera/camera/android/src/main/java/io/flutter/plugins/camera/CameraProperties.java

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,40 +16,224 @@
1616

1717
/** An interface allowing access to the different characteristics of the device's camera. */
1818
public interface CameraProperties {
19+
20+
/**
21+
* Returns the name (or identifier) of the camera device.
22+
*
23+
* @return String The name of the camera device.
24+
*/
1925
String getCameraName();
2026

27+
/**
28+
* Returns the list of frame rate ranges for @see android.control.aeTargetFpsRange supported by
29+
* this camera device.
30+
*
31+
* <p>By default maps to the @see
32+
* android.hardware.camera2.CameraCharacteristics#CONTROL_AE_TARGET_FPS_RANGE key.
33+
*
34+
* @return android.util.Range<Integer>[] List of frame rate ranges supported by this camera
35+
* device.
36+
*/
2137
Range<Integer>[] getControlAutoExposureAvailableTargetFpsRanges();
2238

39+
/**
40+
* Returns the maximum and minimum exposure compensation values for @see
41+
* android.control.aeExposureCompensation, in counts of @see android.control.aeCompensationStep,
42+
* that are supported by this camera device.
43+
*
44+
* <p>By default maps to the @see
45+
* android.hardware.camera2.CameraCharacteristics#CONTROL_AE_COMPENSATION_RANGE key.
46+
*
47+
* @return android.util.Range<Integer> Maximum and minimum exposure compensation supported by this
48+
* camera device.
49+
*/
2350
Range<Integer> getControlAutoExposureCompensationRange();
2451

52+
/**
53+
* Returns the smallest step by which the exposure compensation can be changed.
54+
*
55+
* <p>By default maps to the @see
56+
* android.hardware.camera2.CameraCharacteristics#CONTROL_AE_COMPENSATION_STEP key.
57+
*
58+
* @return double Smallest step by which the exposure compensation can be changed.
59+
*/
2560
double getControlAutoExposureCompensationStep();
2661

62+
/**
63+
* Returns a list of auto-focus modes for @see android.control.afMode that are supported by this
64+
* camera device.
65+
*
66+
* <p>By default maps to the @see
67+
* android.hardware.camera2.CameraCharacteristics#CONTROL_AF_AVAILABLE_MODES key.
68+
*
69+
* @return int[] List of auto-focus modes supported by this camera device.
70+
*/
2771
int[] getControlAutoFocusAvailableModes();
2872

73+
/**
74+
* Returns the maximum number of metering regions that can be used by the auto-exposure routine.
75+
*
76+
* <p>By default maps to the @see
77+
* android.hardware.camera2.CameraCharacteristics#CONTROL_MAX_REGIONS_AE key.
78+
*
79+
* @return Integer Maximum number of metering regions that can be used by the auto-exposure
80+
* routine.
81+
*/
2982
Integer getControlMaxRegionsAutoExposure();
3083

84+
/**
85+
* Returns the maximum number of metering regions that can be used by the auto-focus routine.
86+
*
87+
* <p>By default maps to the @see
88+
* android.hardware.camera2.CameraCharacteristics#CONTROL_MAX_REGIONS_AF key.
89+
*
90+
* @return Integer Maximum number of metering regions that can be used by the auto-focus routine.
91+
*/
3192
Integer getControlMaxRegionsAutoFocus();
3293

94+
/**
95+
* Returns a list of distortion correction modes for @see android.distortionCorrection.mode that
96+
* are supported by this camera device.
97+
*
98+
* <p>By default maps to the @see
99+
* android.hardware.camera2.CameraCharacteristics#DISTORTION_CORRECTION_AVAILABLE_MODES key.
100+
*
101+
* @return int[] List of distortion correction modes supported by this camera device.
102+
*/
103+
@RequiresApi(api = VERSION_CODES.P)
33104
int[] getDistortionCorrectionAvailableModes();
34105

106+
/**
107+
* Returns whether this camera device has a flash unit.
108+
*
109+
* <p>By default maps to the @see
110+
* android.hardware.camera2.CameraCharacteristics#FLASH_INFO_AVAILABLE key.
111+
*
112+
* @return Boolean Whether this camera device has a flash unit.
113+
*/
35114
Boolean getFlashInfoAvailable();
36115

116+
/**
117+
* Returns the direction the camera faces relative to device screen.
118+
*
119+
* <p><string>Possible values:</string>
120+
*
121+
* <ul>
122+
* <li>@see android.hardware.camera2.CameraMetadata.LENS_FACING_FRONT
123+
* <li>@see android.hardware.camera2.CameraMetadata.LENS_FACING_BACK
124+
* <li>@see android.hardware.camera2.CameraMetadata.LENS_FACING_EXTERNAL
125+
* </ul>
126+
*
127+
* By default maps to the @see android.hardware.camera2.CameraCharacteristics.LENS_FACING key.
128+
*
129+
* @return int Direction the camera faces relative to device screen.
130+
*/
37131
int getLensFacing();
38132

133+
/**
134+
* Returns the shortest distance from front most surface of the lens that can be brought into
135+
* sharp focus.
136+
*
137+
* <p>By default maps to the @see
138+
* android.hardware.camera2.CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE key.
139+
*
140+
* @return Float Shortest distance from front most surface of the lens that can be brought into
141+
* sharp focus.
142+
*/
39143
Float getLensInfoMinimumFocusDistance();
40144

145+
/**
146+
* Returns the maximum ratio between both active area width and crop region width, and active area
147+
* height and crop region height, for @see android.scaler.cropRegion.
148+
*
149+
* <p>By default maps to the @see
150+
* android.hardware.camera2.CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM key.
151+
*
152+
* @return Float Maximum ratio between both active area width and crop region width, and active
153+
* area height and crop region height
154+
*/
41155
Float getScalerAvailableMaxDigitalZoom();
42156

157+
/**
158+
* Returns the area of the image sensor which corresponds to active pixels after any geometric
159+
* distortion correction has been applied.
160+
*
161+
* <p>By default maps to the @see
162+
* android.hardware.camera2.CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE key.
163+
*
164+
* @return android.graphics.Rect area of the image sensor which corresponds to active pixels after
165+
* any geometric distortion correction has been applied.
166+
*/
43167
Rect getSensorInfoActiveArraySize();
44168

169+
/**
170+
* Returns the dimensions of the full pixel array, possibly including black calibration pixels.
171+
*
172+
* <p>By default maps to the @see
173+
* android.hardware.camera2.CameraCharacteristics#SENSOR_INFO_PIXEL_ARRAY_SIZE key.
174+
*
175+
* @return android.util.Size Dimensions of the full pixel array, possibly including black
176+
* calibration pixels.
177+
*/
45178
Size getSensorInfoPixelArraySize();
46179

180+
/**
181+
* Returns the area of the image sensor which corresponds to active pixels prior to the
182+
* application of any geometric distortion correction.
183+
*
184+
* <p>By default maps to the @see
185+
* android.hardware.camera2.CameraCharacteristics#SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE
186+
* key.
187+
*
188+
* @return android.graphics.Rect Area of the image sensor which corresponds to active pixels prior
189+
* to the application of any geometric distortion correction.
190+
*/
191+
@RequiresApi(api = VERSION_CODES.M)
47192
Rect getSensorInfoPreCorrectionActiveArraySize();
48193

194+
/**
195+
* Returns the clockwise angle through which the output image needs to be rotated to be upright on
196+
* the device screen in its native orientation.
197+
*
198+
* <p>By default maps to the @see
199+
* android.hardware.camera2.CameraCharacteristics#SENSOR_ORIENTATION key.
200+
*
201+
* @return int Clockwise angle through which the output image needs to be rotated to be upright on
202+
* the device screen in its native orientation.
203+
*/
49204
int getSensorOrientation();
50205

206+
/**
207+
* Returns a level which generally classifies the overall set of the camera device functionality.
208+
*
209+
* <p><strong>Possible values:</strong>
210+
*
211+
* <ul>
212+
* <li>@see android.hardware.camera2.CameraMetadata.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY
213+
* <li>@see android.hardware.camera2.CameraMetadata.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
214+
* <li>@see android.hardware.camera2.CameraMetadata.INFO_SUPPORTED_HARDWARE_LEVEL_FULL
215+
* <li>@see android.hardware.camera2.CameraMetadata.INFO_SUPPORTED_HARDWARE_LEVEL_LEVEL_3
216+
* <li>@see android.hardware.camera2.CameraMetadata.INFO_SUPPORTED_HARDWARE_LEVEL_EXTERNAL
217+
* </ul>
218+
*
219+
* By default maps to the @see
220+
* android.hardware.camera2.CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL key.
221+
*
222+
* @return int Level which generally classifies the overall set of the camera device
223+
* functionality.
224+
*/
51225
int getHardwareLevel();
52226

227+
/**
228+
* Returns a list of noise reduction modes for @see android.noiseReduction.mode that are supported
229+
* by this camera device.
230+
*
231+
* <p>By default maps to the @see
232+
* android.hardware.camera2.CameraCharacteristics#NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES
233+
* key.
234+
*
235+
* @return int[] List of noise reduction modes that are supported by this camera device.
236+
*/
53237
int[] getAvailableNoiseReductionModes();
54238
}
55239

packages/camera/camera/android/src/main/java/io/flutter/plugins/camera/features/CameraFeature.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,30 +27,33 @@ protected CameraFeature(@NonNull CameraProperties cameraProperties) {
2727
public abstract String getDebugName();
2828

2929
/**
30-
* Get the current value of this feature's setting.
30+
* Gets the current value of this feature's setting.
3131
*
32-
* @return
32+
* @return <T> Current value of this feature's setting.
3333
*/
3434
public abstract T getValue();
3535

3636
/**
37-
* Set a new value for this feature's setting.
37+
* Sets a new value for this feature's setting.
3838
*
39-
* @param value
39+
* @param value New value for this feature's setting.
4040
*/
4141
public abstract void setValue(T value);
4242

4343
/**
4444
* Returns whether or not this feature is supported.
4545
*
46-
* @return
46+
* <p>When the feature is not supported any {@see #value} is simply ignored by the camera plugin.
47+
*
48+
* @return boolean Whether or not this feature is supported.
4749
*/
4850
public abstract boolean checkIsSupported();
4951

5052
/**
51-
* Update the setting in a provided request builder.
53+
* Updates the setting in a provided {@see android.hardware.camera2.CaptureRequest.Builder}.
5254
*
53-
* @param requestBuilder
55+
* @param requestBuilder A {@see android.hardware.camera2.CaptureRequest.Builder} instance used to
56+
* configure the settings and outputs needed to capture a single image from the camera device.
5457
*/
5558
public abstract void updateBuilder(CaptureRequest.Builder requestBuilder);
5659
}

0 commit comments

Comments
 (0)