You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/CameraAndroidCameraxPlugin.java
+10
Original file line number
Diff line number
Diff line change
@@ -27,6 +27,7 @@ public final class CameraAndroidCameraxPlugin implements FlutterPlugin, Activity
Copy file name to clipboardExpand all lines: packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/CameraControlHostApiImpl.java
+24
Original file line number
Diff line number
Diff line change
@@ -83,6 +83,12 @@ public void onSuccess(Void voidResult) {
83
83
}
84
84
85
85
publicvoidonFailure(Throwablet) {
86
+
if (tinstanceofCameraControl.OperationCanceledException) {
87
+
// Operation was canceled due to camera being closed or a new request was submitted, which
88
+
// is not actionable and should not block a new value from potentially being submitted.
89
+
result.success(null);
90
+
return;
91
+
}
86
92
result.error(t);
87
93
}
88
94
},
@@ -94,6 +100,9 @@ public void onFailure(Throwable t) {
94
100
*
95
101
* <p>Will trigger an auto focus action and enable auto focus/auto exposure/auto white balance
96
102
* metering regions.
103
+
*
104
+
* <p>Will send a {@link GeneratedCameraXLibrary.Result} with a null result if operation was
105
+
* canceled.
97
106
*/
98
107
publicvoidstartFocusAndMetering(
99
108
@NonNullCameraControlcameraControl,
@@ -117,6 +126,12 @@ public void onSuccess(FocusMeteringResult focusMeteringResult) {
117
126
}
118
127
119
128
publicvoidonFailure(Throwablet) {
129
+
if (tinstanceofCameraControl.OperationCanceledException) {
130
+
// Operation was canceled due to camera being closed or a new request was submitted, which
131
+
// is not actionable and should not block a new value from potentially being submitted.
132
+
result.success(null);
133
+
return;
134
+
}
120
135
result.error(t);
121
136
}
122
137
},
@@ -152,6 +167,9 @@ public void onFailure(Throwable t) {
152
167
* <p>The exposure compensation value set on the camera must be within the range of {@code
153
168
* ExposureState#getExposureCompensationRange()} for the current {@code ExposureState} for the
154
169
* call to succeed.
170
+
*
171
+
* <p>Will send a {@link GeneratedCameraXLibrary.Result} with a null result if operation was
Copy file name to clipboardExpand all lines: packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/GeneratedCameraXLibrary.java
+28-4
Original file line number
Diff line number
Diff line change
@@ -83,14 +83,14 @@ private CameraStateType(final int index) {
83
83
* <p>If you need to add another type to support a type S to use a LiveData<S> in this plugin,
84
84
* ensure the following is done on the Dart side:
85
85
*
86
-
* <p>* In `../lib/src/live_data.dart`, add new cases for S in
86
+
* <p>* In `camera_android_camerax/lib/src/live_data.dart`, add new cases for S in
87
87
* `_LiveDataHostApiImpl#getValueFromInstances` to get the current value of type S from a
88
88
* LiveData<S> instance and in `LiveDataFlutterApiImpl#create` to create the expected type of
89
89
* LiveData<S> when requested.
90
90
*
91
91
* <p>On the native side, ensure the following is done:
92
92
*
93
-
* <p>* Update `LiveDataHostApiImpl#getValue` is updated to properly return identifiers for
93
+
* <p>* Make sure `LiveDataHostApiImpl#getValue` is updated to properly return identifiers for
94
94
* instances of type S. * Update `ObserverFlutterApiWrapper#onChanged` to properly handle
95
95
* receiving calls with instances of type S if a LiveData<S> instance is observed.
96
96
*/
@@ -146,6 +146,24 @@ private VideoResolutionFallbackRule(final int index) {
146
146
}
147
147
}
148
148
149
+
/**
150
+
* The types of capture request options this plugin currently supports.
151
+
*
152
+
* <p>If you need to add another option to support, ensure the following is done on the Dart side:
153
+
*
154
+
* <p>* In `camera_android_camerax/lib/src/capture_request_options.dart`, add new cases for this
155
+
* option in `_CaptureRequestOptionsHostApiImpl#createFromInstances` to create the expected Map
156
+
* entry of option key index and value to send to the native side.
157
+
*
158
+
* <p>On the native side, ensure the following is done:
159
+
*
160
+
* <p>* Update `CaptureRequestOptionsHostApiImpl#create` to set the correct `CaptureRequest` key
161
+
* with a valid value type for this option.
162
+
*
163
+
* <p>See https://developer.android.com/reference/android/hardware/camera2/CaptureRequest for the
164
+
* sorts of capture request options that can be supported via CameraX's interoperability with
165
+
* Camera2.
166
+
*/
149
167
publicenumCaptureRequestKeySupportedType {
150
168
CONTROL_AE_LOCK(0);
151
169
@@ -3899,7 +3917,11 @@ public void create(@NonNull Long identifierArg, @NonNull Reply<Void> callback) {
0 commit comments