Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
167 commits
Select commit Hold shift + click to select a range
7990d35
add kotlin
bparrishMines Dec 23, 2024
849f149
add copyright
bparrishMines Dec 23, 2024
f54d5d9
some work towards
bparrishMines Dec 23, 2024
fe63e89
rest of non persmission and system stuff for pigeon
bparrishMines Dec 23, 2024
bbe060f
compiling
bparrishMines Dec 25, 2024
a131960
compiling
bparrishMines Dec 25, 2024
8d3664a
change dependencies
bparrishMines Dec 25, 2024
1f93a1e
some progress
bparrishMines Dec 25, 2024
bdf0460
finish on system api update
bparrishMines Dec 25, 2024
65de5b9
finish platform implementation
bparrishMines Dec 26, 2024
ee8adb5
add missing java classes
bparrishMines Dec 26, 2024
2b553ef
some of the classes
bparrishMines Dec 26, 2024
e4ab7bc
most of the api implementations
bparrishMines Dec 26, 2024
2d85644
finish java api implementations
bparrishMines Dec 26, 2024
52e4145
remove other implementations
bparrishMines Dec 27, 2024
4f05e1d
more java cleanup
bparrishMines Dec 27, 2024
c07b09a
Merge branch 'main' of github.com:flutter/packages into camerax_proxy
bparrishMines Dec 27, 2024
5bf75b8
formatting
bparrishMines Dec 27, 2024
575a496
code builds again
bparrishMines Dec 27, 2024
475d465
fix setup
bparrishMines Dec 27, 2024
696454d
temporary work for value
bparrishMines Dec 27, 2024
7bf4991
proxy for setup generics
bparrishMines Dec 29, 2024
9530050
update proxy
bparrishMines Jan 2, 2025
5d39444
java test files and update library
bparrishMines Jan 2, 2025
ac5394c
add setup generics
bparrishMines Jan 2, 2025
6b33f06
default mocks for proxy
bparrishMines Jan 3, 2025
9537145
fix test lints
bparrishMines Jan 3, 2025
e43984c
passing tests
bparrishMines Jan 3, 2025
66773c3
change tests to set the proxy
bparrishMines Jan 4, 2025
5e5fb5d
3rd test
bparrishMines Jan 4, 2025
b07d8b5
tests broken
bparrishMines Jan 7, 2025
62f2426
Merge branch 'main' of github.com:flutter/packages into camerax_proxy
bparrishMines Jan 10, 2025
1c40c4e
fix preview
bparrishMines Jan 10, 2025
e2d6d25
fix third test
bparrishMines Jan 10, 2025
79598e7
semi fix test
bparrishMines Jan 17, 2025
1a7c9c8
change how comments are
bparrishMines Jan 22, 2025
8f94c8e
Merge branch 'main' of github.com:flutter/packages into camerax_proxy
bparrishMines Jan 22, 2025
add672d
Merge branch 'camerax_proxy' of github.com:bparrishMines/packages int…
bparrishMines Jan 22, 2025
418e5b0
fix test
bparrishMines Jan 22, 2025
0427fa9
another test
bparrishMines Jan 23, 2025
0a8841b
another test
bparrishMines Jan 23, 2025
14007a8
improve another test
bparrishMines Jan 23, 2025
38ad55e
remove unused methods
bparrishMines Jan 23, 2025
2c09d11
another test
bparrishMines Jan 23, 2025
e76bcaf
Merge branch 'main' of github.com:flutter/packages into camerax_proxy
bparrishMines Jan 23, 2025
0525d53
another test
bparrishMines Jan 24, 2025
6ba035e
another test
bparrishMines Jan 24, 2025
bf12f84
more passing tests
bparrishMines Jan 24, 2025
1b1e183
fix systerm service test
bparrishMines Jan 24, 2025
b22548e
18 out of 91 tests
bparrishMines Jan 26, 2025
0010bad
21 tests
bparrishMines Jan 26, 2025
c674290
Merge branch 'main' of github.com:flutter/packages into camerax_proxy
bparrishMines Jan 26, 2025
4857bf1
22 tests
bparrishMines Jan 26, 2025
f0247d0
23
bparrishMines Jan 26, 2025
01e5f28
25
bparrishMines Jan 27, 2025
1f4c594
29
bparrishMines Jan 27, 2025
bb0166b
34
bparrishMines Jan 27, 2025
6ff4f08
40
bparrishMines Jan 27, 2025
9248b1f
47
bparrishMines Jan 27, 2025
bcfffc7
50
bparrishMines Jan 27, 2025
28fef62
55 tests passing
bparrishMines Jan 27, 2025
b1699e7
fix first exposure test
bparrishMines Jan 27, 2025
f71f535
second exposure test
bparrishMines Jan 27, 2025
be5fd35
test 60
bparrishMines Jan 28, 2025
7c248bb
63 tests
bparrishMines Jan 28, 2025
5bbb31e
first focus test
bparrishMines Jan 28, 2025
02a152a
Merge branch 'main' of github.com:flutter/packages into camerax_proxy
bparrishMines Jan 28, 2025
51aa98e
67 tests
bparrishMines Jan 28, 2025
7b34e55
71 tests
bparrishMines Jan 28, 2025
6e7fc93
failing test still
bparrishMines Jan 30, 2025
28e9535
Merge branch 'main' of github.com:flutter/packages into camerax_proxy
bparrishMines Feb 10, 2025
9d2c860
Merge branch 'main' of github.com:flutter/packages into camerax_proxy
bparrishMines Feb 11, 2025
e54975e
test
bparrishMines Feb 12, 2025
53fb961
more tests fixed
bparrishMines Feb 12, 2025
5d994ea
84 tests
bparrishMines Feb 12, 2025
7d8c3b5
finish all dart unit tests
bparrishMines Feb 12, 2025
1f1f31d
fix analysis errors
bparrishMines Feb 12, 2025
c70f4d4
fix all analysis errors
bparrishMines Feb 12, 2025
ee2d959
fix dart file names
bparrishMines Feb 12, 2025
61e0626
fix platform side with a few missing stuff
bparrishMines Feb 12, 2025
7555588
fix request options
bparrishMines Feb 12, 2025
18b2310
Merge branch 'main' of github.com:flutter/packages into camerax_proxy
bparrishMines Feb 12, 2025
b626999
fixes
bparrishMines Feb 13, 2025
744138b
formatting
bparrishMines Feb 13, 2025
5582bbb
one java test done
bparrishMines Feb 13, 2025
2164d40
move
bparrishMines Feb 13, 2025
b4482a3
Merge branch 'main' of github.com:flutter/packages into camerax_proxy
bparrishMines Feb 13, 2025
9fd4f86
add mockito
bparrishMines Feb 14, 2025
3c82486
formatting and fix tests
bparrishMines Feb 14, 2025
78ee70f
Merge branch 'main' of github.com:flutter/packages into camerax_proxy
bparrishMines Feb 18, 2025
b3a84b6
camera2cameracontrol test
bparrishMines Feb 18, 2025
d16b24a
camera2camera info test
bparrishMines Feb 19, 2025
979993b
add static method tests
bparrishMines Feb 19, 2025
4afd975
plugin tests
bparrishMines Feb 19, 2025
2fedfda
cameracontrol tests
bparrishMines Feb 20, 2025
0886ff1
camerainfo test
bparrishMines Feb 20, 2025
703f176
range tests
bparrishMines Feb 22, 2025
03cbebe
test class override
bparrishMines Feb 22, 2025
3b5722c
more tests
bparrishMines Feb 22, 2025
cfd8cac
camera selector test
bparrishMines Feb 22, 2025
646fcd5
more more tests
bparrishMines Feb 22, 2025
fd07800
capture request optiosn
bparrishMines Feb 22, 2025
424456e
formatting
bparrishMines Feb 22, 2025
7f48551
device orientation api test
bparrishMines Feb 22, 2025
a34228d
2 more tests
bparrishMines Feb 23, 2025
4410f79
focusmetering tests
bparrishMines Feb 23, 2025
fb912b8
image analysis
bparrishMines Feb 23, 2025
503aea9
image capture tests
bparrishMines Feb 23, 2025
2a48433
image capture test
bparrishMines Feb 23, 2025
542cd06
live data
bparrishMines Feb 23, 2025
50eb131
metering point tests
bparrishMines Feb 23, 2025
2f8e3c2
pending recording
bparrishMines Feb 23, 2025
6e21dba
start of preview tests
bparrishMines Feb 23, 2025
a3b5dcb
preview test
bparrishMines Feb 23, 2025
d02456f
process camera tests
bparrishMines Feb 23, 2025
fc23510
quality selector
bparrishMines Feb 23, 2025
0ab8585
recorder tests
bparrishMines Feb 24, 2025
395e768
resolution filter and recording
bparrishMines Feb 24, 2025
8691de4
more java tests
bparrishMines Feb 24, 2025
8a904b3
create camerapermissions error
bparrishMines Feb 24, 2025
ade6c52
system services manager test
bparrishMines Feb 24, 2025
515db6d
rest of java tests
bparrishMines Feb 24, 2025
1605146
version bump
bparrishMines Feb 24, 2025
d555f3a
Merge branch 'main' of github.com:flutter/packages into camerax_proxy
bparrishMines Feb 24, 2025
b675d18
fix tests
bparrishMines Feb 24, 2025
712225f
add licenses
bparrishMines Feb 24, 2025
637fc60
fixup java tests
bparrishMines Feb 24, 2025
c544f32
remove unused code
bparrishMines Feb 24, 2025
ae792fa
add UnsafeOptInUsageError suppress
bparrishMines Feb 24, 2025
2c55484
synthetic accessor lint
bparrishMines Feb 24, 2025
fd23cfe
nonnull
bparrishMines Feb 24, 2025
7ce2e64
more nonnull
bparrishMines Feb 24, 2025
5dc41af
last one
bparrishMines Feb 24, 2025
a202ba2
Merge branch 'main' of github.com:flutter/packages into camerax_proxy
bparrishMines Mar 19, 2025
77688e4
fix imports and device orientation controller
bparrishMines Mar 19, 2025
986718e
fix rotation tests
bparrishMines Mar 19, 2025
d5ac8a5
lints
bparrishMines Mar 19, 2025
163f41f
formatting
bparrishMines Mar 19, 2025
949afb7
use a single previewproxyapi
bparrishMines Apr 1, 2025
0a616aa
better comments
bparrishMines Apr 1, 2025
5ef7811
remove unused vars
bparrishMines Apr 1, 2025
c1f12a3
switch to onSurfaceCleanup
bparrishMines Apr 1, 2025
83d6ad3
review comments
bparrishMines Apr 1, 2025
496b79a
Merge branch 'main' of github.com:flutter/packages into camerax_proxy
bparrishMines Apr 1, 2025
bd4cf2f
fix remove and use get
bparrishMines Apr 1, 2025
7aa02b6
added suppress for generated kotlin
bparrishMines Apr 1, 2025
79d230e
bump dart
bparrishMines Apr 1, 2025
ffd3a45
Merge branch 'main' of github.com:flutter/packages into camerax_proxy
bparrishMines Apr 2, 2025
631bcc0
switch back to cleanup
bparrishMines Apr 2, 2025
d43749a
Merge branch 'main' of github.com:flutter/packages into camerax_proxy
bparrishMines Apr 2, 2025
d7ea161
change to pigeonInstance
bparrishMines Apr 2, 2025
190a2b0
maybe weird formatting
bparrishMines Apr 2, 2025
892b96e
uncomment
bparrishMines Apr 2, 2025
5036d74
add expected pattern to tests
bparrishMines Apr 3, 2025
7e927fc
Merge branch 'main' of github.com:flutter/packages into camerax_proxy
bparrishMines Apr 3, 2025
a539d65
formatting
bparrishMines Apr 3, 2025
c5ae202
throw exception on error
bparrishMines Apr 3, 2025
177339d
fix permission unit test
bparrishMines Apr 3, 2025
0a42540
change ignore to true
bparrishMines Apr 14, 2025
9eb2270
Merge branch 'main' of github.com:flutter/packages into camerax_proxy
bparrishMines Apr 14, 2025
d63078b
add docs for systemservices
bparrishMines Apr 14, 2025
9100a9c
log error on failed flutter method
bparrishMines Apr 14, 2025
5954729
unused method
bparrishMines Apr 14, 2025
e627829
improve example and add comment
bparrishMines Apr 14, 2025
3c6529c
fix syntheticaccessor lint
bparrishMines Apr 14, 2025
44f9113
surface missing cameracontrol errors
bparrishMines Apr 14, 2025
a8327d1
also try catch turning torch mode off
bparrishMines Apr 14, 2025
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
maybe weird formatting
  • Loading branch information
bparrishMines committed Apr 2, 2025
commit 190a2b03ed879b52145691cd85a127829ea5e613

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -76,28 +76,28 @@ class AndroidCameraCameraX extends CameraPlatform {
String? videoOutputPath;

/// Handles access to system resources.
late final SystemServicesManager systemServicesManager = proxy
.newSystemServicesManager(
onCameraError: (_, String errorDescription) {
cameraErrorStreamController.add(errorDescription);
},
);
late final SystemServicesManager systemServicesManager =
proxy.newSystemServicesManager(
onCameraError: (_, String errorDescription) {
cameraErrorStreamController.add(errorDescription);
},
);

/// Handles retrieving media orientation for a device.
late final DeviceOrientationManager deviceOrientationManager = proxy
.newDeviceOrientationManager(
onDeviceOrientationChanged: (_, String orientation) {
final DeviceOrientation deviceOrientation =
_deserializeDeviceOrientation(orientation);
deviceOrientationChangedStreamController.add(
DeviceOrientationChangedEvent(deviceOrientation),
);
},
late final DeviceOrientationManager deviceOrientationManager =
proxy.newDeviceOrientationManager(
onDeviceOrientationChanged: (_, String orientation) {
final DeviceOrientation deviceOrientation =
_deserializeDeviceOrientation(orientation);
deviceOrientationChangedStreamController.add(
DeviceOrientationChangedEvent(deviceOrientation),
);
},
);

/// Stream that emits an event when the corresponding video recording is finalized.
static final StreamController<VideoRecordEvent>
videoRecordingEventStreamController =
videoRecordingEventStreamController =
StreamController<VideoRecordEvent>.broadcast();

/// Stream that emits the errors caused by camera usage on the native side.
Expand All @@ -109,20 +109,20 @@ class AndroidCameraCameraX extends CameraPlatform {
/// Values may start being added to the stream once
/// `startListeningForDeviceOrientationChange(...)` is called.
static final StreamController<DeviceOrientationChangedEvent>
deviceOrientationChangedStreamController =
deviceOrientationChangedStreamController =
StreamController<DeviceOrientationChangedEvent>.broadcast();

/// Stream queue to pick up finalized viceo recording events in
/// [stopVideoRecording].
final StreamQueue<VideoRecordEvent> videoRecordingEventStreamQueue =
StreamQueue<VideoRecordEvent>(videoRecordingEventStreamController.stream);

late final VideoRecordEventListener _videoRecordingEventListener = proxy
.newVideoRecordEventListener(
onEvent: (_, VideoRecordEvent event) {
videoRecordingEventStreamController.add(event);
},
);
late final VideoRecordEventListener _videoRecordingEventListener =
proxy.newVideoRecordEventListener(
onEvent: (_, VideoRecordEvent event) {
videoRecordingEventStreamController.add(event);
},
);

/// Whether or not [preview] has been bound to the lifecycle of the camera by
/// [createCamera].
Expand Down Expand Up @@ -166,9 +166,9 @@ class AndroidCameraCameraX extends CameraPlatform {
StreamController<CameraEvent>.broadcast();

/// The stream of camera events.
Stream<CameraEvent> _cameraEvents(int cameraId) => cameraEventStreamController
.stream
.where((CameraEvent event) => event.cameraId == cameraId);
Stream<CameraEvent> _cameraEvents(int cameraId) =>
cameraEventStreamController.stream
.where((CameraEvent event) => event.cameraId == cameraId);

/// The controller we need to stream image data.
@visibleForTesting
Expand Down Expand Up @@ -276,12 +276,14 @@ class AndroidCameraCameraX extends CameraPlatform {
// Determine the lens direction by filtering the CameraInfo
// TODO(gmackall): replace this with call to CameraInfo.getLensFacing when changes containing that method are available
if ((await proxy
.newCameraSelector(requireLensFacing: LensFacing.back)
.filter(<CameraInfo>[cameraInfo])).isNotEmpty) {
.newCameraSelector(requireLensFacing: LensFacing.back)
.filter(<CameraInfo>[cameraInfo]))
.isNotEmpty) {
cameraLensDirection = CameraLensDirection.back;
} else if ((await proxy
.newCameraSelector(requireLensFacing: LensFacing.front)
.filter(<CameraInfo>[cameraInfo])).isNotEmpty) {
.newCameraSelector(requireLensFacing: LensFacing.front)
.filter(<CameraInfo>[cameraInfo]))
.isNotEmpty) {
cameraLensDirection = CameraLensDirection.front;
} else {
//Skip this CameraInfo as its lens direction is unknown
Expand Down Expand Up @@ -314,10 +316,12 @@ class AndroidCameraCameraX extends CameraPlatform {
CameraDescription description,
ResolutionPreset? resolutionPreset, {
bool enableAudio = false,
}) => createCameraWithSettings(
description,
MediaSettings(resolutionPreset: resolutionPreset, enableAudio: enableAudio),
);
}) =>
createCameraWithSettings(
description,
MediaSettings(
resolutionPreset: resolutionPreset, enableAudio: enableAudio),
);

/// Creates an uninitialized camera instance and returns the camera ID.
///
Expand Down Expand Up @@ -413,9 +417,8 @@ class AndroidCameraCameraX extends CameraPlatform {
);
sensorOrientationDegrees =
((await camera2CameraInfo.getCameraCharacteristic(
proxy.sensorOrientationCameraCharacteristics(),
))!
as int)
proxy.sensorOrientationCameraCharacteristics(),
))! as int)
.toDouble();

sensorOrientationDegrees = cameraDescription.sensorOrientation.toDouble();
Expand Down Expand Up @@ -624,10 +627,9 @@ class AndroidCameraCameraX extends CameraPlatform {
case FocusMode.auto:
// Determine auto-focus point to restore, if any. We do not restore
// default auto-focus point if set previously to lock focus.
final MeteringPoint? unLockedFocusPoint =
_defaultFocusPointLocked
? null
: currentFocusMeteringAction!.meteringPointsAf.first;
final MeteringPoint? unLockedFocusPoint = _defaultFocusPointLocked
? null
: currentFocusMeteringAction!.meteringPointsAf.first;
_defaultFocusPointLocked = false;
autoFocusPoint = unLockedFocusPoint;
disableAutoCancel = false;
Expand All @@ -638,20 +640,19 @@ class AndroidCameraCameraX extends CameraPlatform {
if (currentFocusMeteringAction != null) {
final List<MeteringPoint> possibleCurrentAfPoints =
currentFocusMeteringAction!.meteringPointsAf;
lockedFocusPoint =
possibleCurrentAfPoints.isEmpty
? null
: possibleCurrentAfPoints.first;
lockedFocusPoint = possibleCurrentAfPoints.isEmpty
? null
: possibleCurrentAfPoints.first;
}

// If there isn't, lock center of entire sensor area by default.
if (lockedFocusPoint == null) {
final DisplayOrientedMeteringPointFactory meteringPointFactory = proxy
.newDisplayOrientedMeteringPointFactory(
cameraInfo: cameraInfo!,
width: 1,
height: 1,
);
final DisplayOrientedMeteringPointFactory meteringPointFactory =
proxy.newDisplayOrientedMeteringPointFactory(
cameraInfo: cameraInfo!,
width: 1,
height: 1,
);
lockedFocusPoint = await meteringPointFactory.createPointWithSize(
0.5,
0.5,
Expand Down Expand Up @@ -790,12 +791,12 @@ class AndroidCameraCameraX extends CameraPlatform {
);
final bool lockExposureMode = mode == ExposureMode.locked;

final CaptureRequestOptions captureRequestOptions = proxy
.newCaptureRequestOptions(
options: <CaptureRequestKey, Object?>{
proxy.controlAELockCaptureRequest(): lockExposureMode,
},
);
final CaptureRequestOptions captureRequestOptions =
proxy.newCaptureRequestOptions(
options: <CaptureRequestKey, Object?>{
proxy.controlAELockCaptureRequest(): lockExposureMode,
},
);

await camera2Control.addCaptureRequestOptions(captureRequestOptions);
_currentExposureMode = mode;
Expand Down Expand Up @@ -901,8 +902,8 @@ class AndroidCameraCameraX extends CameraPlatform {

final Stream<DeviceOrientation> deviceOrientationStream =
onDeviceOrientationChanged().map(
(DeviceOrientationChangedEvent e) => e.orientation,
);
(DeviceOrientationChangedEvent e) => e.orientation,
);
if (cameraIsFrontFacing) {
return RotatedPreview.frontFacingCamera(
_initialDeviceOrientation,
Expand Down Expand Up @@ -1038,9 +1039,8 @@ class AndroidCameraCameraX extends CameraPlatform {
);
final InfoSupportedHardwareLevel cameraInfoSupportedHardwareLevel =
(await camera2CameraInfo.getCameraCharacteristic(
proxy.infoSupportedHardwareLevelCameraCharacteristics(),
))!
as InfoSupportedHardwareLevel;
proxy.infoSupportedHardwareLevelCameraCharacteristics(),
))! as InfoSupportedHardwareLevel;

// Handle limited level device restrictions:
final bool cameraSupportsConcurrentImageCapture =
Expand Down Expand Up @@ -1447,13 +1447,12 @@ class AndroidCameraCameraX extends CameraPlatform {
);
final ResolutionFilter resolutionFilter = proxy
.createWithOnePreferredSizeResolutionFilter(preferredSize: boundSize);
final AspectRatioStrategy? aspectRatioStrategy =
aspectRatio == null
? null
: proxy.newAspectRatioStrategy(
preferredAspectRatio: aspectRatio,
fallbackRule: AspectRatioStrategyFallbackRule.auto,
);
final AspectRatioStrategy? aspectRatioStrategy = aspectRatio == null
? null
: proxy.newAspectRatioStrategy(
preferredAspectRatio: aspectRatio,
fallbackRule: AspectRatioStrategyFallbackRule.auto,
);
return proxy.newResolutionSelector(
resolutionStrategy: resolutionStrategy,
resolutionFilter: resolutionFilter,
Expand Down Expand Up @@ -1489,8 +1488,8 @@ class AndroidCameraCameraX extends CameraPlatform {

// We will choose the next highest video quality if the one desired
// is unavailable.
final FallbackStrategy fallbackStrategy = proxy
.lowerQualityOrHigherThanFallbackStrategy(quality: videoQuality);
final FallbackStrategy fallbackStrategy =
proxy.lowerQualityOrHigherThanFallbackStrategy(quality: videoQuality);

return proxy.fromQualitySelector(
quality: videoQuality,
Expand All @@ -1514,12 +1513,12 @@ class AndroidCameraCameraX extends CameraPlatform {
);
}

final DisplayOrientedMeteringPointFactory meteringPointFactory = proxy
.newDisplayOrientedMeteringPointFactory(
width: 1.0,
height: 1.0,
cameraInfo: cameraInfo!,
);
final DisplayOrientedMeteringPointFactory meteringPointFactory =
proxy.newDisplayOrientedMeteringPointFactory(
width: 1.0,
height: 1.0,
cameraInfo: cameraInfo!,
);
meteringPoint = await meteringPointFactory.createPoint(point.x, point.y);
}
return _startFocusAndMeteringFor(
Expand Down Expand Up @@ -1590,11 +1589,11 @@ class AndroidCameraCameraX extends CameraPlatform {
return true;
}
// Create builder to potentially add more MeteringPoints to.
final FocusMeteringActionBuilder actionBuilder = proxy
.withModeFocusMeteringActionBuilder(
point: newMeteringPointInfos.first.$1,
mode: newMeteringPointInfos.first.$2,
);
final FocusMeteringActionBuilder actionBuilder =
proxy.withModeFocusMeteringActionBuilder(
point: newMeteringPointInfos.first.$1,
mode: newMeteringPointInfos.first.$2,
);
if (disableAutoCancel) {
unawaited(actionBuilder.disableAutoCancel());
}
Expand All @@ -1617,26 +1616,25 @@ class AndroidCameraCameraX extends CameraPlatform {
final Iterable<(MeteringPoint, MeteringMode)> originalMeteringPoints =
_combineMeteringPoints(currentFocusMeteringAction!);

newMeteringPointInfos =
originalMeteringPoints
.where(
((MeteringPoint, MeteringMode) meteringPointInfo) =>
// meteringPointInfo may technically include points without a
// mode specified, but this logic is safe because this plugin
// only uses points that explicitly have mode
// FocusMeteringAction.flagAe or FocusMeteringAction.flagAf.
meteringPointInfo.$2 != meteringMode,
)
.toList();
newMeteringPointInfos = originalMeteringPoints
.where(
((MeteringPoint, MeteringMode) meteringPointInfo) =>
// meteringPointInfo may technically include points without a
// mode specified, but this logic is safe because this plugin
// only uses points that explicitly have mode
// FocusMeteringAction.flagAe or FocusMeteringAction.flagAf.
meteringPointInfo.$2 != meteringMode,
)
.toList();
}

newMeteringPointInfos.add((meteringPoint, meteringMode));

final FocusMeteringActionBuilder actionBuilder = proxy
.withModeFocusMeteringActionBuilder(
point: newMeteringPointInfos.first.$1,
mode: newMeteringPointInfos.first.$2,
);
final FocusMeteringActionBuilder actionBuilder =
proxy.withModeFocusMeteringActionBuilder(
point: newMeteringPointInfos.first.$1,
mode: newMeteringPointInfos.first.$2,
);

if (disableAutoCancel) {
unawaited(actionBuilder.disableAutoCancel());
Expand All @@ -1650,8 +1648,8 @@ class AndroidCameraCameraX extends CameraPlatform {
currentFocusMeteringAction = await actionBuilder.build();
}

final FocusMeteringResult? result = await cameraControl
.startFocusAndMetering(currentFocusMeteringAction!);
final FocusMeteringResult? result =
await cameraControl.startFocusAndMetering(currentFocusMeteringAction!);
return result?.isFocusSuccessful ?? false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,12 @@ class Observer<T> extends camerax.Observer {
super.pigeon_binaryMessenger,
// ignore: non_constant_identifier_names
super.pigeon_instanceManager,
}) : _genericOnChanged = onChanged,
super(
onChanged: (camerax.Observer instance, Object value) {
onChanged(instance as Observer<T>, value as T);
},
);
}) : _genericOnChanged = onChanged,
super(
onChanged: (camerax.Observer instance, Object value) {
onChanged(instance as Observer<T>, value as T);
},
);

/// Constructs [Observer] without creating the associated native object.
///
Expand All @@ -185,12 +185,12 @@ class Observer<T> extends camerax.Observer {
super.pigeon_binaryMessenger,
// ignore: non_constant_identifier_names
super.pigeon_instanceManager,
}) : _genericOnChanged = onChanged,
super.pigeon_detached(
onChanged: (camerax.Observer instance, Object value) {
onChanged(instance as Observer<T>, value as T);
},
);
}) : _genericOnChanged = onChanged,
super.pigeon_detached(
onChanged: (camerax.Observer instance, Object value) {
onChanged(instance as Observer<T>, value as T);
},
);

final void Function(Observer<T> instance, T value) _genericOnChanged;

Expand Down
Loading