From 44d782897ee46f6566e8b8df97ac2f36a2336284 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Sat, 22 Apr 2023 12:12:20 -0700 Subject: [PATCH 01/34] Add resolution configuration --- .../lib/src/android_camera_camerax.dart | 44 ++++++++++++------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart index adafd74f33f..845fc18e1db 100644 --- a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart +++ b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart @@ -150,13 +150,13 @@ class AndroidCameraCameraX extends CameraPlatform { final int targetRotation = _getTargetRotation(cameraDescription.sensorOrientation); final ResolutionInfo? previewTargetResolution = - _getTargetResolutionForPreview(resolutionPreset); + _getResolutionInfoFromPreset(resolutionPreset); preview = createPreview(targetRotation, previewTargetResolution); final int flutterSurfaceTextureId = await preview!.setSurfaceProvider(); // Configure ImageCapture instance. final ResolutionInfo? imageCaptureTargetResolution = - _getTargetResolutionForImageCapture(_resolutionPreset); + _getResolutionInfoFromPreset(_resolutionPreset); imageCapture = createImageCapture(null, imageCaptureTargetResolution); // Bind configured UseCases to ProcessCameraProvider instance & mark Preview @@ -232,6 +232,12 @@ class AndroidCameraCameraX extends CameraPlatform { return _cameraEvents(cameraId).whereType(); } + /// The camera's resolution has changed. + @override + Stream onCameraResolutionChanged(int cameraId) { + return _cameraEvents(cameraId).whereType(); + } + /// The camera experienced an error. @override Stream onCameraError(int cameraId) { @@ -366,20 +372,26 @@ class AndroidCameraCameraX extends CameraPlatform { } /// Returns [ResolutionInfo] that maps to the specified resolution preset for - /// a camera preview. - ResolutionInfo? _getTargetResolutionForPreview(ResolutionPreset? resolution) { - // TODO(camsim99): Implement resolution configuration. - // https://github.com/flutter/flutter/issues/120462 - return null; - } - - /// Returns [ResolutionInfo] that maps to the specified resolution preset for - /// image capture. - ResolutionInfo? _getTargetResolutionForImageCapture( - ResolutionPreset? resolution) { - // TODO(camsim99): Implement resolution configuration. - // https://github.com/flutter/flutter/issues/120462 - return null; + ResolutionInfo? _getResolutionInfoFromPreset(ResolutionPreset? preset) { + // TODO(camsim99): File issue for adding warnings about CameraX limits on resolution configuration, and for allowing further configuration. + // TODO(camsim99): max is different for ImageAnalysis, so add further functionality once its PR is merged. + switch (preset) { + case ResolutionPreset.low: + return ResolutionInfo(width: 320, height: 240); + case ResolutionPreset.medium: + return ResolutionInfo(width: 720, height: 480); + case ResolutionPreset.high: + return ResolutionInfo(width: 1280, height: 720); + case ResolutionPreset.veryHigh: + return ResolutionInfo(width: 1920, height: 1080); + case ResolutionPreset.ultraHigh: + return ResolutionInfo(width: 3840, height: 2160); + case ResolutionPreset.max: + case null: + // Default to maximum resolution avaiable or highest device-preferred + // resolution that matches default aspect ratio. + return null; + } } // Methods for calls that need to be tested: From 6281eb5d48987aea666fe68c7372cd23775278ee Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 26 Apr 2023 13:08:41 -0400 Subject: [PATCH 02/34] dart side of impl --- .../lib/src/aspect_ratio_strategy.dart | 123 +++++++ .../lib/src/camerax_library.g.dart | 178 +++++++++- .../lib/src/resolution_selector.dart | 93 +++++ .../lib/src/resolution_strategy.dart | 129 +++++++ .../pigeons/camerax_library.dart | 44 +++ .../android_camera_camerax_test.mocks.dart | 2 +- .../test/aspect_ratio_strategy_test.dart | 54 +++ .../aspect_ratio_strategy_test.mocks.dart | 66 ++++ .../test/resolution_selector_test.dart | 87 +++++ .../test/resolution_selector_test.mocks.dart | 66 ++++ .../test/resolution_strategy_test.dart | 59 ++++ .../test/resolution_strategy_test.mocks.dart | 67 ++++ .../test/test_camerax_library.g.dart | 326 +++++++++++++++--- 13 files changed, 1249 insertions(+), 45 deletions(-) create mode 100644 packages/camera/camera_android_camerax/lib/src/aspect_ratio_strategy.dart create mode 100644 packages/camera/camera_android_camerax/lib/src/resolution_selector.dart create mode 100644 packages/camera/camera_android_camerax/lib/src/resolution_strategy.dart create mode 100644 packages/camera/camera_android_camerax/test/aspect_ratio_strategy_test.dart create mode 100644 packages/camera/camera_android_camerax/test/aspect_ratio_strategy_test.mocks.dart create mode 100644 packages/camera/camera_android_camerax/test/resolution_selector_test.dart create mode 100644 packages/camera/camera_android_camerax/test/resolution_selector_test.mocks.dart create mode 100644 packages/camera/camera_android_camerax/test/resolution_strategy_test.dart create mode 100644 packages/camera/camera_android_camerax/test/resolution_strategy_test.mocks.dart diff --git a/packages/camera/camera_android_camerax/lib/src/aspect_ratio_strategy.dart b/packages/camera/camera_android_camerax/lib/src/aspect_ratio_strategy.dart new file mode 100644 index 00000000000..309ceb6931d --- /dev/null +++ b/packages/camera/camera_android_camerax/lib/src/aspect_ratio_strategy.dart @@ -0,0 +1,123 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:flutter/services.dart'; + +import 'camerax_library.g.dart'; +import 'instance_manager.dart'; +import 'java_object.dart'; + +/// The aspect ratio of the use case. +/// +/// Aspect ratio is the ratio of width to height. +/// +/// See https://developer.android.com/reference/androidx/camera/core/AspectRatio. +class AspectRatio { + AspectRatio._(); + + /// 4:3 standard aspect ratio. + /// + /// See https://developer.android.com/reference/androidx/camera/core/AspectRatio#RATIO_4_3(). + static const int ratio4To3 = 0; + + /// 16:9 standard aspect ratio. + /// + /// See https://developer.android.com/reference/androidx/camera/core/AspectRatio#RATIO_16_9(). + static const int ratio16To9 = 1; + + /// The aspect ratio representing no preference for aspect ratio. + /// + /// See https://developer.android.com/reference/androidx/camera/core/AspectRatio#RATIO_DEFAULT(). + static const int ratioDefault = -1; +} + +/// The aspect ratio strategy defines the sequence of aspect ratios that are +/// used to select the best size for a particular image. +/// +/// See https://developer.android.com/reference/androidx/camera/core/resolutionselector/AspectRatioStrategy. +class AspectRatioStrategy extends JavaObject { + /// Construct a [AspectRatioStrategy]. + AspectRatioStrategy({ + required this.preferredAspectRatio, + required this.fallbackRule, + super.binaryMessenger, + super.instanceManager, + }) : _api = _AspectRatioStrategyHostApiImpl( + instanceManager: instanceManager, + binaryMessenger: binaryMessenger, + ), + super.detached() { + _api.createFromInstances(this, preferredAspectRatio, fallbackRule); + } + + /// Instantiates a [AspectRatioStrategy] without creating and attaching to an + /// instance of the associated native class. + /// + /// This should only be used outside of tests by subclasses created by this + /// library or to create a copy for an [InstanceManager]. + AspectRatioStrategy.detached({ + required this.preferredAspectRatio, + required this.fallbackRule, + super.binaryMessenger, + super.instanceManager, + }) : _api = _AspectRatioStrategyHostApiImpl( + instanceManager: instanceManager, + binaryMessenger: binaryMessenger, + ), + super.detached(); + + /// CameraX doesn't fall back to select sizes of any other aspect ratio when + /// this fallback rule is used. + /// + /// See https://developer.android.com/reference/androidx/camera/core/resolutionselector/AspectRatioStrategy#FALLBACK_RULE_NONE(). + static const int fallbackRuleNone = 0; + + /// CameraX automatically chooses the next best aspect ratio which contains + /// the closest field of view (FOV) of the camera sensor, from the remaining + /// options. + /// + /// See https://developer.android.com/reference/androidx/camera/core/resolutionselector/AspectRatioStrategy#FALLBACK_RULE_AUTO(). + static const int fallbackRuleAuto = 1; + + final _AspectRatioStrategyHostApiImpl _api; + + /// The preferred aspect ratio captured by the camera. + final int preferredAspectRatio; + + /// The specified fallback rule for choosing the aspect ratio when the + /// preferred aspect ratio is not available. + final int fallbackRule; +} + +class _AspectRatioStrategyHostApiImpl extends AspectRatioStrategyHostApi { + _AspectRatioStrategyHostApiImpl({ + this.binaryMessenger, + InstanceManager? instanceManager, + }) : instanceManager = instanceManager ?? JavaObject.globalInstanceManager, + super(binaryMessenger: binaryMessenger); + + final BinaryMessenger? binaryMessenger; + + final InstanceManager instanceManager; + + Future createFromInstances( + AspectRatioStrategy instance, + int preferredAspectRatio, + int fallbackRule, + ) { + return create( + instanceManager.addDartCreatedInstance( + instance, + onCopy: (AspectRatioStrategy original) => AspectRatioStrategy.detached( + preferredAspectRatio: original.preferredAspectRatio, + fallbackRule: original.fallbackRule, + binaryMessenger: binaryMessenger, + instanceManager: instanceManager, + ), + ), + preferredAspectRatio, + fallbackRule, + ); + } +} diff --git a/packages/camera/camera_android_camerax/lib/src/camerax_library.g.dart b/packages/camera/camera_android_camerax/lib/src/camerax_library.g.dart index 473839cac79..32a39a78531 100644 --- a/packages/camera/camera_android_camerax/lib/src/camerax_library.g.dart +++ b/packages/camera/camera_android_camerax/lib/src/camerax_library.g.dart @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v9.1.1), do not edit directly. +// Autogenerated from Pigeon (v9.2.5), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import @@ -63,6 +63,32 @@ class CameraPermissionsErrorData { } } +class CameraSize { + CameraSize({ + required this.width, + required this.height, + }); + + int width; + + int height; + + Object encode() { + return [ + width, + height, + ]; + } + + static CameraSize decode(Object result) { + result as List; + return CameraSize( + width: result[0]! as int, + height: result[1]! as int, + ); + } +} + class InstanceManagerHostApi { /// Constructor for [InstanceManagerHostApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default @@ -944,3 +970,153 @@ class ImageCaptureHostApi { } } } + +class _ResolutionStrategyHostApiCodec extends StandardMessageCodec { + const _ResolutionStrategyHostApiCodec(); + @override + void writeValue(WriteBuffer buffer, Object? value) { + if (value is CameraSize) { + buffer.putUint8(128); + writeValue(buffer, value.encode()); + } else { + super.writeValue(buffer, value); + } + } + + @override + Object? readValueOfType(int type, ReadBuffer buffer) { + switch (type) { + case 128: + return CameraSize.decode(readValue(buffer)!); + default: + return super.readValueOfType(type, buffer); + } + } +} + +/// Host API for `ResolutionStrategy`. +/// +/// This class may handle instantiating and adding native object instances that +/// are attached to a Dart instance or handle method calls on the associated +/// native class or an instance of the class. +class ResolutionStrategyHostApi { + /// Constructor for [ResolutionStrategyHostApi]. The [binaryMessenger] named argument is + /// available for dependency injection. If it is left null, the default + /// BinaryMessenger will be used which routes to the host platform. + ResolutionStrategyHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; + final BinaryMessenger? _binaryMessenger; + + static const MessageCodec codec = _ResolutionStrategyHostApiCodec(); + + /// Create a new native instance and add it to the `InstanceManager`. + Future create( + int arg_identifier, CameraSize arg_size, int arg_fallbackRule) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.ResolutionStrategyHostApi.create', codec, + binaryMessenger: _binaryMessenger); + final List? replyList = await channel + .send([arg_identifier, arg_size, arg_fallbackRule]) + as List?; + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel.', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else { + return; + } + } +} + +/// Host API for `ResolutionSelector`. +/// +/// This class may handle instantiating and adding native object instances that +/// are attached to a Dart instance or handle method calls on the associated +/// native class or an instance of the class. +class ResolutionSelectorHostApi { + /// Constructor for [ResolutionSelectorHostApi]. The [binaryMessenger] named argument is + /// available for dependency injection. If it is left null, the default + /// BinaryMessenger will be used which routes to the host platform. + ResolutionSelectorHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; + final BinaryMessenger? _binaryMessenger; + + static const MessageCodec codec = StandardMessageCodec(); + + /// Create a new native instance and add it to the `InstanceManager`. + Future create(int arg_identifier, int? arg_resolutionStrategyIdentifier, + int? arg_aspectRatioStrategyIdentifier) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.ResolutionSelectorHostApi.create', codec, + binaryMessenger: _binaryMessenger); + final List? replyList = await channel.send([ + arg_identifier, + arg_resolutionStrategyIdentifier, + arg_aspectRatioStrategyIdentifier + ]) as List?; + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel.', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else { + return; + } + } +} + +/// Host API for `AspectRatioStrategy`. +/// +/// This class may handle instantiating and adding native object instances that +/// are attached to a Dart instance or handle method calls on the associated +/// native class or an instance of the class. +class AspectRatioStrategyHostApi { + /// Constructor for [AspectRatioStrategyHostApi]. The [binaryMessenger] named argument is + /// available for dependency injection. If it is left null, the default + /// BinaryMessenger will be used which routes to the host platform. + AspectRatioStrategyHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; + final BinaryMessenger? _binaryMessenger; + + static const MessageCodec codec = StandardMessageCodec(); + + /// Create a new native instance and add it to the `InstanceManager`. + Future create(int arg_identifier, int arg_preferredAspectRatio, + int arg_fallbackRule) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.AspectRatioStrategyHostApi.create', codec, + binaryMessenger: _binaryMessenger); + final List? replyList = await channel.send([ + arg_identifier, + arg_preferredAspectRatio, + arg_fallbackRule + ]) as List?; + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel.', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else { + return; + } + } +} diff --git a/packages/camera/camera_android_camerax/lib/src/resolution_selector.dart b/packages/camera/camera_android_camerax/lib/src/resolution_selector.dart new file mode 100644 index 00000000000..7cb59d54791 --- /dev/null +++ b/packages/camera/camera_android_camerax/lib/src/resolution_selector.dart @@ -0,0 +1,93 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:flutter/services.dart'; + +import 'aspect_ratio_strategy.dart'; +import 'camerax_library.g.dart'; +import 'instance_manager.dart'; +import 'java_object.dart'; +import 'resolution_strategy.dart'; + +/// A set of requirements and priorities used to select a resolution for the +/// UseCase. +/// +/// See https://developer.android.com/reference/androidx/camera/core/resolutionselector/ResolutionSelector. +class ResolutionSelector extends JavaObject { + /// Construct a [ResolutionSelector]. + ResolutionSelector({ + this.resolutionStrategy, + this.aspectRatioStrategy, + super.binaryMessenger, + super.instanceManager, + }) : _api = _ResolutionSelectorHostApiImpl( + instanceManager: instanceManager, + binaryMessenger: binaryMessenger, + ), + super.detached() { + _api.createFromInstances(this, resolutionStrategy, aspectRatioStrategy); + } + + /// Instantiates a [ResolutionSelector] without creating and attaching to an + /// instance of the associated native class. + /// + /// This should only be used outside of tests by subclasses created by this + /// library or to create a copy for an [InstanceManager]. + ResolutionSelector.detached({ + this.resolutionStrategy, + this.aspectRatioStrategy, + super.binaryMessenger, + super.instanceManager, + }) : _api = _ResolutionSelectorHostApiImpl( + instanceManager: instanceManager, + binaryMessenger: binaryMessenger, + ), + super.detached(); + + final _ResolutionSelectorHostApiImpl _api; + + /// Determines how the UseCase will choose the resolution of the captured + /// image. + final ResolutionStrategy? resolutionStrategy; + + /// Determines how the UseCase will choose the aspect ratio of the captured + /// image. + final AspectRatioStrategy? aspectRatioStrategy; +} + +class _ResolutionSelectorHostApiImpl extends ResolutionSelectorHostApi { + _ResolutionSelectorHostApiImpl({ + this.binaryMessenger, + InstanceManager? instanceManager, + }) : instanceManager = instanceManager ?? JavaObject.globalInstanceManager, + super(binaryMessenger: binaryMessenger); + + final BinaryMessenger? binaryMessenger; + + final InstanceManager instanceManager; + + Future createFromInstances( + ResolutionSelector instance, + ResolutionStrategy? resolutionStrategy, + AspectRatioStrategy? aspectRatioStrategy, + ) { + return create( + instanceManager.addDartCreatedInstance( + instance, + onCopy: (ResolutionSelector original) => ResolutionSelector.detached( + resolutionStrategy: original.resolutionStrategy, + aspectRatioStrategy: original.aspectRatioStrategy, + binaryMessenger: binaryMessenger, + instanceManager: instanceManager, + ), + ), + resolutionStrategy == null + ? null + : instanceManager.getIdentifier(resolutionStrategy)!, + aspectRatioStrategy == null + ? null + : instanceManager.getIdentifier(aspectRatioStrategy)!, + ); + } +} diff --git a/packages/camera/camera_android_camerax/lib/src/resolution_strategy.dart b/packages/camera/camera_android_camerax/lib/src/resolution_strategy.dart new file mode 100644 index 00000000000..388e71c6124 --- /dev/null +++ b/packages/camera/camera_android_camerax/lib/src/resolution_strategy.dart @@ -0,0 +1,129 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:flutter/services.dart'; + +import 'camerax_library.g.dart'; +import 'instance_manager.dart'; +import 'java_object.dart'; + +/// The resolution strategy defines the resolution selection sequence to select +/// the best size. +/// +/// See https://developer.android.com/reference/androidx/camera/core/resolutionselector/ResolutionStrategy. +class ResolutionStrategy extends JavaObject { + /// Construct a [ResolutionStrategy]. + ResolutionStrategy({ + required this.boundSize, + required this.fallbackRule, + super.binaryMessenger, + super.instanceManager, + }) : _api = _ResolutionStrategyHostApiImpl( + instanceManager: instanceManager, + binaryMessenger: binaryMessenger, + ), + super.detached() { + _api.createFromInstances(this, boundSize, fallbackRule); + } + + /// Instantiates a [ResolutionStrategy] without creating and attaching to an + /// instance of the associated native class. + /// + /// This should only be used outside of tests by subclasses created by this + /// library or to create a copy for an [InstanceManager]. + ResolutionStrategy.detached({ + required this.boundSize, + required this.fallbackRule, + super.binaryMessenger, + super.instanceManager, + }) : _api = _ResolutionStrategyHostApiImpl( + instanceManager: instanceManager, + binaryMessenger: binaryMessenger, + ), + super.detached(); + + /// CameraX doesn't select an alternate size when the specified bound size is + /// unavailable. + /// + /// Applications will receive [PlatformException] when binding the [UseCase]s + /// with this fallback rule if the device doesn't support the specified bound + /// size. + /// + /// See https://developer.android.com/reference/androidx/camera/core/resolutionselector/ResolutionStrategy#FALLBACK_RULE_NONE(). + static const int fallbackRuleNone = 0; + + /// When the specified bound size is unavailable, CameraX falls back to select + /// the closest higher resolution size. + /// + /// See https://developer.android.com/reference/androidx/camera/core/resolutionselector/ResolutionStrategy#FALLBACK_RULE_CLOSEST_HIGHER_THEN_LOWER(). + static const int fallbackRuleClosestHigherThenLower = 1; + + /// When the specified bound size is unavailable, CameraX falls back to the + /// closest higher resolution size. + /// + /// If CameraX still cannot find any available resolution, it will fallback to + /// select other lower resolutions. + /// + /// See https://developer.android.com/reference/androidx/camera/core/resolutionselector/ResolutionStrategy#FALLBACK_RULE_CLOSEST_HIGHER(). + static const int fallbackRuleClosestHigher = 2; + + /// When the specified bound size is unavailable, CameraX falls back to select + /// the closest lower resolution size. + /// + /// If CameraX still cannot find any available resolution, it will fallback to + /// select other higher resolutions. + /// + /// See https://developer.android.com/reference/androidx/camera/core/resolutionselector/ResolutionStrategy#FALLBACK_RULE_CLOSEST_LOWER_THEN_HIGHER(). + static const int fallbackRuleClosestLowerThenHigher = 3; + + /// When the specified bound size is unavailable, CameraX falls back to the + /// closest lower resolution size. + /// + /// See https://developer.android.com/reference/androidx/camera/core/resolutionselector/ResolutionStrategy#FALLBACK_RULE_CLOSEST_LOWER() + static const int fallbackRuleClosestLower = 4; + + final _ResolutionStrategyHostApiImpl _api; + + /// The specified bound size for the desired resolution of the camera. + final Size boundSize; + + /// The fallback rule for choosing an alternate size when the specified bound + /// size is unavailable. + final int fallbackRule; +} + +class _ResolutionStrategyHostApiImpl extends ResolutionStrategyHostApi { + _ResolutionStrategyHostApiImpl({ + this.binaryMessenger, + InstanceManager? instanceManager, + }) : instanceManager = instanceManager ?? JavaObject.globalInstanceManager, + super(binaryMessenger: binaryMessenger); + + final BinaryMessenger? binaryMessenger; + + final InstanceManager instanceManager; + + Future createFromInstances( + ResolutionStrategy instance, + Size boundSize, + int fallbackRule, + ) { + return create( + instanceManager.addDartCreatedInstance( + instance, + onCopy: (ResolutionStrategy original) => ResolutionStrategy.detached( + boundSize: original.boundSize, + fallbackRule: original.fallbackRule, + binaryMessenger: binaryMessenger, + instanceManager: instanceManager, + ), + ), + CameraSize( + width: boundSize.width.toInt(), + height: boundSize.height.toInt(), + ), + fallbackRule, + ); + } +} diff --git a/packages/camera/camera_android_camerax/pigeons/camerax_library.dart b/packages/camera/camera_android_camerax/pigeons/camerax_library.dart index cf580aa396a..b6ea040a9df 100644 --- a/packages/camera/camera_android_camerax/pigeons/camerax_library.dart +++ b/packages/camera/camera_android_camerax/pigeons/camerax_library.dart @@ -46,6 +46,13 @@ class CameraPermissionsErrorData { String description; } +class CameraSize { + CameraSize(this.width, this.height); + + int width; + int height; +} + @HostApi(dartHostTestHandler: 'TestInstanceManagerHostApi') abstract class InstanceManagerHostApi { /// Clear the native `InstanceManager`. @@ -151,3 +158,40 @@ abstract class ImageCaptureHostApi { @async String takePicture(int identifier); } + +/// Host API for `ResolutionStrategy`. +/// +/// This class may handle instantiating and adding native object instances that +/// are attached to a Dart instance or handle method calls on the associated +/// native class or an instance of the class. +@HostApi(dartHostTestHandler: 'TestResolutionStrategyHostApi') +abstract class ResolutionStrategyHostApi { + /// Create a new native instance and add it to the `InstanceManager`. + void create(int identifier, CameraSize size, int fallbackRule); +} + +/// Host API for `ResolutionSelector`. +/// +/// This class may handle instantiating and adding native object instances that +/// are attached to a Dart instance or handle method calls on the associated +/// native class or an instance of the class. +@HostApi(dartHostTestHandler: 'TestResolutionSelectorHostApi') +abstract class ResolutionSelectorHostApi { + /// Create a new native instance and add it to the `InstanceManager`. + void create( + int identifier, + int? resolutionStrategyIdentifier, + int? aspectRatioStrategyIdentifier, + ); +} + +/// Host API for `AspectRatioStrategy`. +/// +/// This class may handle instantiating and adding native object instances that +/// are attached to a Dart instance or handle method calls on the associated +/// native class or an instance of the class. +@HostApi(dartHostTestHandler: 'TestAspectRatioStrategyHostApi') +abstract class AspectRatioStrategyHostApi { + /// Create a new native instance and add it to the `InstanceManager`. + void create(int identifier, int preferredAspectRatio, int fallbackRule); +} diff --git a/packages/camera/camera_android_camerax/test/android_camera_camerax_test.mocks.dart b/packages/camera/camera_android_camerax/test/android_camera_camerax_test.mocks.dart index 59be6656d5e..05003b7a42a 100644 --- a/packages/camera/camera_android_camerax/test/android_camera_camerax_test.mocks.dart +++ b/packages/camera/camera_android_camerax/test/android_camera_camerax_test.mocks.dart @@ -328,7 +328,7 @@ class MockBuildContext extends _i1.Mock implements _i4.BuildContext { ), ) as _i4.InheritedWidget); @override - void visitAncestorElements(bool Function(_i4.Element)? visitor) => + void visitAncestorElements(_i4.ConditionalElementVisitor? visitor) => super.noSuchMethod( Invocation.method( #visitAncestorElements, diff --git a/packages/camera/camera_android_camerax/test/aspect_ratio_strategy_test.dart b/packages/camera/camera_android_camerax/test/aspect_ratio_strategy_test.dart new file mode 100644 index 00000000000..7b6a05327fd --- /dev/null +++ b/packages/camera/camera_android_camerax/test/aspect_ratio_strategy_test.dart @@ -0,0 +1,54 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:camera_android_camerax/src/aspect_ratio_strategy.dart'; +import 'package:camera_android_camerax/src/instance_manager.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:mockito/annotations.dart'; +import 'package:mockito/mockito.dart'; + +import 'aspect_ratio_strategy_test.mocks.dart'; +import 'test_camerax_library.g.dart'; + +@GenerateMocks([ + TestAspectRatioStrategyHostApi, + TestInstanceManagerHostApi, +]) +void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + + group('AspectRatioStrategy', () { + tearDown(() { + TestAspectRatioStrategyHostApi.setup(null); + TestInstanceManagerHostApi.setup(null); + }); + + test('HostApi create', () { + final MockTestAspectRatioStrategyHostApi mockApi = + MockTestAspectRatioStrategyHostApi(); + TestAspectRatioStrategyHostApi.setup(mockApi); + TestInstanceManagerHostApi.setup(MockTestInstanceManagerHostApi()); + + final InstanceManager instanceManager = InstanceManager( + onWeakReferenceRemoved: (_) {}, + ); + + const int preferredAspectRatio = 0; + + const int fallbackRule = 0; + + final AspectRatioStrategy instance = AspectRatioStrategy( + preferredAspectRatio: preferredAspectRatio, + fallbackRule: fallbackRule, + instanceManager: instanceManager, + ); + + verify(mockApi.create( + instanceManager.getIdentifier(instance), + preferredAspectRatio, + fallbackRule, + )); + }); + }); +} diff --git a/packages/camera/camera_android_camerax/test/aspect_ratio_strategy_test.mocks.dart b/packages/camera/camera_android_camerax/test/aspect_ratio_strategy_test.mocks.dart new file mode 100644 index 00000000000..73cc5b0eff0 --- /dev/null +++ b/packages/camera/camera_android_camerax/test/aspect_ratio_strategy_test.mocks.dart @@ -0,0 +1,66 @@ +// Mocks generated by Mockito 5.4.0 from annotations +// in camera_android_camerax/test/aspect_ratio_strategy_test.dart. +// Do not manually edit this file. + +// ignore_for_file: no_leading_underscores_for_library_prefixes +import 'package:mockito/mockito.dart' as _i1; + +import 'test_camerax_library.g.dart' as _i2; + +// ignore_for_file: type=lint +// ignore_for_file: avoid_redundant_argument_values +// ignore_for_file: avoid_setters_without_getters +// ignore_for_file: comment_references +// ignore_for_file: implementation_imports +// ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: prefer_const_constructors +// ignore_for_file: unnecessary_parenthesis +// ignore_for_file: camel_case_types +// ignore_for_file: subtype_of_sealed_class + +/// A class which mocks [TestAspectRatioStrategyHostApi]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockTestAspectRatioStrategyHostApi extends _i1.Mock + implements _i2.TestAspectRatioStrategyHostApi { + MockTestAspectRatioStrategyHostApi() { + _i1.throwOnMissingStub(this); + } + + @override + void create( + int? identifier, + int? preferredAspectRatio, + int? fallbackRule, + ) => + super.noSuchMethod( + Invocation.method( + #create, + [ + identifier, + preferredAspectRatio, + fallbackRule, + ], + ), + returnValueForMissingStub: null, + ); +} + +/// A class which mocks [TestInstanceManagerHostApi]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockTestInstanceManagerHostApi extends _i1.Mock + implements _i2.TestInstanceManagerHostApi { + MockTestInstanceManagerHostApi() { + _i1.throwOnMissingStub(this); + } + + @override + void clear() => super.noSuchMethod( + Invocation.method( + #clear, + [], + ), + returnValueForMissingStub: null, + ); +} diff --git a/packages/camera/camera_android_camerax/test/resolution_selector_test.dart b/packages/camera/camera_android_camerax/test/resolution_selector_test.dart new file mode 100644 index 00000000000..705da20e2dc --- /dev/null +++ b/packages/camera/camera_android_camerax/test/resolution_selector_test.dart @@ -0,0 +1,87 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:ui'; + +import 'package:camera_android_camerax/src/aspect_ratio_strategy.dart'; +import 'package:camera_android_camerax/src/instance_manager.dart'; +import 'package:camera_android_camerax/src/resolution_selector.dart'; +import 'package:camera_android_camerax/src/resolution_strategy.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:mockito/annotations.dart'; +import 'package:mockito/mockito.dart'; + +import 'resolution_selector_test.mocks.dart'; +import 'test_camerax_library.g.dart'; + +@GenerateMocks([ + TestResolutionSelectorHostApi, + TestInstanceManagerHostApi, +]) +void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + + group('ResolutionSelector', () { + tearDown(() { + TestResolutionSelectorHostApi.setup(null); + TestInstanceManagerHostApi.setup(null); + }); + + test('HostApi create', () { + final MockTestResolutionSelectorHostApi mockApi = + MockTestResolutionSelectorHostApi(); + TestResolutionSelectorHostApi.setup(mockApi); + TestInstanceManagerHostApi.setup(MockTestInstanceManagerHostApi()); + + final InstanceManager instanceManager = InstanceManager( + onWeakReferenceRemoved: (_) {}, + ); + + final ResolutionStrategy resolutionStrategy = ResolutionStrategy.detached( + boundSize: const Size(50, 30), + fallbackRule: ResolutionStrategy.fallbackRuleClosestLower, + instanceManager: instanceManager, + ); + const int resolutionStrategyIdentifier = 14; + instanceManager.addHostCreatedInstance( + resolutionStrategy, + resolutionStrategyIdentifier, + onCopy: (ResolutionStrategy original) => ResolutionStrategy.detached( + boundSize: original.boundSize, + fallbackRule: original.fallbackRule, + instanceManager: instanceManager, + ), + ); + + final AspectRatioStrategy aspectRatioStrategy = + AspectRatioStrategy.detached( + preferredAspectRatio: AspectRatio.ratio4To3, + fallbackRule: AspectRatioStrategy.fallbackRuleAuto, + instanceManager: instanceManager, + ); + const int aspectRatioStrategyIdentifier = 15; + instanceManager.addHostCreatedInstance( + aspectRatioStrategy, + aspectRatioStrategyIdentifier, + onCopy: (AspectRatioStrategy original) => AspectRatioStrategy.detached( + preferredAspectRatio: original.preferredAspectRatio, + fallbackRule: original.fallbackRule, + instanceManager: instanceManager, + ), + ); + + final ResolutionSelector instance = ResolutionSelector( + resolutionStrategy: resolutionStrategy, + aspectRatioStrategy: aspectRatioStrategy, + instanceManager: instanceManager, + ); + + verify(mockApi.create( + instanceManager.getIdentifier(instance), + resolutionStrategyIdentifier, + aspectRatioStrategyIdentifier, + )); + }); + }); +} diff --git a/packages/camera/camera_android_camerax/test/resolution_selector_test.mocks.dart b/packages/camera/camera_android_camerax/test/resolution_selector_test.mocks.dart new file mode 100644 index 00000000000..d0b8ba1a135 --- /dev/null +++ b/packages/camera/camera_android_camerax/test/resolution_selector_test.mocks.dart @@ -0,0 +1,66 @@ +// Mocks generated by Mockito 5.4.0 from annotations +// in camera_android_camerax/test/resolution_selector_test.dart. +// Do not manually edit this file. + +// ignore_for_file: no_leading_underscores_for_library_prefixes +import 'package:mockito/mockito.dart' as _i1; + +import 'test_camerax_library.g.dart' as _i2; + +// ignore_for_file: type=lint +// ignore_for_file: avoid_redundant_argument_values +// ignore_for_file: avoid_setters_without_getters +// ignore_for_file: comment_references +// ignore_for_file: implementation_imports +// ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: prefer_const_constructors +// ignore_for_file: unnecessary_parenthesis +// ignore_for_file: camel_case_types +// ignore_for_file: subtype_of_sealed_class + +/// A class which mocks [TestResolutionSelectorHostApi]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockTestResolutionSelectorHostApi extends _i1.Mock + implements _i2.TestResolutionSelectorHostApi { + MockTestResolutionSelectorHostApi() { + _i1.throwOnMissingStub(this); + } + + @override + void create( + int? identifier, + int? resolutionStrategyIdentifier, + int? aspectRatioStrategyIdentifier, + ) => + super.noSuchMethod( + Invocation.method( + #create, + [ + identifier, + resolutionStrategyIdentifier, + aspectRatioStrategyIdentifier, + ], + ), + returnValueForMissingStub: null, + ); +} + +/// A class which mocks [TestInstanceManagerHostApi]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockTestInstanceManagerHostApi extends _i1.Mock + implements _i2.TestInstanceManagerHostApi { + MockTestInstanceManagerHostApi() { + _i1.throwOnMissingStub(this); + } + + @override + void clear() => super.noSuchMethod( + Invocation.method( + #clear, + [], + ), + returnValueForMissingStub: null, + ); +} diff --git a/packages/camera/camera_android_camerax/test/resolution_strategy_test.dart b/packages/camera/camera_android_camerax/test/resolution_strategy_test.dart new file mode 100644 index 00000000000..06823dbb115 --- /dev/null +++ b/packages/camera/camera_android_camerax/test/resolution_strategy_test.dart @@ -0,0 +1,59 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:ui'; + +import 'package:camera_android_camerax/src/camerax_library.g.dart'; +import 'package:camera_android_camerax/src/instance_manager.dart'; +import 'package:camera_android_camerax/src/resolution_strategy.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:mockito/annotations.dart'; +import 'package:mockito/mockito.dart'; + +import 'resolution_strategy_test.mocks.dart'; +import 'test_camerax_library.g.dart'; + +@GenerateMocks([ + TestResolutionStrategyHostApi, + TestInstanceManagerHostApi, +]) +void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + + group('ResolutionStrategy', () { + tearDown(() { + TestResolutionStrategyHostApi.setup(null); + TestInstanceManagerHostApi.setup(null); + }); + + test('HostApi create', () { + final MockTestResolutionStrategyHostApi mockApi = + MockTestResolutionStrategyHostApi(); + TestResolutionStrategyHostApi.setup(mockApi); + TestInstanceManagerHostApi.setup(MockTestInstanceManagerHostApi()); + + final InstanceManager instanceManager = InstanceManager( + onWeakReferenceRemoved: (_) {}, + ); + + const Size boundSize = Size(50, 30); + + const int fallbackRule = 0; + + final ResolutionStrategy instance = ResolutionStrategy( + boundSize: boundSize, + fallbackRule: fallbackRule, + instanceManager: instanceManager, + ); + + verify(mockApi.create( + instanceManager.getIdentifier(instance), + argThat(isA() + .having((CameraSize size) => size.width, 'width', 50) + .having((CameraSize size) => size.height, 'height', 30)), + fallbackRule, + )); + }); + }); +} diff --git a/packages/camera/camera_android_camerax/test/resolution_strategy_test.mocks.dart b/packages/camera/camera_android_camerax/test/resolution_strategy_test.mocks.dart new file mode 100644 index 00000000000..f2757d9218e --- /dev/null +++ b/packages/camera/camera_android_camerax/test/resolution_strategy_test.mocks.dart @@ -0,0 +1,67 @@ +// Mocks generated by Mockito 5.4.0 from annotations +// in camera_android_camerax/test/resolution_strategy_test.dart. +// Do not manually edit this file. + +// ignore_for_file: no_leading_underscores_for_library_prefixes +import 'package:camera_android_camerax/src/camerax_library.g.dart' as _i3; +import 'package:mockito/mockito.dart' as _i1; + +import 'test_camerax_library.g.dart' as _i2; + +// ignore_for_file: type=lint +// ignore_for_file: avoid_redundant_argument_values +// ignore_for_file: avoid_setters_without_getters +// ignore_for_file: comment_references +// ignore_for_file: implementation_imports +// ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: prefer_const_constructors +// ignore_for_file: unnecessary_parenthesis +// ignore_for_file: camel_case_types +// ignore_for_file: subtype_of_sealed_class + +/// A class which mocks [TestResolutionStrategyHostApi]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockTestResolutionStrategyHostApi extends _i1.Mock + implements _i2.TestResolutionStrategyHostApi { + MockTestResolutionStrategyHostApi() { + _i1.throwOnMissingStub(this); + } + + @override + void create( + int? identifier, + _i3.CameraSize? size, + int? fallbackRule, + ) => + super.noSuchMethod( + Invocation.method( + #create, + [ + identifier, + size, + fallbackRule, + ], + ), + returnValueForMissingStub: null, + ); +} + +/// A class which mocks [TestInstanceManagerHostApi]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockTestInstanceManagerHostApi extends _i1.Mock + implements _i2.TestInstanceManagerHostApi { + MockTestInstanceManagerHostApi() { + _i1.throwOnMissingStub(this); + } + + @override + void clear() => super.noSuchMethod( + Invocation.method( + #clear, + [], + ), + returnValueForMissingStub: null, + ); +} diff --git a/packages/camera/camera_android_camerax/test/test_camerax_library.g.dart b/packages/camera/camera_android_camerax/test/test_camerax_library.g.dart index 2bb655ffb63..9cd83ec89a1 100644 --- a/packages/camera/camera_android_camerax/test/test_camerax_library.g.dart +++ b/packages/camera/camera_android_camerax/test/test_camerax_library.g.dart @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v9.1.1), do not edit directly. +// Autogenerated from Pigeon (v9.2.5), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, unnecessary_import // ignore_for_file: avoid_relative_lib_imports @@ -14,6 +14,8 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:camera_android_camerax/src/camerax_library.g.dart'; abstract class TestInstanceManagerHostApi { + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); /// Clear the native `InstanceManager`. @@ -28,9 +30,12 @@ abstract class TestInstanceManagerHostApi { 'dev.flutter.pigeon.InstanceManagerHostApi.clear', codec, binaryMessenger: binaryMessenger); if (api == null) { - channel.setMockMessageHandler(null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - channel.setMockMessageHandler((Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { // ignore message api.clear(); return []; @@ -41,6 +46,8 @@ abstract class TestInstanceManagerHostApi { } abstract class TestJavaObjectHostApi { + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void dispose(int identifier); @@ -52,9 +59,12 @@ abstract class TestJavaObjectHostApi { 'dev.flutter.pigeon.JavaObjectHostApi.dispose', codec, binaryMessenger: binaryMessenger); if (api == null) { - channel.setMockMessageHandler(null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - channel.setMockMessageHandler((Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.JavaObjectHostApi.dispose was null.'); final List args = (message as List?)!; @@ -70,6 +80,8 @@ abstract class TestJavaObjectHostApi { } abstract class TestCameraInfoHostApi { + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); int getSensorRotationDegrees(int identifier); @@ -82,9 +94,12 @@ abstract class TestCameraInfoHostApi { codec, binaryMessenger: binaryMessenger); if (api == null) { - channel.setMockMessageHandler(null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - channel.setMockMessageHandler((Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.CameraInfoHostApi.getSensorRotationDegrees was null.'); final List args = (message as List?)!; @@ -100,6 +115,8 @@ abstract class TestCameraInfoHostApi { } abstract class TestCameraSelectorHostApi { + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int identifier, int? lensFacing); @@ -113,9 +130,12 @@ abstract class TestCameraSelectorHostApi { 'dev.flutter.pigeon.CameraSelectorHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - channel.setMockMessageHandler(null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - channel.setMockMessageHandler((Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.CameraSelectorHostApi.create was null.'); final List args = (message as List?)!; @@ -133,9 +153,12 @@ abstract class TestCameraSelectorHostApi { 'dev.flutter.pigeon.CameraSelectorHostApi.filter', codec, binaryMessenger: binaryMessenger); if (api == null) { - channel.setMockMessageHandler(null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - channel.setMockMessageHandler((Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.CameraSelectorHostApi.filter was null.'); final List args = (message as List?)!; @@ -156,6 +179,8 @@ abstract class TestCameraSelectorHostApi { } abstract class TestProcessCameraProviderHostApi { + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); Future getInstance(); @@ -178,9 +203,12 @@ abstract class TestProcessCameraProviderHostApi { 'dev.flutter.pigeon.ProcessCameraProviderHostApi.getInstance', codec, binaryMessenger: binaryMessenger); if (api == null) { - channel.setMockMessageHandler(null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - channel.setMockMessageHandler((Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { // ignore message final int output = await api.getInstance(); return [output]; @@ -193,9 +221,12 @@ abstract class TestProcessCameraProviderHostApi { codec, binaryMessenger: binaryMessenger); if (api == null) { - channel.setMockMessageHandler(null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - channel.setMockMessageHandler((Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.getAvailableCameraInfos was null.'); final List args = (message as List?)!; @@ -214,9 +245,12 @@ abstract class TestProcessCameraProviderHostApi { codec, binaryMessenger: binaryMessenger); if (api == null) { - channel.setMockMessageHandler(null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - channel.setMockMessageHandler((Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.bindToLifecycle was null.'); final List args = (message as List?)!; @@ -241,9 +275,12 @@ abstract class TestProcessCameraProviderHostApi { 'dev.flutter.pigeon.ProcessCameraProviderHostApi.isBound', codec, binaryMessenger: binaryMessenger); if (api == null) { - channel.setMockMessageHandler(null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - channel.setMockMessageHandler((Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.isBound was null.'); final List args = (message as List?)!; @@ -264,9 +301,12 @@ abstract class TestProcessCameraProviderHostApi { 'dev.flutter.pigeon.ProcessCameraProviderHostApi.unbind', codec, binaryMessenger: binaryMessenger); if (api == null) { - channel.setMockMessageHandler(null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - channel.setMockMessageHandler((Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.unbind was null.'); final List args = (message as List?)!; @@ -287,9 +327,12 @@ abstract class TestProcessCameraProviderHostApi { 'dev.flutter.pigeon.ProcessCameraProviderHostApi.unbindAll', codec, binaryMessenger: binaryMessenger); if (api == null) { - channel.setMockMessageHandler(null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - channel.setMockMessageHandler((Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.unbindAll was null.'); final List args = (message as List?)!; @@ -328,6 +371,8 @@ class _TestSystemServicesHostApiCodec extends StandardMessageCodec { } abstract class TestSystemServicesHostApi { + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = _TestSystemServicesHostApiCodec(); Future requestCameraPermissions( @@ -346,9 +391,12 @@ abstract class TestSystemServicesHostApi { codec, binaryMessenger: binaryMessenger); if (api == null) { - channel.setMockMessageHandler(null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - channel.setMockMessageHandler((Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.SystemServicesHostApi.requestCameraPermissions was null.'); final List args = (message as List?)!; @@ -367,9 +415,12 @@ abstract class TestSystemServicesHostApi { codec, binaryMessenger: binaryMessenger); if (api == null) { - channel.setMockMessageHandler(null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - channel.setMockMessageHandler((Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.SystemServicesHostApi.startListeningForDeviceOrientationChange was null.'); final List args = (message as List?)!; @@ -391,9 +442,12 @@ abstract class TestSystemServicesHostApi { codec, binaryMessenger: binaryMessenger); if (api == null) { - channel.setMockMessageHandler(null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - channel.setMockMessageHandler((Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { // ignore message api.stopListeningForDeviceOrientationChange(); return []; @@ -432,6 +486,8 @@ class _TestPreviewHostApiCodec extends StandardMessageCodec { } abstract class TestPreviewHostApi { + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = _TestPreviewHostApiCodec(); void create(int identifier, int? rotation, ResolutionInfo? targetResolution); @@ -449,9 +505,12 @@ abstract class TestPreviewHostApi { 'dev.flutter.pigeon.PreviewHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - channel.setMockMessageHandler(null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - channel.setMockMessageHandler((Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.PreviewHostApi.create was null.'); final List args = (message as List?)!; @@ -471,9 +530,12 @@ abstract class TestPreviewHostApi { 'dev.flutter.pigeon.PreviewHostApi.setSurfaceProvider', codec, binaryMessenger: binaryMessenger); if (api == null) { - channel.setMockMessageHandler(null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - channel.setMockMessageHandler((Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.PreviewHostApi.setSurfaceProvider was null.'); final List args = (message as List?)!; @@ -491,9 +553,12 @@ abstract class TestPreviewHostApi { codec, binaryMessenger: binaryMessenger); if (api == null) { - channel.setMockMessageHandler(null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - channel.setMockMessageHandler((Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { // ignore message api.releaseFlutterSurfaceTexture(); return []; @@ -505,9 +570,12 @@ abstract class TestPreviewHostApi { 'dev.flutter.pigeon.PreviewHostApi.getResolutionInfo', codec, binaryMessenger: binaryMessenger); if (api == null) { - channel.setMockMessageHandler(null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - channel.setMockMessageHandler((Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.PreviewHostApi.getResolutionInfo was null.'); final List args = (message as List?)!; @@ -546,6 +614,8 @@ class _TestImageCaptureHostApiCodec extends StandardMessageCodec { } abstract class TestImageCaptureHostApi { + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = _TestImageCaptureHostApiCodec(); void create(int identifier, int? flashMode, ResolutionInfo? targetResolution); @@ -561,9 +631,12 @@ abstract class TestImageCaptureHostApi { 'dev.flutter.pigeon.ImageCaptureHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - channel.setMockMessageHandler(null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - channel.setMockMessageHandler((Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.ImageCaptureHostApi.create was null.'); final List args = (message as List?)!; @@ -583,9 +656,12 @@ abstract class TestImageCaptureHostApi { 'dev.flutter.pigeon.ImageCaptureHostApi.setFlashMode', codec, binaryMessenger: binaryMessenger); if (api == null) { - channel.setMockMessageHandler(null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - channel.setMockMessageHandler((Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.ImageCaptureHostApi.setFlashMode was null.'); final List args = (message as List?)!; @@ -605,9 +681,12 @@ abstract class TestImageCaptureHostApi { 'dev.flutter.pigeon.ImageCaptureHostApi.takePicture', codec, binaryMessenger: binaryMessenger); if (api == null) { - channel.setMockMessageHandler(null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - channel.setMockMessageHandler((Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, 'Argument for dev.flutter.pigeon.ImageCaptureHostApi.takePicture was null.'); final List args = (message as List?)!; @@ -621,3 +700,164 @@ abstract class TestImageCaptureHostApi { } } } + +class _TestResolutionStrategyHostApiCodec extends StandardMessageCodec { + const _TestResolutionStrategyHostApiCodec(); + @override + void writeValue(WriteBuffer buffer, Object? value) { + if (value is CameraSize) { + buffer.putUint8(128); + writeValue(buffer, value.encode()); + } else { + super.writeValue(buffer, value); + } + } + + @override + Object? readValueOfType(int type, ReadBuffer buffer) { + switch (type) { + case 128: + return CameraSize.decode(readValue(buffer)!); + default: + return super.readValueOfType(type, buffer); + } + } +} + +/// Host API for `ResolutionStrategy`. +/// +/// This class may handle instantiating and adding native object instances that +/// are attached to a Dart instance or handle method calls on the associated +/// native class or an instance of the class. +abstract class TestResolutionStrategyHostApi { + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; + static const MessageCodec codec = + _TestResolutionStrategyHostApiCodec(); + + /// Create a new native instance and add it to the `InstanceManager`. + void create(int identifier, CameraSize size, int fallbackRule); + + static void setup(TestResolutionStrategyHostApi? api, + {BinaryMessenger? binaryMessenger}) { + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.ResolutionStrategyHostApi.create', codec, + binaryMessenger: binaryMessenger); + if (api == null) { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); + } else { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.ResolutionStrategyHostApi.create was null.'); + final List args = (message as List?)!; + final int? arg_identifier = (args[0] as int?); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.ResolutionStrategyHostApi.create was null, expected non-null int.'); + final CameraSize? arg_size = (args[1] as CameraSize?); + assert(arg_size != null, + 'Argument for dev.flutter.pigeon.ResolutionStrategyHostApi.create was null, expected non-null CameraSize.'); + final int? arg_fallbackRule = (args[2] as int?); + assert(arg_fallbackRule != null, + 'Argument for dev.flutter.pigeon.ResolutionStrategyHostApi.create was null, expected non-null int.'); + api.create(arg_identifier!, arg_size!, arg_fallbackRule!); + return []; + }); + } + } + } +} + +/// Host API for `ResolutionSelector`. +/// +/// This class may handle instantiating and adding native object instances that +/// are attached to a Dart instance or handle method calls on the associated +/// native class or an instance of the class. +abstract class TestResolutionSelectorHostApi { + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; + static const MessageCodec codec = StandardMessageCodec(); + + /// Create a new native instance and add it to the `InstanceManager`. + void create(int identifier, int? resolutionStrategyIdentifier, + int? aspectRatioStrategyIdentifier); + + static void setup(TestResolutionSelectorHostApi? api, + {BinaryMessenger? binaryMessenger}) { + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.ResolutionSelectorHostApi.create', codec, + binaryMessenger: binaryMessenger); + if (api == null) { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); + } else { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.ResolutionSelectorHostApi.create was null.'); + final List args = (message as List?)!; + final int? arg_identifier = (args[0] as int?); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.ResolutionSelectorHostApi.create was null, expected non-null int.'); + final int? arg_resolutionStrategyIdentifier = (args[1] as int?); + final int? arg_aspectRatioStrategyIdentifier = (args[2] as int?); + api.create(arg_identifier!, arg_resolutionStrategyIdentifier, + arg_aspectRatioStrategyIdentifier); + return []; + }); + } + } + } +} + +/// Host API for `AspectRatioStrategy`. +/// +/// This class may handle instantiating and adding native object instances that +/// are attached to a Dart instance or handle method calls on the associated +/// native class or an instance of the class. +abstract class TestAspectRatioStrategyHostApi { + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; + static const MessageCodec codec = StandardMessageCodec(); + + /// Create a new native instance and add it to the `InstanceManager`. + void create(int identifier, int preferredAspectRatio, int fallbackRule); + + static void setup(TestAspectRatioStrategyHostApi? api, + {BinaryMessenger? binaryMessenger}) { + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.AspectRatioStrategyHostApi.create', codec, + binaryMessenger: binaryMessenger); + if (api == null) { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); + } else { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.AspectRatioStrategyHostApi.create was null.'); + final List args = (message as List?)!; + final int? arg_identifier = (args[0] as int?); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.AspectRatioStrategyHostApi.create was null, expected non-null int.'); + final int? arg_preferredAspectRatio = (args[1] as int?); + assert(arg_preferredAspectRatio != null, + 'Argument for dev.flutter.pigeon.AspectRatioStrategyHostApi.create was null, expected non-null int.'); + final int? arg_fallbackRule = (args[2] as int?); + assert(arg_fallbackRule != null, + 'Argument for dev.flutter.pigeon.AspectRatioStrategyHostApi.create was null, expected non-null int.'); + api.create( + arg_identifier!, arg_preferredAspectRatio!, arg_fallbackRule!); + return []; + }); + } + } + } +} From 9a74cd104abf5fbb3b7413b90c4b5e66001a28af Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 26 Apr 2023 14:50:29 -0400 Subject: [PATCH 03/34] java impls --- .../android/build.gradle | 2 +- .../AspectRatioStrategyHostApiImpl.java | 72 ++++ .../camerax/GeneratedCameraXLibrary.java | 391 +++++++++++++++--- .../ResolutionSelectorHostApiImpl.java | 92 +++++ .../ResolutionStrategyHostApiImpl.java | 78 ++++ .../camerax/AspectRatioStrategyTest.java | 53 +++ .../camerax/ResolutionSelectorTest.java | 61 +++ .../camerax/ResolutionStrategyTest.java | 58 +++ .../lib/src/camerax_library.g.dart | 6 +- .../pigeons/camerax_library.dart | 2 +- .../test/test_camerax_library.g.dart | 8 +- 11 files changed, 763 insertions(+), 60 deletions(-) create mode 100644 packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/AspectRatioStrategyHostApiImpl.java create mode 100644 packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/ResolutionSelectorHostApiImpl.java create mode 100644 packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/ResolutionStrategyHostApiImpl.java create mode 100644 packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/AspectRatioStrategyTest.java create mode 100644 packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/ResolutionSelectorTest.java create mode 100644 packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/ResolutionStrategyTest.java diff --git a/packages/camera/camera_android_camerax/android/build.gradle b/packages/camera/camera_android_camerax/android/build.gradle index 492d1374b8a..d0b122b0167 100644 --- a/packages/camera/camera_android_camerax/android/build.gradle +++ b/packages/camera/camera_android_camerax/android/build.gradle @@ -58,7 +58,7 @@ android { dependencies { // CameraX core library using the camera2 implementation must use same version number. - def camerax_version = "1.3.0-alpha04" + def camerax_version = "1.3.0-alpha06" implementation "androidx.camera:camera-core:${camerax_version}" implementation "androidx.camera:camera-camera2:${camerax_version}" implementation "androidx.camera:camera-lifecycle:${camerax_version}" diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/AspectRatioStrategyHostApiImpl.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/AspectRatioStrategyHostApiImpl.java new file mode 100644 index 00000000000..b2eb51ba2e3 --- /dev/null +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/AspectRatioStrategyHostApiImpl.java @@ -0,0 +1,72 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package io.flutter.plugins.camerax; + +import androidx.annotation.NonNull; +import androidx.annotation.VisibleForTesting; +import androidx.camera.core.resolutionselector.AspectRatioStrategy; +import io.flutter.plugin.common.BinaryMessenger; +import io.flutter.plugins.camerax.GeneratedCameraXLibrary.AspectRatioStrategyHostApi; + +/** + * Host API implementation for `AspectRatioStrategy`. + * + *

This class may handle instantiating and adding native object instances that are attached to a + * Dart instance or handle method calls on the associated native class or an instance of the class. + */ +public class AspectRatioStrategyHostApiImpl implements AspectRatioStrategyHostApi { + // To ease adding additional methods, this value is added prematurely. + @SuppressWarnings({"unused", "FieldCanBeLocal"}) + private final BinaryMessenger binaryMessenger; + + private final InstanceManager instanceManager; + private final AspectRatioStrategyProxy proxy; + + /** Proxy for constructors and static method of `AspectRatioStrategy`. */ + @VisibleForTesting + public static class AspectRatioStrategyProxy { + /** Creates an instance of `AspectRatioStrategy`. */ + @NonNull + public AspectRatioStrategy create( + @NonNull Long preferredAspectRatio, @NonNull Long fallbackRule) { + return new AspectRatioStrategy(preferredAspectRatio.intValue(), fallbackRule.intValue()); + } + } + + /** + * Constructs a {@link AspectRatioStrategyHostApiImpl}. + * + * @param binaryMessenger used to communicate with Dart over asynchronous messages + * @param instanceManager maintains instances stored to communicate with attached Dart objects + */ + public AspectRatioStrategyHostApiImpl( + @NonNull BinaryMessenger binaryMessenger, @NonNull InstanceManager instanceManager) { + this(binaryMessenger, instanceManager, new AspectRatioStrategyProxy()); + } + + /** + * Constructs a {@link AspectRatioStrategyHostApiImpl}. + * + * @param binaryMessenger used to communicate with Dart over asynchronous messages + * @param instanceManager maintains instances stored to communicate with attached Dart objects + * @param proxy proxy for constructors and static method of `AspectRatioStrategy` + */ + @VisibleForTesting + AspectRatioStrategyHostApiImpl( + @NonNull BinaryMessenger binaryMessenger, + @NonNull InstanceManager instanceManager, + @NonNull AspectRatioStrategyProxy proxy) { + this.binaryMessenger = binaryMessenger; + this.instanceManager = instanceManager; + this.proxy = proxy; + } + + @Override + public void create( + @NonNull Long identifier, @NonNull Long preferredAspectRatio, @NonNull Long fallbackRule) { + instanceManager.addDartCreatedInstance( + proxy.create(preferredAspectRatio, fallbackRule), identifier); + } +} diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/GeneratedCameraXLibrary.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/GeneratedCameraXLibrary.java index 4d4439ebe23..d042897172a 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/GeneratedCameraXLibrary.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/GeneratedCameraXLibrary.java @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v9.1.1), do not edit directly. +// Autogenerated from Pigeon (v9.2.5), do not edit directly. // See also: https://pub.dev/packages/pigeon package io.flutter.plugins.camerax; @@ -41,7 +41,7 @@ public FlutterError(@NonNull String code, @Nullable String message, @Nullable Ob } @NonNull - private static ArrayList wrapError(@NonNull Throwable exception) { + protected static ArrayList wrapError(@NonNull Throwable exception) { ArrayList errorList = new ArrayList(3); if (exception instanceof FlutterError) { FlutterError error = (FlutterError) exception; @@ -85,8 +85,8 @@ public void setHeight(@NonNull Long setterArg) { this.height = setterArg; } - /** Constructor is private to enforce null safety; use Builder. */ - private ResolutionInfo() {} + /** Constructor is non-public to enforce null safety; use Builder. */ + ResolutionInfo() {} public static final class Builder { @@ -162,8 +162,8 @@ public void setDescription(@NonNull String setterArg) { this.description = setterArg; } - /** Constructor is private to enforce null safety; use Builder. */ - private CameraPermissionsErrorData() {} + /** Constructor is non-public to enforce null safety; use Builder. */ + CameraPermissionsErrorData() {} public static final class Builder { @@ -207,10 +207,88 @@ ArrayList toList() { } } + /** Generated class from Pigeon that represents data sent in messages. */ + public static final class CameraSize { + private @NonNull Long width; + + public @NonNull Long getWidth() { + return width; + } + + public void setWidth(@NonNull Long setterArg) { + if (setterArg == null) { + throw new IllegalStateException("Nonnull field \"width\" is null."); + } + this.width = setterArg; + } + + private @NonNull Long height; + + public @NonNull Long getHeight() { + return height; + } + + public void setHeight(@NonNull Long setterArg) { + if (setterArg == null) { + throw new IllegalStateException("Nonnull field \"height\" is null."); + } + this.height = setterArg; + } + + /** Constructor is non-public to enforce null safety; use Builder. */ + CameraSize() {} + + public static final class Builder { + + private @Nullable Long width; + + public @NonNull Builder setWidth(@NonNull Long setterArg) { + this.width = setterArg; + return this; + } + + private @Nullable Long height; + + public @NonNull Builder setHeight(@NonNull Long setterArg) { + this.height = setterArg; + return this; + } + + public @NonNull CameraSize build() { + CameraSize pigeonReturn = new CameraSize(); + pigeonReturn.setWidth(width); + pigeonReturn.setHeight(height); + return pigeonReturn; + } + } + + @NonNull + ArrayList toList() { + ArrayList toListResult = new ArrayList(2); + toListResult.add(width); + toListResult.add(height); + return toListResult; + } + + static @NonNull CameraSize fromList(@NonNull ArrayList list) { + CameraSize pigeonResult = new CameraSize(); + Object width = list.get(0); + pigeonResult.setWidth( + (width == null) ? null : ((width instanceof Integer) ? (Integer) width : (Long) width)); + Object height = list.get(1); + pigeonResult.setHeight( + (height == null) + ? null + : ((height instanceof Integer) ? (Integer) height : (Long) height)); + return pigeonResult; + } + } + public interface Result { + @SuppressWarnings("UnknownNullness") void success(T result); - void error(Throwable error); + void error(@NonNull Throwable error); } /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface InstanceManagerHostApi { @@ -222,14 +300,15 @@ public interface InstanceManagerHostApi { void clear(); /** The codec used by InstanceManagerHostApi. */ - static MessageCodec getCodec() { + static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } /** * Sets up an instance of `InstanceManagerHostApi` to handle messages through the * `binaryMessenger`. */ - static void setup(BinaryMessenger binaryMessenger, InstanceManagerHostApi api) { + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable InstanceManagerHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -259,13 +338,13 @@ public interface JavaObjectHostApi { void dispose(@NonNull Long identifier); /** The codec used by JavaObjectHostApi. */ - static MessageCodec getCodec() { + static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } /** * Sets up an instance of `JavaObjectHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(BinaryMessenger binaryMessenger, JavaObjectHostApi api) { + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable JavaObjectHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -293,22 +372,23 @@ static void setup(BinaryMessenger binaryMessenger, JavaObjectHostApi api) { } /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class JavaObjectFlutterApi { - private final BinaryMessenger binaryMessenger; + private final @NonNull BinaryMessenger binaryMessenger; - public JavaObjectFlutterApi(BinaryMessenger argBinaryMessenger) { + public JavaObjectFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } /** Public interface for sending reply. */ + @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); } /** The codec used by JavaObjectFlutterApi. */ - static MessageCodec getCodec() { + static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void dispose(@NonNull Long identifierArg, Reply callback) { + public void dispose(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.JavaObjectFlutterApi.dispose", getCodec()); @@ -324,13 +404,13 @@ public interface CameraInfoHostApi { Long getSensorRotationDegrees(@NonNull Long identifier); /** The codec used by CameraInfoHostApi. */ - static MessageCodec getCodec() { + static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } /** * Sets up an instance of `CameraInfoHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(BinaryMessenger binaryMessenger, CameraInfoHostApi api) { + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraInfoHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -362,22 +442,23 @@ static void setup(BinaryMessenger binaryMessenger, CameraInfoHostApi api) { } /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class CameraInfoFlutterApi { - private final BinaryMessenger binaryMessenger; + private final @NonNull BinaryMessenger binaryMessenger; - public CameraInfoFlutterApi(BinaryMessenger argBinaryMessenger) { + public CameraInfoFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } /** Public interface for sending reply. */ + @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); } /** The codec used by CameraInfoFlutterApi. */ - static MessageCodec getCodec() { + static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void create(@NonNull Long identifierArg, Reply callback) { + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.CameraInfoFlutterApi.create", getCodec()); @@ -395,14 +476,15 @@ public interface CameraSelectorHostApi { List filter(@NonNull Long identifier, @NonNull List cameraInfoIds); /** The codec used by CameraSelectorHostApi. */ - static MessageCodec getCodec() { + static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } /** * Sets up an instance of `CameraSelectorHostApi` to handle messages through the * `binaryMessenger`. */ - static void setup(BinaryMessenger binaryMessenger, CameraSelectorHostApi api) { + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable CameraSelectorHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -460,23 +542,24 @@ static void setup(BinaryMessenger binaryMessenger, CameraSelectorHostApi api) { } /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class CameraSelectorFlutterApi { - private final BinaryMessenger binaryMessenger; + private final @NonNull BinaryMessenger binaryMessenger; - public CameraSelectorFlutterApi(BinaryMessenger argBinaryMessenger) { + public CameraSelectorFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } /** Public interface for sending reply. */ + @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); } /** The codec used by CameraSelectorFlutterApi. */ - static MessageCodec getCodec() { + static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } public void create( - @NonNull Long identifierArg, @Nullable Long lensFacingArg, Reply callback) { + @NonNull Long identifierArg, @Nullable Long lensFacingArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.CameraSelectorFlutterApi.create", getCodec()); @@ -488,7 +571,7 @@ public void create( /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface ProcessCameraProviderHostApi { - void getInstance(Result result); + void getInstance(@NonNull Result result); @NonNull List getAvailableCameraInfos(@NonNull Long identifier); @@ -507,14 +590,15 @@ Long bindToLifecycle( void unbindAll(@NonNull Long identifier); /** The codec used by ProcessCameraProviderHostApi. */ - static MessageCodec getCodec() { + static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } /** * Sets up an instance of `ProcessCameraProviderHostApi` to handle messages through the * `binaryMessenger`. */ - static void setup(BinaryMessenger binaryMessenger, ProcessCameraProviderHostApi api) { + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable ProcessCameraProviderHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -689,22 +773,23 @@ public void error(Throwable error) { } /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class ProcessCameraProviderFlutterApi { - private final BinaryMessenger binaryMessenger; + private final @NonNull BinaryMessenger binaryMessenger; - public ProcessCameraProviderFlutterApi(BinaryMessenger argBinaryMessenger) { + public ProcessCameraProviderFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } /** Public interface for sending reply. */ + @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); } /** The codec used by ProcessCameraProviderFlutterApi. */ - static MessageCodec getCodec() { + static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void create(@NonNull Long identifierArg, Reply callback) { + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, @@ -717,22 +802,23 @@ public void create(@NonNull Long identifierArg, Reply callback) { } /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class CameraFlutterApi { - private final BinaryMessenger binaryMessenger; + private final @NonNull BinaryMessenger binaryMessenger; - public CameraFlutterApi(BinaryMessenger argBinaryMessenger) { + public CameraFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } /** Public interface for sending reply. */ + @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); } /** The codec used by CameraFlutterApi. */ - static MessageCodec getCodec() { + static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void create(@NonNull Long identifierArg, Reply callback) { + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.CameraFlutterApi.create", getCodec()); @@ -772,7 +858,7 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { public interface SystemServicesHostApi { void requestCameraPermissions( - @NonNull Boolean enableAudio, Result result); + @NonNull Boolean enableAudio, @NonNull Result result); void startListeningForDeviceOrientationChange( @NonNull Boolean isFrontFacing, @NonNull Long sensorOrientation); @@ -780,14 +866,15 @@ void startListeningForDeviceOrientationChange( void stopListeningForDeviceOrientationChange(); /** The codec used by SystemServicesHostApi. */ - static MessageCodec getCodec() { + static @NonNull MessageCodec getCodec() { return SystemServicesHostApiCodec.INSTANCE; } /** * Sets up an instance of `SystemServicesHostApi` to handle messages through the * `binaryMessenger`. */ - static void setup(BinaryMessenger binaryMessenger, SystemServicesHostApi api) { + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable SystemServicesHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -874,22 +961,24 @@ public void error(Throwable error) { } /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class SystemServicesFlutterApi { - private final BinaryMessenger binaryMessenger; + private final @NonNull BinaryMessenger binaryMessenger; - public SystemServicesFlutterApi(BinaryMessenger argBinaryMessenger) { + public SystemServicesFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } /** Public interface for sending reply. */ + @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); } /** The codec used by SystemServicesFlutterApi. */ - static MessageCodec getCodec() { + static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void onDeviceOrientationChanged(@NonNull String orientationArg, Reply callback) { + public void onDeviceOrientationChanged( + @NonNull String orientationArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, @@ -900,7 +989,7 @@ public void onDeviceOrientationChanged(@NonNull String orientationArg, Reply callback.reply(null)); } - public void onCameraError(@NonNull String errorDescriptionArg, Reply callback) { + public void onCameraError(@NonNull String errorDescriptionArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, @@ -960,11 +1049,11 @@ void create( ResolutionInfo getResolutionInfo(@NonNull Long identifier); /** The codec used by PreviewHostApi. */ - static MessageCodec getCodec() { + static @NonNull MessageCodec getCodec() { return PreviewHostApiCodec.INSTANCE; } /** Sets up an instance of `PreviewHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(BinaryMessenger binaryMessenger, PreviewHostApi api) { + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PreviewHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1107,17 +1196,17 @@ void create( void setFlashMode(@NonNull Long identifier, @NonNull Long flashMode); - void takePicture(@NonNull Long identifier, Result result); + void takePicture(@NonNull Long identifier, @NonNull Result result); /** The codec used by ImageCaptureHostApi. */ - static MessageCodec getCodec() { + static @NonNull MessageCodec getCodec() { return ImageCaptureHostApiCodec.INSTANCE; } /** * Sets up an instance of `ImageCaptureHostApi` to handle messages through the * `binaryMessenger`. */ - static void setup(BinaryMessenger binaryMessenger, ImageCaptureHostApi api) { + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageCaptureHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1204,4 +1293,204 @@ public void error(Throwable error) { } } } + + private static class ResolutionStrategyHostApiCodec extends StandardMessageCodec { + public static final ResolutionStrategyHostApiCodec INSTANCE = + new ResolutionStrategyHostApiCodec(); + + private ResolutionStrategyHostApiCodec() {} + + @Override + protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { + switch (type) { + case (byte) 128: + return CameraSize.fromList((ArrayList) readValue(buffer)); + default: + return super.readValueOfType(type, buffer); + } + } + + @Override + protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { + if (value instanceof CameraSize) { + stream.write(128); + writeValue(stream, ((CameraSize) value).toList()); + } else { + super.writeValue(stream, value); + } + } + } + + /** + * Host API for `ResolutionStrategy`. + * + *

This class may handle instantiating and adding native object instances that are attached to + * a Dart instance or handle method calls on the associated native class or an instance of the + * class. + * + *

Generated interface from Pigeon that represents a handler of messages from Flutter. + */ + public interface ResolutionStrategyHostApi { + /** Create a new native instance and add it to the `InstanceManager`. */ + void create( + @NonNull Long identifier, @NonNull CameraSize boundSize, @NonNull Long fallbackRule); + + /** The codec used by ResolutionStrategyHostApi. */ + static @NonNull MessageCodec getCodec() { + return ResolutionStrategyHostApiCodec.INSTANCE; + } + /** + * Sets up an instance of `ResolutionStrategyHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable ResolutionStrategyHostApi api) { + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.ResolutionStrategyHostApi.create", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + ArrayList args = (ArrayList) message; + Number identifierArg = (Number) args.get(0); + CameraSize boundSizeArg = (CameraSize) args.get(1); + Number fallbackRuleArg = (Number) args.get(2); + try { + api.create( + (identifierArg == null) ? null : identifierArg.longValue(), + boundSizeArg, + (fallbackRuleArg == null) ? null : fallbackRuleArg.longValue()); + wrapped.add(0, null); + } catch (Throwable exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + } + } + /** + * Host API for `ResolutionSelector`. + * + *

This class may handle instantiating and adding native object instances that are attached to + * a Dart instance or handle method calls on the associated native class or an instance of the + * class. + * + *

Generated interface from Pigeon that represents a handler of messages from Flutter. + */ + public interface ResolutionSelectorHostApi { + /** Create a new native instance and add it to the `InstanceManager`. */ + void create( + @NonNull Long identifier, + @Nullable Long resolutionStrategyIdentifier, + @Nullable Long aspectRatioStrategyIdentifier); + + /** The codec used by ResolutionSelectorHostApi. */ + static @NonNull MessageCodec getCodec() { + return new StandardMessageCodec(); + } + /** + * Sets up an instance of `ResolutionSelectorHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable ResolutionSelectorHostApi api) { + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.ResolutionSelectorHostApi.create", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + ArrayList args = (ArrayList) message; + Number identifierArg = (Number) args.get(0); + Number resolutionStrategyIdentifierArg = (Number) args.get(1); + Number aspectRatioStrategyIdentifierArg = (Number) args.get(2); + try { + api.create( + (identifierArg == null) ? null : identifierArg.longValue(), + (resolutionStrategyIdentifierArg == null) + ? null + : resolutionStrategyIdentifierArg.longValue(), + (aspectRatioStrategyIdentifierArg == null) + ? null + : aspectRatioStrategyIdentifierArg.longValue()); + wrapped.add(0, null); + } catch (Throwable exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + } + } + /** + * Host API for `AspectRatioStrategy`. + * + *

This class may handle instantiating and adding native object instances that are attached to + * a Dart instance or handle method calls on the associated native class or an instance of the + * class. + * + *

Generated interface from Pigeon that represents a handler of messages from Flutter. + */ + public interface AspectRatioStrategyHostApi { + /** Create a new native instance and add it to the `InstanceManager`. */ + void create( + @NonNull Long identifier, @NonNull Long preferredAspectRatio, @NonNull Long fallbackRule); + + /** The codec used by AspectRatioStrategyHostApi. */ + static @NonNull MessageCodec getCodec() { + return new StandardMessageCodec(); + } + /** + * Sets up an instance of `AspectRatioStrategyHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable AspectRatioStrategyHostApi api) { + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.AspectRatioStrategyHostApi.create", + getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + ArrayList args = (ArrayList) message; + Number identifierArg = (Number) args.get(0); + Number preferredAspectRatioArg = (Number) args.get(1); + Number fallbackRuleArg = (Number) args.get(2); + try { + api.create( + (identifierArg == null) ? null : identifierArg.longValue(), + (preferredAspectRatioArg == null) + ? null + : preferredAspectRatioArg.longValue(), + (fallbackRuleArg == null) ? null : fallbackRuleArg.longValue()); + wrapped.add(0, null); + } catch (Throwable exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + } + } } diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/ResolutionSelectorHostApiImpl.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/ResolutionSelectorHostApiImpl.java new file mode 100644 index 00000000000..a7a3e1fec73 --- /dev/null +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/ResolutionSelectorHostApiImpl.java @@ -0,0 +1,92 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package io.flutter.plugins.camerax; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.VisibleForTesting; +import androidx.camera.core.resolutionselector.AspectRatioStrategy; +import androidx.camera.core.resolutionselector.ResolutionSelector; +import androidx.camera.core.resolutionselector.ResolutionStrategy; +import io.flutter.plugin.common.BinaryMessenger; +import io.flutter.plugins.camerax.GeneratedCameraXLibrary.ResolutionSelectorHostApi; + +/** + * Host API implementation for `ResolutionSelector`. + * + *

This class may handle instantiating and adding native object instances that are attached to a + * Dart instance or handle method calls on the associated native class or an instance of the class. + */ +public class ResolutionSelectorHostApiImpl implements ResolutionSelectorHostApi { + // To ease adding additional methods, this value is added prematurely. + @SuppressWarnings({"unused", "FieldCanBeLocal"}) + private final BinaryMessenger binaryMessenger; + + private final InstanceManager instanceManager; + private final ResolutionSelectorProxy proxy; + + /** Proxy for constructors and static method of `ResolutionSelector`. */ + @VisibleForTesting + public static class ResolutionSelectorProxy { + /** Creates an instance of `ResolutionSelector`. */ + @NonNull + public ResolutionSelector create( + @Nullable ResolutionStrategy resolutionStrategy, + @Nullable AspectRatioStrategy aspectRatioStrategy) { + final ResolutionSelector.Builder builder = new ResolutionSelector.Builder(); + if (resolutionStrategy != null) { + builder.setResolutionStrategy(resolutionStrategy); + } + if (aspectRatioStrategy != null) { + builder.setAspectRatioStrategy(aspectRatioStrategy); + } + return builder.build(); + } + } + + /** + * Constructs a {@link ResolutionSelectorHostApiImpl}. + * + * @param binaryMessenger used to communicate with Dart over asynchronous messages + * @param instanceManager maintains instances stored to communicate with attached Dart objects + */ + public ResolutionSelectorHostApiImpl( + @NonNull BinaryMessenger binaryMessenger, @NonNull InstanceManager instanceManager) { + this(binaryMessenger, instanceManager, new ResolutionSelectorProxy()); + } + + /** + * Constructs a {@link ResolutionSelectorHostApiImpl}. + * + * @param binaryMessenger used to communicate with Dart over asynchronous messages + * @param instanceManager maintains instances stored to communicate with attached Dart objects + * @param proxy proxy for constructors and static method of `ResolutionSelector` + */ + @VisibleForTesting + ResolutionSelectorHostApiImpl( + @NonNull BinaryMessenger binaryMessenger, + @NonNull InstanceManager instanceManager, + @NonNull ResolutionSelectorProxy proxy) { + this.binaryMessenger = binaryMessenger; + this.instanceManager = instanceManager; + this.proxy = proxy; + } + + @Override + public void create( + @NonNull Long identifier, + @Nullable Long resolutionStrategyIdentifier, + @Nullable Long aspectRatioStrategyIdentifier) { + instanceManager.addDartCreatedInstance( + proxy.create( + resolutionStrategyIdentifier == null + ? null + : instanceManager.getInstance(resolutionStrategyIdentifier), + aspectRatioStrategyIdentifier == null + ? null + : instanceManager.getInstance(aspectRatioStrategyIdentifier)), + identifier); + } +} diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/ResolutionStrategyHostApiImpl.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/ResolutionStrategyHostApiImpl.java new file mode 100644 index 00000000000..c2a0bd01311 --- /dev/null +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/ResolutionStrategyHostApiImpl.java @@ -0,0 +1,78 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package io.flutter.plugins.camerax; + +import android.util.Size; +import androidx.annotation.NonNull; +import androidx.annotation.VisibleForTesting; +import androidx.camera.core.resolutionselector.ResolutionStrategy; +import io.flutter.plugin.common.BinaryMessenger; +import io.flutter.plugins.camerax.GeneratedCameraXLibrary.ResolutionStrategyHostApi; + +/** + * Host API implementation for `ResolutionStrategy`. + * + *

This class may handle instantiating and adding native object instances that are attached to a + * Dart instance or handle method calls on the associated native class or an instance of the class. + */ +public class ResolutionStrategyHostApiImpl implements ResolutionStrategyHostApi { + // To ease adding additional methods, this value is added prematurely. + @SuppressWarnings({"unused", "FieldCanBeLocal"}) + private final BinaryMessenger binaryMessenger; + + private final InstanceManager instanceManager; + private final ResolutionStrategyProxy proxy; + + /** Proxy for constructors and static method of `ResolutionStrategy`. */ + @VisibleForTesting + public static class ResolutionStrategyProxy { + + /** Creates an instance of `ResolutionStrategy`. */ + @NonNull + public ResolutionStrategy create(@NonNull Size boundSize, @NonNull Long fallbackRule) { + return new ResolutionStrategy(boundSize, fallbackRule.intValue()); + } + } + + /** + * Constructs a {@link ResolutionStrategyHostApiImpl}. + * + * @param binaryMessenger used to communicate with Dart over asynchronous messages + * @param instanceManager maintains instances stored to communicate with attached Dart objects + */ + public ResolutionStrategyHostApiImpl( + @NonNull BinaryMessenger binaryMessenger, @NonNull InstanceManager instanceManager) { + this(binaryMessenger, instanceManager, new ResolutionStrategyProxy()); + } + + /** + * Constructs a {@link ResolutionStrategyHostApiImpl}. + * + * @param binaryMessenger used to communicate with Dart over asynchronous messages + * @param instanceManager maintains instances stored to communicate with attached Dart objects + * @param proxy proxy for constructors and static method of `ResolutionStrategy` + */ + @VisibleForTesting + ResolutionStrategyHostApiImpl( + @NonNull BinaryMessenger binaryMessenger, + @NonNull InstanceManager instanceManager, + @NonNull ResolutionStrategyProxy proxy) { + this.binaryMessenger = binaryMessenger; + this.instanceManager = instanceManager; + this.proxy = proxy; + } + + @Override + public void create( + @NonNull Long identifier, + @NonNull GeneratedCameraXLibrary.CameraSize boundSize, + @NonNull Long fallbackRule) { + instanceManager.addDartCreatedInstance( + proxy.create( + new Size(boundSize.getWidth().intValue(), boundSize.getHeight().intValue()), + fallbackRule), + identifier); + } +} diff --git a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/AspectRatioStrategyTest.java b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/AspectRatioStrategyTest.java new file mode 100644 index 00000000000..da0d3dbfef2 --- /dev/null +++ b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/AspectRatioStrategyTest.java @@ -0,0 +1,53 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package io.flutter.plugins.camerax; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.when; + +import androidx.camera.core.resolutionselector.AspectRatioStrategy; +import io.flutter.plugin.common.BinaryMessenger; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnit; +import org.mockito.junit.MockitoRule; + +public class AspectRatioStrategyTest { + @Rule public MockitoRule mockitoRule = MockitoJUnit.rule(); + @Mock public AspectRatioStrategy mockAspectRatioStrategy; + @Mock public BinaryMessenger mockBinaryMessenger; + @Mock public AspectRatioStrategyHostApiImpl.AspectRatioStrategyProxy mockProxy; + + InstanceManager instanceManager; + + @Before + public void setUp() { + instanceManager = InstanceManager.create(identifier -> {}); + } + + @After + public void tearDown() { + instanceManager.stopFinalizationListener(); + } + + @Test + public void hostApiCreate() { + final Long preferredAspectRatio = 0L; + final Long fallbackRule = 1L; + + when(mockProxy.create(preferredAspectRatio, fallbackRule)).thenReturn(mockAspectRatioStrategy); + + final AspectRatioStrategyHostApiImpl hostApi = + new AspectRatioStrategyHostApiImpl(mockBinaryMessenger, instanceManager, mockProxy); + + final long instanceIdentifier = 0; + hostApi.create(instanceIdentifier, preferredAspectRatio, fallbackRule); + + assertEquals(instanceManager.getInstance(instanceIdentifier), mockAspectRatioStrategy); + } +} diff --git a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/ResolutionSelectorTest.java b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/ResolutionSelectorTest.java new file mode 100644 index 00000000000..237aa30adcf --- /dev/null +++ b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/ResolutionSelectorTest.java @@ -0,0 +1,61 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package io.flutter.plugins.camerax; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import androidx.camera.core.resolutionselector.AspectRatioStrategy; +import androidx.camera.core.resolutionselector.ResolutionSelector; +import androidx.camera.core.resolutionselector.ResolutionStrategy; +import io.flutter.plugin.common.BinaryMessenger; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnit; +import org.mockito.junit.MockitoRule; + +public class ResolutionSelectorTest { + @Rule public MockitoRule mockitoRule = MockitoJUnit.rule(); + @Mock public ResolutionSelector mockResolutionSelector; + @Mock public BinaryMessenger mockBinaryMessenger; + @Mock public ResolutionSelectorHostApiImpl.ResolutionSelectorProxy mockProxy; + + InstanceManager instanceManager; + + @Before + public void setUp() { + instanceManager = InstanceManager.create(identifier -> {}); + } + + @After + public void tearDown() { + instanceManager.stopFinalizationListener(); + } + + @Test + public void hostApiCreate() { + final ResolutionStrategy mockResolutionStrategy = mock(ResolutionStrategy.class); + final long resolutionStrategyIdentifier = 14; + instanceManager.addDartCreatedInstance(mockResolutionStrategy, resolutionStrategyIdentifier); + + final AspectRatioStrategy mockAspectRatioStrategy = mock(AspectRatioStrategy.class); + final long aspectRatioStrategyIdentifier = 15; + instanceManager.addDartCreatedInstance(mockAspectRatioStrategy, aspectRatioStrategyIdentifier); + + when(mockProxy.create(mockResolutionStrategy, mockAspectRatioStrategy)) + .thenReturn(mockResolutionSelector); + final ResolutionSelectorHostApiImpl hostApi = + new ResolutionSelectorHostApiImpl(mockBinaryMessenger, instanceManager, mockProxy); + + final long instanceIdentifier = 0; + hostApi.create(instanceIdentifier, resolutionStrategyIdentifier, aspectRatioStrategyIdentifier); + + assertEquals(instanceManager.getInstance(instanceIdentifier), mockResolutionSelector); + } +} diff --git a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/ResolutionStrategyTest.java b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/ResolutionStrategyTest.java new file mode 100644 index 00000000000..1028a55afe6 --- /dev/null +++ b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/ResolutionStrategyTest.java @@ -0,0 +1,58 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package io.flutter.plugins.camerax; + +import static org.junit.Assert.assertEquals; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.when; + +import android.util.Size; +import androidx.camera.core.resolutionselector.ResolutionStrategy; +import io.flutter.plugin.common.BinaryMessenger; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnit; +import org.mockito.junit.MockitoRule; + +public class ResolutionStrategyTest { + @Rule public MockitoRule mockitoRule = MockitoJUnit.rule(); + @Mock public ResolutionStrategy mockResolutionStrategy; + @Mock public BinaryMessenger mockBinaryMessenger; + @Mock public ResolutionStrategyHostApiImpl.ResolutionStrategyProxy mockProxy; + + InstanceManager instanceManager; + + @Before + public void setUp() { + instanceManager = InstanceManager.create(identifier -> {}); + } + + @After + public void tearDown() { + instanceManager.stopFinalizationListener(); + } + + @Test + public void hostApiCreate() { + final GeneratedCameraXLibrary.CameraSize boundSize = + new GeneratedCameraXLibrary.CameraSize.Builder().setWidth(50L).setHeight(30L).build(); + + final Long fallbackRule = 0L; + + when(mockProxy.create(any(Size.class), eq(fallbackRule))).thenReturn(mockResolutionStrategy); + + final ResolutionStrategyHostApiImpl hostApi = + new ResolutionStrategyHostApiImpl(mockBinaryMessenger, instanceManager, mockProxy); + + final long instanceIdentifier = 0; + hostApi.create(instanceIdentifier, boundSize, fallbackRule); + + assertEquals(instanceManager.getInstance(instanceIdentifier), mockResolutionStrategy); + } +} diff --git a/packages/camera/camera_android_camerax/lib/src/camerax_library.g.dart b/packages/camera/camera_android_camerax/lib/src/camerax_library.g.dart index 32a39a78531..fb52323a18f 100644 --- a/packages/camera/camera_android_camerax/lib/src/camerax_library.g.dart +++ b/packages/camera/camera_android_camerax/lib/src/camerax_library.g.dart @@ -1010,13 +1010,13 @@ class ResolutionStrategyHostApi { static const MessageCodec codec = _ResolutionStrategyHostApiCodec(); /// Create a new native instance and add it to the `InstanceManager`. - Future create( - int arg_identifier, CameraSize arg_size, int arg_fallbackRule) async { + Future create(int arg_identifier, CameraSize arg_boundSize, + int arg_fallbackRule) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ResolutionStrategyHostApi.create', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel - .send([arg_identifier, arg_size, arg_fallbackRule]) + .send([arg_identifier, arg_boundSize, arg_fallbackRule]) as List?; if (replyList == null) { throw PlatformException( diff --git a/packages/camera/camera_android_camerax/pigeons/camerax_library.dart b/packages/camera/camera_android_camerax/pigeons/camerax_library.dart index b6ea040a9df..241fc5aae04 100644 --- a/packages/camera/camera_android_camerax/pigeons/camerax_library.dart +++ b/packages/camera/camera_android_camerax/pigeons/camerax_library.dart @@ -167,7 +167,7 @@ abstract class ImageCaptureHostApi { @HostApi(dartHostTestHandler: 'TestResolutionStrategyHostApi') abstract class ResolutionStrategyHostApi { /// Create a new native instance and add it to the `InstanceManager`. - void create(int identifier, CameraSize size, int fallbackRule); + void create(int identifier, CameraSize boundSize, int fallbackRule); } /// Host API for `ResolutionSelector`. diff --git a/packages/camera/camera_android_camerax/test/test_camerax_library.g.dart b/packages/camera/camera_android_camerax/test/test_camerax_library.g.dart index 9cd83ec89a1..32708fdb0c6 100644 --- a/packages/camera/camera_android_camerax/test/test_camerax_library.g.dart +++ b/packages/camera/camera_android_camerax/test/test_camerax_library.g.dart @@ -736,7 +736,7 @@ abstract class TestResolutionStrategyHostApi { _TestResolutionStrategyHostApiCodec(); /// Create a new native instance and add it to the `InstanceManager`. - void create(int identifier, CameraSize size, int fallbackRule); + void create(int identifier, CameraSize boundSize, int fallbackRule); static void setup(TestResolutionStrategyHostApi? api, {BinaryMessenger? binaryMessenger}) { @@ -757,13 +757,13 @@ abstract class TestResolutionStrategyHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.ResolutionStrategyHostApi.create was null, expected non-null int.'); - final CameraSize? arg_size = (args[1] as CameraSize?); - assert(arg_size != null, + final CameraSize? arg_boundSize = (args[1] as CameraSize?); + assert(arg_boundSize != null, 'Argument for dev.flutter.pigeon.ResolutionStrategyHostApi.create was null, expected non-null CameraSize.'); final int? arg_fallbackRule = (args[2] as int?); assert(arg_fallbackRule != null, 'Argument for dev.flutter.pigeon.ResolutionStrategyHostApi.create was null, expected non-null int.'); - api.create(arg_identifier!, arg_size!, arg_fallbackRule!); + api.create(arg_identifier!, arg_boundSize!, arg_fallbackRule!); return []; }); } From 2a5c0fc48dac9d8a6ecd53c343338dd657b5b5c4 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Mon, 15 May 2023 15:56:22 -0700 Subject: [PATCH 04/34] Fix implementation --- .../camera_android_camerax/CHANGELOG.md | 4 + .../camerax/CameraAndroidCameraxPlugin.java | 2 + .../camerax/GeneratedCameraXLibrary.java | 164 ++---------------- .../camerax/ImageAnalysisHostApiImpl.java | 9 +- .../camerax/ImageCaptureHostApiImpl.java | 8 +- .../plugins/camerax/PreviewHostApiImpl.java | 8 +- .../ResolutionStrategyHostApiImpl.java | 18 +- .../camerax/ResolutionStrategyTest.java | 4 +- .../lib/src/android_camera_camerax.dart | 77 ++++---- .../lib/src/camerax_library.g.dart | 99 ++--------- .../lib/src/image_analysis.dart | 17 +- .../lib/src/image_capture.dart | 20 ++- .../lib/src/preview.dart | 22 ++- .../lib/src/resolution_strategy.dart | 30 ++-- .../pigeons/camerax_library.dart | 15 +- .../camera_android_camerax/pubspec.yaml | 2 +- .../test/resolution_strategy_test.dart | 6 +- .../test/resolution_strategy_test.mocks.dart | 2 +- .../test/test_camerax_library.g.dart | 87 ++-------- 19 files changed, 193 insertions(+), 401 deletions(-) diff --git a/packages/camera/camera_android_camerax/CHANGELOG.md b/packages/camera/camera_android_camerax/CHANGELOG.md index 13d2f18fb92..16ec38e886a 100644 --- a/packages/camera/camera_android_camerax/CHANGELOG.md +++ b/packages/camera/camera_android_camerax/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.5.0+3 + +* Implements resolution configuration for live camera preview, image capture, and image analysis use cases. + ## 0.5.0+2 * Adds a dependency on kotlin-bom to align versions of Kotlin transitive dependencies. diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/CameraAndroidCameraxPlugin.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/CameraAndroidCameraxPlugin.java index d386635257b..d1dd99810a9 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/CameraAndroidCameraxPlugin.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/CameraAndroidCameraxPlugin.java @@ -96,6 +96,8 @@ public void setUp( binaryMessenger, pendingRecordingHostApiImpl); videoCaptureHostApiImpl = new VideoCaptureHostApiImpl(binaryMessenger, instanceManager); GeneratedCameraXLibrary.VideoCaptureHostApi.setup(binaryMessenger, videoCaptureHostApiImpl); + GeneratedCameraXLibrary.ResolutionSelectorHostApi.setup(binaryMessenger, new ResolutionSelectorHostApiImpl(binaryMessenger, instanceManager)); + GeneratedCameraXLibrary.ResolutionStrategyHostApi.setup(binaryMessenger, new ResolutionStrategyHostApiImpl(binaryMessenger, instanceManager)); } @Override diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/GeneratedCameraXLibrary.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/GeneratedCameraXLibrary.java index ea9968a342d..2d9645bdf4c 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/GeneratedCameraXLibrary.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/GeneratedCameraXLibrary.java @@ -254,79 +254,6 @@ ArrayList toList() { } } - /** Generated class from Pigeon that represents data sent in messages. */ - public static final class CameraSize { - private @NonNull Long width; - - public @NonNull Long getWidth() { - return width; - } - - public void setWidth(@NonNull Long setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"width\" is null."); - } - this.width = setterArg; - } - - private @NonNull Long height; - - public @NonNull Long getHeight() { - return height; - } - - public void setHeight(@NonNull Long setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"height\" is null."); - } - this.height = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - CameraSize() {} - - public static final class Builder { - - private @Nullable Long width; - - public @NonNull Builder setWidth(@NonNull Long setterArg) { - this.width = setterArg; - return this; - } - - private @Nullable Long height; - - public @NonNull Builder setHeight(@NonNull Long setterArg) { - this.height = setterArg; - return this; - } - - public @NonNull CameraSize build() { - CameraSize pigeonReturn = new CameraSize(); - pigeonReturn.setWidth(width); - pigeonReturn.setHeight(height); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList(2); - toListResult.add(width); - toListResult.add(height); - return toListResult; - } - - static @NonNull CameraSize fromList(@NonNull ArrayList list) { - CameraSize pigeonResult = new CameraSize(); - Object width = list.get(0); - pigeonResult.setWidth((width == null) ? null : ((width instanceof Integer) ? (Integer) width : (Long) width)); - Object height = list.get(1); - pigeonResult.setHeight((height == null) ? null : ((height instanceof Integer) ? (Integer) height : (Long) height)); - return pigeonResult; - } - } - /** Generated class from Pigeon that represents data sent in messages. */ public static final class CameraStateTypeData { private @NonNull CameraStateType value; @@ -1303,8 +1230,6 @@ protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { switch (type) { case (byte) 128: return ResolutionInfo.fromList((ArrayList) readValue(buffer)); - case (byte) 129: - return ResolutionInfo.fromList((ArrayList) readValue(buffer)); default: return super.readValueOfType(type, buffer); } @@ -1315,9 +1240,6 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { if (value instanceof ResolutionInfo) { stream.write(128); writeValue(stream, ((ResolutionInfo) value).toList()); - } else if (value instanceof ResolutionInfo) { - stream.write(129); - writeValue(stream, ((ResolutionInfo) value).toList()); } else { super.writeValue(stream, value); } @@ -1327,7 +1249,7 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface PreviewHostApi { - void create(@NonNull Long identifier, @Nullable Long rotation, @Nullable ResolutionInfo targetResolution); + void create(@NonNull Long identifier, @Nullable Long rotation, @Nullable Long resolutionSelectorId); @NonNull Long setSurfaceProvider(@NonNull Long identifier); @@ -1354,9 +1276,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PreviewHos ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); Number rotationArg = (Number) args.get(1); - ResolutionInfo targetResolutionArg = (ResolutionInfo) args.get(2); + Number resolutionSelectorIdArg = (Number) args.get(2); try { - api.create((identifierArg == null) ? null : identifierArg.longValue(), (rotationArg == null) ? null : rotationArg.longValue(), targetResolutionArg); + api.create((identifierArg == null) ? null : identifierArg.longValue(), (rotationArg == null) ? null : rotationArg.longValue(), (resolutionSelectorIdArg == null) ? null : resolutionSelectorIdArg.longValue()); wrapped.add(0, null); } catch (Throwable exception) { @@ -1884,37 +1806,10 @@ public void create(@NonNull Long identifierArg, @NonNull Reply callback) { channelReply -> callback.reply(null)); } } - - private static class ImageCaptureHostApiCodec extends StandardMessageCodec { - public static final ImageCaptureHostApiCodec INSTANCE = new ImageCaptureHostApiCodec(); - - private ImageCaptureHostApiCodec() {} - - @Override - protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { - switch (type) { - case (byte) 128: - return ResolutionInfo.fromList((ArrayList) readValue(buffer)); - default: - return super.readValueOfType(type, buffer); - } - } - - @Override - protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { - if (value instanceof ResolutionInfo) { - stream.write(128); - writeValue(stream, ((ResolutionInfo) value).toList()); - } else { - super.writeValue(stream, value); - } - } - } - /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface ImageCaptureHostApi { - void create(@NonNull Long identifier, @Nullable Long flashMode, @Nullable ResolutionInfo targetResolution); + void create(@NonNull Long identifier, @Nullable Long flashMode, @Nullable Long resolutionSelectorId); void setFlashMode(@NonNull Long identifier, @NonNull Long flashMode); @@ -1922,7 +1817,7 @@ public interface ImageCaptureHostApi { /** The codec used by ImageCaptureHostApi. */ static @NonNull MessageCodec getCodec() { - return ImageCaptureHostApiCodec.INSTANCE; + return new StandardMessageCodec(); } /**Sets up an instance of `ImageCaptureHostApi` to handle messages through the `binaryMessenger`. */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageCaptureHostApi api) { @@ -1937,9 +1832,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageCaptu ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); Number flashModeArg = (Number) args.get(1); - ResolutionInfo targetResolutionArg = (ResolutionInfo) args.get(2); + Number resolutionSelectorIdArg = (Number) args.get(2); try { - api.create((identifierArg == null) ? null : identifierArg.longValue(), (flashModeArg == null) ? null : flashModeArg.longValue(), targetResolutionArg); + api.create((identifierArg == null) ? null : identifierArg.longValue(), (flashModeArg == null) ? null : flashModeArg.longValue(), (resolutionSelectorIdArg == null) ? null : resolutionSelectorIdArg.longValue()); wrapped.add(0, null); } catch (Throwable exception) { @@ -2018,7 +1913,7 @@ private ResolutionStrategyHostApiCodec() {} protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { switch (type) { case (byte) 128: - return CameraSize.fromList((ArrayList) readValue(buffer)); + return ResolutionInfo.fromList((ArrayList) readValue(buffer)); default: return super.readValueOfType(type, buffer); } @@ -2026,9 +1921,9 @@ protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { @Override protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { - if (value instanceof CameraSize) { + if (value instanceof ResolutionInfo) { stream.write(128); - writeValue(stream, ((CameraSize) value).toList()); + writeValue(stream, ((ResolutionInfo) value).toList()); } else { super.writeValue(stream, value); } @@ -2046,7 +1941,7 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { */ public interface ResolutionStrategyHostApi { /** Create a new native instance and add it to the `InstanceManager`. */ - void create(@NonNull Long identifier, @NonNull CameraSize boundSize, @NonNull Long fallbackRule); + void create(@NonNull Long identifier, @Nullable ResolutionInfo boundSize, @Nullable Long fallbackRule); /** The codec used by ResolutionStrategyHostApi. */ static @NonNull MessageCodec getCodec() { @@ -2064,7 +1959,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable Resolution ArrayList wrapped = new ArrayList(); ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); - CameraSize boundSizeArg = (CameraSize) args.get(1); + ResolutionInfo boundSizeArg = (ResolutionInfo) args.get(1); Number fallbackRuleArg = (Number) args.get(2); try { api.create((identifierArg == null) ? null : identifierArg.longValue(), boundSizeArg, (fallbackRuleArg == null) ? null : fallbackRuleArg.longValue()); @@ -2308,37 +2203,10 @@ public void create(@NonNull Long identifierArg, @NonNull Double minZoomRatioArg, channelReply -> callback.reply(null)); } } - - private static class ImageAnalysisHostApiCodec extends StandardMessageCodec { - public static final ImageAnalysisHostApiCodec INSTANCE = new ImageAnalysisHostApiCodec(); - - private ImageAnalysisHostApiCodec() {} - - @Override - protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { - switch (type) { - case (byte) 128: - return ResolutionInfo.fromList((ArrayList) readValue(buffer)); - default: - return super.readValueOfType(type, buffer); - } - } - - @Override - protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { - if (value instanceof ResolutionInfo) { - stream.write(128); - writeValue(stream, ((ResolutionInfo) value).toList()); - } else { - super.writeValue(stream, value); - } - } - } - /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface ImageAnalysisHostApi { - void create(@NonNull Long identifier, @Nullable ResolutionInfo targetResolutionIdentifier); + void create(@NonNull Long identifier, @Nullable Long resolutionSelectorId); void setAnalyzer(@NonNull Long identifier, @NonNull Long analyzerIdentifier); @@ -2346,7 +2214,7 @@ public interface ImageAnalysisHostApi { /** The codec used by ImageAnalysisHostApi. */ static @NonNull MessageCodec getCodec() { - return ImageAnalysisHostApiCodec.INSTANCE; + return new StandardMessageCodec(); } /**Sets up an instance of `ImageAnalysisHostApi` to handle messages through the `binaryMessenger`. */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageAnalysisHostApi api) { @@ -2360,9 +2228,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageAnaly ArrayList wrapped = new ArrayList(); ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); - ResolutionInfo targetResolutionIdentifierArg = (ResolutionInfo) args.get(1); + Number resolutionSelectorIdArg = (Number) args.get(1); try { - api.create((identifierArg == null) ? null : identifierArg.longValue(), targetResolutionIdentifierArg); + api.create((identifierArg == null) ? null : identifierArg.longValue(), (resolutionSelectorIdArg == null) ? null : resolutionSelectorIdArg.longValue()); wrapped.add(0, null); } catch (Throwable exception) { diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/ImageAnalysisHostApiImpl.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/ImageAnalysisHostApiImpl.java index 5e786176d50..1e9c2ff5c78 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/ImageAnalysisHostApiImpl.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/ImageAnalysisHostApiImpl.java @@ -9,6 +9,7 @@ import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import androidx.camera.core.ImageAnalysis; +import androidx.camera.core.resolutionselector.ResolutionSelector; import androidx.core.content.ContextCompat; import io.flutter.plugin.common.BinaryMessenger; import io.flutter.plugins.camerax.GeneratedCameraXLibrary.ImageAnalysisHostApi; @@ -38,11 +39,11 @@ public void setContext(@NonNull Context context) { /** Creates an {@link ImageAnalysis} instance with the target resolution if specified. */ @Override - public void create(@NonNull Long identifier, @Nullable ResolutionInfo targetResolution) { + public void create(@NonNull Long identifier, @Nullable Long resolutionSelectorId) { ImageAnalysis.Builder imageAnalysisBuilder = cameraXProxy.createImageAnalysisBuilder(); - - if (targetResolution != null) { - imageAnalysisBuilder.setTargetResolution(CameraXProxy.sizeFromResolution(targetResolution)); + ResolutionSelector resolutionSelector = instanceManager.getInstance(resolutionSelectorId); + if (resolutionSelector != null) { + imageAnalysisBuilder.setResolutionSelector(resolutionSelector); } ImageAnalysis imageAnalysis = imageAnalysisBuilder.build(); diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/ImageCaptureHostApiImpl.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/ImageCaptureHostApiImpl.java index 0c00ed63f2f..acea57f3db7 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/ImageCaptureHostApiImpl.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/ImageCaptureHostApiImpl.java @@ -10,6 +10,7 @@ import androidx.annotation.VisibleForTesting; import androidx.camera.core.ImageCapture; import androidx.camera.core.ImageCaptureException; +import androidx.camera.core.resolutionselector.ResolutionSelector; import io.flutter.plugin.common.BinaryMessenger; import io.flutter.plugins.camerax.GeneratedCameraXLibrary.ImageCaptureHostApi; import java.io.File; @@ -54,14 +55,15 @@ public void setContext(Context context) { public void create( @NonNull Long identifier, @Nullable Long flashMode, - @Nullable GeneratedCameraXLibrary.ResolutionInfo targetResolution) { + @Nullable Long resolutionSelectorId) { ImageCapture.Builder imageCaptureBuilder = cameraXProxy.createImageCaptureBuilder(); + ResolutionSelector resolutionSelector = instanceManager.getInstance(resolutionSelectorId); if (flashMode != null) { // This sets the requested flash mode, but may fail silently. imageCaptureBuilder.setFlashMode(flashMode.intValue()); } - if (targetResolution != null) { - imageCaptureBuilder.setTargetResolution(CameraXProxy.sizeFromResolution(targetResolution)); + if (resolutionSelector != null) { + imageCaptureBuilder.setResolutionSelector(resolutionSelector); } ImageCapture imageCapture = imageCaptureBuilder.build(); instanceManager.addDartCreatedInstance(imageCapture, identifier); diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/PreviewHostApiImpl.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/PreviewHostApiImpl.java index e89b4bc9eab..411f292acd5 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/PreviewHostApiImpl.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/PreviewHostApiImpl.java @@ -12,6 +12,7 @@ import androidx.annotation.VisibleForTesting; import androidx.camera.core.Preview; import androidx.camera.core.SurfaceRequest; +import androidx.camera.core.resolutionselector.ResolutionSelector; import io.flutter.plugin.common.BinaryMessenger; import io.flutter.plugins.camerax.GeneratedCameraXLibrary.PreviewHostApi; import io.flutter.view.TextureRegistry; @@ -40,13 +41,14 @@ public PreviewHostApiImpl( public void create( @NonNull Long identifier, @Nullable Long rotation, - @Nullable GeneratedCameraXLibrary.ResolutionInfo targetResolution) { + @Nullable Long resolutionSelectorId) { Preview.Builder previewBuilder = cameraXProxy.createPreviewBuilder(); + ResolutionSelector resolutionSelector = instanceManager.getInstance(resolutionSelectorId); if (rotation != null) { previewBuilder.setTargetRotation(rotation.intValue()); } - if (targetResolution != null) { - previewBuilder.setTargetResolution(CameraXProxy.sizeFromResolution(targetResolution)); + if (resolutionSelector != null) { + previewBuilder.setResolutionSelector(resolutionSelector); } Preview preview = previewBuilder.build(); instanceManager.addDartCreatedInstance(preview, identifier); diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/ResolutionStrategyHostApiImpl.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/ResolutionStrategyHostApiImpl.java index c2a0bd01311..4d7a0989c3e 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/ResolutionStrategyHostApiImpl.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/ResolutionStrategyHostApiImpl.java @@ -6,6 +6,7 @@ import android.util.Size; import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import androidx.camera.core.resolutionselector.ResolutionStrategy; import io.flutter.plugin.common.BinaryMessenger; @@ -67,12 +68,19 @@ public ResolutionStrategyHostApiImpl( @Override public void create( @NonNull Long identifier, - @NonNull GeneratedCameraXLibrary.CameraSize boundSize, - @NonNull Long fallbackRule) { + @Nullable GeneratedCameraXLibrary.ResolutionInfo boundSize, + @Nullable Long fallbackRule) { + ResolutionStrategy resolutionStrategy; + if (boundSize == null) { + resolutionStrategy = ResolutionStrategy.HIGHEST_AVAILABLE_STRATEGY; + } + else { + resolutionStrategy = proxy.create( + new Size(boundSize.getWidth().intValue(), boundSize.getHeight().intValue()), + fallbackRule); + } instanceManager.addDartCreatedInstance( - proxy.create( - new Size(boundSize.getWidth().intValue(), boundSize.getHeight().intValue()), - fallbackRule), + resolutionStrategy, identifier); } } diff --git a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/ResolutionStrategyTest.java b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/ResolutionStrategyTest.java index 1028a55afe6..101e2e3068d 100644 --- a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/ResolutionStrategyTest.java +++ b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/ResolutionStrategyTest.java @@ -40,8 +40,8 @@ public void tearDown() { @Test public void hostApiCreate() { - final GeneratedCameraXLibrary.CameraSize boundSize = - new GeneratedCameraXLibrary.CameraSize.Builder().setWidth(50L).setHeight(30L).build(); + final GeneratedCameraXLibrary.ResolutionInfo boundSize = + new GeneratedCameraXLibrary.ResolutionInfo().Builder().setWidth(50L).setHeight(30L).build(); final Long fallbackRule = 0L; diff --git a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart index 93f6da6fe0c..d0ee05c9826 100644 --- a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart +++ b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart @@ -27,6 +27,8 @@ import 'preview.dart'; import 'process_camera_provider.dart'; import 'recorder.dart'; import 'recording.dart'; +import 'resolution_selector.dart'; +import 'resolution_strategy.dart'; import 'surface.dart'; import 'system_services.dart'; import 'use_case.dart'; @@ -113,9 +115,10 @@ class AndroidCameraCameraX extends CameraPlatform { @visibleForTesting CameraSelector? cameraSelector; - /// The resolution preset used to create a camera that should be used for - /// capturing still images and recording video. - ResolutionPreset? _resolutionPreset; + /// The [ResolutionSelector] that represents resolution preset used to create + /// a camera that should be used for capturing still images, recording video, + /// and image analysis. + ResolutionSelector? _presetResolutionSelector; /// The controller we need to broadcast the different camera events. /// @@ -225,24 +228,22 @@ class AndroidCameraCameraX extends CameraPlatform { // Start listening for device orientation changes preceding camera creation. startListeningForDeviceOrientationChange( cameraIsFrontFacing, cameraDescription.sensorOrientation); + // Determine ResolutionSelector based on preset for camera UseCases. + _presetResolutionSelector = + await _getResolutionSelectorFromPreset(resolutionPreset); // Retrieve a fresh ProcessCameraProvider instance. processCameraProvider ??= await ProcessCameraProvider.getInstance(); processCameraProvider!.unbindAll(); // Configure Preview instance. - _resolutionPreset = resolutionPreset; final int targetRotation = _getTargetRotation(cameraDescription.sensorOrientation); - final ResolutionInfo? previewTargetResolution = - _getResolutionInfoFromPreset(resolutionPreset); - preview = createPreview(targetRotation, previewTargetResolution); + preview = createPreview(targetRotation, _presetResolutionSelector); final int flutterSurfaceTextureId = await preview!.setSurfaceProvider(); // Configure ImageCapture instance. - final ResolutionInfo? imageCaptureTargetResolution = - _getResolutionInfoFromPreset(_resolutionPreset); - imageCapture = createImageCapture(null, imageCaptureTargetResolution); + imageCapture = createImageCapture(null, _presetResolutionSelector); // Configure VideoCapture and Recorder instances. // TODO(gmackall): Enable video capture resolution configuration in createRecorder(). @@ -632,7 +633,7 @@ class AndroidCameraCameraX extends CameraPlatform { // TODO(camsim99): Support resolution configuration. // Defaults to YUV_420_888 image format. - imageAnalysis = createImageAnalysis(null); + imageAnalysis = createImageAnalysis(_presetResolutionSelector); imageAnalysis!.setAnalyzer(analyzer); // TODO(camsim99): Reset live camera state observers here when @@ -765,27 +766,44 @@ class AndroidCameraCameraX extends CameraPlatform { } } - /// Returns [ResolutionInfo] that maps to the specified resolution preset for - ResolutionInfo? _getResolutionInfoFromPreset(ResolutionPreset? preset) { - // TODO(camsim99): File issue for adding warnings about CameraX limits on resolution configuration, and for allowing further configuration. - // TODO(camsim99): max is different for ImageAnalysis, so add further functionality once its PR is merged. + Future _getResolutionSelectorFromPreset( + ResolutionPreset? preset) async { + ResolutionStrategy? resolutionStrategy; + const int generalFallbackRule = + ResolutionStrategy.fallbackRuleClosestHigher; switch (preset) { case ResolutionPreset.low: - return ResolutionInfo(width: 320, height: 240); + resolutionStrategy = ResolutionStrategy( + boundSize: const Size(320, 240), fallbackRule: generalFallbackRule); + break; case ResolutionPreset.medium: - return ResolutionInfo(width: 720, height: 480); + resolutionStrategy = ResolutionStrategy( + boundSize: const Size(720, 480), fallbackRule: generalFallbackRule); + break; case ResolutionPreset.high: - return ResolutionInfo(width: 1280, height: 720); + resolutionStrategy = ResolutionStrategy( + boundSize: const Size(1280, 720), + fallbackRule: generalFallbackRule); + break; case ResolutionPreset.veryHigh: - return ResolutionInfo(width: 1920, height: 1080); + resolutionStrategy = ResolutionStrategy( + boundSize: const Size(1920, 1080), + fallbackRule: generalFallbackRule); + break; case ResolutionPreset.ultraHigh: - return ResolutionInfo(width: 3840, height: 2160); + resolutionStrategy = ResolutionStrategy( + boundSize: const Size(3840, 2160), + fallbackRule: generalFallbackRule); + break; case ResolutionPreset.max: + resolutionStrategy = ResolutionStrategy.getHighestAvailableStrategy(); + break; case null: - // Default to maximum resolution avaiable or highest device-preferred - // resolution that matches default aspect ratio. - return null; + // TODO(camsim99): Add comment here about default behavior. + break; } + + return ResolutionSelector(resolutionStrategy: resolutionStrategy); } // Methods for calls that need to be tested: @@ -820,18 +838,19 @@ class AndroidCameraCameraX extends CameraPlatform { /// Returns a [Preview] configured with the specified target rotation and /// resolution. @visibleForTesting - Preview createPreview(int targetRotation, ResolutionInfo? targetResolution) { + Preview createPreview( + int targetRotation, ResolutionSelector? resolutionSelector) { return Preview( - targetRotation: targetRotation, targetResolution: targetResolution); + targetRotation: targetRotation, resolutionSelector: resolutionSelector); } /// Returns an [ImageCapture] configured with specified flash mode and /// target resolution. @visibleForTesting ImageCapture createImageCapture( - int? flashMode, ResolutionInfo? targetResolution) { + int? flashMode, ResolutionSelector? resolutionSelector) { return ImageCapture( - targetFlashMode: flashMode, targetResolution: targetResolution); + targetFlashMode: flashMode, resolutionSelector: resolutionSelector); } /// Returns a [Recorder] for use in video capture. @@ -848,7 +867,7 @@ class AndroidCameraCameraX extends CameraPlatform { /// Returns an [ImageAnalysis] configured with specified target resolution. @visibleForTesting - ImageAnalysis createImageAnalysis(ResolutionInfo? targetResolution) { - return ImageAnalysis(targetResolution: targetResolution); + ImageAnalysis createImageAnalysis(ResolutionSelector? resolutionSelector) { + return ImageAnalysis(resolutionSelector: resolutionSelector); } } diff --git a/packages/camera/camera_android_camerax/lib/src/camerax_library.g.dart b/packages/camera/camera_android_camerax/lib/src/camerax_library.g.dart index 3f1f3d87f12..8183d5f43e8 100644 --- a/packages/camera/camera_android_camerax/lib/src/camerax_library.g.dart +++ b/packages/camera/camera_android_camerax/lib/src/camerax_library.g.dart @@ -95,32 +95,6 @@ class CameraPermissionsErrorData { } } -class CameraSize { - CameraSize({ - required this.width, - required this.height, - }); - - int width; - - int height; - - Object encode() { - return [ - width, - height, - ]; - } - - static CameraSize decode(Object result) { - result as List; - return CameraSize( - width: result[0]! as int, - height: result[1]! as int, - ); - } -} - class CameraStateTypeData { CameraStateTypeData({ required this.value, @@ -962,9 +936,6 @@ class _PreviewHostApiCodec extends StandardMessageCodec { if (value is ResolutionInfo) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else if (value is ResolutionInfo) { - buffer.putUint8(129); - writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } @@ -975,8 +946,6 @@ class _PreviewHostApiCodec extends StandardMessageCodec { switch (type) { case 128: return ResolutionInfo.decode(readValue(buffer)!); - case 129: - return ResolutionInfo.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); } @@ -993,12 +962,12 @@ class PreviewHostApi { static const MessageCodec codec = _PreviewHostApiCodec(); - Future create(int arg_identifier, int? arg_rotation, ResolutionInfo? arg_targetResolution) async { + Future create(int arg_identifier, int? arg_rotation, int? arg_resolutionSelectorId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PreviewHostApi.create', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_identifier, arg_rotation, arg_targetResolution]) as List?; + await channel.send([arg_identifier, arg_rotation, arg_resolutionSelectorId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1522,29 +1491,6 @@ abstract class RecordingFlutterApi { } } -class _ImageCaptureHostApiCodec extends StandardMessageCodec { - const _ImageCaptureHostApiCodec(); - @override - void writeValue(WriteBuffer buffer, Object? value) { - if (value is ResolutionInfo) { - buffer.putUint8(128); - writeValue(buffer, value.encode()); - } else { - super.writeValue(buffer, value); - } - } - - @override - Object? readValueOfType(int type, ReadBuffer buffer) { - switch (type) { - case 128: - return ResolutionInfo.decode(readValue(buffer)!); - default: - return super.readValueOfType(type, buffer); - } - } -} - class ImageCaptureHostApi { /// Constructor for [ImageCaptureHostApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default @@ -1553,14 +1499,14 @@ class ImageCaptureHostApi { : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; - static const MessageCodec codec = _ImageCaptureHostApiCodec(); + static const MessageCodec codec = StandardMessageCodec(); - Future create(int arg_identifier, int? arg_flashMode, ResolutionInfo? arg_targetResolution) async { + Future create(int arg_identifier, int? arg_flashMode, int? arg_resolutionSelectorId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ImageCaptureHostApi.create', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_identifier, arg_flashMode, arg_targetResolution]) as List?; + await channel.send([arg_identifier, arg_flashMode, arg_resolutionSelectorId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1631,7 +1577,7 @@ class _ResolutionStrategyHostApiCodec extends StandardMessageCodec { const _ResolutionStrategyHostApiCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { - if (value is CameraSize) { + if (value is ResolutionInfo) { buffer.putUint8(128); writeValue(buffer, value.encode()); } else { @@ -1643,7 +1589,7 @@ class _ResolutionStrategyHostApiCodec extends StandardMessageCodec { Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { case 128: - return CameraSize.decode(readValue(buffer)!); + return ResolutionInfo.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); } @@ -1666,7 +1612,7 @@ class ResolutionStrategyHostApi { static const MessageCodec codec = _ResolutionStrategyHostApiCodec(); /// Create a new native instance and add it to the `InstanceManager`. - Future create(int arg_identifier, CameraSize arg_boundSize, int arg_fallbackRule) async { + Future create(int arg_identifier, ResolutionInfo? arg_boundSize, int? arg_fallbackRule) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ResolutionStrategyHostApi.create', codec, binaryMessenger: _binaryMessenger); @@ -1913,29 +1859,6 @@ abstract class ZoomStateFlutterApi { } } -class _ImageAnalysisHostApiCodec extends StandardMessageCodec { - const _ImageAnalysisHostApiCodec(); - @override - void writeValue(WriteBuffer buffer, Object? value) { - if (value is ResolutionInfo) { - buffer.putUint8(128); - writeValue(buffer, value.encode()); - } else { - super.writeValue(buffer, value); - } - } - - @override - Object? readValueOfType(int type, ReadBuffer buffer) { - switch (type) { - case 128: - return ResolutionInfo.decode(readValue(buffer)!); - default: - return super.readValueOfType(type, buffer); - } - } -} - class ImageAnalysisHostApi { /// Constructor for [ImageAnalysisHostApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default @@ -1944,14 +1867,14 @@ class ImageAnalysisHostApi { : _binaryMessenger = binaryMessenger; final BinaryMessenger? _binaryMessenger; - static const MessageCodec codec = _ImageAnalysisHostApiCodec(); + static const MessageCodec codec = StandardMessageCodec(); - Future create(int arg_identifier, ResolutionInfo? arg_targetResolutionIdentifier) async { + Future create(int arg_identifier, int? arg_resolutionSelectorId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ImageAnalysisHostApi.create', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_identifier, arg_targetResolutionIdentifier]) as List?; + await channel.send([arg_identifier, arg_resolutionSelectorId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', diff --git a/packages/camera/camera_android_camerax/lib/src/image_analysis.dart b/packages/camera/camera_android_camerax/lib/src/image_analysis.dart index 7ffaba72eca..cc3e64564ce 100644 --- a/packages/camera/camera_android_camerax/lib/src/image_analysis.dart +++ b/packages/camera/camera_android_camerax/lib/src/image_analysis.dart @@ -11,6 +11,7 @@ import 'android_camera_camerax_flutter_api_impls.dart'; import 'camerax_library.g.dart'; import 'instance_manager.dart'; import 'java_object.dart'; +import 'resolution_selector.dart'; import 'use_case.dart'; /// Use case for providing CPU accessible images for performing image analysis. @@ -21,13 +22,13 @@ class ImageAnalysis extends UseCase { ImageAnalysis( {BinaryMessenger? binaryMessenger, InstanceManager? instanceManager, - this.targetResolution}) + this.resolutionSelector}) : super.detached( binaryMessenger: binaryMessenger, instanceManager: instanceManager) { _api = _ImageAnalysisHostApiImpl( binaryMessenger: binaryMessenger, instanceManager: instanceManager); - _api.createfromInstances(this, targetResolution); + _api.createfromInstances(this, resolutionSelector); AndroidCameraXCameraFlutterApis.instance.ensureSetUp(); } @@ -35,7 +36,7 @@ class ImageAnalysis extends UseCase { ImageAnalysis.detached( {BinaryMessenger? binaryMessenger, InstanceManager? instanceManager, - this.targetResolution}) + this.resolutionSelector}) : super.detached( binaryMessenger: binaryMessenger, instanceManager: instanceManager) { @@ -47,7 +48,7 @@ class ImageAnalysis extends UseCase { late final _ImageAnalysisHostApiImpl _api; /// Target resolution of the camera preview stream. - final ResolutionInfo? targetResolution; + final ResolutionSelector? resolutionSelector; /// Sets an [Analyzer] to receive and analyze images. Future setAnalyzer(Analyzer analyzer) => @@ -81,18 +82,20 @@ class _ImageAnalysisHostApiImpl extends ImageAnalysisHostApi { /// on the native side. Future createfromInstances( ImageAnalysis instance, - ResolutionInfo? targetResolution, + ResolutionSelector? resolutionSelector, ) { return create( instanceManager.addDartCreatedInstance( instance, onCopy: (ImageAnalysis original) => ImageAnalysis.detached( - targetResolution: original.targetResolution, + resolutionSelector: original.resolutionSelector, binaryMessenger: binaryMessenger, instanceManager: instanceManager, ), ), - targetResolution, + resolutionSelector == null + ? null + : instanceManager.getIdentifier(resolutionSelector), ); } diff --git a/packages/camera/camera_android_camerax/lib/src/image_capture.dart b/packages/camera/camera_android_camerax/lib/src/image_capture.dart index 6a9b2dedd04..e2c27fe5ce9 100644 --- a/packages/camera/camera_android_camerax/lib/src/image_capture.dart +++ b/packages/camera/camera_android_camerax/lib/src/image_capture.dart @@ -7,6 +7,7 @@ import 'package:flutter/services.dart' show BinaryMessenger; import 'camerax_library.g.dart'; import 'instance_manager.dart'; import 'java_object.dart'; +import 'resolution_selector.dart'; import 'use_case.dart'; /// Use case for picture taking. @@ -18,14 +19,14 @@ class ImageCapture extends UseCase { BinaryMessenger? binaryMessenger, InstanceManager? instanceManager, this.targetFlashMode, - this.targetResolution, + this.resolutionSelector, }) : super.detached( binaryMessenger: binaryMessenger, instanceManager: instanceManager, ) { _api = ImageCaptureHostApiImpl( binaryMessenger: binaryMessenger, instanceManager: instanceManager); - _api.createFromInstance(this, targetFlashMode, targetResolution); + _api.createFromInstance(this, targetFlashMode, resolutionSelector); } /// Constructs a [ImageCapture] that is not automatically attached to a native object. @@ -33,7 +34,7 @@ class ImageCapture extends UseCase { BinaryMessenger? binaryMessenger, InstanceManager? instanceManager, this.targetFlashMode, - this.targetResolution, + this.resolutionSelector, }) : super.detached( binaryMessenger: binaryMessenger, instanceManager: instanceManager, @@ -48,7 +49,7 @@ class ImageCapture extends UseCase { final int? targetFlashMode; /// Target resolution of the image output from taking a picture. - final ResolutionInfo? targetResolution; + final ResolutionSelector? resolutionSelector; /// Constant for automatic flash mode. /// @@ -119,16 +120,21 @@ class ImageCaptureHostApiImpl extends ImageCaptureHostApi { /// Creates an [ImageCapture] instance with the flash mode and target resolution /// if specified. void createFromInstance(ImageCapture instance, int? targetFlashMode, - ResolutionInfo? targetResolution) { + ResolutionSelector? resolutionSelector) { final int identifier = instanceManager.addDartCreatedInstance(instance, onCopy: (ImageCapture original) { return ImageCapture.detached( binaryMessenger: binaryMessenger, instanceManager: instanceManager, targetFlashMode: original.targetFlashMode, - targetResolution: original.targetResolution); + resolutionSelector: original.resolutionSelector); }); - create(identifier, targetFlashMode, targetResolution); + create( + identifier, + targetFlashMode, + resolutionSelector == null + ? null + : instanceManager.getIdentifier(resolutionSelector)); } /// Sets the flash mode for the specified [ImageCapture] instance to take diff --git a/packages/camera/camera_android_camerax/lib/src/preview.dart b/packages/camera/camera_android_camerax/lib/src/preview.dart index c3094d71417..060d302a45e 100644 --- a/packages/camera/camera_android_camerax/lib/src/preview.dart +++ b/packages/camera/camera_android_camerax/lib/src/preview.dart @@ -7,6 +7,7 @@ import 'package:flutter/services.dart' show BinaryMessenger; import 'camerax_library.g.dart'; import 'instance_manager.dart'; import 'java_object.dart'; +import 'resolution_selector.dart'; import 'use_case.dart'; /// Use case that provides a camera preview stream for display. @@ -18,13 +19,13 @@ class Preview extends UseCase { {BinaryMessenger? binaryMessenger, InstanceManager? instanceManager, this.targetRotation, - this.targetResolution}) + this.resolutionSelector}) : super.detached( binaryMessenger: binaryMessenger, instanceManager: instanceManager) { _api = PreviewHostApiImpl( binaryMessenger: binaryMessenger, instanceManager: instanceManager); - _api.createFromInstance(this, targetRotation, targetResolution); + _api.createFromInstance(this, targetRotation, resolutionSelector); } /// Constructs a [Preview] that is not automatically attached to a native object. @@ -32,7 +33,7 @@ class Preview extends UseCase { {BinaryMessenger? binaryMessenger, InstanceManager? instanceManager, this.targetRotation, - this.targetResolution}) + this.resolutionSelector}) : super.detached( binaryMessenger: binaryMessenger, instanceManager: instanceManager) { @@ -46,7 +47,7 @@ class Preview extends UseCase { final int? targetRotation; /// Target resolution of the camera preview stream. - final ResolutionInfo? targetResolution; + final ResolutionSelector? resolutionSelector; /// Sets the surface provider for the preview stream. /// @@ -90,17 +91,22 @@ class PreviewHostApiImpl extends PreviewHostApi { /// Creates a [Preview] with the target rotation and target resolution if /// specified. - void createFromInstance( - Preview instance, int? targetRotation, ResolutionInfo? targetResolution) { + void createFromInstance(Preview instance, int? targetRotation, + ResolutionSelector? resolutionSelector) { final int identifier = instanceManager.addDartCreatedInstance(instance, onCopy: (Preview original) { return Preview.detached( binaryMessenger: binaryMessenger, instanceManager: instanceManager, targetRotation: original.targetRotation, - targetResolution: original.targetResolution); + resolutionSelector: original.resolutionSelector); }); - create(identifier, targetRotation, targetResolution); + create( + identifier, + targetRotation, + resolutionSelector == null + ? null + : instanceManager.getIdentifier(resolutionSelector)); } /// Sets the surface provider of the specified [Preview] instance and returns diff --git a/packages/camera/camera_android_camerax/lib/src/resolution_strategy.dart b/packages/camera/camera_android_camerax/lib/src/resolution_strategy.dart index 388e71c6124..d4cb7dcac26 100644 --- a/packages/camera/camera_android_camerax/lib/src/resolution_strategy.dart +++ b/packages/camera/camera_android_camerax/lib/src/resolution_strategy.dart @@ -15,8 +15,8 @@ import 'java_object.dart'; class ResolutionStrategy extends JavaObject { /// Construct a [ResolutionStrategy]. ResolutionStrategy({ - required this.boundSize, - required this.fallbackRule, + this.boundSize, + this.fallbackRule, super.binaryMessenger, super.instanceManager, }) : _api = _ResolutionStrategyHostApiImpl( @@ -83,14 +83,22 @@ class ResolutionStrategy extends JavaObject { /// See https://developer.android.com/reference/androidx/camera/core/resolutionselector/ResolutionStrategy#FALLBACK_RULE_CLOSEST_LOWER() static const int fallbackRuleClosestLower = 4; + static ResolutionStrategy getHighestAvailableStrategy({ + BinaryMessenger? binaryMessenger, + InstanceManager? instanceManager, + }) { + return ResolutionStrategy( + binaryMessenger: binaryMessenger, instanceManager: instanceManager); + } + final _ResolutionStrategyHostApiImpl _api; /// The specified bound size for the desired resolution of the camera. - final Size boundSize; + final Size? boundSize; /// The fallback rule for choosing an alternate size when the specified bound /// size is unavailable. - final int fallbackRule; + final int? fallbackRule; } class _ResolutionStrategyHostApiImpl extends ResolutionStrategyHostApi { @@ -106,8 +114,8 @@ class _ResolutionStrategyHostApiImpl extends ResolutionStrategyHostApi { Future createFromInstances( ResolutionStrategy instance, - Size boundSize, - int fallbackRule, + Size? boundSize, + int? fallbackRule, ) { return create( instanceManager.addDartCreatedInstance( @@ -119,10 +127,12 @@ class _ResolutionStrategyHostApiImpl extends ResolutionStrategyHostApi { instanceManager: instanceManager, ), ), - CameraSize( - width: boundSize.width.toInt(), - height: boundSize.height.toInt(), - ), + boundSize == null + ? null + : ResolutionInfo( + width: boundSize.width.toInt(), + height: boundSize.height.toInt(), + ), fallbackRule, ); } diff --git a/packages/camera/camera_android_camerax/pigeons/camerax_library.dart b/packages/camera/camera_android_camerax/pigeons/camerax_library.dart index e184cf1fb5d..e2ad3b44f47 100644 --- a/packages/camera/camera_android_camerax/pigeons/camerax_library.dart +++ b/packages/camera/camera_android_camerax/pigeons/camerax_library.dart @@ -46,13 +46,6 @@ class CameraPermissionsErrorData { String description; } -class CameraSize { - CameraSize(this.width, this.height); - - int width; - int height; -} - /// The states the camera can be in. /// /// See https://developer.android.com/reference/androidx/camera/core/CameraState.Type. @@ -203,7 +196,7 @@ abstract class SystemServicesFlutterApi { @HostApi(dartHostTestHandler: 'TestPreviewHostApi') abstract class PreviewHostApi { - void create(int identifier, int? rotation, ResolutionInfo? targetResolution); + void create(int identifier, int? rotation, int? resolutionSelectorId); int setSurfaceProvider(int identifier); @@ -268,7 +261,7 @@ abstract class RecordingFlutterApi { @HostApi(dartHostTestHandler: 'TestImageCaptureHostApi') abstract class ImageCaptureHostApi { - void create(int identifier, int? flashMode, ResolutionInfo? targetResolution); + void create(int identifier, int? flashMode, int? resolutionSelectorId); void setFlashMode(int identifier, int flashMode); @@ -284,7 +277,7 @@ abstract class ImageCaptureHostApi { @HostApi(dartHostTestHandler: 'TestResolutionStrategyHostApi') abstract class ResolutionStrategyHostApi { /// Create a new native instance and add it to the `InstanceManager`. - void create(int identifier, CameraSize boundSize, int fallbackRule); + void create(int identifier, ResolutionInfo? boundSize, int? fallbackRule); } /// Host API for `ResolutionSelector`. @@ -333,7 +326,7 @@ abstract class ZoomStateFlutterApi { @HostApi(dartHostTestHandler: 'TestImageAnalysisHostApi') abstract class ImageAnalysisHostApi { - void create(int identifier, ResolutionInfo? targetResolutionIdentifier); + void create(int identifier, int? resolutionSelectorId); void setAnalyzer(int identifier, int analyzerIdentifier); diff --git a/packages/camera/camera_android_camerax/pubspec.yaml b/packages/camera/camera_android_camerax/pubspec.yaml index 7c577666323..97a95def2e0 100644 --- a/packages/camera/camera_android_camerax/pubspec.yaml +++ b/packages/camera/camera_android_camerax/pubspec.yaml @@ -3,7 +3,7 @@ description: Android implementation of the camera plugin using the CameraX libra repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_android_camerax issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22 -version: 0.5.0+2 +version: 0.5.0+3 environment: sdk: ">=2.19.0 <4.0.0" diff --git a/packages/camera/camera_android_camerax/test/resolution_strategy_test.dart b/packages/camera/camera_android_camerax/test/resolution_strategy_test.dart index 06823dbb115..357fa5462ed 100644 --- a/packages/camera/camera_android_camerax/test/resolution_strategy_test.dart +++ b/packages/camera/camera_android_camerax/test/resolution_strategy_test.dart @@ -49,9 +49,9 @@ void main() { verify(mockApi.create( instanceManager.getIdentifier(instance), - argThat(isA() - .having((CameraSize size) => size.width, 'width', 50) - .having((CameraSize size) => size.height, 'height', 30)), + argThat(isA() + .having((ResolutionInfo size) => size.width, 'width', 50) + .having((ResolutionInfo size) => size.height, 'height', 30)), fallbackRule, )); }); diff --git a/packages/camera/camera_android_camerax/test/resolution_strategy_test.mocks.dart b/packages/camera/camera_android_camerax/test/resolution_strategy_test.mocks.dart index a761fc8b75b..953a9136f90 100644 --- a/packages/camera/camera_android_camerax/test/resolution_strategy_test.mocks.dart +++ b/packages/camera/camera_android_camerax/test/resolution_strategy_test.mocks.dart @@ -31,7 +31,7 @@ class MockTestResolutionStrategyHostApi extends _i1.Mock @override void create( int? identifier, - _i3.CameraSize? boundSize, + _i3.ResolutionInfo? boundSize, int? fallbackRule, ) => super.noSuchMethod( diff --git a/packages/camera/camera_android_camerax/test/test_camerax_library.g.dart b/packages/camera/camera_android_camerax/test/test_camerax_library.g.dart index 6d58fa98f05..5350bbdfac4 100644 --- a/packages/camera/camera_android_camerax/test/test_camerax_library.g.dart +++ b/packages/camera/camera_android_camerax/test/test_camerax_library.g.dart @@ -508,9 +508,6 @@ class _TestPreviewHostApiCodec extends StandardMessageCodec { if (value is ResolutionInfo) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else if (value is ResolutionInfo) { - buffer.putUint8(129); - writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } @@ -521,8 +518,6 @@ class _TestPreviewHostApiCodec extends StandardMessageCodec { switch (type) { case 128: return ResolutionInfo.decode(readValue(buffer)!); - case 129: - return ResolutionInfo.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); } @@ -533,7 +528,7 @@ abstract class TestPreviewHostApi { static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = _TestPreviewHostApiCodec(); - void create(int identifier, int? rotation, ResolutionInfo? targetResolution); + void create(int identifier, int? rotation, int? resolutionSelectorId); int setSurfaceProvider(int identifier); @@ -557,8 +552,8 @@ abstract class TestPreviewHostApi { assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.PreviewHostApi.create was null, expected non-null int.'); final int? arg_rotation = (args[1] as int?); - final ResolutionInfo? arg_targetResolution = (args[2] as ResolutionInfo?); - api.create(arg_identifier!, arg_rotation, arg_targetResolution); + final int? arg_resolutionSelectorId = (args[2] as int?); + api.create(arg_identifier!, arg_rotation, arg_resolutionSelectorId); return []; }); } @@ -886,34 +881,11 @@ abstract class TestRecordingHostApi { } } -class _TestImageCaptureHostApiCodec extends StandardMessageCodec { - const _TestImageCaptureHostApiCodec(); - @override - void writeValue(WriteBuffer buffer, Object? value) { - if (value is ResolutionInfo) { - buffer.putUint8(128); - writeValue(buffer, value.encode()); - } else { - super.writeValue(buffer, value); - } - } - - @override - Object? readValueOfType(int type, ReadBuffer buffer) { - switch (type) { - case 128: - return ResolutionInfo.decode(readValue(buffer)!); - default: - return super.readValueOfType(type, buffer); - } - } -} - abstract class TestImageCaptureHostApi { static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; - static const MessageCodec codec = _TestImageCaptureHostApiCodec(); + static const MessageCodec codec = StandardMessageCodec(); - void create(int identifier, int? flashMode, ResolutionInfo? targetResolution); + void create(int identifier, int? flashMode, int? resolutionSelectorId); void setFlashMode(int identifier, int flashMode); @@ -935,8 +907,8 @@ abstract class TestImageCaptureHostApi { assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.ImageCaptureHostApi.create was null, expected non-null int.'); final int? arg_flashMode = (args[1] as int?); - final ResolutionInfo? arg_targetResolution = (args[2] as ResolutionInfo?); - api.create(arg_identifier!, arg_flashMode, arg_targetResolution); + final int? arg_resolutionSelectorId = (args[2] as int?); + api.create(arg_identifier!, arg_flashMode, arg_resolutionSelectorId); return []; }); } @@ -989,7 +961,7 @@ class _TestResolutionStrategyHostApiCodec extends StandardMessageCodec { const _TestResolutionStrategyHostApiCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { - if (value is CameraSize) { + if (value is ResolutionInfo) { buffer.putUint8(128); writeValue(buffer, value.encode()); } else { @@ -1001,7 +973,7 @@ class _TestResolutionStrategyHostApiCodec extends StandardMessageCodec { Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { case 128: - return CameraSize.decode(readValue(buffer)!); + return ResolutionInfo.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); } @@ -1018,7 +990,7 @@ abstract class TestResolutionStrategyHostApi { static const MessageCodec codec = _TestResolutionStrategyHostApiCodec(); /// Create a new native instance and add it to the `InstanceManager`. - void create(int identifier, CameraSize boundSize, int fallbackRule); + void create(int identifier, ResolutionInfo? boundSize, int? fallbackRule); static void setup(TestResolutionStrategyHostApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -1035,13 +1007,9 @@ abstract class TestResolutionStrategyHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.ResolutionStrategyHostApi.create was null, expected non-null int.'); - final CameraSize? arg_boundSize = (args[1] as CameraSize?); - assert(arg_boundSize != null, - 'Argument for dev.flutter.pigeon.ResolutionStrategyHostApi.create was null, expected non-null CameraSize.'); + final ResolutionInfo? arg_boundSize = (args[1] as ResolutionInfo?); final int? arg_fallbackRule = (args[2] as int?); - assert(arg_fallbackRule != null, - 'Argument for dev.flutter.pigeon.ResolutionStrategyHostApi.create was null, expected non-null int.'); - api.create(arg_identifier!, arg_boundSize!, arg_fallbackRule!); + api.create(arg_identifier!, arg_boundSize, arg_fallbackRule); return []; }); } @@ -1127,34 +1095,11 @@ abstract class TestAspectRatioStrategyHostApi { } } -class _TestImageAnalysisHostApiCodec extends StandardMessageCodec { - const _TestImageAnalysisHostApiCodec(); - @override - void writeValue(WriteBuffer buffer, Object? value) { - if (value is ResolutionInfo) { - buffer.putUint8(128); - writeValue(buffer, value.encode()); - } else { - super.writeValue(buffer, value); - } - } - - @override - Object? readValueOfType(int type, ReadBuffer buffer) { - switch (type) { - case 128: - return ResolutionInfo.decode(readValue(buffer)!); - default: - return super.readValueOfType(type, buffer); - } - } -} - abstract class TestImageAnalysisHostApi { static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; - static const MessageCodec codec = _TestImageAnalysisHostApiCodec(); + static const MessageCodec codec = StandardMessageCodec(); - void create(int identifier, ResolutionInfo? targetResolutionIdentifier); + void create(int identifier, int? resolutionSelectorId); void setAnalyzer(int identifier, int analyzerIdentifier); @@ -1175,8 +1120,8 @@ abstract class TestImageAnalysisHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.ImageAnalysisHostApi.create was null, expected non-null int.'); - final ResolutionInfo? arg_targetResolutionIdentifier = (args[1] as ResolutionInfo?); - api.create(arg_identifier!, arg_targetResolutionIdentifier); + final int? arg_resolutionSelectorId = (args[1] as int?); + api.create(arg_identifier!, arg_resolutionSelectorId); return []; }); } From 9001ab08e4b322fb54b315c76be192fc224749b3 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Mon, 15 May 2023 16:02:30 -0700 Subject: [PATCH 05/34] Small cleanup --- .../camerax/CameraAndroidCameraxPlugin.java | 1 + .../lib/src/android_camera_camerax.dart | 22 +++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/CameraAndroidCameraxPlugin.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/CameraAndroidCameraxPlugin.java index d1dd99810a9..f50728cc5ed 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/CameraAndroidCameraxPlugin.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/CameraAndroidCameraxPlugin.java @@ -98,6 +98,7 @@ public void setUp( GeneratedCameraXLibrary.VideoCaptureHostApi.setup(binaryMessenger, videoCaptureHostApiImpl); GeneratedCameraXLibrary.ResolutionSelectorHostApi.setup(binaryMessenger, new ResolutionSelectorHostApiImpl(binaryMessenger, instanceManager)); GeneratedCameraXLibrary.ResolutionStrategyHostApi.setup(binaryMessenger, new ResolutionStrategyHostApiImpl(binaryMessenger, instanceManager)); + GeneratedCameraXLibrary.AspectRatioStrategyHostApi.setup(binaryMessenger, new AspectRatioStrategyHostApiImpl(binaryMessenger, instanceManager)); } @Override diff --git a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart index d0ee05c9826..afe3413b986 100644 --- a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart +++ b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart @@ -239,11 +239,11 @@ class AndroidCameraCameraX extends CameraPlatform { // Configure Preview instance. final int targetRotation = _getTargetRotation(cameraDescription.sensorOrientation); - preview = createPreview(targetRotation, _presetResolutionSelector); + preview = createPreview(targetRotation); final int flutterSurfaceTextureId = await preview!.setSurfaceProvider(); // Configure ImageCapture instance. - imageCapture = createImageCapture(null, _presetResolutionSelector); + imageCapture = createImageCapture(null); // Configure VideoCapture and Recorder instances. // TODO(gmackall): Enable video capture resolution configuration in createRecorder(). @@ -633,7 +633,7 @@ class AndroidCameraCameraX extends CameraPlatform { // TODO(camsim99): Support resolution configuration. // Defaults to YUV_420_888 image format. - imageAnalysis = createImageAnalysis(_presetResolutionSelector); + imageAnalysis = createImageAnalysis(); imageAnalysis!.setAnalyzer(analyzer); // TODO(camsim99): Reset live camera state observers here when @@ -838,19 +838,19 @@ class AndroidCameraCameraX extends CameraPlatform { /// Returns a [Preview] configured with the specified target rotation and /// resolution. @visibleForTesting - Preview createPreview( - int targetRotation, ResolutionSelector? resolutionSelector) { + Preview createPreview(int targetRotation) { return Preview( - targetRotation: targetRotation, resolutionSelector: resolutionSelector); + targetRotation: targetRotation, + resolutionSelector: _presetResolutionSelector); } /// Returns an [ImageCapture] configured with specified flash mode and /// target resolution. @visibleForTesting - ImageCapture createImageCapture( - int? flashMode, ResolutionSelector? resolutionSelector) { + ImageCapture createImageCapture(int? flashMode) { return ImageCapture( - targetFlashMode: flashMode, resolutionSelector: resolutionSelector); + targetFlashMode: flashMode, + resolutionSelector: _presetResolutionSelector); } /// Returns a [Recorder] for use in video capture. @@ -867,7 +867,7 @@ class AndroidCameraCameraX extends CameraPlatform { /// Returns an [ImageAnalysis] configured with specified target resolution. @visibleForTesting - ImageAnalysis createImageAnalysis(ResolutionSelector? resolutionSelector) { - return ImageAnalysis(resolutionSelector: resolutionSelector); + ImageAnalysis createImageAnalysis() { + return ImageAnalysis(resolutionSelector: _presetResolutionSelector); } } From fd19de6119049db3c4352b788d06361b6f8b3362 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Wed, 17 May 2023 11:33:06 -0700 Subject: [PATCH 06/34] Fixing tests and cleanup minus plugin dart impl test --- .../AspectRatioStrategyHostApiImpl.java | 22 +++------ .../camerax/CameraAndroidCameraxPlugin.java | 6 +-- .../ResolutionSelectorHostApiImpl.java | 27 +++++----- .../ResolutionStrategyHostApiImpl.java | 32 ++++++------ .../camerax/AspectRatioStrategyTest.java | 4 +- .../plugins/camerax/ImageAnalysisTest.java | 20 +++----- .../plugins/camerax/ImageCaptureTest.java | 19 +++---- .../flutter/plugins/camerax/PreviewTest.java | 19 +++---- .../camerax/ResolutionSelectorTest.java | 6 +-- .../camerax/ResolutionStrategyTest.java | 18 +++++-- .../lib/src/android_camera_camerax.dart | 25 ++++++---- .../lib/src/aspect_ratio_strategy.dart | 15 +++++- .../lib/src/image_analysis.dart | 3 ++ .../lib/src/image_capture.dart | 3 ++ .../lib/src/preview.dart | 3 ++ .../lib/src/resolution_selector.dart | 15 +++++- .../lib/src/resolution_strategy.dart | 37 +++++++++++++- .../pigeons/camerax_library.dart | 18 ------- .../test/image_analysis_test.dart | 43 +++++++++------- .../test/image_analysis_test.mocks.dart | 16 ++++-- .../test/image_capture_test.dart | 35 +++++++------ .../test/image_capture_test.mocks.dart | 24 ++++++--- .../test/preview_test.dart | 35 ++++++++----- .../test/preview_test.mocks.dart | 15 +++++- .../test/resolution_selector_test.dart | 2 +- .../test/resolution_strategy_test.dart | 49 ++++++++++++++++++- 26 files changed, 318 insertions(+), 193 deletions(-) diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/AspectRatioStrategyHostApiImpl.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/AspectRatioStrategyHostApiImpl.java index b2eb51ba2e3..d856c404b9c 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/AspectRatioStrategyHostApiImpl.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/AspectRatioStrategyHostApiImpl.java @@ -11,23 +11,19 @@ import io.flutter.plugins.camerax.GeneratedCameraXLibrary.AspectRatioStrategyHostApi; /** - * Host API implementation for `AspectRatioStrategy`. + * Host API implementation for {@link AspectRatioStrategy}. * - *

This class may handle instantiating and adding native object instances that are attached to a + *

This class handles instantiating and adding native object instances that are attached to a * Dart instance or handle method calls on the associated native class or an instance of the class. */ public class AspectRatioStrategyHostApiImpl implements AspectRatioStrategyHostApi { - // To ease adding additional methods, this value is added prematurely. - @SuppressWarnings({"unused", "FieldCanBeLocal"}) - private final BinaryMessenger binaryMessenger; - private final InstanceManager instanceManager; private final AspectRatioStrategyProxy proxy; - /** Proxy for constructors and static method of `AspectRatioStrategy`. */ + /** Proxy for constructors and static method of {@link AspectRatioStrategy}. */ @VisibleForTesting public static class AspectRatioStrategyProxy { - /** Creates an instance of `AspectRatioStrategy`. */ + /** Creates an instance of {@link AspectRatioStrategy}. */ @NonNull public AspectRatioStrategy create( @NonNull Long preferredAspectRatio, @NonNull Long fallbackRule) { @@ -38,27 +34,23 @@ public AspectRatioStrategy create( /** * Constructs a {@link AspectRatioStrategyHostApiImpl}. * - * @param binaryMessenger used to communicate with Dart over asynchronous messages * @param instanceManager maintains instances stored to communicate with attached Dart objects */ public AspectRatioStrategyHostApiImpl( - @NonNull BinaryMessenger binaryMessenger, @NonNull InstanceManager instanceManager) { - this(binaryMessenger, instanceManager, new AspectRatioStrategyProxy()); + @NonNull InstanceManager instanceManager) { + this(instanceManager, new AspectRatioStrategyProxy()); } /** * Constructs a {@link AspectRatioStrategyHostApiImpl}. * - * @param binaryMessenger used to communicate with Dart over asynchronous messages * @param instanceManager maintains instances stored to communicate with attached Dart objects - * @param proxy proxy for constructors and static method of `AspectRatioStrategy` + * @param proxy proxy for constructors and static method of {@link AspectRatioStrategy} */ @VisibleForTesting AspectRatioStrategyHostApiImpl( - @NonNull BinaryMessenger binaryMessenger, @NonNull InstanceManager instanceManager, @NonNull AspectRatioStrategyProxy proxy) { - this.binaryMessenger = binaryMessenger; this.instanceManager = instanceManager; this.proxy = proxy; } diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/CameraAndroidCameraxPlugin.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/CameraAndroidCameraxPlugin.java index f50728cc5ed..86105340277 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/CameraAndroidCameraxPlugin.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/CameraAndroidCameraxPlugin.java @@ -96,9 +96,9 @@ public void setUp( binaryMessenger, pendingRecordingHostApiImpl); videoCaptureHostApiImpl = new VideoCaptureHostApiImpl(binaryMessenger, instanceManager); GeneratedCameraXLibrary.VideoCaptureHostApi.setup(binaryMessenger, videoCaptureHostApiImpl); - GeneratedCameraXLibrary.ResolutionSelectorHostApi.setup(binaryMessenger, new ResolutionSelectorHostApiImpl(binaryMessenger, instanceManager)); - GeneratedCameraXLibrary.ResolutionStrategyHostApi.setup(binaryMessenger, new ResolutionStrategyHostApiImpl(binaryMessenger, instanceManager)); - GeneratedCameraXLibrary.AspectRatioStrategyHostApi.setup(binaryMessenger, new AspectRatioStrategyHostApiImpl(binaryMessenger, instanceManager)); + GeneratedCameraXLibrary.ResolutionSelectorHostApi.setup(binaryMessenger, new ResolutionSelectorHostApiImpl(instanceManager)); + GeneratedCameraXLibrary.ResolutionStrategyHostApi.setup(binaryMessenger, new ResolutionStrategyHostApiImpl(instanceManager)); + GeneratedCameraXLibrary.AspectRatioStrategyHostApi.setup(binaryMessenger, new AspectRatioStrategyHostApiImpl(instanceManager)); } @Override diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/ResolutionSelectorHostApiImpl.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/ResolutionSelectorHostApiImpl.java index a7a3e1fec73..3bdb58ca073 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/ResolutionSelectorHostApiImpl.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/ResolutionSelectorHostApiImpl.java @@ -10,27 +10,22 @@ import androidx.camera.core.resolutionselector.AspectRatioStrategy; import androidx.camera.core.resolutionselector.ResolutionSelector; import androidx.camera.core.resolutionselector.ResolutionStrategy; -import io.flutter.plugin.common.BinaryMessenger; import io.flutter.plugins.camerax.GeneratedCameraXLibrary.ResolutionSelectorHostApi; /** - * Host API implementation for `ResolutionSelector`. + * Host API implementation for {@link ResolutionSelector}. * - *

This class may handle instantiating and adding native object instances that are attached to a + *

This class handles instantiating and adding native object instances that are attached to a * Dart instance or handle method calls on the associated native class or an instance of the class. */ public class ResolutionSelectorHostApiImpl implements ResolutionSelectorHostApi { - // To ease adding additional methods, this value is added prematurely. - @SuppressWarnings({"unused", "FieldCanBeLocal"}) - private final BinaryMessenger binaryMessenger; - private final InstanceManager instanceManager; private final ResolutionSelectorProxy proxy; - /** Proxy for constructors and static method of `ResolutionSelector`. */ + /** Proxy for constructors and static method of {@link ResolutionSelector}. */ @VisibleForTesting public static class ResolutionSelectorProxy { - /** Creates an instance of `ResolutionSelector`. */ + /** Creates an instance of {@link ResolutionSelector}. */ @NonNull public ResolutionSelector create( @Nullable ResolutionStrategy resolutionStrategy, @@ -49,31 +44,31 @@ public ResolutionSelector create( /** * Constructs a {@link ResolutionSelectorHostApiImpl}. * - * @param binaryMessenger used to communicate with Dart over asynchronous messages * @param instanceManager maintains instances stored to communicate with attached Dart objects */ public ResolutionSelectorHostApiImpl( - @NonNull BinaryMessenger binaryMessenger, @NonNull InstanceManager instanceManager) { - this(binaryMessenger, instanceManager, new ResolutionSelectorProxy()); + @NonNull InstanceManager instanceManager) { + this(instanceManager, new ResolutionSelectorProxy()); } /** * Constructs a {@link ResolutionSelectorHostApiImpl}. * - * @param binaryMessenger used to communicate with Dart over asynchronous messages * @param instanceManager maintains instances stored to communicate with attached Dart objects - * @param proxy proxy for constructors and static method of `ResolutionSelector` + * @param proxy proxy for constructors and static method of {@link ResolutionSelector} */ @VisibleForTesting ResolutionSelectorHostApiImpl( - @NonNull BinaryMessenger binaryMessenger, @NonNull InstanceManager instanceManager, @NonNull ResolutionSelectorProxy proxy) { - this.binaryMessenger = binaryMessenger; this.instanceManager = instanceManager; this.proxy = proxy; } + /** + * Creates a {@link ResolutionSelector} instance with the {@link ResolutionStrategy} and + * {@link AspectRatio} that have the identifiers specified if provided. + */ @Override public void create( @NonNull Long identifier, diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/ResolutionStrategyHostApiImpl.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/ResolutionStrategyHostApiImpl.java index 4d7a0989c3e..13a3750e2da 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/ResolutionStrategyHostApiImpl.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/ResolutionStrategyHostApiImpl.java @@ -9,28 +9,23 @@ import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import androidx.camera.core.resolutionselector.ResolutionStrategy; -import io.flutter.plugin.common.BinaryMessenger; import io.flutter.plugins.camerax.GeneratedCameraXLibrary.ResolutionStrategyHostApi; /** - * Host API implementation for `ResolutionStrategy`. + * Host API implementation for {@link ResolutionStrategy}. * - *

This class may handle instantiating and adding native object instances that are attached to a + *

This class handles instantiating and adding native object instances that are attached to a * Dart instance or handle method calls on the associated native class or an instance of the class. */ public class ResolutionStrategyHostApiImpl implements ResolutionStrategyHostApi { - // To ease adding additional methods, this value is added prematurely. - @SuppressWarnings({"unused", "FieldCanBeLocal"}) - private final BinaryMessenger binaryMessenger; - private final InstanceManager instanceManager; private final ResolutionStrategyProxy proxy; - /** Proxy for constructors and static method of `ResolutionStrategy`. */ + /** Proxy for constructors and static method of {@link ResolutionStrategy}. */ @VisibleForTesting public static class ResolutionStrategyProxy { - /** Creates an instance of `ResolutionStrategy`. */ + /** Creates an instance of {@link ResolutionStrategy}. */ @NonNull public ResolutionStrategy create(@NonNull Size boundSize, @NonNull Long fallbackRule) { return new ResolutionStrategy(boundSize, fallbackRule.intValue()); @@ -40,40 +35,43 @@ public ResolutionStrategy create(@NonNull Size boundSize, @NonNull Long fallback /** * Constructs a {@link ResolutionStrategyHostApiImpl}. * - * @param binaryMessenger used to communicate with Dart over asynchronous messages * @param instanceManager maintains instances stored to communicate with attached Dart objects */ public ResolutionStrategyHostApiImpl( - @NonNull BinaryMessenger binaryMessenger, @NonNull InstanceManager instanceManager) { - this(binaryMessenger, instanceManager, new ResolutionStrategyProxy()); + @NonNull InstanceManager instanceManager) { + this(instanceManager, new ResolutionStrategyProxy()); } /** * Constructs a {@link ResolutionStrategyHostApiImpl}. * - * @param binaryMessenger used to communicate with Dart over asynchronous messages * @param instanceManager maintains instances stored to communicate with attached Dart objects - * @param proxy proxy for constructors and static method of `ResolutionStrategy` + * @param proxy proxy for constructors and static method of {@link ResolutionStrategy} */ @VisibleForTesting ResolutionStrategyHostApiImpl( - @NonNull BinaryMessenger binaryMessenger, @NonNull InstanceManager instanceManager, @NonNull ResolutionStrategyProxy proxy) { - this.binaryMessenger = binaryMessenger; this.instanceManager = instanceManager; this.proxy = proxy; } + /** + * Creates a {@link ResolutionStrategy} instance with the {@link GeneratedCameraXLibrary.ResolutionInfo} + * bound size and {@code fallbackRule} if specified. + */ @Override public void create( @NonNull Long identifier, @Nullable GeneratedCameraXLibrary.ResolutionInfo boundSize, @Nullable Long fallbackRule) { ResolutionStrategy resolutionStrategy; - if (boundSize == null) { + if (boundSize == null && fallbackRule == null) { resolutionStrategy = ResolutionStrategy.HIGHEST_AVAILABLE_STRATEGY; } + else if (boundSize == null) { + throw new IllegalArgumentException("A bound size must be specified if a fallback rule is specified as non-null to create a valid ResolutionStrategy."); + } else { resolutionStrategy = proxy.create( new Size(boundSize.getWidth().intValue(), boundSize.getHeight().intValue()), diff --git a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/AspectRatioStrategyTest.java b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/AspectRatioStrategyTest.java index da0d3dbfef2..5da0a371ffa 100644 --- a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/AspectRatioStrategyTest.java +++ b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/AspectRatioStrategyTest.java @@ -8,7 +8,6 @@ import static org.mockito.Mockito.when; import androidx.camera.core.resolutionselector.AspectRatioStrategy; -import io.flutter.plugin.common.BinaryMessenger; import org.junit.After; import org.junit.Before; import org.junit.Rule; @@ -20,7 +19,6 @@ public class AspectRatioStrategyTest { @Rule public MockitoRule mockitoRule = MockitoJUnit.rule(); @Mock public AspectRatioStrategy mockAspectRatioStrategy; - @Mock public BinaryMessenger mockBinaryMessenger; @Mock public AspectRatioStrategyHostApiImpl.AspectRatioStrategyProxy mockProxy; InstanceManager instanceManager; @@ -43,7 +41,7 @@ public void hostApiCreate() { when(mockProxy.create(preferredAspectRatio, fallbackRule)).thenReturn(mockAspectRatioStrategy); final AspectRatioStrategyHostApiImpl hostApi = - new AspectRatioStrategyHostApiImpl(mockBinaryMessenger, instanceManager, mockProxy); + new AspectRatioStrategyHostApiImpl(instanceManager, mockProxy); final long instanceIdentifier = 0; hostApi.create(instanceIdentifier, preferredAspectRatio, fallbackRule); diff --git a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/ImageAnalysisTest.java b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/ImageAnalysisTest.java index 38f77761da9..2c96a3102c0 100644 --- a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/ImageAnalysisTest.java +++ b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/ImageAnalysisTest.java @@ -14,9 +14,11 @@ import android.content.Context; import android.util.Size; import androidx.camera.core.ImageAnalysis; +import androidx.camera.core.resolutionselector.ResolutionSelector; import androidx.test.core.app.ApplicationProvider; import io.flutter.plugin.common.BinaryMessenger; import io.flutter.plugins.camerax.GeneratedCameraXLibrary.ResolutionInfo; + import java.util.concurrent.Executor; import org.junit.After; import org.junit.Before; @@ -55,27 +57,19 @@ public void hostApiCreate_createsExpectedImageAnalysisInstanceWithExpectedIdenti new ImageAnalysisHostApiImpl(mockBinaryMessenger, instanceManager); final CameraXProxy mockCameraXProxy = mock(CameraXProxy.class); final ImageAnalysis.Builder mockImageAnalysisBuilder = mock(ImageAnalysis.Builder.class); - final int targetResolutionWidth = 10; - final int targetResolutionHeight = 50; - final ResolutionInfo resolutionInfo = - new ResolutionInfo.Builder() - .setWidth(Long.valueOf(targetResolutionWidth)) - .setHeight(Long.valueOf(targetResolutionHeight)) - .build(); + final ResolutionSelector mockResolutionSelector = mock(ResolutionSelector.class); final long instanceIdentifier = 0; + final long mockResolutionSelectorId = 25; hostApi.cameraXProxy = mockCameraXProxy; - - final ArgumentCaptor sizeCaptor = ArgumentCaptor.forClass(Size.class); + instanceManager.addDartCreatedInstance(mockResolutionSelector, mockResolutionSelectorId); when(mockCameraXProxy.createImageAnalysisBuilder()).thenReturn(mockImageAnalysisBuilder); when(mockImageAnalysisBuilder.build()).thenReturn(mockImageAnalysis); - hostApi.create(instanceIdentifier, resolutionInfo); + hostApi.create(instanceIdentifier, mockResolutionSelectorId); - verify(mockImageAnalysisBuilder).setTargetResolution(sizeCaptor.capture()); - assertEquals(sizeCaptor.getValue().getWidth(), targetResolutionWidth); - assertEquals(sizeCaptor.getValue().getHeight(), targetResolutionHeight); + verify(mockImageAnalysisBuilder).setResolutionSelector(mockResolutionSelector); assertEquals(instanceManager.getInstance(instanceIdentifier), mockImageAnalysis); } diff --git a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/ImageCaptureTest.java b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/ImageCaptureTest.java index 881b6bea5a7..2e178b41234 100644 --- a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/ImageCaptureTest.java +++ b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/ImageCaptureTest.java @@ -18,6 +18,7 @@ import android.util.Size; import androidx.camera.core.ImageCapture; import androidx.camera.core.ImageCaptureException; +import androidx.camera.core.resolutionselector.ResolutionSelector; import io.flutter.plugin.common.BinaryMessenger; import java.io.File; import java.io.IOException; @@ -66,26 +67,18 @@ public void create_createsImageCaptureWithCorrectConfiguration() { final ImageCapture.Builder mockImageCaptureBuilder = mock(ImageCapture.Builder.class); final Long imageCaptureIdentifier = 74L; final Long flashMode = Long.valueOf(ImageCapture.FLASH_MODE_ON); - final int targetResolutionWidth = 10; - final int targetResolutionHeight = 50; - final GeneratedCameraXLibrary.ResolutionInfo resolutionInfo = - new GeneratedCameraXLibrary.ResolutionInfo.Builder() - .setWidth(Long.valueOf(targetResolutionWidth)) - .setHeight(Long.valueOf(targetResolutionHeight)) - .build(); + final ResolutionSelector mockResolutionSelector = mock(ResolutionSelector.class); + final long mockResolutionSelectorId = 77; imageCaptureHostApiImpl.cameraXProxy = mockCameraXProxy; + testInstanceManager.addDartCreatedInstance(mockResolutionSelector, mockResolutionSelectorId); when(mockCameraXProxy.createImageCaptureBuilder()).thenReturn(mockImageCaptureBuilder); when(mockImageCaptureBuilder.build()).thenReturn(mockImageCapture); - final ArgumentCaptor sizeCaptor = ArgumentCaptor.forClass(Size.class); - - imageCaptureHostApiImpl.create(imageCaptureIdentifier, flashMode, resolutionInfo); + imageCaptureHostApiImpl.create(imageCaptureIdentifier, flashMode, mockResolutionSelectorId); verify(mockImageCaptureBuilder).setFlashMode(flashMode.intValue()); - verify(mockImageCaptureBuilder).setTargetResolution(sizeCaptor.capture()); - assertEquals(sizeCaptor.getValue().getWidth(), targetResolutionWidth); - assertEquals(sizeCaptor.getValue().getHeight(), targetResolutionHeight); + verify(mockImageCaptureBuilder).setResolutionSelector(mockResolutionSelector); verify(mockImageCaptureBuilder).build(); verify(testInstanceManager).addDartCreatedInstance(mockImageCapture, imageCaptureIdentifier); } diff --git a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/PreviewTest.java b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/PreviewTest.java index 39b73abd738..1d2bcc4e852 100644 --- a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/PreviewTest.java +++ b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/PreviewTest.java @@ -18,6 +18,7 @@ import android.view.Surface; import androidx.camera.core.Preview; import androidx.camera.core.SurfaceRequest; +import androidx.camera.core.resolutionselector.ResolutionSelector; import androidx.core.util.Consumer; import io.flutter.plugin.common.BinaryMessenger; import io.flutter.plugins.camerax.GeneratedCameraXLibrary.ResolutionInfo; @@ -63,27 +64,19 @@ public void create_createsPreviewWithCorrectConfiguration() { new PreviewHostApiImpl(mockBinaryMessenger, testInstanceManager, mockTextureRegistry); final Preview.Builder mockPreviewBuilder = mock(Preview.Builder.class); final int targetRotation = 90; - final int targetResolutionWidth = 10; - final int targetResolutionHeight = 50; final Long previewIdentifier = 3L; - final GeneratedCameraXLibrary.ResolutionInfo resolutionInfo = - new GeneratedCameraXLibrary.ResolutionInfo.Builder() - .setWidth(Long.valueOf(targetResolutionWidth)) - .setHeight(Long.valueOf(targetResolutionHeight)) - .build(); + final ResolutionSelector mockResolutionSelector = mock(ResolutionSelector.class); + final long mockResolutionSelectorId = 90; previewHostApi.cameraXProxy = mockCameraXProxy; + testInstanceManager.addDartCreatedInstance(mockResolutionSelector, mockResolutionSelectorId); when(mockCameraXProxy.createPreviewBuilder()).thenReturn(mockPreviewBuilder); when(mockPreviewBuilder.build()).thenReturn(mockPreview); - final ArgumentCaptor sizeCaptor = ArgumentCaptor.forClass(Size.class); - - previewHostApi.create(previewIdentifier, Long.valueOf(targetRotation), resolutionInfo); + previewHostApi.create(previewIdentifier, Long.valueOf(targetRotation), mockResolutionSelectorId); verify(mockPreviewBuilder).setTargetRotation(targetRotation); - verify(mockPreviewBuilder).setTargetResolution(sizeCaptor.capture()); - assertEquals(sizeCaptor.getValue().getWidth(), targetResolutionWidth); - assertEquals(sizeCaptor.getValue().getHeight(), targetResolutionHeight); + verify(mockPreviewBuilder).setResolutionSelector(mockResolutionSelector); verify(mockPreviewBuilder).build(); verify(testInstanceManager).addDartCreatedInstance(mockPreview, previewIdentifier); } diff --git a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/ResolutionSelectorTest.java b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/ResolutionSelectorTest.java index 237aa30adcf..f323e4706c9 100644 --- a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/ResolutionSelectorTest.java +++ b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/ResolutionSelectorTest.java @@ -11,7 +11,6 @@ import androidx.camera.core.resolutionselector.AspectRatioStrategy; import androidx.camera.core.resolutionselector.ResolutionSelector; import androidx.camera.core.resolutionselector.ResolutionStrategy; -import io.flutter.plugin.common.BinaryMessenger; import org.junit.After; import org.junit.Before; import org.junit.Rule; @@ -23,7 +22,6 @@ public class ResolutionSelectorTest { @Rule public MockitoRule mockitoRule = MockitoJUnit.rule(); @Mock public ResolutionSelector mockResolutionSelector; - @Mock public BinaryMessenger mockBinaryMessenger; @Mock public ResolutionSelectorHostApiImpl.ResolutionSelectorProxy mockProxy; InstanceManager instanceManager; @@ -39,7 +37,7 @@ public void tearDown() { } @Test - public void hostApiCreate() { + public void hostApiCreate_createsExpectedResolutionSelectorInstance() { final ResolutionStrategy mockResolutionStrategy = mock(ResolutionStrategy.class); final long resolutionStrategyIdentifier = 14; instanceManager.addDartCreatedInstance(mockResolutionStrategy, resolutionStrategyIdentifier); @@ -51,7 +49,7 @@ public void hostApiCreate() { when(mockProxy.create(mockResolutionStrategy, mockAspectRatioStrategy)) .thenReturn(mockResolutionSelector); final ResolutionSelectorHostApiImpl hostApi = - new ResolutionSelectorHostApiImpl(mockBinaryMessenger, instanceManager, mockProxy); + new ResolutionSelectorHostApiImpl(instanceManager, mockProxy); final long instanceIdentifier = 0; hostApi.create(instanceIdentifier, resolutionStrategyIdentifier, aspectRatioStrategyIdentifier); diff --git a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/ResolutionStrategyTest.java b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/ResolutionStrategyTest.java index 101e2e3068d..6bb522d93d3 100644 --- a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/ResolutionStrategyTest.java +++ b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/ResolutionStrategyTest.java @@ -5,13 +5,13 @@ package io.flutter.plugins.camerax; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThrows; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.when; import android.util.Size; import androidx.camera.core.resolutionselector.ResolutionStrategy; -import io.flutter.plugin.common.BinaryMessenger; import org.junit.After; import org.junit.Before; import org.junit.Rule; @@ -23,7 +23,6 @@ public class ResolutionStrategyTest { @Rule public MockitoRule mockitoRule = MockitoJUnit.rule(); @Mock public ResolutionStrategy mockResolutionStrategy; - @Mock public BinaryMessenger mockBinaryMessenger; @Mock public ResolutionStrategyHostApiImpl.ResolutionStrategyProxy mockProxy; InstanceManager instanceManager; @@ -39,20 +38,29 @@ public void tearDown() { } @Test - public void hostApiCreate() { + public void hostApiCreate_createsExpectedResolutionStrategyInstanceWhenArgumentsValid() { final GeneratedCameraXLibrary.ResolutionInfo boundSize = - new GeneratedCameraXLibrary.ResolutionInfo().Builder().setWidth(50L).setHeight(30L).build(); + new GeneratedCameraXLibrary.ResolutionInfo.Builder().setWidth(50L).setHeight(30L).build(); final Long fallbackRule = 0L; when(mockProxy.create(any(Size.class), eq(fallbackRule))).thenReturn(mockResolutionStrategy); final ResolutionStrategyHostApiImpl hostApi = - new ResolutionStrategyHostApiImpl(mockBinaryMessenger, instanceManager, mockProxy); + new ResolutionStrategyHostApiImpl(instanceManager, mockProxy); final long instanceIdentifier = 0; hostApi.create(instanceIdentifier, boundSize, fallbackRule); assertEquals(instanceManager.getInstance(instanceIdentifier), mockResolutionStrategy); } + + @Test + public void hostApiCreate_throwsAssertionErrorWhenArgumentsInvalid() { + final Long fallbackRule = 8L; + final long instanceIdentifier = 0; + + // We expect an errror to be thrown in fallbackRule is specified but bound size is not. + assertThrows(IllegalArgumentException.clas, () -> hostApi.create(instanceIdentifier, null, fallbackRule)); + } } diff --git a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart index afe3413b986..74b9ffd7f3e 100644 --- a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart +++ b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart @@ -115,9 +115,9 @@ class AndroidCameraCameraX extends CameraPlatform { @visibleForTesting CameraSelector? cameraSelector; - /// The [ResolutionSelector] that represents resolution preset used to create - /// a camera that should be used for capturing still images, recording video, - /// and image analysis. + /// The [ResolutionSelector] that represents the resolution preset used to + /// create a camera that will be used for capturing still images, recording + /// video, and image analysis. ResolutionSelector? _presetResolutionSelector; /// The controller we need to broadcast the different camera events. @@ -330,6 +330,8 @@ class AndroidCameraCameraX extends CameraPlatform { } /// The camera's resolution has changed. + /// + /// This stream currently has no events being added to it from this plugin. @override Stream onCameraResolutionChanged(int cameraId) { return _cameraEvents(cameraId).whereType(); @@ -766,11 +768,15 @@ class AndroidCameraCameraX extends CameraPlatform { } } + /// Returns the [ResolutionSelector] that maps to the specified resolution + /// preset for camera [UseCase]s. + /// + /// If the specified [preset] is unavailable, the camera will fallback to the + /// closest lower resolution available. Future _getResolutionSelectorFromPreset( ResolutionPreset? preset) async { ResolutionStrategy? resolutionStrategy; - const int generalFallbackRule = - ResolutionStrategy.fallbackRuleClosestHigher; + const int generalFallbackRule = ResolutionStrategy.fallbackRuleClosestLower; switch (preset) { case ResolutionPreset.low: resolutionStrategy = ResolutionStrategy( @@ -799,7 +805,8 @@ class AndroidCameraCameraX extends CameraPlatform { resolutionStrategy = ResolutionStrategy.getHighestAvailableStrategy(); break; case null: - // TODO(camsim99): Add comment here about default behavior. + // If not preset is specified, default to CameraX's default behvaior + // for each UseCase. break; } @@ -836,7 +843,7 @@ class AndroidCameraCameraX extends CameraPlatform { } /// Returns a [Preview] configured with the specified target rotation and - /// resolution. + /// preset [ResolutionSelector]. @visibleForTesting Preview createPreview(int targetRotation) { return Preview( @@ -845,7 +852,7 @@ class AndroidCameraCameraX extends CameraPlatform { } /// Returns an [ImageCapture] configured with specified flash mode and - /// target resolution. + /// the preset [ResolutionSelector]. @visibleForTesting ImageCapture createImageCapture(int? flashMode) { return ImageCapture( @@ -865,7 +872,7 @@ class AndroidCameraCameraX extends CameraPlatform { return VideoCapture.withOutput(recorder); } - /// Returns an [ImageAnalysis] configured with specified target resolution. + /// Returns an [ImageAnalysis] configured with the preset [ResolutionSelector]. @visibleForTesting ImageAnalysis createImageAnalysis() { return ImageAnalysis(resolutionSelector: _presetResolutionSelector); diff --git a/packages/camera/camera_android_camerax/lib/src/aspect_ratio_strategy.dart b/packages/camera/camera_android_camerax/lib/src/aspect_ratio_strategy.dart index 309ceb6931d..78edb7433a9 100644 --- a/packages/camera/camera_android_camerax/lib/src/aspect_ratio_strategy.dart +++ b/packages/camera/camera_android_camerax/lib/src/aspect_ratio_strategy.dart @@ -8,7 +8,7 @@ import 'camerax_library.g.dart'; import 'instance_manager.dart'; import 'java_object.dart'; -/// The aspect ratio of the use case. +/// The aspect ratio of a use case. /// /// Aspect ratio is the ratio of width to height. /// @@ -90,17 +90,30 @@ class AspectRatioStrategy extends JavaObject { final int fallbackRule; } +/// Host API implementation of [AspectRatioStrategy]. class _AspectRatioStrategyHostApiImpl extends AspectRatioStrategyHostApi { + /// Constructs an [_AspectRatioStrategyHostApiImpl]. + /// + /// If [binaryMessenger] is null, the default [BinaryMessenger] will be used, + /// which routes to the host platform. + /// + /// An [instanceManager] is typically passed when a copy of an instance + /// contained by an [InstanceManager] is being created. If left null, it + /// will default to the global instance defined in [JavaObject]. _AspectRatioStrategyHostApiImpl({ this.binaryMessenger, InstanceManager? instanceManager, }) : instanceManager = instanceManager ?? JavaObject.globalInstanceManager, super(binaryMessenger: binaryMessenger); + /// Receives binary data across the Flutter platform barrier. final BinaryMessenger? binaryMessenger; + /// Maintains instances stored to communicate with native language objects. final InstanceManager instanceManager; + /// Creates a [AspectRatioStrategy] on the native side with the preferred + /// aspect ratio and fallback rule specified. Future createFromInstances( AspectRatioStrategy instance, int preferredAspectRatio, diff --git a/packages/camera/camera_android_camerax/lib/src/image_analysis.dart b/packages/camera/camera_android_camerax/lib/src/image_analysis.dart index cc3e64564ce..3abca052986 100644 --- a/packages/camera/camera_android_camerax/lib/src/image_analysis.dart +++ b/packages/camera/camera_android_camerax/lib/src/image_analysis.dart @@ -48,6 +48,9 @@ class ImageAnalysis extends UseCase { late final _ImageAnalysisHostApiImpl _api; /// Target resolution of the camera preview stream. + /// + /// If not set, this [UseCase] will default to the behavior described in: + /// https://developer.android.com/reference/androidx/camera/core/ImageAnalysis.Builder#setResolutionSelector(androidx.camera.core.resolutionselector.ResolutionSelector). final ResolutionSelector? resolutionSelector; /// Sets an [Analyzer] to receive and analyze images. diff --git a/packages/camera/camera_android_camerax/lib/src/image_capture.dart b/packages/camera/camera_android_camerax/lib/src/image_capture.dart index e2c27fe5ce9..d575da4f4de 100644 --- a/packages/camera/camera_android_camerax/lib/src/image_capture.dart +++ b/packages/camera/camera_android_camerax/lib/src/image_capture.dart @@ -49,6 +49,9 @@ class ImageCapture extends UseCase { final int? targetFlashMode; /// Target resolution of the image output from taking a picture. + /// + /// If not set, this [UseCase] will default to the behavior described in: + /// https://developer.android.com/reference/androidx/camera/core/ImageCapture.Builder#setResolutionSelector(androidx.camera.core.resolutionselector.ResolutionSelector). final ResolutionSelector? resolutionSelector; /// Constant for automatic flash mode. diff --git a/packages/camera/camera_android_camerax/lib/src/preview.dart b/packages/camera/camera_android_camerax/lib/src/preview.dart index 060d302a45e..307593ef204 100644 --- a/packages/camera/camera_android_camerax/lib/src/preview.dart +++ b/packages/camera/camera_android_camerax/lib/src/preview.dart @@ -47,6 +47,9 @@ class Preview extends UseCase { final int? targetRotation; /// Target resolution of the camera preview stream. + /// + /// If not set, this [UseCase] will default to the behavior described in: + /// https://developer.android.com/reference/androidx/camera/core/Preview.Builder#setResolutionSelector(androidx.camera.core.resolutionselector.ResolutionSelector) final ResolutionSelector? resolutionSelector; /// Sets the surface provider for the preview stream. diff --git a/packages/camera/camera_android_camerax/lib/src/resolution_selector.dart b/packages/camera/camera_android_camerax/lib/src/resolution_selector.dart index 7cb59d54791..5ec31ca95a3 100644 --- a/packages/camera/camera_android_camerax/lib/src/resolution_selector.dart +++ b/packages/camera/camera_android_camerax/lib/src/resolution_selector.dart @@ -10,7 +10,7 @@ import 'instance_manager.dart'; import 'java_object.dart'; import 'resolution_strategy.dart'; -/// A set of requirements and priorities used to select a resolution for the +/// A set of requirements and priorities used to select a resolution for a /// UseCase. /// /// See https://developer.android.com/reference/androidx/camera/core/resolutionselector/ResolutionSelector. @@ -56,17 +56,30 @@ class ResolutionSelector extends JavaObject { final AspectRatioStrategy? aspectRatioStrategy; } +/// Host API implementation of [ResolutionSelector]. class _ResolutionSelectorHostApiImpl extends ResolutionSelectorHostApi { + /// Constructs an [_ResolutionSelectorHostApiImpl]. + /// + /// If [binaryMessenger] is null, the default [BinaryMessenger] will be used, + /// which routes to the host platform. + /// + /// An [instanceManager] is typically passed when a copy of an instance + /// contained by an [InstanceManager] is being created. If left null, it + /// will default to the global instance defined in [JavaObject]. _ResolutionSelectorHostApiImpl({ this.binaryMessenger, InstanceManager? instanceManager, }) : instanceManager = instanceManager ?? JavaObject.globalInstanceManager, super(binaryMessenger: binaryMessenger); + /// Receives binary data across the Flutter platform barrier. final BinaryMessenger? binaryMessenger; + /// Maintains instances stored to communicate with native language objects. final InstanceManager instanceManager; + /// Creates a [ResolutionSelector] on the native side with the + /// [ResolutionStrategy] and [AspectRatioStrategy] if specified. Future createFromInstances( ResolutionSelector instance, ResolutionStrategy? resolutionStrategy, diff --git a/packages/camera/camera_android_camerax/lib/src/resolution_strategy.dart b/packages/camera/camera_android_camerax/lib/src/resolution_strategy.dart index d4cb7dcac26..5d8c425200f 100644 --- a/packages/camera/camera_android_camerax/lib/src/resolution_strategy.dart +++ b/packages/camera/camera_android_camerax/lib/src/resolution_strategy.dart @@ -24,6 +24,10 @@ class ResolutionStrategy extends JavaObject { binaryMessenger: binaryMessenger, ), super.detached() { + if (boundSize == null && fallbackRule != null) { + throw ArgumentError( + 'fallbackRule cannot be specified with a null boundSize. If you wish to create the highest available resolution ResolutionStrategy, specify fallbackRule as null.'); + } _api.createFromInstances(this, boundSize, fallbackRule); } @@ -41,7 +45,12 @@ class ResolutionStrategy extends JavaObject { instanceManager: instanceManager, binaryMessenger: binaryMessenger, ), - super.detached(); + super.detached() { + if (boundSize == null && fallbackRule != null) { + throw ArgumentError( + 'fallbackRule cannot be specified with a null boundSize. If you wish to create the highest available resolution ResolutionStrategy, specify fallbackRule as null.'); + } + } /// CameraX doesn't select an alternate size when the specified bound size is /// unavailable. @@ -83,6 +92,10 @@ class ResolutionStrategy extends JavaObject { /// See https://developer.android.com/reference/androidx/camera/core/resolutionselector/ResolutionStrategy#FALLBACK_RULE_CLOSEST_LOWER() static const int fallbackRuleClosestLower = 4; + /// Returns the resolution strategey that chooses the highest available + /// resolution. + /// + /// See https://developer.android.com/reference/androidx/camera/core/resolutionselector/ResolutionStrategy#HIGHEST_AVAILABLE_STRATEGY(). static ResolutionStrategy getHighestAvailableStrategy({ BinaryMessenger? binaryMessenger, InstanceManager? instanceManager, @@ -94,24 +107,46 @@ class ResolutionStrategy extends JavaObject { final _ResolutionStrategyHostApiImpl _api; /// The specified bound size for the desired resolution of the camera. + /// + /// If left null, [fallbackRule] must also be left null in order to create a + /// valid [ResolutionStrategy]. This will create the [ResolutionStrategy] + /// that chooses the highest available resolution, which can also be retrieved + /// by calling [getHighestAvailableStrategy]. final Size? boundSize; /// The fallback rule for choosing an alternate size when the specified bound /// size is unavailable. + /// + /// Must be left null if [boundSize] is specified as null. This will create + /// the [ResolutionStrategy] that chooses the highest available resolution, + /// which can also be retrieved by calling [getHighestAvailableStrategy]. final int? fallbackRule; } +/// Host API implementation of [ResolutionStrategy]. class _ResolutionStrategyHostApiImpl extends ResolutionStrategyHostApi { + /// Constructs an [_ResolutionStrategyHostApiImpl]. + /// + /// If [binaryMessenger] is null, the default [BinaryMessenger] will be used, + /// which routes to the host platform. + /// + /// An [instanceManager] is typically passed when a copy of an instance + /// contained by an [InstanceManager] is being created. If left null, it + /// will default to the global instance defined in [JavaObject]. _ResolutionStrategyHostApiImpl({ this.binaryMessenger, InstanceManager? instanceManager, }) : instanceManager = instanceManager ?? JavaObject.globalInstanceManager, super(binaryMessenger: binaryMessenger); + /// Receives binary data across the Flutter platform barrier. final BinaryMessenger? binaryMessenger; + /// Maintains instances stored to communicate with native language objects. final InstanceManager instanceManager; + /// Creates a [ResolutionStrategy] on the native side with the bound [Size] + /// and fallback rule, if specified. Future createFromInstances( ResolutionStrategy instance, Size? boundSize, diff --git a/packages/camera/camera_android_camerax/pigeons/camerax_library.dart b/packages/camera/camera_android_camerax/pigeons/camerax_library.dart index e2ad3b44f47..a22d7f6e351 100644 --- a/packages/camera/camera_android_camerax/pigeons/camerax_library.dart +++ b/packages/camera/camera_android_camerax/pigeons/camerax_library.dart @@ -269,25 +269,13 @@ abstract class ImageCaptureHostApi { String takePicture(int identifier); } -/// Host API for `ResolutionStrategy`. -/// -/// This class may handle instantiating and adding native object instances that -/// are attached to a Dart instance or handle method calls on the associated -/// native class or an instance of the class. @HostApi(dartHostTestHandler: 'TestResolutionStrategyHostApi') abstract class ResolutionStrategyHostApi { - /// Create a new native instance and add it to the `InstanceManager`. void create(int identifier, ResolutionInfo? boundSize, int? fallbackRule); } -/// Host API for `ResolutionSelector`. -/// -/// This class may handle instantiating and adding native object instances that -/// are attached to a Dart instance or handle method calls on the associated -/// native class or an instance of the class. @HostApi(dartHostTestHandler: 'TestResolutionSelectorHostApi') abstract class ResolutionSelectorHostApi { - /// Create a new native instance and add it to the `InstanceManager`. void create( int identifier, int? resolutionStrategyIdentifier, @@ -295,14 +283,8 @@ abstract class ResolutionSelectorHostApi { ); } -/// Host API for `AspectRatioStrategy`. -/// -/// This class may handle instantiating and adding native object instances that -/// are attached to a Dart instance or handle method calls on the associated -/// native class or an instance of the class. @HostApi(dartHostTestHandler: 'TestAspectRatioStrategyHostApi') abstract class AspectRatioStrategyHostApi { - /// Create a new native instance and add it to the `InstanceManager`. void create(int identifier, int preferredAspectRatio, int fallbackRule); } diff --git a/packages/camera/camera_android_camerax/test/image_analysis_test.dart b/packages/camera/camera_android_camerax/test/image_analysis_test.dart index 0e581094f2b..07d4060b2ee 100644 --- a/packages/camera/camera_android_camerax/test/image_analysis_test.dart +++ b/packages/camera/camera_android_camerax/test/image_analysis_test.dart @@ -3,10 +3,10 @@ // found in the LICENSE file. import 'package:camera_android_camerax/src/analyzer.dart'; -import 'package:camera_android_camerax/src/camerax_library.g.dart'; import 'package:camera_android_camerax/src/image_analysis.dart'; import 'package:camera_android_camerax/src/image_proxy.dart'; import 'package:camera_android_camerax/src/instance_manager.dart'; +import 'package:camera_android_camerax/src/resolution_selector.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; @@ -14,7 +14,11 @@ import 'package:mockito/mockito.dart'; import 'image_analysis_test.mocks.dart'; import 'test_camerax_library.g.dart'; -@GenerateMocks([TestImageAnalysisHostApi, TestInstanceManagerHostApi]) +@GenerateMocks([ + TestImageAnalysisHostApi, + TestInstanceManagerHostApi, + ResolutionSelector, +]) void main() { TestWidgetsFlutterBinding.ensureInitialized(); @@ -22,8 +26,6 @@ void main() { TestInstanceManagerHostApi.setup(MockTestInstanceManagerHostApi()); group('ImageAnalysis', () { - setUp(() {}); - tearDown(() { TestImageAnalysisHostApi.setup(null); TestInstanceManagerHostApi.setup(null); @@ -39,22 +41,25 @@ void main() { onWeakReferenceRemoved: (_) {}, ); - const int targetResolutionWidth = 65; - const int targetResolutionHeight = 99; - final ResolutionInfo targetResolution = - ResolutionInfo(width: 65, height: 99); + final MockResolutionSelector mockResolutionSelector = + MockResolutionSelector(); + const int mockResolutionSelectorId = 24; final ImageAnalysis instance = ImageAnalysis( - targetResolution: targetResolution, + resolutionSelector: mockResolutionSelector, instanceManager: instanceManager, ); - final VerificationResult createVerification = verify(mockApi.create( + instanceManager.addHostCreatedInstance( + mockResolutionSelector, mockResolutionSelectorId, + onCopy: (ResolutionSelector original) { + return ResolutionSelector( + resolutionStrategy: original.resolutionStrategy, + aspectRatioStrategy: original.aspectRatioStrategy); + }); + + verify(mockApi.create( argThat(equals(instanceManager.getIdentifier(instance))), - captureAny)); - final ResolutionInfo capturedResolutionInfo = - createVerification.captured.single as ResolutionInfo; - expect(capturedResolutionInfo.width, equals(targetResolutionWidth)); - expect(capturedResolutionInfo.height, equals(targetResolutionHeight)); + argThat(equals(mockResolutionSelectorId)))); }); test('setAnalyzer', () async { @@ -67,7 +72,7 @@ void main() { ); final ImageAnalysis instance = ImageAnalysis.detached( - targetResolution: ResolutionInfo(width: 75, height: 98), + resolutionSelector: MockResolutionSelector(), instanceManager: instanceManager, ); const int instanceIdentifier = 0; @@ -75,7 +80,7 @@ void main() { instance, instanceIdentifier, onCopy: (ImageAnalysis original) => ImageAnalysis.detached( - targetResolution: original.targetResolution, + resolutionSelector: original.resolutionSelector, instanceManager: instanceManager, ), ); @@ -114,7 +119,7 @@ void main() { ); final ImageAnalysis instance = ImageAnalysis.detached( - targetResolution: ResolutionInfo(width: 75, height: 98), + resolutionSelector: MockResolutionSelector(), instanceManager: instanceManager, ); const int instanceIdentifier = 0; @@ -122,7 +127,7 @@ void main() { instance, instanceIdentifier, onCopy: (ImageAnalysis original) => ImageAnalysis.detached( - targetResolution: original.targetResolution, + resolutionSelector: original.resolutionSelector, instanceManager: instanceManager, ), ); diff --git a/packages/camera/camera_android_camerax/test/image_analysis_test.mocks.dart b/packages/camera/camera_android_camerax/test/image_analysis_test.mocks.dart index 421d9908c3a..cc13d6b8142 100644 --- a/packages/camera/camera_android_camerax/test/image_analysis_test.mocks.dart +++ b/packages/camera/camera_android_camerax/test/image_analysis_test.mocks.dart @@ -3,7 +3,7 @@ // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes -import 'package:camera_android_camerax/src/camerax_library.g.dart' as _i3; +import 'package:camera_android_camerax/src/resolution_selector.dart' as _i3; import 'package:mockito/mockito.dart' as _i1; import 'test_camerax_library.g.dart' as _i2; @@ -31,14 +31,14 @@ class MockTestImageAnalysisHostApi extends _i1.Mock @override void create( int? identifier, - _i3.ResolutionInfo? targetResolutionIdentifier, + int? resolutionSelectorId, ) => super.noSuchMethod( Invocation.method( #create, [ identifier, - targetResolutionIdentifier, + resolutionSelectorId, ], ), returnValueForMissingStub: null, @@ -86,3 +86,13 @@ class MockTestInstanceManagerHostApi extends _i1.Mock returnValueForMissingStub: null, ); } + +/// A class which mocks [ResolutionSelector]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockResolutionSelector extends _i1.Mock + implements _i3.ResolutionSelector { + MockResolutionSelector() { + _i1.throwOnMissingStub(this); + } +} diff --git a/packages/camera/camera_android_camerax/test/image_capture_test.dart b/packages/camera/camera_android_camerax/test/image_capture_test.dart index bfcc66c0175..ca6a9c5dc5e 100644 --- a/packages/camera/camera_android_camerax/test/image_capture_test.dart +++ b/packages/camera/camera_android_camerax/test/image_capture_test.dart @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'package:camera_android_camerax/src/camerax_library.g.dart'; import 'package:camera_android_camerax/src/image_capture.dart'; import 'package:camera_android_camerax/src/instance_manager.dart'; +import 'package:camera_android_camerax/src/resolution_selector.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; @@ -12,7 +12,7 @@ import 'package:mockito/mockito.dart'; import 'image_capture_test.mocks.dart'; import 'test_camerax_library.g.dart'; -@GenerateMocks([TestImageCaptureHostApi]) +@GenerateMocks([TestImageCaptureHostApi, ResolutionSelector]) void main() { TestWidgetsFlutterBinding.ensureInitialized(); @@ -29,11 +29,11 @@ void main() { ImageCapture.detached( instanceManager: instanceManager, targetFlashMode: ImageCapture.flashModeOn, - targetResolution: ResolutionInfo(width: 50, height: 10), + resolutionSelector: MockResolutionSelector(), ); verifyNever(mockApi.create(argThat(isA()), argThat(isA()), - argThat(isA()))); + argThat(isA()))); }); test('create calls create on the Java side', () async { @@ -44,21 +44,28 @@ void main() { onWeakReferenceRemoved: (_) {}, ); const int targetFlashMode = ImageCapture.flashModeAuto; - const int targetResolutionWidth = 10; - const int targetResolutionHeight = 50; + final MockResolutionSelector mockResolutionSelector = + MockResolutionSelector(); + const int mockResolutionSelectorId = 24; + + instanceManager.addHostCreatedInstance( + mockResolutionSelector, mockResolutionSelectorId, + onCopy: (ResolutionSelector original) { + return ResolutionSelector( + resolutionStrategy: original.resolutionStrategy, + aspectRatioStrategy: original.aspectRatioStrategy); + }); + ImageCapture( instanceManager: instanceManager, targetFlashMode: targetFlashMode, - targetResolution: ResolutionInfo( - width: targetResolutionWidth, height: targetResolutionHeight), + resolutionSelector: mockResolutionSelector, ); - final VerificationResult createVerification = verify(mockApi.create( - argThat(isA()), argThat(equals(targetFlashMode)), captureAny)); - final ResolutionInfo capturedResolutionInfo = - createVerification.captured.single as ResolutionInfo; - expect(capturedResolutionInfo.width, equals(targetResolutionWidth)); - expect(capturedResolutionInfo.height, equals(targetResolutionHeight)); + verify(mockApi.create( + argThat(isA()), + argThat(equals(targetFlashMode)), + argThat(equals(mockResolutionSelector)))); }); test('setFlashMode makes call to set flash mode for ImageCapture instance', diff --git a/packages/camera/camera_android_camerax/test/image_capture_test.mocks.dart b/packages/camera/camera_android_camerax/test/image_capture_test.mocks.dart index 63761d80b88..d991efea7fe 100644 --- a/packages/camera/camera_android_camerax/test/image_capture_test.mocks.dart +++ b/packages/camera/camera_android_camerax/test/image_capture_test.mocks.dart @@ -3,9 +3,9 @@ // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i4; +import 'dart:async' as _i3; -import 'package:camera_android_camerax/src/camerax_library.g.dart' as _i3; +import 'package:camera_android_camerax/src/resolution_selector.dart' as _i4; import 'package:mockito/mockito.dart' as _i1; import 'test_camerax_library.g.dart' as _i2; @@ -34,7 +34,7 @@ class MockTestImageCaptureHostApi extends _i1.Mock void create( int? identifier, int? flashMode, - _i3.ResolutionInfo? targetResolution, + int? resolutionSelectorId, ) => super.noSuchMethod( Invocation.method( @@ -42,7 +42,7 @@ class MockTestImageCaptureHostApi extends _i1.Mock [ identifier, flashMode, - targetResolution, + resolutionSelectorId, ], ), returnValueForMissingStub: null, @@ -63,11 +63,21 @@ class MockTestImageCaptureHostApi extends _i1.Mock returnValueForMissingStub: null, ); @override - _i4.Future takePicture(int? identifier) => (super.noSuchMethod( + _i3.Future takePicture(int? identifier) => (super.noSuchMethod( Invocation.method( #takePicture, [identifier], ), - returnValue: _i4.Future.value(''), - ) as _i4.Future); + returnValue: _i3.Future.value(''), + ) as _i3.Future); +} + +/// A class which mocks [ResolutionSelector]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockResolutionSelector extends _i1.Mock + implements _i4.ResolutionSelector { + MockResolutionSelector() { + _i1.throwOnMissingStub(this); + } } diff --git a/packages/camera/camera_android_camerax/test/preview_test.dart b/packages/camera/camera_android_camerax/test/preview_test.dart index 6eacd42b5ca..c90563407d5 100644 --- a/packages/camera/camera_android_camerax/test/preview_test.dart +++ b/packages/camera/camera_android_camerax/test/preview_test.dart @@ -5,6 +5,7 @@ import 'package:camera_android_camerax/src/camerax_library.g.dart'; import 'package:camera_android_camerax/src/instance_manager.dart'; import 'package:camera_android_camerax/src/preview.dart'; +import 'package:camera_android_camerax/src/resolution_selector.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; @@ -12,7 +13,8 @@ import 'package:mockito/mockito.dart'; import 'preview_test.mocks.dart'; import 'test_camerax_library.g.dart'; -@GenerateMocks([TestInstanceManagerHostApi, TestPreviewHostApi]) +@GenerateMocks( + [TestInstanceManagerHostApi, TestPreviewHostApi, ResolutionSelector]) void main() { TestWidgetsFlutterBinding.ensureInitialized(); @@ -32,11 +34,11 @@ void main() { Preview.detached( instanceManager: instanceManager, targetRotation: 90, - targetResolution: ResolutionInfo(width: 50, height: 10), + resolutionSelector: MockResolutionSelector(), ); verifyNever(mockApi.create(argThat(isA()), argThat(isA()), - argThat(isA()))); + argThat(isA()))); }); test('create calls create on the Java side', () async { @@ -47,21 +49,28 @@ void main() { onWeakReferenceRemoved: (_) {}, ); const int targetRotation = 90; - const int targetResolutionWidth = 10; - const int targetResolutionHeight = 50; + final MockResolutionSelector mockResolutionSelector = + MockResolutionSelector(); + const int mockResolutionSelectorId = 24; + + instanceManager.addHostCreatedInstance( + mockResolutionSelector, mockResolutionSelectorId, + onCopy: (ResolutionSelector original) { + return ResolutionSelector( + resolutionStrategy: original.resolutionStrategy, + aspectRatioStrategy: original.aspectRatioStrategy); + }); + Preview( instanceManager: instanceManager, targetRotation: targetRotation, - targetResolution: ResolutionInfo( - width: targetResolutionWidth, height: targetResolutionHeight), + resolutionSelector: mockResolutionSelector, ); - final VerificationResult createVerification = verify(mockApi.create( - argThat(isA()), argThat(equals(targetRotation)), captureAny)); - final ResolutionInfo capturedResolutionInfo = - createVerification.captured.single as ResolutionInfo; - expect(capturedResolutionInfo.width, equals(targetResolutionWidth)); - expect(capturedResolutionInfo.height, equals(targetResolutionHeight)); + verify(mockApi.create( + argThat(isA()), + argThat(equals(targetRotation)), + argThat(equals(mockResolutionSelectorId)))); }); test( diff --git a/packages/camera/camera_android_camerax/test/preview_test.mocks.dart b/packages/camera/camera_android_camerax/test/preview_test.mocks.dart index 467f4dc2978..67bbe7e014e 100644 --- a/packages/camera/camera_android_camerax/test/preview_test.mocks.dart +++ b/packages/camera/camera_android_camerax/test/preview_test.mocks.dart @@ -4,6 +4,7 @@ // ignore_for_file: no_leading_underscores_for_library_prefixes import 'package:camera_android_camerax/src/camerax_library.g.dart' as _i2; +import 'package:camera_android_camerax/src/resolution_selector.dart' as _i4; import 'package:mockito/mockito.dart' as _i1; import 'test_camerax_library.g.dart' as _i3; @@ -62,7 +63,7 @@ class MockTestPreviewHostApi extends _i1.Mock void create( int? identifier, int? rotation, - _i2.ResolutionInfo? targetResolution, + int? resolutionSelectorId, ) => super.noSuchMethod( Invocation.method( @@ -70,7 +71,7 @@ class MockTestPreviewHostApi extends _i1.Mock [ identifier, rotation, - targetResolution, + resolutionSelectorId, ], ), returnValueForMissingStub: null, @@ -106,3 +107,13 @@ class MockTestPreviewHostApi extends _i1.Mock ), ) as _i2.ResolutionInfo); } + +/// A class which mocks [ResolutionSelector]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockResolutionSelector extends _i1.Mock + implements _i4.ResolutionSelector { + MockResolutionSelector() { + _i1.throwOnMissingStub(this); + } +} diff --git a/packages/camera/camera_android_camerax/test/resolution_selector_test.dart b/packages/camera/camera_android_camerax/test/resolution_selector_test.dart index 705da20e2dc..89e5dc0d65e 100644 --- a/packages/camera/camera_android_camerax/test/resolution_selector_test.dart +++ b/packages/camera/camera_android_camerax/test/resolution_selector_test.dart @@ -28,7 +28,7 @@ void main() { TestInstanceManagerHostApi.setup(null); }); - test('HostApi create', () { + test('HostApi create creates expected ResolutionSelector instance', () { final MockTestResolutionSelectorHostApi mockApi = MockTestResolutionSelectorHostApi(); TestResolutionSelectorHostApi.setup(mockApi); diff --git a/packages/camera/camera_android_camerax/test/resolution_strategy_test.dart b/packages/camera/camera_android_camerax/test/resolution_strategy_test.dart index 357fa5462ed..0951c2d138b 100644 --- a/packages/camera/camera_android_camerax/test/resolution_strategy_test.dart +++ b/packages/camera/camera_android_camerax/test/resolution_strategy_test.dart @@ -27,7 +27,9 @@ void main() { TestInstanceManagerHostApi.setup(null); }); - test('HostApi create', () { + test( + 'ResolutionStrategy constructor detects valid boundSize and fallbackRule combinations', + () { final MockTestResolutionStrategyHostApi mockApi = MockTestResolutionStrategyHostApi(); TestResolutionStrategyHostApi.setup(mockApi); @@ -37,8 +39,51 @@ void main() { onWeakReferenceRemoved: (_) {}, ); - const Size boundSize = Size(50, 30); + // Expect error if boundSize is null, but fallbackRule is not. + Size? boundSize; + int? fallbackRule = 5; + expect( + ResolutionStrategy( + boundSize: boundSize, + fallbackRule: fallbackRule, + instanceManager: instanceManager, + ), + throwsArgumentError); + + // Expect no error if boundSize is non-null, but fallbackRule is not. + boundSize = const Size(3, 5); + fallbackRule = null; + expect( + ResolutionStrategy( + boundSize: boundSize, + fallbackRule: fallbackRule, + instanceManager: instanceManager, + ), + returnsNormally); + + // Expect no error if boundSize and fallbackRule are both null. + boundSize = null; + fallbackRule = null; + expect( + ResolutionStrategy( + boundSize: boundSize, + fallbackRule: fallbackRule, + instanceManager: instanceManager, + ), + returnsNormally); + }); + + test('HostApi create creates expected ResolutionStrategy', () { + final MockTestResolutionStrategyHostApi mockApi = + MockTestResolutionStrategyHostApi(); + TestResolutionStrategyHostApi.setup(mockApi); + TestInstanceManagerHostApi.setup(MockTestInstanceManagerHostApi()); + final InstanceManager instanceManager = InstanceManager( + onWeakReferenceRemoved: (_) {}, + ); + + const Size boundSize = Size(50, 30); const int fallbackRule = 0; final ResolutionStrategy instance = ResolutionStrategy( From 6389ae1c72fe0d38ac80a6d854f58170db4bc4b3 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Tue, 18 Jul 2023 16:07:57 -0700 Subject: [PATCH 07/34] Work on Dart side -- tests, cleanup, bug id --- .../android/build.gradle | 2 +- .../lib/src/android_camera_camerax.dart | 102 +++++++++--------- .../lib/src/resolution_strategy.dart | 9 +- .../test/android_camera_camerax_test.dart | 95 ++++++++++++++-- .../aspect_ratio_strategy_test.mocks.dart | 4 +- .../test/image_analysis_test.dart | 21 ++-- .../test/image_capture_test.dart | 6 +- .../test/image_capture_test.mocks.dart | 20 ++-- .../test/preview_test.dart | 4 +- .../test/resolution_selector_test.mocks.dart | 4 +- .../test/resolution_strategy_test.dart | 30 +++--- .../test/resolution_strategy_test.mocks.dart | 4 +- 12 files changed, 193 insertions(+), 108 deletions(-) diff --git a/packages/camera/camera_android_camerax/android/build.gradle b/packages/camera/camera_android_camerax/android/build.gradle index 30e95ead604..5530a3bb104 100644 --- a/packages/camera/camera_android_camerax/android/build.gradle +++ b/packages/camera/camera_android_camerax/android/build.gradle @@ -61,7 +61,7 @@ android { dependencies { // CameraX core library using the camera2 implementation must use same version number. - def camerax_version = "1.3.0-alpha06" + def camerax_version = "1.3.0-beta01" implementation "androidx.camera:camera-core:${camerax_version}" implementation "androidx.camera:camera-camera2:${camerax_version}" implementation "androidx.camera:camera-lifecycle:${camerax_version}" diff --git a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart index 7060b731dfc..59cce2e1cbc 100644 --- a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart +++ b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart @@ -121,7 +121,8 @@ class AndroidCameraCameraX extends CameraPlatform { /// The [ResolutionSelector] that represents the resolution preset used to /// create a camera that will be used for capturing still images, recording /// video, and image analysis. - ResolutionSelector? _presetResolutionSelector; + @visibleForTesting + ResolutionSelector? presetResolutionSelector; /// The controller we need to broadcast the different camera events. /// @@ -232,7 +233,7 @@ class AndroidCameraCameraX extends CameraPlatform { startListeningForDeviceOrientationChange( cameraIsFrontFacing, cameraDescription.sensorOrientation); // Determine ResolutionSelector based on preset for camera UseCases. - _presetResolutionSelector = + presetResolutionSelector = await _getResolutionSelectorFromPreset(resolutionPreset); // Retrieve a fresh ProcessCameraProvider instance. @@ -246,7 +247,10 @@ class AndroidCameraCameraX extends CameraPlatform { final int flutterSurfaceTextureId = await preview!.setSurfaceProvider(); // Configure ImageCapture instance. - imageCapture = createImageCapture(null); + imageCapture = createImageCapture(); + + // Configure ImageAnalysis instance. Defaults to YUV_420_888 image format. + imageAnalysis = createImageAnalysis(); // Configure VideoCapture and Recorder instances. // TODO(gmackall): Enable video capture resolution configuration in createRecorder(). @@ -256,10 +260,9 @@ class AndroidCameraCameraX extends CameraPlatform { // Bind configured UseCases to ProcessCameraProvider instance & mark Preview // instance as bound but not paused. Video capture is bound at first use // instead of here. - camera = await processCameraProvider! - .bindToLifecycle(cameraSelector!, [preview!, imageCapture!]); - await _updateLiveCameraState(flutterSurfaceTextureId); - cameraInfo = await camera!.getCameraInfo(); + camera = await processCameraProvider!.bindToLifecycle( + cameraSelector!, [preview!, imageCapture!, imageAnalysis!]); + await _updateCameraInfoAndLiveCameraState(flutterSurfaceTextureId); _previewIsPaused = false; return flutterSurfaceTextureId; @@ -583,7 +586,7 @@ class AndroidCameraCameraX extends CameraPlatform { Stream onStreamedFrameAvailable(int cameraId, {CameraImageStreamOptions? options}) { cameraImageDataStreamController = StreamController( - onListen: _onFrameStreamListen, + onListen: () => _onFrameStreamListen(cameraId), onCancel: _onFrameStreamCancel, ); return cameraImageDataStreamController!.stream; @@ -607,13 +610,12 @@ class AndroidCameraCameraX extends CameraPlatform { camera = await processCameraProvider! .bindToLifecycle(cameraSelector!, [preview!]); - await _updateLiveCameraState(cameraId); - cameraInfo = await camera!.getCameraInfo(); + await _updateCameraInfoAndLiveCameraState(cameraId); } /// Configures the [imageAnalysis] instance for image streaming and binds it /// to camera lifecycle controlled by the [processCameraProvider]. - Future _configureAndBindImageAnalysisToLifecycle() async { + Future _configureAndBindImageAnalysisToLifecycle(int cameraId) async { // Create Analyzer that can read image data for image streaming. final WeakReference weakThis = WeakReference(this); @@ -649,21 +651,7 @@ class AndroidCameraCameraX extends CameraPlatform { ? Analyzer.detached(analyze: analyze) : Analyzer(analyze: analyze); - // TODO(camsim99): Support resolution configuration. - // Defaults to YUV_420_888 image format. - imageAnalysis = createImageAnalysis(); unawaited(imageAnalysis!.setAnalyzer(analyzer)); - - if (await processCameraProvider!.isBound(imageAnalysis!)) { - // No need to bind imageAnalysis to lifecycle again. - return; - } - - // TODO(camsim99): Reset live camera state observers here when - // https://github.com/flutter/packages/pull/3419 lands. - camera = await processCameraProvider! - .bindToLifecycle(cameraSelector!, [imageAnalysis!]); - cameraInfo = await camera!.getCameraInfo(); } /// Unbinds [useCase] from camera lifecycle controlled by the @@ -681,8 +669,8 @@ class AndroidCameraCameraX extends CameraPlatform { /// The [onListen] callback for the stream controller used for image /// streaming. - Future _onFrameStreamListen() async { - await _configureAndBindImageAnalysisToLifecycle(); + Future _onFrameStreamListen(int cameraId) async { + await _configureAndBindImageAnalysisToLifecycle(cameraId); } /// The [onCancel] callback for the stream controller used for image @@ -710,15 +698,16 @@ class AndroidCameraCameraX extends CameraPlatform { // Methods concerning camera state: - /// Adds observers to the [LiveData] of the [CameraState] of the current + /// Updates [cameraInfo] to the information corresponding to [camera] and + /// adds observers to the [LiveData] of the [CameraState] of the current /// [camera], saved as [liveCameraState]. /// /// If a previous [liveCameraState] was stored, existing observers are /// removed, as well. - Future _updateLiveCameraState(int cameraId) async { - final CameraInfo cameraInfo = await camera!.getCameraInfo(); + Future _updateCameraInfoAndLiveCameraState(int cameraId) async { + cameraInfo = await camera!.getCameraInfo(); await liveCameraState?.removeObservers(); - liveCameraState = await cameraInfo.getCameraState(); + liveCameraState = await cameraInfo!.getCameraState(); await liveCameraState!.observe(_createCameraClosingObserver(cameraId)); } @@ -796,42 +785,49 @@ class AndroidCameraCameraX extends CameraPlatform { /// closest lower resolution available. Future _getResolutionSelectorFromPreset( ResolutionPreset? preset) async { + const int fallbackRule = ResolutionStrategy.fallbackRuleClosestLower; + + Size? boundSize; ResolutionStrategy? resolutionStrategy; - const int generalFallbackRule = ResolutionStrategy.fallbackRuleClosestLower; switch (preset) { case ResolutionPreset.low: - resolutionStrategy = ResolutionStrategy( - boundSize: const Size(320, 240), fallbackRule: generalFallbackRule); + boundSize = const Size(320, 240); break; case ResolutionPreset.medium: - resolutionStrategy = ResolutionStrategy( - boundSize: const Size(720, 480), fallbackRule: generalFallbackRule); + boundSize = const Size(720, 480); break; case ResolutionPreset.high: - resolutionStrategy = ResolutionStrategy( - boundSize: const Size(1280, 720), - fallbackRule: generalFallbackRule); + boundSize = const Size(1280, 720); break; case ResolutionPreset.veryHigh: - resolutionStrategy = ResolutionStrategy( - boundSize: const Size(1920, 1080), - fallbackRule: generalFallbackRule); + boundSize = const Size(1920, 1080); break; case ResolutionPreset.ultraHigh: - resolutionStrategy = ResolutionStrategy( - boundSize: const Size(3840, 2160), - fallbackRule: generalFallbackRule); + boundSize = const Size(3840, 2160); break; case ResolutionPreset.max: - resolutionStrategy = ResolutionStrategy.getHighestAvailableStrategy(); + // Automatically set strategy to choose highest available. + resolutionStrategy = ResolutionStrategy.getHighestAvailableStrategy( + detached: _shouldCreateDetachedObjectForTesting); break; case null: // If not preset is specified, default to CameraX's default behvaior // for each UseCase. - break; + return null; + } + + if (_shouldCreateDetachedObjectForTesting) { + resolutionStrategy ??= ResolutionStrategy.detached( + boundSize: boundSize, fallbackRule: fallbackRule); + return ResolutionSelector.detached( + resolutionStrategy: resolutionStrategy); } - return ResolutionSelector(resolutionStrategy: resolutionStrategy); + resolutionStrategy ??= + ResolutionStrategy(boundSize: boundSize, fallbackRule: fallbackRule); + return ResolutionSelector( + resolutionStrategy: ResolutionStrategy( + boundSize: boundSize, fallbackRule: fallbackRule)); } // Methods for calls that need to be tested: @@ -869,16 +865,14 @@ class AndroidCameraCameraX extends CameraPlatform { Preview createPreview(int targetRotation) { return Preview( targetRotation: targetRotation, - resolutionSelector: _presetResolutionSelector); + resolutionSelector: presetResolutionSelector); } /// Returns an [ImageCapture] configured with specified flash mode and /// the preset [ResolutionSelector]. @visibleForTesting - ImageCapture createImageCapture(int? flashMode) { - return ImageCapture( - targetFlashMode: flashMode, - resolutionSelector: _presetResolutionSelector); + ImageCapture createImageCapture() { + return ImageCapture(resolutionSelector: presetResolutionSelector); } /// Returns a [Recorder] for use in video capture. @@ -896,6 +890,6 @@ class AndroidCameraCameraX extends CameraPlatform { /// Returns an [ImageAnalysis] configured with the preset [ResolutionSelector]. @visibleForTesting ImageAnalysis createImageAnalysis() { - return ImageAnalysis(resolutionSelector: _presetResolutionSelector); + return ImageAnalysis(resolutionSelector: presetResolutionSelector); } } diff --git a/packages/camera/camera_android_camerax/lib/src/resolution_strategy.dart b/packages/camera/camera_android_camerax/lib/src/resolution_strategy.dart index 5d8c425200f..582ba2f3bb6 100644 --- a/packages/camera/camera_android_camerax/lib/src/resolution_strategy.dart +++ b/packages/camera/camera_android_camerax/lib/src/resolution_strategy.dart @@ -37,8 +37,8 @@ class ResolutionStrategy extends JavaObject { /// This should only be used outside of tests by subclasses created by this /// library or to create a copy for an [InstanceManager]. ResolutionStrategy.detached({ - required this.boundSize, - required this.fallbackRule, + this.boundSize, + this.fallbackRule, super.binaryMessenger, super.instanceManager, }) : _api = _ResolutionStrategyHostApiImpl( @@ -99,7 +99,12 @@ class ResolutionStrategy extends JavaObject { static ResolutionStrategy getHighestAvailableStrategy({ BinaryMessenger? binaryMessenger, InstanceManager? instanceManager, + bool detached = false, }) { + if (detached) { + return ResolutionStrategy.detached( + binaryMessenger: binaryMessenger, instanceManager: instanceManager); + } return ResolutionStrategy( binaryMessenger: binaryMessenger, instanceManager: instanceManager); } diff --git a/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart b/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart index bdebdce095d..53076cc2df6 100644 --- a/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart +++ b/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart @@ -25,6 +25,7 @@ import 'package:camera_android_camerax/src/preview.dart'; import 'package:camera_android_camerax/src/process_camera_provider.dart'; import 'package:camera_android_camerax/src/recorder.dart'; import 'package:camera_android_camerax/src/recording.dart'; +import 'package:camera_android_camerax/src/resolution_strategy.dart'; import 'package:camera_android_camerax/src/system_services.dart'; import 'package:camera_android_camerax/src/use_case.dart'; import 'package:camera_android_camerax/src/video_capture.dart'; @@ -264,6 +265,81 @@ void main() { expect(camera.cameraInfo, equals(mockCameraInfo)); }); + test( + 'createCamera properly sets preset resolution for non-video capture use cases', + () async { + final FakeAndroidCameraCameraX camera = + FakeAndroidCameraCameraX(shouldCreateDetachedObjectForTesting: true); + final MockProcessCameraProvider mockProcessCameraProvider = + MockProcessCameraProvider(); + const CameraLensDirection testLensDirection = CameraLensDirection.back; + const int testSensorOrientation = 90; + const CameraDescription testCameraDescription = CameraDescription( + name: 'cameraName', + lensDirection: testLensDirection, + sensorOrientation: testSensorOrientation); + const bool enableAudio = true; + final MockCamera mockCamera = MockCamera(); + final MockCameraInfo mockCameraInfo = MockCameraInfo(); + + camera.processCameraProvider = mockProcessCameraProvider; + + when(mockProcessCameraProvider.bindToLifecycle( + camera.mockBackCameraSelector, + [camera.testPreview, camera.testImageCapture])) + .thenAnswer((_) async => mockCamera); + when(mockCamera.getCameraInfo()).thenAnswer((_) async => mockCameraInfo); + when(mockCameraInfo.getCameraState()) + .thenAnswer((_) async => MockLiveCameraState()); + camera.processCameraProvider = mockProcessCameraProvider; + + // Test non-null resolution presets. + for (final ResolutionPreset resolutionPreset in ResolutionPreset.values) { + await camera.createCamera(testCameraDescription, resolutionPreset, + enableAudio: enableAudio); + + Size? expectedBoundSize; + ResolutionStrategy? expectedResolutionStrategy; + switch (resolutionPreset) { + case ResolutionPreset.low: + expectedBoundSize = const Size(320, 240); + break; + case ResolutionPreset.medium: + expectedBoundSize = const Size(720, 480); + break; + case ResolutionPreset.high: + expectedBoundSize = const Size(1280, 720); + break; + case ResolutionPreset.veryHigh: + expectedBoundSize = const Size(1920, 1080); + break; + case ResolutionPreset.ultraHigh: + expectedBoundSize = const Size(3840, 2160); + break; + case ResolutionPreset.max: + expectedResolutionStrategy = + ResolutionStrategy.getHighestAvailableStrategy(detached: true); + break; + } + + // We expect the strategy to be the highest available or correspond to the + // expected bound size, with fallback to the closest and highest available + // resolution. + expectedResolutionStrategy ??= ResolutionStrategy.detached( + boundSize: expectedBoundSize, + fallbackRule: ResolutionStrategy.fallbackRuleClosestLower); + + expect(camera.presetResolutionSelector!.resolutionStrategy!.boundSize, + equals(expectedResolutionStrategy.boundSize)); + expect(camera.presetResolutionSelector!.resolutionStrategy!.fallbackRule, + equals(expectedResolutionStrategy.fallbackRule)); + } + + // Test null case + await camera.createCamera(testCameraDescription, null); + expect(camera.presetResolutionSelector, isNull); + }); + test( 'initializeCamera throws a CameraException when createCamera has not been called before initializedCamera', () async { @@ -917,6 +993,7 @@ void main() { final MockProcessCameraProvider mockProcessCameraProvider = MockProcessCameraProvider(); final MockCamera mockCamera = MockCamera(); + final MockCameraInfo mockCameraInfo = MockCameraInfo(); const int cameraId = 22; camera.processCameraProvider = mockProcessCameraProvider; @@ -925,7 +1002,9 @@ void main() { when(mockProcessCameraProvider.bindToLifecycle(any, any)) .thenAnswer((_) => Future.value(mockCamera)); when(mockCamera.getCameraInfo()) - .thenAnswer((_) => Future.value(MockCameraInfo())); + .thenAnswer((_) => Future.value(mockCameraInfo)); + when(mockCameraInfo.getCameraState()) + .thenAnswer((_) async => MockLiveCameraState()); final CameraImageData mockCameraImageData = MockCameraImageData(); final Stream imageStream = @@ -947,6 +1026,7 @@ void main() { final MockProcessCameraProvider mockProcessCameraProvider = MockProcessCameraProvider(); final MockCamera mockCamera = MockCamera(); + final MockCameraInfo mockCameraInfo = MockCameraInfo(); const int cameraId = 22; camera.processCameraProvider = mockProcessCameraProvider; @@ -955,7 +1035,9 @@ void main() { when(mockProcessCameraProvider.bindToLifecycle(any, any)) .thenAnswer((_) => Future.value(mockCamera)); when(mockCamera.getCameraInfo()) - .thenAnswer((_) => Future.value(MockCameraInfo())); + .thenAnswer((_) => Future.value(mockCameraInfo)); + when(mockCameraInfo.getCameraState()) + .thenAnswer((_) async => MockLiveCameraState()); final CameraImageData mockCameraImageData = MockCameraImageData(); final Stream imageStream = @@ -1009,6 +1091,8 @@ void main() { mockCameraSelector, [camera.mockImageAnalysis])) .thenAnswer((_) async => mockCamera); when(mockCamera.getCameraInfo()).thenAnswer((_) async => mockCameraInfo); + when(mockCameraInfo.getCameraState()) + .thenAnswer((_) async => MockLiveCameraState()); when(mockImageProxy.getPlanes()) .thenAnswer((_) => Future>.value(mockPlanes)); when(mockPlane.buffer).thenReturn(buffer); @@ -1127,13 +1211,12 @@ class FakeAndroidCameraCameraX extends AndroidCameraCameraX { } @override - Preview createPreview(int targetRotation, ResolutionInfo? targetResolution) { + Preview createPreview(int targetRotation) { return testPreview; } @override - ImageCapture createImageCapture( - int? flashMode, ResolutionInfo? targetResolution) { + ImageCapture createImageCapture() { return testImageCapture; } @@ -1148,7 +1231,7 @@ class FakeAndroidCameraCameraX extends AndroidCameraCameraX { } @override - ImageAnalysis createImageAnalysis(ResolutionInfo? targetResolution) { + ImageAnalysis createImageAnalysis() { return mockImageAnalysis; } } diff --git a/packages/camera/camera_android_camerax/test/aspect_ratio_strategy_test.mocks.dart b/packages/camera/camera_android_camerax/test/aspect_ratio_strategy_test.mocks.dart index 73cc5b0eff0..28dda66896e 100644 --- a/packages/camera/camera_android_camerax/test/aspect_ratio_strategy_test.mocks.dart +++ b/packages/camera/camera_android_camerax/test/aspect_ratio_strategy_test.mocks.dart @@ -1,7 +1,9 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.1 from annotations // in camera_android_camerax/test/aspect_ratio_strategy_test.dart. // Do not manually edit this file. +// @dart=2.19 + // ignore_for_file: no_leading_underscores_for_library_prefixes import 'package:mockito/mockito.dart' as _i1; diff --git a/packages/camera/camera_android_camerax/test/image_analysis_test.dart b/packages/camera/camera_android_camerax/test/image_analysis_test.dart index b67261edf35..80acd655982 100644 --- a/packages/camera/camera_android_camerax/test/image_analysis_test.dart +++ b/packages/camera/camera_android_camerax/test/image_analysis_test.dart @@ -30,7 +30,7 @@ void main() { TestImageAnalysisHostApi.setup(null); }); - test('HostApi create', () { + test('create calls create on the Java side', () { final MockTestImageAnalysisHostApi mockApi = MockTestImageAnalysisHostApi(); TestImageAnalysisHostApi.setup(mockApi); @@ -42,25 +42,25 @@ void main() { final MockResolutionSelector mockResolutionSelector = MockResolutionSelector(); const int mockResolutionSelectorId = 24; - final ImageAnalysis instance = ImageAnalysis( - resolutionSelector: mockResolutionSelector, - instanceManager: instanceManager, - ); instanceManager.addHostCreatedInstance( mockResolutionSelector, mockResolutionSelectorId, onCopy: (ResolutionSelector original) { - return ResolutionSelector( - resolutionStrategy: original.resolutionStrategy, - aspectRatioStrategy: original.aspectRatioStrategy); + return MockResolutionSelector(); }); + final ImageAnalysis instance = ImageAnalysis( + resolutionSelector: mockResolutionSelector, + instanceManager: instanceManager, + ); + verify(mockApi.create( argThat(equals(instanceManager.getIdentifier(instance))), argThat(equals(mockResolutionSelectorId)))); }); - test('setAnalyzer', () async { + test('setAnalyzer makes call to set analyzer on ImageAnalysis instance', + () async { final MockTestImageAnalysisHostApi mockApi = MockTestImageAnalysisHostApi(); TestImageAnalysisHostApi.setup(mockApi); @@ -107,7 +107,8 @@ void main() { )); }); - test('clearAnalyzer', () async { + test('clearAnalyzer makes call to clear analyzer on ImageAnalysis instance', + () async { final MockTestImageAnalysisHostApi mockApi = MockTestImageAnalysisHostApi(); TestImageAnalysisHostApi.setup(mockApi); diff --git a/packages/camera/camera_android_camerax/test/image_capture_test.dart b/packages/camera/camera_android_camerax/test/image_capture_test.dart index 338b3656e49..c50314ed3cb 100644 --- a/packages/camera/camera_android_camerax/test/image_capture_test.dart +++ b/packages/camera/camera_android_camerax/test/image_capture_test.dart @@ -58,9 +58,7 @@ void main() { instanceManager.addHostCreatedInstance( mockResolutionSelector, mockResolutionSelectorId, onCopy: (ResolutionSelector original) { - return ResolutionSelector( - resolutionStrategy: original.resolutionStrategy, - aspectRatioStrategy: original.aspectRatioStrategy); + return MockResolutionSelector(); }); ImageCapture( @@ -72,7 +70,7 @@ void main() { verify(mockApi.create( argThat(isA()), argThat(equals(targetFlashMode)), - argThat(equals(mockResolutionSelector)))); + argThat(equals(mockResolutionSelectorId)))); }); test('setFlashMode makes call to set flash mode for ImageCapture instance', diff --git a/packages/camera/camera_android_camerax/test/image_capture_test.mocks.dart b/packages/camera/camera_android_camerax/test/image_capture_test.mocks.dart index 0ce4f186834..c24a363daf2 100644 --- a/packages/camera/camera_android_camerax/test/image_capture_test.mocks.dart +++ b/packages/camera/camera_android_camerax/test/image_capture_test.mocks.dart @@ -74,16 +74,6 @@ class MockTestImageCaptureHostApi extends _i1.Mock ) as _i3.Future); } -/// A class which mocks [ResolutionSelector]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockResolutionSelector extends _i1.Mock - implements _i4.ResolutionSelector { - MockResolutionSelector() { - _i1.throwOnMissingStub(this); - } -} - /// A class which mocks [TestInstanceManagerHostApi]. /// /// See the documentation for Mockito's code generation for more information. @@ -102,3 +92,13 @@ class MockTestInstanceManagerHostApi extends _i1.Mock returnValueForMissingStub: null, ); } + +/// A class which mocks [ResolutionSelector]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockResolutionSelector extends _i1.Mock + implements _i4.ResolutionSelector { + MockResolutionSelector() { + _i1.throwOnMissingStub(this); + } +} diff --git a/packages/camera/camera_android_camerax/test/preview_test.dart b/packages/camera/camera_android_camerax/test/preview_test.dart index c90563407d5..29f862cda4c 100644 --- a/packages/camera/camera_android_camerax/test/preview_test.dart +++ b/packages/camera/camera_android_camerax/test/preview_test.dart @@ -56,9 +56,7 @@ void main() { instanceManager.addHostCreatedInstance( mockResolutionSelector, mockResolutionSelectorId, onCopy: (ResolutionSelector original) { - return ResolutionSelector( - resolutionStrategy: original.resolutionStrategy, - aspectRatioStrategy: original.aspectRatioStrategy); + return MockResolutionSelector(); }); Preview( diff --git a/packages/camera/camera_android_camerax/test/resolution_selector_test.mocks.dart b/packages/camera/camera_android_camerax/test/resolution_selector_test.mocks.dart index d0b8ba1a135..4692bfc9232 100644 --- a/packages/camera/camera_android_camerax/test/resolution_selector_test.mocks.dart +++ b/packages/camera/camera_android_camerax/test/resolution_selector_test.mocks.dart @@ -1,7 +1,9 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.1 from annotations // in camera_android_camerax/test/resolution_selector_test.dart. // Do not manually edit this file. +// @dart=2.19 + // ignore_for_file: no_leading_underscores_for_library_prefixes import 'package:mockito/mockito.dart' as _i1; diff --git a/packages/camera/camera_android_camerax/test/resolution_strategy_test.dart b/packages/camera/camera_android_camerax/test/resolution_strategy_test.dart index 0951c2d138b..83c8151d8df 100644 --- a/packages/camera/camera_android_camerax/test/resolution_strategy_test.dart +++ b/packages/camera/camera_android_camerax/test/resolution_strategy_test.dart @@ -43,33 +43,33 @@ void main() { Size? boundSize; int? fallbackRule = 5; expect( - ResolutionStrategy( - boundSize: boundSize, - fallbackRule: fallbackRule, - instanceManager: instanceManager, - ), + () => ResolutionStrategy( + boundSize: boundSize, + fallbackRule: fallbackRule, + instanceManager: instanceManager, + ), throwsArgumentError); // Expect no error if boundSize is non-null, but fallbackRule is not. boundSize = const Size(3, 5); fallbackRule = null; expect( - ResolutionStrategy( - boundSize: boundSize, - fallbackRule: fallbackRule, - instanceManager: instanceManager, - ), + () => ResolutionStrategy( + boundSize: boundSize, + fallbackRule: fallbackRule, + instanceManager: instanceManager, + ), returnsNormally); // Expect no error if boundSize and fallbackRule are both null. boundSize = null; fallbackRule = null; expect( - ResolutionStrategy( - boundSize: boundSize, - fallbackRule: fallbackRule, - instanceManager: instanceManager, - ), + () => ResolutionStrategy( + boundSize: boundSize, + fallbackRule: fallbackRule, + instanceManager: instanceManager, + ), returnsNormally); }); diff --git a/packages/camera/camera_android_camerax/test/resolution_strategy_test.mocks.dart b/packages/camera/camera_android_camerax/test/resolution_strategy_test.mocks.dart index 953a9136f90..1a667389bac 100644 --- a/packages/camera/camera_android_camerax/test/resolution_strategy_test.mocks.dart +++ b/packages/camera/camera_android_camerax/test/resolution_strategy_test.mocks.dart @@ -1,7 +1,9 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.1 from annotations // in camera_android_camerax/test/resolution_strategy_test.dart. // Do not manually edit this file. +// @dart=2.19 + // ignore_for_file: no_leading_underscores_for_library_prefixes import 'package:camera_android_camerax/src/camerax_library.g.dart' as _i3; import 'package:mockito/mockito.dart' as _i1; From 16770dedabeb8874524e2457ef2de4f2a3fed326 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Tue, 18 Jul 2023 16:12:10 -0700 Subject: [PATCH 08/34] Fix java unit tests --- .../io/flutter/plugins/camerax/ResolutionStrategyTest.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/ResolutionStrategyTest.java b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/ResolutionStrategyTest.java index 6bb522d93d3..716dbb74e7e 100644 --- a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/ResolutionStrategyTest.java +++ b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/ResolutionStrategyTest.java @@ -60,7 +60,10 @@ public void hostApiCreate_throwsAssertionErrorWhenArgumentsInvalid() { final Long fallbackRule = 8L; final long instanceIdentifier = 0; + final ResolutionStrategyHostApiImpl hostApi = + new ResolutionStrategyHostApiImpl(instanceManager, mockProxy); + // We expect an errror to be thrown in fallbackRule is specified but bound size is not. - assertThrows(IllegalArgumentException.clas, () -> hostApi.create(instanceIdentifier, null, fallbackRule)); + assertThrows(IllegalArgumentException.class, () -> hostApi.create(instanceIdentifier, null, fallbackRule)); } } From a8144faf015afb4baa6729e82b63584f5890c68a Mon Sep 17 00:00:00 2001 From: camsim99 Date: Tue, 18 Jul 2023 16:17:27 -0700 Subject: [PATCH 09/34] Fix typo --- .../java/io/flutter/plugins/camerax/ResolutionStrategyTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/ResolutionStrategyTest.java b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/ResolutionStrategyTest.java index 716dbb74e7e..d29fa17b2db 100644 --- a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/ResolutionStrategyTest.java +++ b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/ResolutionStrategyTest.java @@ -63,7 +63,7 @@ public void hostApiCreate_throwsAssertionErrorWhenArgumentsInvalid() { final ResolutionStrategyHostApiImpl hostApi = new ResolutionStrategyHostApiImpl(instanceManager, mockProxy); - // We expect an errror to be thrown in fallbackRule is specified but bound size is not. + // We expect an exception to be thrown in fallbackRule is specified but bound size is not. assertThrows(IllegalArgumentException.class, () -> hostApi.create(instanceIdentifier, null, fallbackRule)); } } From aba4c34d64f89550727ab8906b062a59e62de8f8 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Wed, 19 Jul 2023 09:27:06 -0700 Subject: [PATCH 10/34] Fix dart tests --- .../test/android_camera_camerax_test.dart | 76 ++++++++++--------- 1 file changed, 39 insertions(+), 37 deletions(-) diff --git a/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart b/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart index 53076cc2df6..33035413598 100644 --- a/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart +++ b/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart @@ -182,9 +182,11 @@ void main() { when(camera.testPreview.setSurfaceProvider()) .thenAnswer((_) async => testSurfaceTextureId); when(mockProcessCameraProvider.bindToLifecycle( - camera.mockBackCameraSelector, - [camera.testPreview, camera.testImageCapture])) - .thenAnswer((_) async => mockCamera); + camera.mockBackCameraSelector, [ + camera.testPreview, + camera.testImageCapture, + camera.testImageAnalysis + ])).thenAnswer((_) async => mockCamera); when(mockCamera.getCameraInfo()).thenAnswer((_) async => mockCameraInfo); when(mockCameraInfo.getCameraState()) .thenAnswer((_) async => mockLiveCameraState); @@ -246,9 +248,11 @@ void main() { camera.processCameraProvider = mockProcessCameraProvider; when(mockProcessCameraProvider.bindToLifecycle( - camera.mockBackCameraSelector, - [camera.testPreview, camera.testImageCapture])) - .thenAnswer((_) async => mockCamera); + camera.mockBackCameraSelector, [ + camera.testPreview, + camera.testImageCapture, + camera.testImageAnalysis + ])).thenAnswer((_) async => mockCamera); when(mockCamera.getCameraInfo()).thenAnswer((_) async => mockCameraInfo); when(mockCameraInfo.getCameraState()) .thenAnswer((_) async => MockLiveCameraState()); @@ -258,8 +262,12 @@ void main() { enableAudio: enableAudio); // Verify expected UseCases were bound. - verify(camera.processCameraProvider!.bindToLifecycle(camera.cameraSelector!, - [camera.testPreview, camera.testImageCapture])); + verify(camera.processCameraProvider!.bindToLifecycle( + camera.cameraSelector!, [ + camera.testPreview, + camera.testImageCapture, + camera.testImageAnalysis + ])); // Verify the camera's CameraInfo instance got updated. expect(camera.cameraInfo, equals(mockCameraInfo)); @@ -285,9 +293,11 @@ void main() { camera.processCameraProvider = mockProcessCameraProvider; when(mockProcessCameraProvider.bindToLifecycle( - camera.mockBackCameraSelector, - [camera.testPreview, camera.testImageCapture])) - .thenAnswer((_) async => mockCamera); + camera.mockBackCameraSelector, [ + camera.testPreview, + camera.testImageCapture, + camera.testImageAnalysis + ])).thenAnswer((_) async => mockCamera); when(mockCamera.getCameraInfo()).thenAnswer((_) async => mockCameraInfo); when(mockCameraInfo.getCameraState()) .thenAnswer((_) async => MockLiveCameraState()); @@ -389,9 +399,11 @@ void main() { .thenAnswer((_) async => cameraId); when(camera.processCameraProvider!.bindToLifecycle( - camera.mockBackCameraSelector, - [camera.testPreview, camera.testImageCapture])) - .thenAnswer((_) async => mockCamera); + camera.mockBackCameraSelector, [ + camera.testPreview, + camera.testImageCapture, + camera.testImageAnalysis + ])).thenAnswer((_) async => mockCamera); when(mockCamera.getCameraInfo()).thenAnswer((_) async => mockCameraInfo); when(mockCameraInfo.getCameraState()) .thenAnswer((_) async => MockLiveCameraState()); @@ -998,6 +1010,7 @@ void main() { camera.processCameraProvider = mockProcessCameraProvider; camera.cameraSelector = MockCameraSelector(); + camera.imageAnalysis = MockImageAnalysis(); when(mockProcessCameraProvider.bindToLifecycle(any, any)) .thenAnswer((_) => Future.value(mockCamera)); @@ -1031,6 +1044,7 @@ void main() { camera.processCameraProvider = mockProcessCameraProvider; camera.cameraSelector = MockCameraSelector(); + camera.imageAnalysis = MockImageAnalysis(); when(mockProcessCameraProvider.bindToLifecycle(any, any)) .thenAnswer((_) => Future.value(mockCamera)); @@ -1070,6 +1084,7 @@ void main() { final ProcessCameraProvider mockProcessCameraProvider = MockProcessCameraProvider(); final CameraSelector mockCameraSelector = MockCameraSelector(); + final MockImageAnalysis mockImageAnalysis = MockImageAnalysis(); final Camera mockCamera = MockCamera(); final CameraInfo mockCameraInfo = MockCameraInfo(); final MockImageProxy mockImageProxy = MockImageProxy(); @@ -1084,11 +1099,12 @@ void main() { camera.processCameraProvider = mockProcessCameraProvider; camera.cameraSelector = mockCameraSelector; + camera.imageAnalysis = mockImageAnalysis; - when(mockProcessCameraProvider.isBound(camera.mockImageAnalysis)) + when(mockProcessCameraProvider.isBound(mockImageAnalysis)) .thenAnswer((_) async => Future.value(false)); - when(mockProcessCameraProvider.bindToLifecycle( - mockCameraSelector, [camera.mockImageAnalysis])) + when(mockProcessCameraProvider + .bindToLifecycle(mockCameraSelector, [mockImageAnalysis])) .thenAnswer((_) async => mockCamera); when(mockCamera.getCameraInfo()).thenAnswer((_) async => mockCameraInfo); when(mockCameraInfo.getCameraState()) @@ -1113,12 +1129,8 @@ void main() { // Test ImageAnalysis use case is bound to ProcessCameraProvider. final Analyzer capturedAnalyzer = - verify(camera.mockImageAnalysis.setAnalyzer(captureAny)).captured.single + verify(mockImageAnalysis.setAnalyzer(captureAny)).captured.single as Analyzer; - await untilCalled( - mockProcessCameraProvider.isBound(camera.mockImageAnalysis)); - await untilCalled(mockProcessCameraProvider.bindToLifecycle( - mockCameraSelector, [camera.mockImageAnalysis])); await capturedAnalyzer.analyze(mockImageProxy); final CameraImageData imageData = await imageDataCompleter.future; @@ -1132,9 +1144,6 @@ void main() { expect(imageData.height, equals(imageHeight)); expect(imageData.width, equals(imageWidth)); - // Verify camera and cameraInfo were properly updated. - expect(camera.camera, equals(mockCamera)); - expect(camera.cameraInfo, equals(mockCameraInfo)); await onStreamedFrameAvailableSubscription.cancel(); }); @@ -1147,26 +1156,19 @@ void main() { final ProcessCameraProvider mockProcessCameraProvider = MockProcessCameraProvider(); final CameraSelector mockCameraSelector = MockCameraSelector(); - final Camera mockCamera = MockCamera(); + final MockImageAnalysis mockImageAnalysis = MockImageAnalysis(); camera.processCameraProvider = mockProcessCameraProvider; camera.cameraSelector = mockCameraSelector; - - when(mockProcessCameraProvider.bindToLifecycle( - mockCameraSelector, [camera.mockImageAnalysis])) - .thenAnswer((_) async => mockCamera); - when(mockCamera.getCameraInfo()).thenAnswer((_) async => MockCameraInfo()); + camera.imageAnalysis = mockImageAnalysis; final StreamSubscription imageStreamSubscription = camera .onStreamedFrameAvailable(cameraId) .listen((CameraImageData data) {}); - when(mockProcessCameraProvider.isBound(camera.mockImageAnalysis)) - .thenAnswer((_) async => Future.value(true)); - await imageStreamSubscription.cancel(); - verify(camera.mockImageAnalysis.clearAnalyzer()); + verify(mockImageAnalysis.clearAnalyzer()); }); } @@ -1185,7 +1187,7 @@ class FakeAndroidCameraCameraX extends AndroidCameraCameraX { final MockCameraSelector mockFrontCameraSelector = MockCameraSelector(); final MockRecorder testRecorder = MockRecorder(); final MockVideoCapture testVideoCapture = MockVideoCapture(); - final MockImageAnalysis mockImageAnalysis = MockImageAnalysis(); + final MockImageAnalysis testImageAnalysis = MockImageAnalysis(); @override Future requestCameraPermissions(bool enableAudio) async { @@ -1232,6 +1234,6 @@ class FakeAndroidCameraCameraX extends AndroidCameraCameraX { @override ImageAnalysis createImageAnalysis() { - return mockImageAnalysis; + return testImageAnalysis; } } From ca5604acc838513ad2f0affa15ce1a2091702d27 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Thu, 20 Jul 2023 14:46:54 -0700 Subject: [PATCH 11/34] Add integration tests --- .../integration_test/integration_test.dart | 137 ++++++++++++++++-- .../lib/src/android_camera_camerax.dart | 2 +- 2 files changed, 124 insertions(+), 15 deletions(-) diff --git a/packages/camera/camera_android_camerax/example/integration_test/integration_test.dart b/packages/camera/camera_android_camerax/example/integration_test/integration_test.dart index b6cba8da981..88d920df500 100644 --- a/packages/camera/camera_android_camerax/example/integration_test/integration_test.dart +++ b/packages/camera/camera_android_camerax/example/integration_test/integration_test.dart @@ -2,11 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'dart:async'; import 'dart:io'; import 'dart:ui'; import 'package:camera_android_camerax/camera_android_camerax.dart'; import 'package:camera_android_camerax_example/camera_controller.dart'; +import 'package:camera_android_camerax_example/camera_image.dart'; import 'package:camera_platform_interface/camera_platform_interface.dart'; import 'package:flutter/painting.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -19,6 +21,46 @@ void main() { CameraPlatform.instance = AndroidCameraCameraX(); }); + final Map presetExpectedSizes = + { + ResolutionPreset.low: const Size(240, 320), + ResolutionPreset.medium: const Size(480, 720), + ResolutionPreset.high: const Size(720, 1280), + ResolutionPreset.veryHigh: const Size(1080, 1920), + ResolutionPreset.ultraHigh: const Size(2160, 3840), + // Don't bother checking for max here since it could be anything. + }; + + /// Verify that [actual] has dimensions that are at least as large as + /// [expectedSize]. Allows for a mismatch in portrait vs landscape. Returns + /// whether the dimensions exactly match. + bool assertExpectedDimensions(Size expectedSize, Size actual) { + expect(actual.shortestSide, lessThanOrEqualTo(expectedSize.shortestSide)); + expect(actual.longestSide, lessThanOrEqualTo(expectedSize.longestSide)); + return actual.shortestSide == expectedSize.shortestSide && + actual.longestSide == expectedSize.longestSide; + } + + // This tests that the capture is no bigger than the preset, since we have + // automatic code to fall back to smaller sizes when we need to. Returns + // whether the image is exactly the desired resolution. + Future testCaptureImageResolution( + CameraController controller, ResolutionPreset preset) async { + final Size expectedSize = presetExpectedSizes[preset]!; + + // Take Picture + final XFile file = await controller.takePicture(); + + // Load picture + final File fileImage = File(file.path); + final Image image = await decodeImageFromList(fileImage.readAsBytesSync()); + + // Verify image dimensions are as expected + expect(image, isNotNull); + return assertExpectedDimensions( + expectedSize, Size(image.height.toDouble(), image.width.toDouble())); + } + testWidgets('availableCameras only supports valid back or front cameras', (WidgetTester tester) async { final List availableCameras = @@ -31,27 +73,94 @@ void main() { } }); - testWidgets('takePictures stores a valid image in memory', + testWidgets('Capture specific image resolutions', (WidgetTester tester) async { - final List availableCameras = + final List cameras = await CameraPlatform.instance.availableCameras(); - if (availableCameras.isEmpty) { + if (cameras.isEmpty) { return; } - for (final CameraDescription cameraDescription in availableCameras) { - final CameraController controller = - CameraController(cameraDescription, ResolutionPreset.high); - await controller.initialize(); + for (final CameraDescription cameraDescription in cameras) { + bool previousPresetExactlySupported = true; + for (final MapEntry preset + in presetExpectedSizes.entries) { + final CameraController controller = + CameraController(cameraDescription, preset.key); + await controller.initialize(); + final bool presetExactlySupported = + await testCaptureImageResolution(controller, preset.key); + expect(!(!previousPresetExactlySupported && presetExactlySupported), + isTrue, + reason: + 'The camera took higher resolution pictures at a lower resolution.'); + previousPresetExactlySupported = presetExactlySupported; + await controller.dispose(); + } + } + }); + + testWidgets('Preview takes expected resolution from preset', + (WidgetTester tester) async { + final List cameras = + await CameraPlatform.instance.availableCameras(); + if (cameras.isEmpty) { + return; + } + for (final CameraDescription cameraDescription in cameras) { + bool previousPresetExactlySupported = true; + for (final MapEntry preset + in presetExpectedSizes.entries) { + final CameraController controller = + CameraController(cameraDescription, preset.key); + + await controller.initialize(); + + while (controller.value.previewSize == null) { + // Wait for preview size to update. + } + + final bool presetExactlySupported = assertExpectedDimensions( + presetExpectedSizes[preset.key]!, controller.value.previewSize!); + expect(!(!previousPresetExactlySupported && presetExactlySupported), + isTrue, + reason: 'The preview has a lower resolution than that specified.'); + previousPresetExactlySupported = presetExactlySupported; + await controller.dispose(); + } + } + }); - // Take Picture - final XFile file = await controller.takePicture(); + testWidgets('Images from streaming have expected resolution from preset', + (WidgetTester tester) async { + final List cameras = + await CameraPlatform.instance.availableCameras(); + if (cameras.isEmpty) { + return; + } + for (final CameraDescription cameraDescription in cameras) { + bool previousPresetExactlySupported = true; + for (final MapEntry preset + in presetExpectedSizes.entries) { + final CameraController controller = + CameraController(cameraDescription, preset.key); + final Completer imageCompleter = Completer(); + await controller.initialize(); + await controller.startImageStream((CameraImage image) { + imageCompleter.complete(image); + controller.stopImageStream(); + }); - // Try loading picture - final File fileImage = File(file.path); - final Image image = - await decodeImageFromList(fileImage.readAsBytesSync()); + final CameraImage image = await imageCompleter.future; + final bool presetExactlySupported = assertExpectedDimensions( + presetExpectedSizes[preset.key]!, + Size(image.height.toDouble(), image.width.toDouble())); + expect(!(!previousPresetExactlySupported && presetExactlySupported), + isTrue, + reason: 'The preview has a lower resolution than that specified.'); + previousPresetExactlySupported = presetExactlySupported; - expect(image, isNotNull); + await controller.dispose(); + } } }); } diff --git a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart index 59cce2e1cbc..88547683000 100644 --- a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart +++ b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart @@ -310,8 +310,8 @@ class AndroidCameraCameraX extends CameraPlatform { cameraEventStreamController.add(CameraInitializedEvent( cameraId, - previewResolutionInfo.width.toDouble(), previewResolutionInfo.height.toDouble(), + previewResolutionInfo.width.toDouble(), exposureMode, exposurePointSupported, focusMode, From b778894bf6cedc6c98bd48353a5746483df8f39e Mon Sep 17 00:00:00 2001 From: camsim99 Date: Wed, 16 Aug 2023 15:12:42 -0700 Subject: [PATCH 12/34] Add res support --- .../lib/src/android_camera_camerax.dart | 110 +++++++++++++----- 1 file changed, 84 insertions(+), 26 deletions(-) diff --git a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart index bcc213eaa0f..296809fa75a 100644 --- a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart +++ b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart @@ -16,6 +16,7 @@ import 'camera_selector.dart'; import 'camera_state.dart'; import 'camerax_library.g.dart'; import 'exposure_state.dart'; +import 'fallback_strategy.dart'; import 'image_analysis.dart'; import 'image_capture.dart'; import 'image_proxy.dart'; @@ -25,6 +26,7 @@ import 'pending_recording.dart'; import 'plane_proxy.dart'; import 'preview.dart'; import 'process_camera_provider.dart'; +import 'quality_selector.dart'; import 'recorder.dart'; import 'recording.dart'; import 'resolution_selector.dart'; @@ -119,11 +121,16 @@ class AndroidCameraCameraX extends CameraPlatform { CameraSelector? cameraSelector; /// The [ResolutionSelector] that represents the resolution preset used to - /// create a camera that will be used for capturing still images, recording - /// video, and image analysis. + /// create a camera that will be used for capturing still images, and image + /// analysis. @visibleForTesting ResolutionSelector? presetResolutionSelector; + /// The [QualitySelector] that represents the resolution preset used to + /// create a camera that will be used for recording video. + @visibleForTesting + QualitySelector? presetQualitySelector; + /// The controller we need to broadcast the different camera events. /// /// It is a `broadcast` because multiple controllers will connect to @@ -234,27 +241,30 @@ class AndroidCameraCameraX extends CameraPlatform { cameraIsFrontFacing, cameraDescription.sensorOrientation); // Determine ResolutionSelector based on preset for camera UseCases. presetResolutionSelector = - await _getResolutionSelectorFromPreset(resolutionPreset); + _getResolutionSelectorFromPreset(resolutionPreset); + presetQualitySelector = _getQualitySelectorFromPreset(resolutionPreset); // Retrieve a fresh ProcessCameraProvider instance. processCameraProvider ??= await ProcessCameraProvider.getInstance(); processCameraProvider!.unbindAll(); - // TODO(camsim99): Implement resolution configuration for UseCases - // configured here. https://github.com/flutter/flutter/issues/120462 - // Configure Preview instance. final int targetRotation = _getTargetRotation(cameraDescription.sensorOrientation); - preview = createPreview(targetRotation); + preview = createPreview( + targetRotation: targetRotation, + resolutionSelector: presetResolutionSelector); final int flutterSurfaceTextureId = await preview!.setSurfaceProvider(); // Configure ImageCapture instance. - imageCapture = createImageCapture(null); + imageCapture = createImageCapture(presetResolutionSelector); + + // Configure ImageAnalysis instance. + // Defaults to YUV_420_888 image format. + imageAnalysis ??= createImageAnalysis(presetResolutionSelector); // Configure VideoCapture and Recorder instances. - // TODO(gmackall): Enable video capture resolution configuration in createRecorder(). - recorder = createRecorder(); + recorder = createRecorder(presetQualitySelector); videoCapture = await createVideoCapture(recorder!); // Bind configured UseCases to ProcessCameraProvider instance & mark Preview @@ -502,6 +512,10 @@ class AndroidCameraCameraX extends CameraPlatform { /// Configures and starts a video recording. Returns silently without doing /// anything if there is currently an active recording. + /// + /// Note that the preset resolution is used to configure the recording, but + /// 240p ([ResolutionPreset.low]) is unsupported and will fallback to + /// configure the recording as the next highest avaialable quality. @override Future startVideoRecording(int cameraId, {Duration? maxVideoDuration}) async { @@ -651,9 +665,6 @@ class AndroidCameraCameraX extends CameraPlatform { ? Analyzer.detached(analyze: analyze) : Analyzer(analyze: analyze); - // TODO(camsim99): Support resolution configuration. - // Defaults to YUV_420_888 image format. - imageAnalysis ??= createImageAnalysis(); unawaited(imageAnalysis!.setAnalyzer(analyzer)); } @@ -786,8 +797,8 @@ class AndroidCameraCameraX extends CameraPlatform { /// /// If the specified [preset] is unavailable, the camera will fallback to the /// closest lower resolution available. - Future _getResolutionSelectorFromPreset( - ResolutionPreset? preset) async { + ResolutionSelector? _getResolutionSelectorFromPreset( + ResolutionPreset? preset) { const int fallbackRule = ResolutionStrategy.fallbackRuleClosestLower; Size? boundSize; @@ -810,8 +821,9 @@ class AndroidCameraCameraX extends CameraPlatform { break; case ResolutionPreset.max: // Automatically set strategy to choose highest available. - // TODO(camsim99): handle _shouldCreateDetachedObjectForTesting - resolutionStrategy = ResolutionStrategy.highestAvailableStrategy(); + resolutionStrategy = _shouldCreateDetachedObjectForTesting + ? ResolutionStrategy.detachedHighestAvailableStrategy() + : ResolutionStrategy.highestAvailableStrategy(); break; case null: // If not preset is specified, default to CameraX's default behvaior @@ -826,7 +838,6 @@ class AndroidCameraCameraX extends CameraPlatform { resolutionStrategy: resolutionStrategy); } - // TODO(camsim99): check boundSize logic here. resolutionStrategy ??= ResolutionStrategy(boundSize: boundSize!, fallbackRule: fallbackRule); return ResolutionSelector( @@ -834,6 +845,51 @@ class AndroidCameraCameraX extends CameraPlatform { boundSize: boundSize!, fallbackRule: fallbackRule)); } + /// Returns the [QualitySelector] that maps to the specified resolution + /// preset for the camera used only for video capture. + /// + /// If the specified [preset] is unavailable, the camera will fallback to the + /// closest lower resolution available. + QualitySelector? _getQualitySelectorFromPreset(ResolutionPreset? preset) { + VideoQualityConstraint? videoQuality; + switch (preset) { + case ResolutionPreset.low: + // 240p is not supported by CameraX. + case ResolutionPreset.medium: + videoQuality = VideoQualityConstraint.SD; + break; + case ResolutionPreset.high: + videoQuality = VideoQualityConstraint.HD; + break; + case ResolutionPreset.veryHigh: + videoQuality = VideoQualityConstraint.FHD; + break; + case ResolutionPreset.ultraHigh: + videoQuality = VideoQualityConstraint.UHD; + break; + case ResolutionPreset.max: + videoQuality = VideoQualityConstraint.highest; + break; + case null: + // If not preset is specified, default to CameraX's default behvaior + // for each UseCase. + return null; + } + + // We will choose the next highest video quality if the one desired + // is unavaiable. + final FallbackStrategy fallbackStrategy = FallbackStrategy( + quality: videoQuality, + fallbackRule: VideoResolutionFallbackRule.lowerQualityThan); + + return _shouldCreateDetachedObjectForTesting + ? QualitySelector.detached( + qualityList: [videoQuality], + fallbackStrategy: fallbackStrategy) + : QualitySelector.from( + quality: videoQuality, fallbackStrategy: fallbackStrategy); + } + // Methods for calls that need to be tested: /// Requests camera permissions. @@ -866,21 +922,23 @@ class AndroidCameraCameraX extends CameraPlatform { /// Returns a [Preview] configured with the specified target rotation and /// preset [ResolutionSelector]. @visibleForTesting - Preview createPreview(int targetRotation) { - return Preview(targetRotation: targetRotation); + Preview createPreview( + {required int targetRotation, ResolutionSelector? resolutionSelector}) { + return Preview( + targetRotation: targetRotation, resolutionSelector: resolutionSelector); } /// Returns an [ImageCapture] configured with specified flash mode and /// the preset [ResolutionSelector]. @visibleForTesting - ImageCapture createImageCapture(int? flashMode) { - return ImageCapture(targetFlashMode: flashMode); + ImageCapture createImageCapture(ResolutionSelector? resolutionSelector) { + return ImageCapture(resolutionSelector: resolutionSelector); } /// Returns a [Recorder] for use in video capture. @visibleForTesting - Recorder createRecorder() { - return Recorder(); + Recorder createRecorder(QualitySelector? qualitySelector) { + return Recorder(qualitySelector: qualitySelector); } /// Returns a [VideoCapture] associated with the provided [Recorder]. @@ -891,7 +949,7 @@ class AndroidCameraCameraX extends CameraPlatform { /// Returns an [ImageAnalysis] configured with the preset [ResolutionSelector]. @visibleForTesting - ImageAnalysis createImageAnalysis() { - return ImageAnalysis(); + ImageAnalysis createImageAnalysis(ResolutionSelector? resolutionSelector) { + return ImageAnalysis(resolutionSelector: resolutionSelector); } } From 8d2cb3a2bc549758e9fa39399a89a04eef9b6b17 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Wed, 16 Aug 2023 15:27:06 -0700 Subject: [PATCH 13/34] correct overrides --- .../test/android_camera_camerax_test.dart | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart b/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart index b2da0b33a63..787e0fed1b8 100644 --- a/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart +++ b/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart @@ -23,8 +23,10 @@ import 'package:camera_android_camerax/src/pending_recording.dart'; import 'package:camera_android_camerax/src/plane_proxy.dart'; import 'package:camera_android_camerax/src/preview.dart'; import 'package:camera_android_camerax/src/process_camera_provider.dart'; +import 'package:camera_android_camerax/src/quality_selector.dart'; import 'package:camera_android_camerax/src/recorder.dart'; import 'package:camera_android_camerax/src/recording.dart'; +import 'package:camera_android_camerax/src/resolution_selector.dart'; import 'package:camera_android_camerax/src/resolution_strategy.dart'; import 'package:camera_android_camerax/src/system_services.dart'; import 'package:camera_android_camerax/src/use_case.dart'; @@ -1214,17 +1216,18 @@ class FakeAndroidCameraCameraX extends AndroidCameraCameraX { } @override - Preview createPreview(int targetRotation) { + Preview createPreview( + {required int targetRotation, ResolutionSelector? resolutionSelector}) { return testPreview; } @override - ImageCapture createImageCapture(int? flashMode) { + ImageCapture createImageCapture(ResolutionSelector? resolutionSelector) { return testImageCapture; } @override - Recorder createRecorder() { + Recorder createRecorder(QualitySelector? qualitySelector) { return testRecorder; } @@ -1234,7 +1237,7 @@ class FakeAndroidCameraCameraX extends AndroidCameraCameraX { } @override - ImageAnalysis createImageAnalysis() { + ImageAnalysis createImageAnalysis(ResolutionSelector? resolutionSelector) { return testImageAnalysis; } } From fd3ade22accd7b9cb2d42a803dd52f7333688678 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Wed, 16 Aug 2023 15:42:04 -0700 Subject: [PATCH 14/34] Self review --- .../camera/camera_android_camerax/README.md | 7 +--- .../lib/src/android_camera_camerax.dart | 33 ++++++++++++------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/packages/camera/camera_android_camerax/README.md b/packages/camera/camera_android_camerax/README.md index dd6e5633880..ee2fd1ede57 100644 --- a/packages/camera/camera_android_camerax/README.md +++ b/packages/camera/camera_android_camerax/README.md @@ -24,16 +24,11 @@ dependencies: ## Missing features and limitations -### Resolution configuration \[[Issue #120462][120462]\] - -Any specified `ResolutionPreset` wll go unused in favor of CameraX defaults and -`onCameraResolutionChanged` is unimplemented. - ### Locking/Unlocking capture orientation \[[Issue #125915][125915]\] `lockCaptureOrientation` & `unLockCaptureOrientation` are unimplemented. -### Flash mode configuration \[[Issue #120715][120715]\] +### Torch mode \[[Issue #120715][120715]\] Calling `setFlashMode` with mode `FlashMode.torch` currently does nothing. diff --git a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart index 296809fa75a..0c26585bcd3 100644 --- a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart +++ b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart @@ -239,7 +239,8 @@ class AndroidCameraCameraX extends CameraPlatform { // Start listening for device orientation changes preceding camera creation. startListeningForDeviceOrientationChange( cameraIsFrontFacing, cameraDescription.sensorOrientation); - // Determine ResolutionSelector based on preset for camera UseCases. + // Determine ResolutionSelector and QualitySelector based on preset for + // camera UseCases. presetResolutionSelector = _getResolutionSelectorFromPreset(resolutionPreset); presetQualitySelector = _getQualitySelectorFromPreset(resolutionPreset); @@ -320,7 +321,8 @@ class AndroidCameraCameraX extends CameraPlatform { cameraEventStreamController.add(CameraInitializedEvent( cameraId, - previewResolutionInfo.height.toDouble(), + previewResolutionInfo.height + .toDouble(), // TODO(camsim99): Is this order right? previewResolutionInfo.width.toDouble(), exposureMode, exposurePointSupported, @@ -665,7 +667,7 @@ class AndroidCameraCameraX extends CameraPlatform { ? Analyzer.detached(analyze: analyze) : Analyzer(analyze: analyze); - unawaited(imageAnalysis!.setAnalyzer(analyzer)); + await imageAnalysis!.setAnalyzer(analyzer); } /// Unbinds [useCase] from camera lifecycle controlled by the @@ -795,7 +797,7 @@ class AndroidCameraCameraX extends CameraPlatform { /// Returns the [ResolutionSelector] that maps to the specified resolution /// preset for camera [UseCase]s. /// - /// If the specified [preset] is unavailable, the camera will fallback to the + /// If the specified [preset] is unavailable, the camera will fall back to the /// closest lower resolution available. ResolutionSelector? _getResolutionSelectorFromPreset( ResolutionPreset? preset) { @@ -848,7 +850,7 @@ class AndroidCameraCameraX extends CameraPlatform { /// Returns the [QualitySelector] that maps to the specified resolution /// preset for the camera used only for video capture. /// - /// If the specified [preset] is unavailable, the camera will fallback to the + /// If the specified [preset] is unavailable, the camera will fall back to the /// closest lower resolution available. QualitySelector? _getQualitySelectorFromPreset(ResolutionPreset? preset) { VideoQualityConstraint? videoQuality; @@ -878,9 +880,14 @@ class AndroidCameraCameraX extends CameraPlatform { // We will choose the next highest video quality if the one desired // is unavaiable. - final FallbackStrategy fallbackStrategy = FallbackStrategy( - quality: videoQuality, - fallbackRule: VideoResolutionFallbackRule.lowerQualityThan); + const VideoResolutionFallbackRule fallbackRule = + VideoResolutionFallbackRule.lowerQualityThan; + final FallbackStrategy fallbackStrategy = + _shouldCreateDetachedObjectForTesting + ? FallbackStrategy.detached( + quality: videoQuality, fallbackRule: fallbackRule) + : FallbackStrategy( + quality: videoQuality, fallbackRule: fallbackRule); return _shouldCreateDetachedObjectForTesting ? QualitySelector.detached( @@ -920,7 +927,7 @@ class AndroidCameraCameraX extends CameraPlatform { } /// Returns a [Preview] configured with the specified target rotation and - /// preset [ResolutionSelector]. + /// specified [ResolutionSelector]. @visibleForTesting Preview createPreview( {required int targetRotation, ResolutionSelector? resolutionSelector}) { @@ -929,13 +936,14 @@ class AndroidCameraCameraX extends CameraPlatform { } /// Returns an [ImageCapture] configured with specified flash mode and - /// the preset [ResolutionSelector]. + /// the specified [ResolutionSelector]. @visibleForTesting ImageCapture createImageCapture(ResolutionSelector? resolutionSelector) { return ImageCapture(resolutionSelector: resolutionSelector); } - /// Returns a [Recorder] for use in video capture. + /// Returns a [Recorder] for use in video capture configured with the + /// specified [QualitySelector]. @visibleForTesting Recorder createRecorder(QualitySelector? qualitySelector) { return Recorder(qualitySelector: qualitySelector); @@ -947,7 +955,8 @@ class AndroidCameraCameraX extends CameraPlatform { return VideoCapture.withOutput(recorder); } - /// Returns an [ImageAnalysis] configured with the preset [ResolutionSelector]. + /// Returns an [ImageAnalysis] configured with the specified + /// [ResolutionSelector]. @visibleForTesting ImageAnalysis createImageAnalysis(ResolutionSelector? resolutionSelector) { return ImageAnalysis(resolutionSelector: resolutionSelector); From 1dc6fbd9a77712944c9abdbcb26ef0574d0a7d7c Mon Sep 17 00:00:00 2001 From: camsim99 Date: Wed, 16 Aug 2023 15:42:51 -0700 Subject: [PATCH 15/34] formatting --- .../camerax/GeneratedCameraXLibrary.java | 828 ++++++++++++------ .../lib/src/camerax_library.g.dart | 313 ++++--- .../test/test_camerax_library.g.dart | 728 ++++++++++----- 3 files changed, 1219 insertions(+), 650 deletions(-) diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/GeneratedCameraXLibrary.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/GeneratedCameraXLibrary.java index 24d51cd1064..cc1d7c7c638 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/GeneratedCameraXLibrary.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/GeneratedCameraXLibrary.java @@ -18,9 +18,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; -import java.util.HashMap; import java.util.List; -import java.util.Map; /** Generated class from Pigeon. */ @SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression", "serial"}) @@ -35,8 +33,7 @@ public static class FlutterError extends RuntimeException { /** The error details. Must be a datatype supported by the api codec. */ public final Object details; - public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) - { + public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) { super(message); this.code = code; this.details = details; @@ -55,7 +52,7 @@ protected static ArrayList wrapError(@NonNull Throwable exception) { errorList.add(exception.toString()); errorList.add(exception.getClass().getSimpleName()); errorList.add( - "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); + "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); } return errorList; } @@ -63,7 +60,7 @@ protected static ArrayList wrapError(@NonNull Throwable exception) { /** * The states the camera can be in. * - * See https://developer.android.com/reference/androidx/camera/core/CameraState.Type. + *

See https://developer.android.com/reference/androidx/camera/core/CameraState.Type. */ public enum CameraStateType { CLOSED(0), @@ -82,20 +79,19 @@ private CameraStateType(final int index) { /** * The types (T) properly wrapped to be used as a LiveData. * - * If you need to add another type to support a type S to use a LiveData in - * this plugin, ensure the following is done on the Dart side: + *

If you need to add another type to support a type S to use a LiveData in this plugin, + * ensure the following is done on the Dart side: * - * * In `../lib/src/live_data.dart`, add new cases for S in - * `_LiveDataHostApiImpl#getValueFromInstances` to get the current value of - * type S from a LiveData instance and in `LiveDataFlutterApiImpl#create` - * to create the expected type of LiveData when requested. + *

* In `../lib/src/live_data.dart`, add new cases for S in + * `_LiveDataHostApiImpl#getValueFromInstances` to get the current value of type S from a + * LiveData instance and in `LiveDataFlutterApiImpl#create` to create the expected type of + * LiveData when requested. * - * On the native side, ensure the following is done: + *

On the native side, ensure the following is done: * - * * Update `LiveDataHostApiImpl#getValue` is updated to properly return - * identifiers for instances of type S. - * * Update `ObserverFlutterApiWrapper#onChanged` to properly handle receiving - * calls with instances of type S if a LiveData instance is observed. + *

* Update `LiveDataHostApiImpl#getValue` is updated to properly return identifiers for + * instances of type S. * Update `ObserverFlutterApiWrapper#onChanged` to properly handle + * receiving calls with instances of type S if a LiveData instance is observed. */ public enum LiveDataSupportedType { CAMERA_STATE(0), @@ -109,12 +105,12 @@ private LiveDataSupportedType(final int index) { } /** - * Video quality constraints that will be used by a QualitySelector to choose - * an appropriate video resolution. + * Video quality constraints that will be used by a QualitySelector to choose an appropriate video + * resolution. * - * These are pre-defined quality constants that are universally used for video. + *

These are pre-defined quality constants that are universally used for video. * - * See https://developer.android.com/reference/androidx/camera/video/Quality. + *

See https://developer.android.com/reference/androidx/camera/video/Quality. */ public enum VideoQualityConstraint { SD(0), @@ -134,7 +130,7 @@ private VideoQualityConstraint(final int index) { /** * Fallback rules for selecting video resolution. * - * See https://developer.android.com/reference/androidx/camera/video/FallbackStrategy. + *

See https://developer.android.com/reference/androidx/camera/video/FallbackStrategy. */ public enum VideoResolutionFallbackRule { HIGHER_QUALITY_OR_LOWER_THAN(0), @@ -215,9 +211,13 @@ ArrayList toList() { static @NonNull ResolutionInfo fromList(@NonNull ArrayList list) { ResolutionInfo pigeonResult = new ResolutionInfo(); Object width = list.get(0); - pigeonResult.setWidth((width == null) ? null : ((width instanceof Integer) ? (Integer) width : (Long) width)); + pigeonResult.setWidth( + (width == null) ? null : ((width instanceof Integer) ? (Integer) width : (Long) width)); Object height = list.get(1); - pigeonResult.setHeight((height == null) ? null : ((height instanceof Integer) ? (Integer) height : (Long) height)); + pigeonResult.setHeight( + (height == null) + ? null + : ((height instanceof Integer) ? (Integer) height : (Long) height)); return pigeonResult; } } @@ -459,9 +459,19 @@ ArrayList toList() { static @NonNull ExposureCompensationRange fromList(@NonNull ArrayList list) { ExposureCompensationRange pigeonResult = new ExposureCompensationRange(); Object minCompensation = list.get(0); - pigeonResult.setMinCompensation((minCompensation == null) ? null : ((minCompensation instanceof Integer) ? (Integer) minCompensation : (Long) minCompensation)); + pigeonResult.setMinCompensation( + (minCompensation == null) + ? null + : ((minCompensation instanceof Integer) + ? (Integer) minCompensation + : (Long) minCompensation)); Object maxCompensation = list.get(1); - pigeonResult.setMaxCompensation((maxCompensation == null) ? null : ((maxCompensation instanceof Integer) ? (Integer) maxCompensation : (Long) maxCompensation)); + pigeonResult.setMaxCompensation( + (maxCompensation == null) + ? null + : ((maxCompensation instanceof Integer) + ? (Integer) maxCompensation + : (Long) maxCompensation)); return pigeonResult; } } @@ -477,7 +487,7 @@ public interface InstanceManagerHostApi { /** * Clear the native `InstanceManager`. * - * This is typically only used after a hot restart. + *

This is typically only used after a hot restart. */ void clear(); @@ -485,8 +495,12 @@ public interface InstanceManagerHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `InstanceManagerHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable InstanceManagerHostApi api) { + /** + * Sets up an instance of `InstanceManagerHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable InstanceManagerHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -498,8 +512,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable InstanceMa try { api.clear(); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -520,7 +533,9 @@ public interface JavaObjectHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `JavaObjectHostApi` to handle messages through the `binaryMessenger`. */ + /** + * Sets up an instance of `JavaObjectHostApi` to handle messages through the `binaryMessenger`. + */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable JavaObjectHostApi api) { { BasicMessageChannel channel = @@ -535,8 +550,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable JavaObject try { api.dispose((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -556,7 +570,7 @@ public JavaObjectFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -565,6 +579,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + public void dispose(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -577,28 +592,32 @@ public void dispose(@NonNull Long identifierArg, @NonNull Reply callback) /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface CameraInfoHostApi { - @NonNull + @NonNull Long getSensorRotationDegrees(@NonNull Long identifier); - @NonNull + @NonNull Long getCameraState(@NonNull Long identifier); - @NonNull + @NonNull Long getExposureState(@NonNull Long identifier); - @NonNull + @NonNull Long getZoomState(@NonNull Long identifier); /** The codec used by CameraInfoHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `CameraInfoHostApi` to handle messages through the `binaryMessenger`. */ + /** + * Sets up an instance of `CameraInfoHostApi` to handle messages through the `binaryMessenger`. + */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraInfoHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.CameraInfoHostApi.getSensorRotationDegrees", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.CameraInfoHostApi.getSensorRotationDegrees", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -606,10 +625,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraInfo ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - Long output = api.getSensorRotationDegrees((identifierArg == null) ? null : identifierArg.longValue()); + Long output = + api.getSensorRotationDegrees( + (identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -630,10 +650,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraInfo ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - Long output = api.getCameraState((identifierArg == null) ? null : identifierArg.longValue()); + Long output = + api.getCameraState( + (identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -646,7 +667,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraInfo { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.CameraInfoHostApi.getExposureState", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.CameraInfoHostApi.getExposureState", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -654,10 +677,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraInfo ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - Long output = api.getExposureState((identifierArg == null) ? null : identifierArg.longValue()); + Long output = + api.getExposureState( + (identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -678,10 +702,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraInfo ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - Long output = api.getZoomState((identifierArg == null) ? null : identifierArg.longValue()); + Long output = + api.getZoomState((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -701,7 +725,7 @@ public CameraInfoFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -710,6 +734,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -724,15 +749,19 @@ public interface CameraSelectorHostApi { void create(@NonNull Long identifier, @Nullable Long lensFacing); - @NonNull + @NonNull List filter(@NonNull Long identifier, @NonNull List cameraInfoIds); /** The codec used by CameraSelectorHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `CameraSelectorHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraSelectorHostApi api) { + /** + * Sets up an instance of `CameraSelectorHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable CameraSelectorHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -745,10 +774,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraSele Number identifierArg = (Number) args.get(0); Number lensFacingArg = (Number) args.get(1); try { - api.create((identifierArg == null) ? null : identifierArg.longValue(), (lensFacingArg == null) ? null : lensFacingArg.longValue()); + api.create( + (identifierArg == null) ? null : identifierArg.longValue(), + (lensFacingArg == null) ? null : lensFacingArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -770,10 +800,12 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraSele Number identifierArg = (Number) args.get(0); List cameraInfoIdsArg = (List) args.get(1); try { - List output = api.filter((identifierArg == null) ? null : identifierArg.longValue(), cameraInfoIdsArg); + List output = + api.filter( + (identifierArg == null) ? null : identifierArg.longValue(), + cameraInfoIdsArg); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -793,7 +825,7 @@ public CameraSelectorFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -802,7 +834,9 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void create(@NonNull Long identifierArg, @Nullable Long lensFacingArg, @NonNull Reply callback) { + + public void create( + @NonNull Long identifierArg, @Nullable Long lensFacingArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.CameraSelectorFlutterApi.create", getCodec()); @@ -816,13 +850,16 @@ public interface ProcessCameraProviderHostApi { void getInstance(@NonNull Result result); - @NonNull + @NonNull List getAvailableCameraInfos(@NonNull Long identifier); - @NonNull - Long bindToLifecycle(@NonNull Long identifier, @NonNull Long cameraSelectorIdentifier, @NonNull List useCaseIds); + @NonNull + Long bindToLifecycle( + @NonNull Long identifier, + @NonNull Long cameraSelectorIdentifier, + @NonNull List useCaseIds); - @NonNull + @NonNull Boolean isBound(@NonNull Long identifier, @NonNull Long useCaseIdentifier); void unbind(@NonNull Long identifier, @NonNull List useCaseIds); @@ -833,12 +870,18 @@ public interface ProcessCameraProviderHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `ProcessCameraProviderHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ProcessCameraProviderHostApi api) { + /** + * Sets up an instance of `ProcessCameraProviderHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable ProcessCameraProviderHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.ProcessCameraProviderHostApi.getInstance", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.ProcessCameraProviderHostApi.getInstance", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -865,7 +908,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.ProcessCameraProviderHostApi.getAvailableCameraInfos", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.ProcessCameraProviderHostApi.getAvailableCameraInfos", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -873,10 +918,11 @@ public void error(Throwable error) { ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - List output = api.getAvailableCameraInfos((identifierArg == null) ? null : identifierArg.longValue()); + List output = + api.getAvailableCameraInfos( + (identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -889,7 +935,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.ProcessCameraProviderHostApi.bindToLifecycle", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.ProcessCameraProviderHostApi.bindToLifecycle", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -899,10 +947,15 @@ public void error(Throwable error) { Number cameraSelectorIdentifierArg = (Number) args.get(1); List useCaseIdsArg = (List) args.get(2); try { - Long output = api.bindToLifecycle((identifierArg == null) ? null : identifierArg.longValue(), (cameraSelectorIdentifierArg == null) ? null : cameraSelectorIdentifierArg.longValue(), useCaseIdsArg); + Long output = + api.bindToLifecycle( + (identifierArg == null) ? null : identifierArg.longValue(), + (cameraSelectorIdentifierArg == null) + ? null + : cameraSelectorIdentifierArg.longValue(), + useCaseIdsArg); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -915,7 +968,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.ProcessCameraProviderHostApi.isBound", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.ProcessCameraProviderHostApi.isBound", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -924,10 +979,12 @@ public void error(Throwable error) { Number identifierArg = (Number) args.get(0); Number useCaseIdentifierArg = (Number) args.get(1); try { - Boolean output = api.isBound((identifierArg == null) ? null : identifierArg.longValue(), (useCaseIdentifierArg == null) ? null : useCaseIdentifierArg.longValue()); + Boolean output = + api.isBound( + (identifierArg == null) ? null : identifierArg.longValue(), + (useCaseIdentifierArg == null) ? null : useCaseIdentifierArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -940,7 +997,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.ProcessCameraProviderHostApi.unbind", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.ProcessCameraProviderHostApi.unbind", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -949,10 +1008,10 @@ public void error(Throwable error) { Number identifierArg = (Number) args.get(0); List useCaseIdsArg = (List) args.get(1); try { - api.unbind((identifierArg == null) ? null : identifierArg.longValue(), useCaseIdsArg); + api.unbind( + (identifierArg == null) ? null : identifierArg.longValue(), useCaseIdsArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -965,7 +1024,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.ProcessCameraProviderHostApi.unbindAll", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.ProcessCameraProviderHostApi.unbindAll", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -975,8 +1036,7 @@ public void error(Throwable error) { try { api.unbindAll((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -996,7 +1056,7 @@ public ProcessCameraProviderFlutterApi(@NonNull BinaryMessenger argBinaryMesseng this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -1005,10 +1065,13 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.ProcessCameraProviderFlutterApi.create", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.ProcessCameraProviderFlutterApi.create", + getCodec()); channel.send( new ArrayList(Collections.singletonList(identifierArg)), channelReply -> callback.reply(null)); @@ -1017,14 +1080,14 @@ public void create(@NonNull Long identifierArg, @NonNull Reply callback) { /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface CameraHostApi { - @NonNull + @NonNull Long getCameraInfo(@NonNull Long identifier); /** The codec used by CameraHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `CameraHostApi` to handle messages through the `binaryMessenger`. */ + /** Sets up an instance of `CameraHostApi` to handle messages through the `binaryMessenger`. */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraHostApi api) { { BasicMessageChannel channel = @@ -1037,10 +1100,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraHost ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - Long output = api.getCameraInfo((identifierArg == null) ? null : identifierArg.longValue()); + Long output = + api.getCameraInfo((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1060,7 +1123,7 @@ public CameraFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -1069,6 +1132,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1108,25 +1172,33 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface SystemServicesHostApi { - void requestCameraPermissions(@NonNull Boolean enableAudio, @NonNull Result result); + void requestCameraPermissions( + @NonNull Boolean enableAudio, @NonNull Result result); - void startListeningForDeviceOrientationChange(@NonNull Boolean isFrontFacing, @NonNull Long sensorOrientation); + void startListeningForDeviceOrientationChange( + @NonNull Boolean isFrontFacing, @NonNull Long sensorOrientation); void stopListeningForDeviceOrientationChange(); - @NonNull + @NonNull String getTempFilePath(@NonNull String prefix, @NonNull String suffix); /** The codec used by SystemServicesHostApi. */ static @NonNull MessageCodec getCodec() { return SystemServicesHostApiCodec.INSTANCE; } - /**Sets up an instance of `SystemServicesHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable SystemServicesHostApi api) { + /** + * Sets up an instance of `SystemServicesHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable SystemServicesHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.SystemServicesHostApi.requestCameraPermissions", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.SystemServicesHostApi.requestCameraPermissions", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1155,7 +1227,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.SystemServicesHostApi.startListeningForDeviceOrientationChange", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.SystemServicesHostApi.startListeningForDeviceOrientationChange", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1164,10 +1238,11 @@ public void error(Throwable error) { Boolean isFrontFacingArg = (Boolean) args.get(0); Number sensorOrientationArg = (Number) args.get(1); try { - api.startListeningForDeviceOrientationChange(isFrontFacingArg, (sensorOrientationArg == null) ? null : sensorOrientationArg.longValue()); + api.startListeningForDeviceOrientationChange( + isFrontFacingArg, + (sensorOrientationArg == null) ? null : sensorOrientationArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1180,7 +1255,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.SystemServicesHostApi.stopListeningForDeviceOrientationChange", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.SystemServicesHostApi.stopListeningForDeviceOrientationChange", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1188,8 +1265,7 @@ public void error(Throwable error) { try { api.stopListeningForDeviceOrientationChange(); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1202,7 +1278,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.SystemServicesHostApi.getTempFilePath", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.SystemServicesHostApi.getTempFilePath", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1213,8 +1291,7 @@ public void error(Throwable error) { try { String output = api.getTempFilePath(prefixArg, suffixArg); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1234,7 +1311,7 @@ public SystemServicesFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -1243,18 +1320,25 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void onDeviceOrientationChanged(@NonNull String orientationArg, @NonNull Reply callback) { + + public void onDeviceOrientationChanged( + @NonNull String orientationArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.SystemServicesFlutterApi.onDeviceOrientationChanged", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.SystemServicesFlutterApi.onDeviceOrientationChanged", + getCodec()); channel.send( new ArrayList(Collections.singletonList(orientationArg)), channelReply -> callback.reply(null)); } + public void onCameraError(@NonNull String errorDescriptionArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.SystemServicesFlutterApi.onCameraError", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.SystemServicesFlutterApi.onCameraError", + getCodec()); channel.send( new ArrayList(Collections.singletonList(errorDescriptionArg)), channelReply -> callback.reply(null)); @@ -1290,21 +1374,22 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface PreviewHostApi { - void create(@NonNull Long identifier, @Nullable Long rotation, @Nullable Long resolutionSelectorId); + void create( + @NonNull Long identifier, @Nullable Long rotation, @Nullable Long resolutionSelectorId); - @NonNull + @NonNull Long setSurfaceProvider(@NonNull Long identifier); void releaseFlutterSurfaceTexture(); - @NonNull + @NonNull ResolutionInfo getResolutionInfo(@NonNull Long identifier); /** The codec used by PreviewHostApi. */ static @NonNull MessageCodec getCodec() { return PreviewHostApiCodec.INSTANCE; } - /**Sets up an instance of `PreviewHostApi` to handle messages through the `binaryMessenger`. */ + /** Sets up an instance of `PreviewHostApi` to handle messages through the `binaryMessenger`. */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PreviewHostApi api) { { BasicMessageChannel channel = @@ -1319,10 +1404,14 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PreviewHos Number rotationArg = (Number) args.get(1); Number resolutionSelectorIdArg = (Number) args.get(2); try { - api.create((identifierArg == null) ? null : identifierArg.longValue(), (rotationArg == null) ? null : rotationArg.longValue(), (resolutionSelectorIdArg == null) ? null : resolutionSelectorIdArg.longValue()); + api.create( + (identifierArg == null) ? null : identifierArg.longValue(), + (rotationArg == null) ? null : rotationArg.longValue(), + (resolutionSelectorIdArg == null) + ? null + : resolutionSelectorIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1335,7 +1424,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PreviewHos { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.PreviewHostApi.setSurfaceProvider", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.PreviewHostApi.setSurfaceProvider", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1343,10 +1434,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PreviewHos ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - Long output = api.setSurfaceProvider((identifierArg == null) ? null : identifierArg.longValue()); + Long output = + api.setSurfaceProvider( + (identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1359,7 +1451,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PreviewHos { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.PreviewHostApi.releaseFlutterSurfaceTexture", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.PreviewHostApi.releaseFlutterSurfaceTexture", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1367,8 +1461,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PreviewHos try { api.releaseFlutterSurfaceTexture(); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1389,10 +1482,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PreviewHos ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - ResolutionInfo output = api.getResolutionInfo((identifierArg == null) ? null : identifierArg.longValue()); + ResolutionInfo output = + api.getResolutionInfo( + (identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1407,17 +1501,20 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PreviewHos /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface VideoCaptureHostApi { - @NonNull + @NonNull Long withOutput(@NonNull Long videoOutputId); - @NonNull + @NonNull Long getOutput(@NonNull Long identifier); /** The codec used by VideoCaptureHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `VideoCaptureHostApi` to handle messages through the `binaryMessenger`. */ + /** + * Sets up an instance of `VideoCaptureHostApi` to handle messages through the + * `binaryMessenger`. + */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable VideoCaptureHostApi api) { { BasicMessageChannel channel = @@ -1430,10 +1527,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable VideoCaptu ArrayList args = (ArrayList) message; Number videoOutputIdArg = (Number) args.get(0); try { - Long output = api.withOutput((videoOutputIdArg == null) ? null : videoOutputIdArg.longValue()); + Long output = + api.withOutput( + (videoOutputIdArg == null) ? null : videoOutputIdArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1454,10 +1552,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable VideoCaptu ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - Long output = api.getOutput((identifierArg == null) ? null : identifierArg.longValue()); + Long output = + api.getOutput((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1477,7 +1575,7 @@ public VideoCaptureFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -1486,6 +1584,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1498,22 +1597,28 @@ public void create(@NonNull Long identifierArg, @NonNull Reply callback) { /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface RecorderHostApi { - void create(@NonNull Long identifier, @Nullable Long aspectRatio, @Nullable Long bitRate, @Nullable Long qualitySelectorId); + void create( + @NonNull Long identifier, + @Nullable Long aspectRatio, + @Nullable Long bitRate, + @Nullable Long qualitySelectorId); - @NonNull + @NonNull Long getAspectRatio(@NonNull Long identifier); - @NonNull + @NonNull Long getTargetVideoEncodingBitRate(@NonNull Long identifier); - @NonNull + @NonNull Long prepareRecording(@NonNull Long identifier, @NonNull String path); /** The codec used by RecorderHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `RecorderHostApi` to handle messages through the `binaryMessenger`. */ + /** + * Sets up an instance of `RecorderHostApi` to handle messages through the `binaryMessenger`. + */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable RecorderHostApi api) { { BasicMessageChannel channel = @@ -1529,10 +1634,13 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable RecorderHo Number bitRateArg = (Number) args.get(2); Number qualitySelectorIdArg = (Number) args.get(3); try { - api.create((identifierArg == null) ? null : identifierArg.longValue(), (aspectRatioArg == null) ? null : aspectRatioArg.longValue(), (bitRateArg == null) ? null : bitRateArg.longValue(), (qualitySelectorIdArg == null) ? null : qualitySelectorIdArg.longValue()); + api.create( + (identifierArg == null) ? null : identifierArg.longValue(), + (aspectRatioArg == null) ? null : aspectRatioArg.longValue(), + (bitRateArg == null) ? null : bitRateArg.longValue(), + (qualitySelectorIdArg == null) ? null : qualitySelectorIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1553,10 +1661,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable RecorderHo ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - Long output = api.getAspectRatio((identifierArg == null) ? null : identifierArg.longValue()); + Long output = + api.getAspectRatio( + (identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1569,7 +1678,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable RecorderHo { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.RecorderHostApi.getTargetVideoEncodingBitRate", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.RecorderHostApi.getTargetVideoEncodingBitRate", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1577,10 +1688,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable RecorderHo ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - Long output = api.getTargetVideoEncodingBitRate((identifierArg == null) ? null : identifierArg.longValue()); + Long output = + api.getTargetVideoEncodingBitRate( + (identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1602,10 +1714,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable RecorderHo Number identifierArg = (Number) args.get(0); String pathArg = (String) args.get(1); try { - Long output = api.prepareRecording((identifierArg == null) ? null : identifierArg.longValue(), pathArg); + Long output = + api.prepareRecording( + (identifierArg == null) ? null : identifierArg.longValue(), pathArg); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1625,7 +1738,7 @@ public RecorderFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -1634,7 +1747,12 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void create(@NonNull Long identifierArg, @Nullable Long aspectRatioArg, @Nullable Long bitRateArg, @NonNull Reply callback) { + + public void create( + @NonNull Long identifierArg, + @Nullable Long aspectRatioArg, + @Nullable Long bitRateArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.RecorderFlutterApi.create", getCodec()); @@ -1646,15 +1764,19 @@ public void create(@NonNull Long identifierArg, @Nullable Long aspectRatioArg, @ /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface PendingRecordingHostApi { - @NonNull + @NonNull Long start(@NonNull Long identifier); /** The codec used by PendingRecordingHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `PendingRecordingHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PendingRecordingHostApi api) { + /** + * Sets up an instance of `PendingRecordingHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable PendingRecordingHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1666,10 +1788,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PendingRec ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - Long output = api.start((identifierArg == null) ? null : identifierArg.longValue()); + Long output = + api.start((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1689,7 +1811,7 @@ public PendingRecordingFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -1698,6 +1820,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1722,7 +1845,9 @@ public interface RecordingHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `RecordingHostApi` to handle messages through the `binaryMessenger`. */ + /** + * Sets up an instance of `RecordingHostApi` to handle messages through the `binaryMessenger`. + */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable RecordingHostApi api) { { BasicMessageChannel channel = @@ -1737,8 +1862,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable RecordingH try { api.close((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1761,8 +1885,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable RecordingH try { api.pause((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1785,8 +1908,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable RecordingH try { api.resume((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1809,8 +1931,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable RecordingH try { api.stop((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1830,7 +1951,7 @@ public RecordingFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -1839,6 +1960,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1851,7 +1973,8 @@ public void create(@NonNull Long identifierArg, @NonNull Reply callback) { /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface ImageCaptureHostApi { - void create(@NonNull Long identifier, @Nullable Long flashMode, @Nullable Long resolutionSelectorId); + void create( + @NonNull Long identifier, @Nullable Long flashMode, @Nullable Long resolutionSelectorId); void setFlashMode(@NonNull Long identifier, @NonNull Long flashMode); @@ -1861,7 +1984,10 @@ public interface ImageCaptureHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `ImageCaptureHostApi` to handle messages through the `binaryMessenger`. */ + /** + * Sets up an instance of `ImageCaptureHostApi` to handle messages through the + * `binaryMessenger`. + */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageCaptureHostApi api) { { BasicMessageChannel channel = @@ -1876,10 +2002,14 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageCaptu Number flashModeArg = (Number) args.get(1); Number resolutionSelectorIdArg = (Number) args.get(2); try { - api.create((identifierArg == null) ? null : identifierArg.longValue(), (flashModeArg == null) ? null : flashModeArg.longValue(), (resolutionSelectorIdArg == null) ? null : resolutionSelectorIdArg.longValue()); + api.create( + (identifierArg == null) ? null : identifierArg.longValue(), + (flashModeArg == null) ? null : flashModeArg.longValue(), + (resolutionSelectorIdArg == null) + ? null + : resolutionSelectorIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1901,10 +2031,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageCaptu Number identifierArg = (Number) args.get(0); Number flashModeArg = (Number) args.get(1); try { - api.setFlashMode((identifierArg == null) ? null : identifierArg.longValue(), (flashModeArg == null) ? null : flashModeArg.longValue()); + api.setFlashMode( + (identifierArg == null) ? null : identifierArg.longValue(), + (flashModeArg == null) ? null : flashModeArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1937,7 +2068,8 @@ public void error(Throwable error) { } }; - api.takePicture((identifierArg == null) ? null : identifierArg.longValue(), resultCallback); + api.takePicture( + (identifierArg == null) ? null : identifierArg.longValue(), resultCallback); }); } else { channel.setMessageHandler(null); @@ -1947,7 +2079,8 @@ public void error(Throwable error) { } private static class ResolutionStrategyHostApiCodec extends StandardMessageCodec { - public static final ResolutionStrategyHostApiCodec INSTANCE = new ResolutionStrategyHostApiCodec(); + public static final ResolutionStrategyHostApiCodec INSTANCE = + new ResolutionStrategyHostApiCodec(); private ResolutionStrategyHostApiCodec() {} @@ -1975,14 +2108,19 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface ResolutionStrategyHostApi { - void create(@NonNull Long identifier, @Nullable ResolutionInfo boundSize, @Nullable Long fallbackRule); + void create( + @NonNull Long identifier, @Nullable ResolutionInfo boundSize, @Nullable Long fallbackRule); /** The codec used by ResolutionStrategyHostApi. */ static @NonNull MessageCodec getCodec() { return ResolutionStrategyHostApiCodec.INSTANCE; } - /**Sets up an instance of `ResolutionStrategyHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ResolutionStrategyHostApi api) { + /** + * Sets up an instance of `ResolutionStrategyHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable ResolutionStrategyHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1996,10 +2134,12 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable Resolution ResolutionInfo boundSizeArg = (ResolutionInfo) args.get(1); Number fallbackRuleArg = (Number) args.get(2); try { - api.create((identifierArg == null) ? null : identifierArg.longValue(), boundSizeArg, (fallbackRuleArg == null) ? null : fallbackRuleArg.longValue()); + api.create( + (identifierArg == null) ? null : identifierArg.longValue(), + boundSizeArg, + (fallbackRuleArg == null) ? null : fallbackRuleArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2014,14 +2154,21 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable Resolution /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface ResolutionSelectorHostApi { - void create(@NonNull Long identifier, @Nullable Long resolutionStrategyIdentifier, @Nullable Long aspectRatioStrategyIdentifier); + void create( + @NonNull Long identifier, + @Nullable Long resolutionStrategyIdentifier, + @Nullable Long aspectRatioStrategyIdentifier); /** The codec used by ResolutionSelectorHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `ResolutionSelectorHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ResolutionSelectorHostApi api) { + /** + * Sets up an instance of `ResolutionSelectorHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable ResolutionSelectorHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2035,10 +2182,16 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable Resolution Number resolutionStrategyIdentifierArg = (Number) args.get(1); Number aspectRatioStrategyIdentifierArg = (Number) args.get(2); try { - api.create((identifierArg == null) ? null : identifierArg.longValue(), (resolutionStrategyIdentifierArg == null) ? null : resolutionStrategyIdentifierArg.longValue(), (aspectRatioStrategyIdentifierArg == null) ? null : aspectRatioStrategyIdentifierArg.longValue()); + api.create( + (identifierArg == null) ? null : identifierArg.longValue(), + (resolutionStrategyIdentifierArg == null) + ? null + : resolutionStrategyIdentifierArg.longValue(), + (aspectRatioStrategyIdentifierArg == null) + ? null + : aspectRatioStrategyIdentifierArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2053,18 +2206,25 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable Resolution /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface AspectRatioStrategyHostApi { - void create(@NonNull Long identifier, @NonNull Long preferredAspectRatio, @NonNull Long fallbackRule); + void create( + @NonNull Long identifier, @NonNull Long preferredAspectRatio, @NonNull Long fallbackRule); /** The codec used by AspectRatioStrategyHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `AspectRatioStrategyHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable AspectRatioStrategyHostApi api) { + /** + * Sets up an instance of `AspectRatioStrategyHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable AspectRatioStrategyHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.AspectRatioStrategyHostApi.create", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.AspectRatioStrategyHostApi.create", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2074,10 +2234,14 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable AspectRati Number preferredAspectRatioArg = (Number) args.get(1); Number fallbackRuleArg = (Number) args.get(2); try { - api.create((identifierArg == null) ? null : identifierArg.longValue(), (preferredAspectRatioArg == null) ? null : preferredAspectRatioArg.longValue(), (fallbackRuleArg == null) ? null : fallbackRuleArg.longValue()); + api.create( + (identifierArg == null) ? null : identifierArg.longValue(), + (preferredAspectRatioArg == null) + ? null + : preferredAspectRatioArg.longValue(), + (fallbackRuleArg == null) ? null : fallbackRuleArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2124,7 +2288,7 @@ public CameraStateFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2133,7 +2297,12 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return CameraStateFlutterApiCodec.INSTANCE; } - public void create(@NonNull Long identifierArg, @NonNull CameraStateTypeData typeArg, @Nullable Long errorIdentifierArg, @NonNull Reply callback) { + + public void create( + @NonNull Long identifierArg, + @NonNull CameraStateTypeData typeArg, + @Nullable Long errorIdentifierArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.CameraStateFlutterApi.create", getCodec()); @@ -2177,7 +2346,7 @@ public ExposureStateFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2186,12 +2355,19 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return ExposureStateFlutterApiCodec.INSTANCE; } - public void create(@NonNull Long identifierArg, @NonNull ExposureCompensationRange exposureCompensationRangeArg, @NonNull Double exposureCompensationStepArg, @NonNull Reply callback) { + + public void create( + @NonNull Long identifierArg, + @NonNull ExposureCompensationRange exposureCompensationRangeArg, + @NonNull Double exposureCompensationStepArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.ExposureStateFlutterApi.create", getCodec()); channel.send( - new ArrayList(Arrays.asList(identifierArg, exposureCompensationRangeArg, exposureCompensationStepArg)), + new ArrayList( + Arrays.asList( + identifierArg, exposureCompensationRangeArg, exposureCompensationStepArg)), channelReply -> callback.reply(null)); } } @@ -2203,7 +2379,7 @@ public ZoomStateFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2212,7 +2388,12 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void create(@NonNull Long identifierArg, @NonNull Double minZoomRatioArg, @NonNull Double maxZoomRatioArg, @NonNull Reply callback) { + + public void create( + @NonNull Long identifierArg, + @NonNull Double minZoomRatioArg, + @NonNull Double maxZoomRatioArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.ZoomStateFlutterApi.create", getCodec()); @@ -2234,8 +2415,12 @@ public interface ImageAnalysisHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `ImageAnalysisHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageAnalysisHostApi api) { + /** + * Sets up an instance of `ImageAnalysisHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable ImageAnalysisHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2248,10 +2433,13 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageAnaly Number identifierArg = (Number) args.get(0); Number resolutionSelectorIdArg = (Number) args.get(1); try { - api.create((identifierArg == null) ? null : identifierArg.longValue(), (resolutionSelectorIdArg == null) ? null : resolutionSelectorIdArg.longValue()); + api.create( + (identifierArg == null) ? null : identifierArg.longValue(), + (resolutionSelectorIdArg == null) + ? null + : resolutionSelectorIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2273,10 +2461,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageAnaly Number identifierArg = (Number) args.get(0); Number analyzerIdentifierArg = (Number) args.get(1); try { - api.setAnalyzer((identifierArg == null) ? null : identifierArg.longValue(), (analyzerIdentifierArg == null) ? null : analyzerIdentifierArg.longValue()); + api.setAnalyzer( + (identifierArg == null) ? null : identifierArg.longValue(), + (analyzerIdentifierArg == null) ? null : analyzerIdentifierArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2289,7 +2478,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageAnaly { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.ImageAnalysisHostApi.clearAnalyzer", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.ImageAnalysisHostApi.clearAnalyzer", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2299,8 +2490,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageAnaly try { api.clearAnalyzer((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2321,7 +2511,9 @@ public interface AnalyzerHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `AnalyzerHostApi` to handle messages through the `binaryMessenger`. */ + /** + * Sets up an instance of `AnalyzerHostApi` to handle messages through the `binaryMessenger`. + */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable AnalyzerHostApi api) { { BasicMessageChannel channel = @@ -2336,8 +2528,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable AnalyzerHo try { api.create((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2358,7 +2549,9 @@ public interface ObserverHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `ObserverHostApi` to handle messages through the `binaryMessenger`. */ + /** + * Sets up an instance of `ObserverHostApi` to handle messages through the `binaryMessenger`. + */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ObserverHostApi api) { { BasicMessageChannel channel = @@ -2373,8 +2566,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ObserverHo try { api.create((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2394,7 +2586,7 @@ public ObserverFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2403,7 +2595,11 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void onChanged(@NonNull Long identifierArg, @NonNull Long valueIdentifierArg, @NonNull Reply callback) { + + public void onChanged( + @NonNull Long identifierArg, + @NonNull Long valueIdentifierArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.ObserverFlutterApi.onChanged", getCodec()); @@ -2420,7 +2616,7 @@ public CameraStateErrorFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2429,7 +2625,9 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void create(@NonNull Long identifierArg, @NonNull Long codeArg, @NonNull Reply callback) { + + public void create( + @NonNull Long identifierArg, @NonNull Long codeArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.CameraStateErrorFlutterApi.create", getCodec()); @@ -2472,14 +2670,16 @@ public interface LiveDataHostApi { void removeObservers(@NonNull Long identifier); - @Nullable + @Nullable Long getValue(@NonNull Long identifier, @NonNull LiveDataSupportedTypeData type); /** The codec used by LiveDataHostApi. */ static @NonNull MessageCodec getCodec() { return LiveDataHostApiCodec.INSTANCE; } - /**Sets up an instance of `LiveDataHostApi` to handle messages through the `binaryMessenger`. */ + /** + * Sets up an instance of `LiveDataHostApi` to handle messages through the `binaryMessenger`. + */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable LiveDataHostApi api) { { BasicMessageChannel channel = @@ -2493,10 +2693,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable LiveDataHo Number identifierArg = (Number) args.get(0); Number observerIdentifierArg = (Number) args.get(1); try { - api.observe((identifierArg == null) ? null : identifierArg.longValue(), (observerIdentifierArg == null) ? null : observerIdentifierArg.longValue()); + api.observe( + (identifierArg == null) ? null : identifierArg.longValue(), + (observerIdentifierArg == null) ? null : observerIdentifierArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2519,8 +2720,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable LiveDataHo try { api.removeObservers((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2542,10 +2742,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable LiveDataHo Number identifierArg = (Number) args.get(0); LiveDataSupportedTypeData typeArg = (LiveDataSupportedTypeData) args.get(1); try { - Long output = api.getValue((identifierArg == null) ? null : identifierArg.longValue(), typeArg); + Long output = + api.getValue( + (identifierArg == null) ? null : identifierArg.longValue(), typeArg); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2592,7 +2793,7 @@ public LiveDataFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2601,7 +2802,11 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return LiveDataFlutterApiCodec.INSTANCE; } - public void create(@NonNull Long identifierArg, @NonNull LiveDataSupportedTypeData typeArg, @NonNull Reply callback) { + + public void create( + @NonNull Long identifierArg, + @NonNull LiveDataSupportedTypeData typeArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.LiveDataFlutterApi.create", getCodec()); @@ -2618,7 +2823,7 @@ public AnalyzerFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2627,6 +2832,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2635,7 +2841,11 @@ public void create(@NonNull Long identifierArg, @NonNull Reply callback) { new ArrayList(Collections.singletonList(identifierArg)), channelReply -> callback.reply(null)); } - public void analyze(@NonNull Long identifierArg, @NonNull Long imageProxyIdentifierArg, @NonNull Reply callback) { + + public void analyze( + @NonNull Long identifierArg, + @NonNull Long imageProxyIdentifierArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.AnalyzerFlutterApi.analyze", getCodec()); @@ -2647,7 +2857,7 @@ public void analyze(@NonNull Long identifierArg, @NonNull Long imageProxyIdentif /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface ImageProxyHostApi { - @NonNull + @NonNull List getPlanes(@NonNull Long identifier); void close(@NonNull Long identifier); @@ -2656,7 +2866,9 @@ public interface ImageProxyHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `ImageProxyHostApi` to handle messages through the `binaryMessenger`. */ + /** + * Sets up an instance of `ImageProxyHostApi` to handle messages through the `binaryMessenger`. + */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageProxyHostApi api) { { BasicMessageChannel channel = @@ -2669,10 +2881,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageProxy ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - List output = api.getPlanes((identifierArg == null) ? null : identifierArg.longValue()); + List output = + api.getPlanes((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2695,8 +2907,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageProxy try { api.close((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2716,7 +2927,7 @@ public ImageProxyFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2725,7 +2936,13 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void create(@NonNull Long identifierArg, @NonNull Long formatArg, @NonNull Long heightArg, @NonNull Long widthArg, @NonNull Reply callback) { + + public void create( + @NonNull Long identifierArg, + @NonNull Long formatArg, + @NonNull Long heightArg, + @NonNull Long widthArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.ImageProxyFlutterApi.create", getCodec()); @@ -2742,7 +2959,7 @@ public PlaneProxyFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2751,12 +2968,19 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void create(@NonNull Long identifierArg, @NonNull byte[] bufferArg, @NonNull Long pixelStrideArg, @NonNull Long rowStrideArg, @NonNull Reply callback) { + + public void create( + @NonNull Long identifierArg, + @NonNull byte[] bufferArg, + @NonNull Long pixelStrideArg, + @NonNull Long rowStrideArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.PlaneProxyFlutterApi.create", getCodec()); channel.send( - new ArrayList(Arrays.asList(identifierArg, bufferArg, pixelStrideArg, rowStrideArg)), + new ArrayList( + Arrays.asList(identifierArg, bufferArg, pixelStrideArg, rowStrideArg)), channelReply -> callback.reply(null)); } } @@ -2790,17 +3014,25 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface QualitySelectorHostApi { - void create(@NonNull Long identifier, @NonNull List videoQualityConstraintIndexList, @Nullable Long fallbackStrategyId); + void create( + @NonNull Long identifier, + @NonNull List videoQualityConstraintIndexList, + @Nullable Long fallbackStrategyId); - @NonNull - ResolutionInfo getResolution(@NonNull Long cameraInfoId, @NonNull VideoQualityConstraint quality); + @NonNull + ResolutionInfo getResolution( + @NonNull Long cameraInfoId, @NonNull VideoQualityConstraint quality); /** The codec used by QualitySelectorHostApi. */ static @NonNull MessageCodec getCodec() { return QualitySelectorHostApiCodec.INSTANCE; } - /**Sets up an instance of `QualitySelectorHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable QualitySelectorHostApi api) { + /** + * Sets up an instance of `QualitySelectorHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable QualitySelectorHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2814,10 +3046,12 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable QualitySel List videoQualityConstraintIndexListArg = (List) args.get(1); Number fallbackStrategyIdArg = (Number) args.get(2); try { - api.create((identifierArg == null) ? null : identifierArg.longValue(), videoQualityConstraintIndexListArg, (fallbackStrategyIdArg == null) ? null : fallbackStrategyIdArg.longValue()); + api.create( + (identifierArg == null) ? null : identifierArg.longValue(), + videoQualityConstraintIndexListArg, + (fallbackStrategyIdArg == null) ? null : fallbackStrategyIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2830,19 +3064,24 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable QualitySel { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.QualitySelectorHostApi.getResolution", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.QualitySelectorHostApi.getResolution", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { ArrayList wrapped = new ArrayList(); ArrayList args = (ArrayList) message; Number cameraInfoIdArg = (Number) args.get(0); - VideoQualityConstraint qualityArg = args.get(1) == null ? null : VideoQualityConstraint.values()[(int) args.get(1)]; + VideoQualityConstraint qualityArg = + args.get(1) == null ? null : VideoQualityConstraint.values()[(int) args.get(1)]; try { - ResolutionInfo output = api.getResolution((cameraInfoIdArg == null) ? null : cameraInfoIdArg.longValue(), qualityArg); + ResolutionInfo output = + api.getResolution( + (cameraInfoIdArg == null) ? null : cameraInfoIdArg.longValue(), + qualityArg); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2857,14 +3096,21 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable QualitySel /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface FallbackStrategyHostApi { - void create(@NonNull Long identifier, @NonNull VideoQualityConstraint quality, @NonNull VideoResolutionFallbackRule fallbackRule); + void create( + @NonNull Long identifier, + @NonNull VideoQualityConstraint quality, + @NonNull VideoResolutionFallbackRule fallbackRule); /** The codec used by FallbackStrategyHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `FallbackStrategyHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable FallbackStrategyHostApi api) { + /** + * Sets up an instance of `FallbackStrategyHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable FallbackStrategyHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2875,13 +3121,19 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable FallbackSt ArrayList wrapped = new ArrayList(); ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); - VideoQualityConstraint qualityArg = args.get(1) == null ? null : VideoQualityConstraint.values()[(int) args.get(1)]; - VideoResolutionFallbackRule fallbackRuleArg = args.get(2) == null ? null : VideoResolutionFallbackRule.values()[(int) args.get(2)]; + VideoQualityConstraint qualityArg = + args.get(1) == null ? null : VideoQualityConstraint.values()[(int) args.get(1)]; + VideoResolutionFallbackRule fallbackRuleArg = + args.get(2) == null + ? null + : VideoResolutionFallbackRule.values()[(int) args.get(2)]; try { - api.create((identifierArg == null) ? null : identifierArg.longValue(), qualityArg, fallbackRuleArg); + api.create( + (identifierArg == null) ? null : identifierArg.longValue(), + qualityArg, + fallbackRuleArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } diff --git a/packages/camera/camera_android_camerax/lib/src/camerax_library.g.dart b/packages/camera/camera_android_camerax/lib/src/camerax_library.g.dart index 50fda90e346..0681a61e375 100644 --- a/packages/camera/camera_android_camerax/lib/src/camerax_library.g.dart +++ b/packages/camera/camera_android_camerax/lib/src/camerax_library.g.dart @@ -205,8 +205,7 @@ class InstanceManagerHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.InstanceManagerHostApi.clear', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -262,7 +261,8 @@ abstract class JavaObjectFlutterApi { void dispose(int identifier); - static void setup(JavaObjectFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(JavaObjectFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaObjectFlutterApi.dispose', codec, @@ -272,7 +272,7 @@ abstract class JavaObjectFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaObjectFlutterApi.dispose was null.'); + 'Argument for dev.flutter.pigeon.JavaObjectFlutterApi.dispose was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -409,7 +409,8 @@ abstract class CameraInfoFlutterApi { void create(int identifier); - static void setup(CameraInfoFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(CameraInfoFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraInfoFlutterApi.create', codec, @@ -419,7 +420,7 @@ abstract class CameraInfoFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraInfoFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.CameraInfoFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -446,8 +447,8 @@ class CameraSelectorHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraSelectorHostApi.create', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_lensFacing]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_lensFacing]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -464,12 +465,13 @@ class CameraSelectorHostApi { } } - Future> filter(int arg_identifier, List arg_cameraInfoIds) async { + Future> filter( + int arg_identifier, List arg_cameraInfoIds) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraSelectorHostApi.filter', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_cameraInfoIds]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_cameraInfoIds]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -497,7 +499,8 @@ abstract class CameraSelectorFlutterApi { void create(int identifier, int? lensFacing); - static void setup(CameraSelectorFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(CameraSelectorFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraSelectorFlutterApi.create', codec, @@ -507,7 +510,7 @@ abstract class CameraSelectorFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraSelectorFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.CameraSelectorFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -535,8 +538,7 @@ class ProcessCameraProviderHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ProcessCameraProviderHostApi.getInstance', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -560,7 +562,8 @@ class ProcessCameraProviderHostApi { Future> getAvailableCameraInfos(int arg_identifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.ProcessCameraProviderHostApi.getAvailableCameraInfos', codec, + 'dev.flutter.pigeon.ProcessCameraProviderHostApi.getAvailableCameraInfos', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_identifier]) as List?; @@ -585,12 +588,17 @@ class ProcessCameraProviderHostApi { } } - Future bindToLifecycle(int arg_identifier, int arg_cameraSelectorIdentifier, List arg_useCaseIds) async { + Future bindToLifecycle(int arg_identifier, + int arg_cameraSelectorIdentifier, List arg_useCaseIds) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.ProcessCameraProviderHostApi.bindToLifecycle', codec, + 'dev.flutter.pigeon.ProcessCameraProviderHostApi.bindToLifecycle', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_cameraSelectorIdentifier, arg_useCaseIds]) as List?; + final List? replyList = await channel.send([ + arg_identifier, + arg_cameraSelectorIdentifier, + arg_useCaseIds + ]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -617,7 +625,8 @@ class ProcessCameraProviderHostApi { 'dev.flutter.pigeon.ProcessCameraProviderHostApi.isBound', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_identifier, arg_useCaseIdentifier]) as List?; + await channel.send([arg_identifier, arg_useCaseIdentifier]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -643,8 +652,8 @@ class ProcessCameraProviderHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ProcessCameraProviderHostApi.unbind', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_useCaseIds]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_useCaseIds]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -689,7 +698,8 @@ abstract class ProcessCameraProviderFlutterApi { void create(int identifier); - static void setup(ProcessCameraProviderFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(ProcessCameraProviderFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ProcessCameraProviderFlutterApi.create', codec, @@ -699,7 +709,7 @@ abstract class ProcessCameraProviderFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ProcessCameraProviderFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.ProcessCameraProviderFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -765,7 +775,7 @@ abstract class CameraFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.CameraFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -793,7 +803,7 @@ class _SystemServicesHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return CameraPermissionsErrorData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -811,9 +821,11 @@ class SystemServicesHostApi { static const MessageCodec codec = _SystemServicesHostApiCodec(); - Future requestCameraPermissions(bool arg_enableAudio) async { + Future requestCameraPermissions( + bool arg_enableAudio) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.SystemServicesHostApi.requestCameraPermissions', codec, + 'dev.flutter.pigeon.SystemServicesHostApi.requestCameraPermissions', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_enableAudio]) as List?; @@ -833,12 +845,15 @@ class SystemServicesHostApi { } } - Future startListeningForDeviceOrientationChange(bool arg_isFrontFacing, int arg_sensorOrientation) async { + Future startListeningForDeviceOrientationChange( + bool arg_isFrontFacing, int arg_sensorOrientation) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.SystemServicesHostApi.startListeningForDeviceOrientationChange', codec, + 'dev.flutter.pigeon.SystemServicesHostApi.startListeningForDeviceOrientationChange', + codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_isFrontFacing, arg_sensorOrientation]) as List?; + await channel.send([arg_isFrontFacing, arg_sensorOrientation]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -857,10 +872,10 @@ class SystemServicesHostApi { Future stopListeningForDeviceOrientationChange() async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.SystemServicesHostApi.stopListeningForDeviceOrientationChange', codec, + 'dev.flutter.pigeon.SystemServicesHostApi.stopListeningForDeviceOrientationChange', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -912,17 +927,19 @@ abstract class SystemServicesFlutterApi { void onCameraError(String errorDescription); - static void setup(SystemServicesFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(SystemServicesFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.SystemServicesFlutterApi.onDeviceOrientationChanged', codec, + 'dev.flutter.pigeon.SystemServicesFlutterApi.onDeviceOrientationChanged', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.SystemServicesFlutterApi.onDeviceOrientationChanged was null.'); + 'Argument for dev.flutter.pigeon.SystemServicesFlutterApi.onDeviceOrientationChanged was null.'); final List args = (message as List?)!; final String? arg_orientation = (args[0] as String?); assert(arg_orientation != null, @@ -941,7 +958,7 @@ abstract class SystemServicesFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.SystemServicesFlutterApi.onCameraError was null.'); + 'Argument for dev.flutter.pigeon.SystemServicesFlutterApi.onCameraError was null.'); final List args = (message as List?)!; final String? arg_errorDescription = (args[0] as String?); assert(arg_errorDescription != null, @@ -969,7 +986,7 @@ class _PreviewHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return ResolutionInfo.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -987,12 +1004,14 @@ class PreviewHostApi { static const MessageCodec codec = _PreviewHostApiCodec(); - Future create(int arg_identifier, int? arg_rotation, int? arg_resolutionSelectorId) async { + Future create(int arg_identifier, int? arg_rotation, + int? arg_resolutionSelectorId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PreviewHostApi.create', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_rotation, arg_resolutionSelectorId]) as List?; + final List? replyList = await channel.send( + [arg_identifier, arg_rotation, arg_resolutionSelectorId]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1040,8 +1059,7 @@ class PreviewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PreviewHostApi.releaseFlutterSurfaceTexture', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1156,7 +1174,8 @@ abstract class VideoCaptureFlutterApi { void create(int identifier); - static void setup(VideoCaptureFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(VideoCaptureFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.VideoCaptureFlutterApi.create', codec, @@ -1166,7 +1185,7 @@ abstract class VideoCaptureFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.VideoCaptureFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.VideoCaptureFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1189,12 +1208,17 @@ class RecorderHostApi { static const MessageCodec codec = StandardMessageCodec(); - Future create(int arg_identifier, int? arg_aspectRatio, int? arg_bitRate, int? arg_qualitySelectorId) async { + Future create(int arg_identifier, int? arg_aspectRatio, + int? arg_bitRate, int? arg_qualitySelectorId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.RecorderHostApi.create', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_aspectRatio, arg_bitRate, arg_qualitySelectorId]) as List?; + final List? replyList = await channel.send([ + arg_identifier, + arg_aspectRatio, + arg_bitRate, + arg_qualitySelectorId + ]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1240,7 +1264,8 @@ class RecorderHostApi { Future getTargetVideoEncodingBitRate(int arg_identifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.RecorderHostApi.getTargetVideoEncodingBitRate', codec, + 'dev.flutter.pigeon.RecorderHostApi.getTargetVideoEncodingBitRate', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_identifier]) as List?; @@ -1269,8 +1294,8 @@ class RecorderHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.RecorderHostApi.prepareRecording', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_path]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_path]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1298,7 +1323,8 @@ abstract class RecorderFlutterApi { void create(int identifier, int? aspectRatio, int? bitRate); - static void setup(RecorderFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(RecorderFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.RecorderFlutterApi.create', codec, @@ -1308,7 +1334,7 @@ abstract class RecorderFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.RecorderFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.RecorderFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1366,7 +1392,8 @@ abstract class PendingRecordingFlutterApi { void create(int identifier); - static void setup(PendingRecordingFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(PendingRecordingFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PendingRecordingFlutterApi.create', codec, @@ -1376,7 +1403,7 @@ abstract class PendingRecordingFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PendingRecordingFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.PendingRecordingFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1493,7 +1520,8 @@ abstract class RecordingFlutterApi { void create(int identifier); - static void setup(RecordingFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(RecordingFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.RecordingFlutterApi.create', codec, @@ -1503,7 +1531,7 @@ abstract class RecordingFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.RecordingFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.RecordingFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1526,12 +1554,14 @@ class ImageCaptureHostApi { static const MessageCodec codec = StandardMessageCodec(); - Future create(int arg_identifier, int? arg_flashMode, int? arg_resolutionSelectorId) async { + Future create(int arg_identifier, int? arg_flashMode, + int? arg_resolutionSelectorId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ImageCaptureHostApi.create', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_flashMode, arg_resolutionSelectorId]) as List?; + final List? replyList = await channel.send( + [arg_identifier, arg_flashMode, arg_resolutionSelectorId]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1552,8 +1582,8 @@ class ImageCaptureHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ImageCaptureHostApi.setFlashMode', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_flashMode]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_flashMode]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1613,7 +1643,7 @@ class _ResolutionStrategyHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return ResolutionInfo.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -1631,12 +1661,14 @@ class ResolutionStrategyHostApi { static const MessageCodec codec = _ResolutionStrategyHostApiCodec(); - Future create(int arg_identifier, ResolutionInfo? arg_boundSize, int? arg_fallbackRule) async { + Future create(int arg_identifier, ResolutionInfo? arg_boundSize, + int? arg_fallbackRule) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ResolutionStrategyHostApi.create', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_boundSize, arg_fallbackRule]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_boundSize, arg_fallbackRule]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1664,12 +1696,16 @@ class ResolutionSelectorHostApi { static const MessageCodec codec = StandardMessageCodec(); - Future create(int arg_identifier, int? arg_resolutionStrategyIdentifier, int? arg_aspectRatioStrategyIdentifier) async { + Future create(int arg_identifier, int? arg_resolutionStrategyIdentifier, + int? arg_aspectRatioStrategyIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ResolutionSelectorHostApi.create', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_resolutionStrategyIdentifier, arg_aspectRatioStrategyIdentifier]) as List?; + final List? replyList = await channel.send([ + arg_identifier, + arg_resolutionStrategyIdentifier, + arg_aspectRatioStrategyIdentifier + ]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1697,12 +1733,16 @@ class AspectRatioStrategyHostApi { static const MessageCodec codec = StandardMessageCodec(); - Future create(int arg_identifier, int arg_preferredAspectRatio, int arg_fallbackRule) async { + Future create(int arg_identifier, int arg_preferredAspectRatio, + int arg_fallbackRule) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.AspectRatioStrategyHostApi.create', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_preferredAspectRatio, arg_fallbackRule]) as List?; + final List? replyList = await channel.send([ + arg_identifier, + arg_preferredAspectRatio, + arg_fallbackRule + ]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1735,7 +1775,7 @@ class _CameraStateFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return CameraStateTypeData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -1748,7 +1788,8 @@ abstract class CameraStateFlutterApi { void create(int identifier, CameraStateTypeData type, int? errorIdentifier); - static void setup(CameraStateFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(CameraStateFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraStateFlutterApi.create', codec, @@ -1758,12 +1799,13 @@ abstract class CameraStateFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraStateFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.CameraStateFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.CameraStateFlutterApi.create was null, expected non-null int.'); - final CameraStateTypeData? arg_type = (args[1] as CameraStateTypeData?); + final CameraStateTypeData? arg_type = + (args[1] as CameraStateTypeData?); assert(arg_type != null, 'Argument for dev.flutter.pigeon.CameraStateFlutterApi.create was null, expected non-null CameraStateTypeData.'); final int? arg_errorIdentifier = (args[2] as int?); @@ -1790,7 +1832,7 @@ class _ExposureStateFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return ExposureCompensationRange.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -1801,9 +1843,13 @@ class _ExposureStateFlutterApiCodec extends StandardMessageCodec { abstract class ExposureStateFlutterApi { static const MessageCodec codec = _ExposureStateFlutterApiCodec(); - void create(int identifier, ExposureCompensationRange exposureCompensationRange, double exposureCompensationStep); + void create( + int identifier, + ExposureCompensationRange exposureCompensationRange, + double exposureCompensationStep); - static void setup(ExposureStateFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(ExposureStateFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ExposureStateFlutterApi.create', codec, @@ -1813,18 +1859,20 @@ abstract class ExposureStateFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ExposureStateFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.ExposureStateFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.ExposureStateFlutterApi.create was null, expected non-null int.'); - final ExposureCompensationRange? arg_exposureCompensationRange = (args[1] as ExposureCompensationRange?); + final ExposureCompensationRange? arg_exposureCompensationRange = + (args[1] as ExposureCompensationRange?); assert(arg_exposureCompensationRange != null, 'Argument for dev.flutter.pigeon.ExposureStateFlutterApi.create was null, expected non-null ExposureCompensationRange.'); final double? arg_exposureCompensationStep = (args[2] as double?); assert(arg_exposureCompensationStep != null, 'Argument for dev.flutter.pigeon.ExposureStateFlutterApi.create was null, expected non-null double.'); - api.create(arg_identifier!, arg_exposureCompensationRange!, arg_exposureCompensationStep!); + api.create(arg_identifier!, arg_exposureCompensationRange!, + arg_exposureCompensationStep!); return; }); } @@ -1837,7 +1885,8 @@ abstract class ZoomStateFlutterApi { void create(int identifier, double minZoomRatio, double maxZoomRatio); - static void setup(ZoomStateFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(ZoomStateFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ZoomStateFlutterApi.create', codec, @@ -1847,7 +1896,7 @@ abstract class ZoomStateFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ZoomStateFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.ZoomStateFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1881,7 +1930,8 @@ class ImageAnalysisHostApi { 'dev.flutter.pigeon.ImageAnalysisHostApi.create', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_identifier, arg_resolutionSelectorId]) as List?; + await channel.send([arg_identifier, arg_resolutionSelectorId]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1898,12 +1948,14 @@ class ImageAnalysisHostApi { } } - Future setAnalyzer(int arg_identifier, int arg_analyzerIdentifier) async { + Future setAnalyzer( + int arg_identifier, int arg_analyzerIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ImageAnalysisHostApi.setAnalyzer', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_identifier, arg_analyzerIdentifier]) as List?; + await channel.send([arg_identifier, arg_analyzerIdentifier]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2014,7 +2066,8 @@ abstract class ObserverFlutterApi { void onChanged(int identifier, int valueIdentifier); - static void setup(ObserverFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(ObserverFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ObserverFlutterApi.onChanged', codec, @@ -2024,7 +2077,7 @@ abstract class ObserverFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ObserverFlutterApi.onChanged was null.'); + 'Argument for dev.flutter.pigeon.ObserverFlutterApi.onChanged was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -2045,7 +2098,8 @@ abstract class CameraStateErrorFlutterApi { void create(int identifier, int code); - static void setup(CameraStateErrorFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(CameraStateErrorFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraStateErrorFlutterApi.create', codec, @@ -2055,7 +2109,7 @@ abstract class CameraStateErrorFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraStateErrorFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.CameraStateErrorFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -2086,7 +2140,7 @@ class _LiveDataHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return LiveDataSupportedTypeData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -2109,7 +2163,8 @@ class LiveDataHostApi { 'dev.flutter.pigeon.LiveDataHostApi.observe', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_identifier, arg_observerIdentifier]) as List?; + await channel.send([arg_identifier, arg_observerIdentifier]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2148,12 +2203,13 @@ class LiveDataHostApi { } } - Future getValue(int arg_identifier, LiveDataSupportedTypeData arg_type) async { + Future getValue( + int arg_identifier, LiveDataSupportedTypeData arg_type) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.LiveDataHostApi.getValue', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_type]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_type]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2186,7 +2242,7 @@ class _LiveDataFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return LiveDataSupportedTypeData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -2199,7 +2255,8 @@ abstract class LiveDataFlutterApi { void create(int identifier, LiveDataSupportedTypeData type); - static void setup(LiveDataFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(LiveDataFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.LiveDataFlutterApi.create', codec, @@ -2209,12 +2266,13 @@ abstract class LiveDataFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.LiveDataFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.LiveDataFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.LiveDataFlutterApi.create was null, expected non-null int.'); - final LiveDataSupportedTypeData? arg_type = (args[1] as LiveDataSupportedTypeData?); + final LiveDataSupportedTypeData? arg_type = + (args[1] as LiveDataSupportedTypeData?); assert(arg_type != null, 'Argument for dev.flutter.pigeon.LiveDataFlutterApi.create was null, expected non-null LiveDataSupportedTypeData.'); api.create(arg_identifier!, arg_type!); @@ -2232,7 +2290,8 @@ abstract class AnalyzerFlutterApi { void analyze(int identifier, int imageProxyIdentifier); - static void setup(AnalyzerFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(AnalyzerFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.AnalyzerFlutterApi.create', codec, @@ -2242,7 +2301,7 @@ abstract class AnalyzerFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.AnalyzerFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.AnalyzerFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -2261,7 +2320,7 @@ abstract class AnalyzerFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.AnalyzerFlutterApi.analyze was null.'); + 'Argument for dev.flutter.pigeon.AnalyzerFlutterApi.analyze was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -2342,7 +2401,8 @@ abstract class ImageProxyFlutterApi { void create(int identifier, int format, int height, int width); - static void setup(ImageProxyFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(ImageProxyFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ImageProxyFlutterApi.create', codec, @@ -2352,7 +2412,7 @@ abstract class ImageProxyFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ImageProxyFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.ImageProxyFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -2379,7 +2439,8 @@ abstract class PlaneProxyFlutterApi { void create(int identifier, Uint8List buffer, int pixelStride, int rowStride); - static void setup(PlaneProxyFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(PlaneProxyFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PlaneProxyFlutterApi.create', codec, @@ -2389,7 +2450,7 @@ abstract class PlaneProxyFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PlaneProxyFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.PlaneProxyFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -2403,7 +2464,8 @@ abstract class PlaneProxyFlutterApi { final int? arg_rowStride = (args[3] as int?); assert(arg_rowStride != null, 'Argument for dev.flutter.pigeon.PlaneProxyFlutterApi.create was null, expected non-null int.'); - api.create(arg_identifier!, arg_buffer!, arg_pixelStride!, arg_rowStride!); + api.create( + arg_identifier!, arg_buffer!, arg_pixelStride!, arg_rowStride!); return; }); } @@ -2426,7 +2488,7 @@ class _QualitySelectorHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return ResolutionInfo.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -2444,12 +2506,18 @@ class QualitySelectorHostApi { static const MessageCodec codec = _QualitySelectorHostApiCodec(); - Future create(int arg_identifier, List arg_videoQualityConstraintIndexList, int? arg_fallbackStrategyId) async { + Future create( + int arg_identifier, + List arg_videoQualityConstraintIndexList, + int? arg_fallbackStrategyId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.QualitySelectorHostApi.create', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_videoQualityConstraintIndexList, arg_fallbackStrategyId]) as List?; + final List? replyList = await channel.send([ + arg_identifier, + arg_videoQualityConstraintIndexList, + arg_fallbackStrategyId + ]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2466,12 +2534,13 @@ class QualitySelectorHostApi { } } - Future getResolution(int arg_cameraInfoId, VideoQualityConstraint arg_quality) async { + Future getResolution( + int arg_cameraInfoId, VideoQualityConstraint arg_quality) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.QualitySelectorHostApi.getResolution', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_cameraInfoId, arg_quality.index]) as List?; + final List? replyList = await channel + .send([arg_cameraInfoId, arg_quality.index]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2504,12 +2573,16 @@ class FallbackStrategyHostApi { static const MessageCodec codec = StandardMessageCodec(); - Future create(int arg_identifier, VideoQualityConstraint arg_quality, VideoResolutionFallbackRule arg_fallbackRule) async { + Future create(int arg_identifier, VideoQualityConstraint arg_quality, + VideoResolutionFallbackRule arg_fallbackRule) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.FallbackStrategyHostApi.create', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_quality.index, arg_fallbackRule.index]) as List?; + final List? replyList = await channel.send([ + arg_identifier, + arg_quality.index, + arg_fallbackRule.index + ]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', diff --git a/packages/camera/camera_android_camerax/test/test_camerax_library.g.dart b/packages/camera/camera_android_camerax/test/test_camerax_library.g.dart index 76b3becf47f..d4c935e819c 100644 --- a/packages/camera/camera_android_camerax/test/test_camerax_library.g.dart +++ b/packages/camera/camera_android_camerax/test/test_camerax_library.g.dart @@ -14,7 +14,8 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:camera_android_camerax/src/camerax_library.g.dart'; abstract class TestInstanceManagerHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); /// Clear the native `InstanceManager`. @@ -22,15 +23,19 @@ abstract class TestInstanceManagerHostApi { /// This is typically only used after a hot restart. void clear(); - static void setup(TestInstanceManagerHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestInstanceManagerHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.InstanceManagerHostApi.clear', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { // ignore message api.clear(); return []; @@ -41,22 +46,27 @@ abstract class TestInstanceManagerHostApi { } abstract class TestJavaObjectHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void dispose(int identifier); - static void setup(TestJavaObjectHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestJavaObjectHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaObjectHostApi.dispose', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaObjectHostApi.dispose was null.'); + 'Argument for dev.flutter.pigeon.JavaObjectHostApi.dispose was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -70,7 +80,8 @@ abstract class TestJavaObjectHostApi { } abstract class TestCameraInfoHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); int getSensorRotationDegrees(int identifier); @@ -81,17 +92,22 @@ abstract class TestCameraInfoHostApi { int getZoomState(int identifier); - static void setup(TestCameraInfoHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestCameraInfoHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CameraInfoHostApi.getSensorRotationDegrees', codec, + 'dev.flutter.pigeon.CameraInfoHostApi.getSensorRotationDegrees', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraInfoHostApi.getSensorRotationDegrees was null.'); + 'Argument for dev.flutter.pigeon.CameraInfoHostApi.getSensorRotationDegrees was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -106,11 +122,14 @@ abstract class TestCameraInfoHostApi { 'dev.flutter.pigeon.CameraInfoHostApi.getCameraState', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraInfoHostApi.getCameraState was null.'); + 'Argument for dev.flutter.pigeon.CameraInfoHostApi.getCameraState was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -125,11 +144,14 @@ abstract class TestCameraInfoHostApi { 'dev.flutter.pigeon.CameraInfoHostApi.getExposureState', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraInfoHostApi.getExposureState was null.'); + 'Argument for dev.flutter.pigeon.CameraInfoHostApi.getExposureState was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -144,11 +166,14 @@ abstract class TestCameraInfoHostApi { 'dev.flutter.pigeon.CameraInfoHostApi.getZoomState', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraInfoHostApi.getZoomState was null.'); + 'Argument for dev.flutter.pigeon.CameraInfoHostApi.getZoomState was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -162,24 +187,29 @@ abstract class TestCameraInfoHostApi { } abstract class TestCameraSelectorHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int identifier, int? lensFacing); List filter(int identifier, List cameraInfoIds); - static void setup(TestCameraSelectorHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestCameraSelectorHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraSelectorHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraSelectorHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.CameraSelectorHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -195,19 +225,24 @@ abstract class TestCameraSelectorHostApi { 'dev.flutter.pigeon.CameraSelectorHostApi.filter', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraSelectorHostApi.filter was null.'); + 'Argument for dev.flutter.pigeon.CameraSelectorHostApi.filter was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.CameraSelectorHostApi.filter was null, expected non-null int.'); - final List? arg_cameraInfoIds = (args[1] as List?)?.cast(); + final List? arg_cameraInfoIds = + (args[1] as List?)?.cast(); assert(arg_cameraInfoIds != null, 'Argument for dev.flutter.pigeon.CameraSelectorHostApi.filter was null, expected non-null List.'); - final List output = api.filter(arg_identifier!, arg_cameraInfoIds!); + final List output = + api.filter(arg_identifier!, arg_cameraInfoIds!); return [output]; }); } @@ -216,14 +251,16 @@ abstract class TestCameraSelectorHostApi { } abstract class TestProcessCameraProviderHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); Future getInstance(); List getAvailableCameraInfos(int identifier); - int bindToLifecycle(int identifier, int cameraSelectorIdentifier, List useCaseIds); + int bindToLifecycle( + int identifier, int cameraSelectorIdentifier, List useCaseIds); bool isBound(int identifier, int useCaseIdentifier); @@ -231,15 +268,19 @@ abstract class TestProcessCameraProviderHostApi { void unbindAll(int identifier); - static void setup(TestProcessCameraProviderHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestProcessCameraProviderHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ProcessCameraProviderHostApi.getInstance', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { // ignore message final int output = await api.getInstance(); return [output]; @@ -248,33 +289,42 @@ abstract class TestProcessCameraProviderHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.ProcessCameraProviderHostApi.getAvailableCameraInfos', codec, + 'dev.flutter.pigeon.ProcessCameraProviderHostApi.getAvailableCameraInfos', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.getAvailableCameraInfos was null.'); + 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.getAvailableCameraInfos was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.getAvailableCameraInfos was null, expected non-null int.'); - final List output = api.getAvailableCameraInfos(arg_identifier!); + final List output = + api.getAvailableCameraInfos(arg_identifier!); return [output]; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.ProcessCameraProviderHostApi.bindToLifecycle', codec, + 'dev.flutter.pigeon.ProcessCameraProviderHostApi.bindToLifecycle', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.bindToLifecycle was null.'); + 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.bindToLifecycle was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -282,10 +332,12 @@ abstract class TestProcessCameraProviderHostApi { final int? arg_cameraSelectorIdentifier = (args[1] as int?); assert(arg_cameraSelectorIdentifier != null, 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.bindToLifecycle was null, expected non-null int.'); - final List? arg_useCaseIds = (args[2] as List?)?.cast(); + final List? arg_useCaseIds = + (args[2] as List?)?.cast(); assert(arg_useCaseIds != null, 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.bindToLifecycle was null, expected non-null List.'); - final int output = api.bindToLifecycle(arg_identifier!, arg_cameraSelectorIdentifier!, arg_useCaseIds!); + final int output = api.bindToLifecycle( + arg_identifier!, arg_cameraSelectorIdentifier!, arg_useCaseIds!); return [output]; }); } @@ -295,11 +347,14 @@ abstract class TestProcessCameraProviderHostApi { 'dev.flutter.pigeon.ProcessCameraProviderHostApi.isBound', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.isBound was null.'); + 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.isBound was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -307,7 +362,8 @@ abstract class TestProcessCameraProviderHostApi { final int? arg_useCaseIdentifier = (args[1] as int?); assert(arg_useCaseIdentifier != null, 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.isBound was null, expected non-null int.'); - final bool output = api.isBound(arg_identifier!, arg_useCaseIdentifier!); + final bool output = + api.isBound(arg_identifier!, arg_useCaseIdentifier!); return [output]; }); } @@ -317,16 +373,20 @@ abstract class TestProcessCameraProviderHostApi { 'dev.flutter.pigeon.ProcessCameraProviderHostApi.unbind', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.unbind was null.'); + 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.unbind was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.unbind was null, expected non-null int.'); - final List? arg_useCaseIds = (args[1] as List?)?.cast(); + final List? arg_useCaseIds = + (args[1] as List?)?.cast(); assert(arg_useCaseIds != null, 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.unbind was null, expected non-null List.'); api.unbind(arg_identifier!, arg_useCaseIds!); @@ -339,11 +399,14 @@ abstract class TestProcessCameraProviderHostApi { 'dev.flutter.pigeon.ProcessCameraProviderHostApi.unbindAll', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.unbindAll was null.'); + 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.unbindAll was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -357,22 +420,27 @@ abstract class TestProcessCameraProviderHostApi { } abstract class TestCameraHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); int getCameraInfo(int identifier); - static void setup(TestCameraHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestCameraHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraHostApi.getCameraInfo', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraHostApi.getCameraInfo was null.'); + 'Argument for dev.flutter.pigeon.CameraHostApi.getCameraInfo was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -400,7 +468,7 @@ class _TestSystemServicesHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return CameraPermissionsErrorData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -409,47 +477,60 @@ class _TestSystemServicesHostApiCodec extends StandardMessageCodec { } abstract class TestSystemServicesHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = _TestSystemServicesHostApiCodec(); - Future requestCameraPermissions(bool enableAudio); + Future requestCameraPermissions( + bool enableAudio); - void startListeningForDeviceOrientationChange(bool isFrontFacing, int sensorOrientation); + void startListeningForDeviceOrientationChange( + bool isFrontFacing, int sensorOrientation); void stopListeningForDeviceOrientationChange(); String getTempFilePath(String prefix, String suffix); - static void setup(TestSystemServicesHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestSystemServicesHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.SystemServicesHostApi.requestCameraPermissions', codec, + 'dev.flutter.pigeon.SystemServicesHostApi.requestCameraPermissions', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.SystemServicesHostApi.requestCameraPermissions was null.'); + 'Argument for dev.flutter.pigeon.SystemServicesHostApi.requestCameraPermissions was null.'); final List args = (message as List?)!; final bool? arg_enableAudio = (args[0] as bool?); assert(arg_enableAudio != null, 'Argument for dev.flutter.pigeon.SystemServicesHostApi.requestCameraPermissions was null, expected non-null bool.'); - final CameraPermissionsErrorData? output = await api.requestCameraPermissions(arg_enableAudio!); + final CameraPermissionsErrorData? output = + await api.requestCameraPermissions(arg_enableAudio!); return [output]; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.SystemServicesHostApi.startListeningForDeviceOrientationChange', codec, + 'dev.flutter.pigeon.SystemServicesHostApi.startListeningForDeviceOrientationChange', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.SystemServicesHostApi.startListeningForDeviceOrientationChange was null.'); + 'Argument for dev.flutter.pigeon.SystemServicesHostApi.startListeningForDeviceOrientationChange was null.'); final List args = (message as List?)!; final bool? arg_isFrontFacing = (args[0] as bool?); assert(arg_isFrontFacing != null, @@ -457,19 +538,24 @@ abstract class TestSystemServicesHostApi { final int? arg_sensorOrientation = (args[1] as int?); assert(arg_sensorOrientation != null, 'Argument for dev.flutter.pigeon.SystemServicesHostApi.startListeningForDeviceOrientationChange was null, expected non-null int.'); - api.startListeningForDeviceOrientationChange(arg_isFrontFacing!, arg_sensorOrientation!); + api.startListeningForDeviceOrientationChange( + arg_isFrontFacing!, arg_sensorOrientation!); return []; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.SystemServicesHostApi.stopListeningForDeviceOrientationChange', codec, + 'dev.flutter.pigeon.SystemServicesHostApi.stopListeningForDeviceOrientationChange', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { // ignore message api.stopListeningForDeviceOrientationChange(); return []; @@ -481,11 +567,14 @@ abstract class TestSystemServicesHostApi { 'dev.flutter.pigeon.SystemServicesHostApi.getTempFilePath', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.SystemServicesHostApi.getTempFilePath was null.'); + 'Argument for dev.flutter.pigeon.SystemServicesHostApi.getTempFilePath was null.'); final List args = (message as List?)!; final String? arg_prefix = (args[0] as String?); assert(arg_prefix != null, @@ -516,7 +605,7 @@ class _TestPreviewHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return ResolutionInfo.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -525,7 +614,8 @@ class _TestPreviewHostApiCodec extends StandardMessageCodec { } abstract class TestPreviewHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = _TestPreviewHostApiCodec(); void create(int identifier, int? rotation, int? resolutionSelectorId); @@ -536,17 +626,21 @@ abstract class TestPreviewHostApi { ResolutionInfo getResolutionInfo(int identifier); - static void setup(TestPreviewHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestPreviewHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PreviewHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PreviewHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.PreviewHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -563,11 +657,14 @@ abstract class TestPreviewHostApi { 'dev.flutter.pigeon.PreviewHostApi.setSurfaceProvider', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PreviewHostApi.setSurfaceProvider was null.'); + 'Argument for dev.flutter.pigeon.PreviewHostApi.setSurfaceProvider was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -579,12 +676,16 @@ abstract class TestPreviewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.PreviewHostApi.releaseFlutterSurfaceTexture', codec, + 'dev.flutter.pigeon.PreviewHostApi.releaseFlutterSurfaceTexture', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { // ignore message api.releaseFlutterSurfaceTexture(); return []; @@ -596,11 +697,14 @@ abstract class TestPreviewHostApi { 'dev.flutter.pigeon.PreviewHostApi.getResolutionInfo', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PreviewHostApi.getResolutionInfo was null.'); + 'Argument for dev.flutter.pigeon.PreviewHostApi.getResolutionInfo was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -614,24 +718,29 @@ abstract class TestPreviewHostApi { } abstract class TestVideoCaptureHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); int withOutput(int videoOutputId); int getOutput(int identifier); - static void setup(TestVideoCaptureHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestVideoCaptureHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.VideoCaptureHostApi.withOutput', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.VideoCaptureHostApi.withOutput was null.'); + 'Argument for dev.flutter.pigeon.VideoCaptureHostApi.withOutput was null.'); final List args = (message as List?)!; final int? arg_videoOutputId = (args[0] as int?); assert(arg_videoOutputId != null, @@ -646,11 +755,14 @@ abstract class TestVideoCaptureHostApi { 'dev.flutter.pigeon.VideoCaptureHostApi.getOutput', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.VideoCaptureHostApi.getOutput was null.'); + 'Argument for dev.flutter.pigeon.VideoCaptureHostApi.getOutput was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -664,10 +776,12 @@ abstract class TestVideoCaptureHostApi { } abstract class TestRecorderHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); - void create(int identifier, int? aspectRatio, int? bitRate, int? qualitySelectorId); + void create( + int identifier, int? aspectRatio, int? bitRate, int? qualitySelectorId); int getAspectRatio(int identifier); @@ -675,17 +789,21 @@ abstract class TestRecorderHostApi { int prepareRecording(int identifier, String path); - static void setup(TestRecorderHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestRecorderHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.RecorderHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.RecorderHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.RecorderHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -693,7 +811,8 @@ abstract class TestRecorderHostApi { final int? arg_aspectRatio = (args[1] as int?); final int? arg_bitRate = (args[2] as int?); final int? arg_qualitySelectorId = (args[3] as int?); - api.create(arg_identifier!, arg_aspectRatio, arg_bitRate, arg_qualitySelectorId); + api.create(arg_identifier!, arg_aspectRatio, arg_bitRate, + arg_qualitySelectorId); return []; }); } @@ -703,11 +822,14 @@ abstract class TestRecorderHostApi { 'dev.flutter.pigeon.RecorderHostApi.getAspectRatio', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.RecorderHostApi.getAspectRatio was null.'); + 'Argument for dev.flutter.pigeon.RecorderHostApi.getAspectRatio was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -719,14 +841,18 @@ abstract class TestRecorderHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.RecorderHostApi.getTargetVideoEncodingBitRate', codec, + 'dev.flutter.pigeon.RecorderHostApi.getTargetVideoEncodingBitRate', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.RecorderHostApi.getTargetVideoEncodingBitRate was null.'); + 'Argument for dev.flutter.pigeon.RecorderHostApi.getTargetVideoEncodingBitRate was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -741,11 +867,14 @@ abstract class TestRecorderHostApi { 'dev.flutter.pigeon.RecorderHostApi.prepareRecording', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.RecorderHostApi.prepareRecording was null.'); + 'Argument for dev.flutter.pigeon.RecorderHostApi.prepareRecording was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -762,22 +891,27 @@ abstract class TestRecorderHostApi { } abstract class TestPendingRecordingHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); int start(int identifier); - static void setup(TestPendingRecordingHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestPendingRecordingHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PendingRecordingHostApi.start', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PendingRecordingHostApi.start was null.'); + 'Argument for dev.flutter.pigeon.PendingRecordingHostApi.start was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -791,7 +925,8 @@ abstract class TestPendingRecordingHostApi { } abstract class TestRecordingHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void close(int identifier); @@ -802,17 +937,21 @@ abstract class TestRecordingHostApi { void stop(int identifier); - static void setup(TestRecordingHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestRecordingHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.RecordingHostApi.close', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.RecordingHostApi.close was null.'); + 'Argument for dev.flutter.pigeon.RecordingHostApi.close was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -827,11 +966,14 @@ abstract class TestRecordingHostApi { 'dev.flutter.pigeon.RecordingHostApi.pause', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.RecordingHostApi.pause was null.'); + 'Argument for dev.flutter.pigeon.RecordingHostApi.pause was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -846,11 +988,14 @@ abstract class TestRecordingHostApi { 'dev.flutter.pigeon.RecordingHostApi.resume', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.RecordingHostApi.resume was null.'); + 'Argument for dev.flutter.pigeon.RecordingHostApi.resume was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -865,11 +1010,14 @@ abstract class TestRecordingHostApi { 'dev.flutter.pigeon.RecordingHostApi.stop', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.RecordingHostApi.stop was null.'); + 'Argument for dev.flutter.pigeon.RecordingHostApi.stop was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -883,7 +1031,8 @@ abstract class TestRecordingHostApi { } abstract class TestImageCaptureHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int identifier, int? flashMode, int? resolutionSelectorId); @@ -892,17 +1041,21 @@ abstract class TestImageCaptureHostApi { Future takePicture(int identifier); - static void setup(TestImageCaptureHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestImageCaptureHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ImageCaptureHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ImageCaptureHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.ImageCaptureHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -919,11 +1072,14 @@ abstract class TestImageCaptureHostApi { 'dev.flutter.pigeon.ImageCaptureHostApi.setFlashMode', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ImageCaptureHostApi.setFlashMode was null.'); + 'Argument for dev.flutter.pigeon.ImageCaptureHostApi.setFlashMode was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -941,11 +1097,14 @@ abstract class TestImageCaptureHostApi { 'dev.flutter.pigeon.ImageCaptureHostApi.takePicture', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ImageCaptureHostApi.takePicture was null.'); + 'Argument for dev.flutter.pigeon.ImageCaptureHostApi.takePicture was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -973,7 +1132,7 @@ class _TestResolutionStrategyHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return ResolutionInfo.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -982,22 +1141,28 @@ class _TestResolutionStrategyHostApiCodec extends StandardMessageCodec { } abstract class TestResolutionStrategyHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; - static const MessageCodec codec = _TestResolutionStrategyHostApiCodec(); + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; + static const MessageCodec codec = + _TestResolutionStrategyHostApiCodec(); void create(int identifier, ResolutionInfo? boundSize, int? fallbackRule); - static void setup(TestResolutionStrategyHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestResolutionStrategyHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ResolutionStrategyHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ResolutionStrategyHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.ResolutionStrategyHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1013,29 +1178,36 @@ abstract class TestResolutionStrategyHostApi { } abstract class TestResolutionSelectorHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); - void create(int identifier, int? resolutionStrategyIdentifier, int? aspectRatioStrategyIdentifier); + void create(int identifier, int? resolutionStrategyIdentifier, + int? aspectRatioStrategyIdentifier); - static void setup(TestResolutionSelectorHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestResolutionSelectorHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ResolutionSelectorHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ResolutionSelectorHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.ResolutionSelectorHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.ResolutionSelectorHostApi.create was null, expected non-null int.'); final int? arg_resolutionStrategyIdentifier = (args[1] as int?); final int? arg_aspectRatioStrategyIdentifier = (args[2] as int?); - api.create(arg_identifier!, arg_resolutionStrategyIdentifier, arg_aspectRatioStrategyIdentifier); + api.create(arg_identifier!, arg_resolutionStrategyIdentifier, + arg_aspectRatioStrategyIdentifier); return []; }); } @@ -1044,22 +1216,27 @@ abstract class TestResolutionSelectorHostApi { } abstract class TestAspectRatioStrategyHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int identifier, int preferredAspectRatio, int fallbackRule); - static void setup(TestAspectRatioStrategyHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestAspectRatioStrategyHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.AspectRatioStrategyHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.AspectRatioStrategyHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.AspectRatioStrategyHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1070,7 +1247,8 @@ abstract class TestAspectRatioStrategyHostApi { final int? arg_fallbackRule = (args[2] as int?); assert(arg_fallbackRule != null, 'Argument for dev.flutter.pigeon.AspectRatioStrategyHostApi.create was null, expected non-null int.'); - api.create(arg_identifier!, arg_preferredAspectRatio!, arg_fallbackRule!); + api.create( + arg_identifier!, arg_preferredAspectRatio!, arg_fallbackRule!); return []; }); } @@ -1079,7 +1257,8 @@ abstract class TestAspectRatioStrategyHostApi { } abstract class TestImageAnalysisHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int identifier, int? resolutionSelectorId); @@ -1088,17 +1267,21 @@ abstract class TestImageAnalysisHostApi { void clearAnalyzer(int identifier); - static void setup(TestImageAnalysisHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestImageAnalysisHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ImageAnalysisHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ImageAnalysisHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.ImageAnalysisHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1114,11 +1297,14 @@ abstract class TestImageAnalysisHostApi { 'dev.flutter.pigeon.ImageAnalysisHostApi.setAnalyzer', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ImageAnalysisHostApi.setAnalyzer was null.'); + 'Argument for dev.flutter.pigeon.ImageAnalysisHostApi.setAnalyzer was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1136,11 +1322,14 @@ abstract class TestImageAnalysisHostApi { 'dev.flutter.pigeon.ImageAnalysisHostApi.clearAnalyzer', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ImageAnalysisHostApi.clearAnalyzer was null.'); + 'Argument for dev.flutter.pigeon.ImageAnalysisHostApi.clearAnalyzer was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1154,22 +1343,27 @@ abstract class TestImageAnalysisHostApi { } abstract class TestAnalyzerHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int identifier); - static void setup(TestAnalyzerHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestAnalyzerHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.AnalyzerHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.AnalyzerHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.AnalyzerHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1183,22 +1377,27 @@ abstract class TestAnalyzerHostApi { } abstract class TestObserverHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int identifier); - static void setup(TestObserverHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestObserverHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ObserverHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ObserverHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.ObserverHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1226,7 +1425,7 @@ class _TestLiveDataHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return LiveDataSupportedTypeData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -1235,7 +1434,8 @@ class _TestLiveDataHostApiCodec extends StandardMessageCodec { } abstract class TestLiveDataHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = _TestLiveDataHostApiCodec(); void observe(int identifier, int observerIdentifier); @@ -1244,17 +1444,21 @@ abstract class TestLiveDataHostApi { int? getValue(int identifier, LiveDataSupportedTypeData type); - static void setup(TestLiveDataHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestLiveDataHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.LiveDataHostApi.observe', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.LiveDataHostApi.observe was null.'); + 'Argument for dev.flutter.pigeon.LiveDataHostApi.observe was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1272,11 +1476,14 @@ abstract class TestLiveDataHostApi { 'dev.flutter.pigeon.LiveDataHostApi.removeObservers', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.LiveDataHostApi.removeObservers was null.'); + 'Argument for dev.flutter.pigeon.LiveDataHostApi.removeObservers was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1291,16 +1498,20 @@ abstract class TestLiveDataHostApi { 'dev.flutter.pigeon.LiveDataHostApi.getValue', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.LiveDataHostApi.getValue was null.'); + 'Argument for dev.flutter.pigeon.LiveDataHostApi.getValue was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.LiveDataHostApi.getValue was null, expected non-null int.'); - final LiveDataSupportedTypeData? arg_type = (args[1] as LiveDataSupportedTypeData?); + final LiveDataSupportedTypeData? arg_type = + (args[1] as LiveDataSupportedTypeData?); assert(arg_type != null, 'Argument for dev.flutter.pigeon.LiveDataHostApi.getValue was null, expected non-null LiveDataSupportedTypeData.'); final int? output = api.getValue(arg_identifier!, arg_type!); @@ -1312,24 +1523,29 @@ abstract class TestLiveDataHostApi { } abstract class TestImageProxyHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); List getPlanes(int identifier); void close(int identifier); - static void setup(TestImageProxyHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestImageProxyHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ImageProxyHostApi.getPlanes', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ImageProxyHostApi.getPlanes was null.'); + 'Argument for dev.flutter.pigeon.ImageProxyHostApi.getPlanes was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1344,11 +1560,14 @@ abstract class TestImageProxyHostApi { 'dev.flutter.pigeon.ImageProxyHostApi.close', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ImageProxyHostApi.close was null.'); + 'Argument for dev.flutter.pigeon.ImageProxyHostApi.close was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1376,7 +1595,7 @@ class _TestQualitySelectorHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return ResolutionInfo.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -1385,33 +1604,42 @@ class _TestQualitySelectorHostApiCodec extends StandardMessageCodec { } abstract class TestQualitySelectorHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = _TestQualitySelectorHostApiCodec(); - void create(int identifier, List videoQualityConstraintIndexList, int? fallbackStrategyId); + void create(int identifier, List videoQualityConstraintIndexList, + int? fallbackStrategyId); - ResolutionInfo getResolution(int cameraInfoId, VideoQualityConstraint quality); + ResolutionInfo getResolution( + int cameraInfoId, VideoQualityConstraint quality); - static void setup(TestQualitySelectorHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestQualitySelectorHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.QualitySelectorHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.QualitySelectorHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.QualitySelectorHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.QualitySelectorHostApi.create was null, expected non-null int.'); - final List? arg_videoQualityConstraintIndexList = (args[1] as List?)?.cast(); + final List? arg_videoQualityConstraintIndexList = + (args[1] as List?)?.cast(); assert(arg_videoQualityConstraintIndexList != null, 'Argument for dev.flutter.pigeon.QualitySelectorHostApi.create was null, expected non-null List.'); final int? arg_fallbackStrategyId = (args[2] as int?); - api.create(arg_identifier!, arg_videoQualityConstraintIndexList!, arg_fallbackStrategyId); + api.create(arg_identifier!, arg_videoQualityConstraintIndexList!, + arg_fallbackStrategyId); return []; }); } @@ -1421,19 +1649,25 @@ abstract class TestQualitySelectorHostApi { 'dev.flutter.pigeon.QualitySelectorHostApi.getResolution', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.QualitySelectorHostApi.getResolution was null.'); + 'Argument for dev.flutter.pigeon.QualitySelectorHostApi.getResolution was null.'); final List args = (message as List?)!; final int? arg_cameraInfoId = (args[0] as int?); assert(arg_cameraInfoId != null, 'Argument for dev.flutter.pigeon.QualitySelectorHostApi.getResolution was null, expected non-null int.'); - final VideoQualityConstraint? arg_quality = args[1] == null ? null : VideoQualityConstraint.values[args[1] as int]; + final VideoQualityConstraint? arg_quality = args[1] == null + ? null + : VideoQualityConstraint.values[args[1] as int]; assert(arg_quality != null, 'Argument for dev.flutter.pigeon.QualitySelectorHostApi.getResolution was null, expected non-null VideoQualityConstraint.'); - final ResolutionInfo output = api.getResolution(arg_cameraInfoId!, arg_quality!); + final ResolutionInfo output = + api.getResolution(arg_cameraInfoId!, arg_quality!); return [output]; }); } @@ -1442,30 +1676,40 @@ abstract class TestQualitySelectorHostApi { } abstract class TestFallbackStrategyHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); - void create(int identifier, VideoQualityConstraint quality, VideoResolutionFallbackRule fallbackRule); + void create(int identifier, VideoQualityConstraint quality, + VideoResolutionFallbackRule fallbackRule); - static void setup(TestFallbackStrategyHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestFallbackStrategyHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.FallbackStrategyHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FallbackStrategyHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.FallbackStrategyHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.FallbackStrategyHostApi.create was null, expected non-null int.'); - final VideoQualityConstraint? arg_quality = args[1] == null ? null : VideoQualityConstraint.values[args[1] as int]; + final VideoQualityConstraint? arg_quality = args[1] == null + ? null + : VideoQualityConstraint.values[args[1] as int]; assert(arg_quality != null, 'Argument for dev.flutter.pigeon.FallbackStrategyHostApi.create was null, expected non-null VideoQualityConstraint.'); - final VideoResolutionFallbackRule? arg_fallbackRule = args[2] == null ? null : VideoResolutionFallbackRule.values[args[2] as int]; + final VideoResolutionFallbackRule? arg_fallbackRule = args[2] == null + ? null + : VideoResolutionFallbackRule.values[args[2] as int]; assert(arg_fallbackRule != null, 'Argument for dev.flutter.pigeon.FallbackStrategyHostApi.create was null, expected non-null VideoResolutionFallbackRule.'); api.create(arg_identifier!, arg_quality!, arg_fallbackRule!); From fad7cbc7007de2d0c2451e0feb380a8324958fc8 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Wed, 16 Aug 2023 15:54:34 -0700 Subject: [PATCH 16/34] Undo strange change --- .../lib/src/android_camera_camerax.dart | 3 +-- .../test/android_camera_camerax_test.dart | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart index 0c26585bcd3..83649933843 100644 --- a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart +++ b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart @@ -321,9 +321,8 @@ class AndroidCameraCameraX extends CameraPlatform { cameraEventStreamController.add(CameraInitializedEvent( cameraId, - previewResolutionInfo.height - .toDouble(), // TODO(camsim99): Is this order right? previewResolutionInfo.width.toDouble(), + previewResolutionInfo.height.toDouble(), exposureMode, exposurePointSupported, focusMode, diff --git a/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart b/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart index 787e0fed1b8..1f00caa3c99 100644 --- a/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart +++ b/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart @@ -329,9 +329,8 @@ void main() { expectedBoundSize = const Size(3840, 2160); break; case ResolutionPreset.max: - // TODO(camsim99): handle detached objects for tests - expectedResolutionStrategy = null; - // ResolutionStrategy.getHighestAvailableStrategy(detached: true); + expectedResolutionStrategy = + ResolutionStrategy.detachedHighestAvailableStrategy(); break; } From 08edc4c9896675a461e3b48add2f60e7051d51a6 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Wed, 16 Aug 2023 16:42:06 -0700 Subject: [PATCH 17/34] Fix dart unit tests --- .../lib/src/android_camera_camerax.dart | 18 +-- .../test/android_camera_camerax_test.dart | 108 +++++++++++++++++- 2 files changed, 108 insertions(+), 18 deletions(-) diff --git a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart index 83649933843..e9283053a0b 100644 --- a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart +++ b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart @@ -120,17 +120,6 @@ class AndroidCameraCameraX extends CameraPlatform { @visibleForTesting CameraSelector? cameraSelector; - /// The [ResolutionSelector] that represents the resolution preset used to - /// create a camera that will be used for capturing still images, and image - /// analysis. - @visibleForTesting - ResolutionSelector? presetResolutionSelector; - - /// The [QualitySelector] that represents the resolution preset used to - /// create a camera that will be used for recording video. - @visibleForTesting - QualitySelector? presetQualitySelector; - /// The controller we need to broadcast the different camera events. /// /// It is a `broadcast` because multiple controllers will connect to @@ -241,9 +230,10 @@ class AndroidCameraCameraX extends CameraPlatform { cameraIsFrontFacing, cameraDescription.sensorOrientation); // Determine ResolutionSelector and QualitySelector based on preset for // camera UseCases. - presetResolutionSelector = + final ResolutionSelector? presetResolutionSelector = _getResolutionSelectorFromPreset(resolutionPreset); - presetQualitySelector = _getQualitySelectorFromPreset(resolutionPreset); + final QualitySelector? presetQualitySelector = + _getQualitySelectorFromPreset(resolutionPreset); // Retrieve a fresh ProcessCameraProvider instance. processCameraProvider ??= await ProcessCameraProvider.getInstance(); @@ -262,7 +252,7 @@ class AndroidCameraCameraX extends CameraPlatform { // Configure ImageAnalysis instance. // Defaults to YUV_420_888 image format. - imageAnalysis ??= createImageAnalysis(presetResolutionSelector); + imageAnalysis = createImageAnalysis(presetResolutionSelector); // Configure VideoCapture and Recorder instances. recorder = createRecorder(presetQualitySelector); diff --git a/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart b/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart index 1f00caa3c99..82820f56728 100644 --- a/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart +++ b/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart @@ -14,6 +14,7 @@ import 'package:camera_android_camerax/src/camera_state.dart'; import 'package:camera_android_camerax/src/camera_state_error.dart'; import 'package:camera_android_camerax/src/camerax_library.g.dart'; import 'package:camera_android_camerax/src/exposure_state.dart'; +import 'package:camera_android_camerax/src/fallback_strategy.dart'; import 'package:camera_android_camerax/src/image_analysis.dart'; import 'package:camera_android_camerax/src/image_capture.dart'; import 'package:camera_android_camerax/src/image_proxy.dart'; @@ -341,15 +342,110 @@ void main() { boundSize: expectedBoundSize, fallbackRule: ResolutionStrategy.fallbackRuleClosestLower); - expect(camera.presetResolutionSelector!.resolutionStrategy!.boundSize, + expect(camera.preview!.resolutionSelector!.resolutionStrategy!.boundSize, equals(expectedResolutionStrategy.boundSize)); - expect(camera.presetResolutionSelector!.resolutionStrategy!.fallbackRule, + expect( + camera + .imageCapture!.resolutionSelector!.resolutionStrategy!.boundSize, + equals(expectedResolutionStrategy.boundSize)); + expect( + camera + .imageAnalysis!.resolutionSelector!.resolutionStrategy!.boundSize, + equals(expectedResolutionStrategy.boundSize)); + expect( + camera.preview!.resolutionSelector!.resolutionStrategy!.fallbackRule, + equals(expectedResolutionStrategy.fallbackRule)); + expect( + camera.imageCapture!.resolutionSelector!.resolutionStrategy! + .fallbackRule, + equals(expectedResolutionStrategy.fallbackRule)); + expect( + camera.imageAnalysis!.resolutionSelector!.resolutionStrategy! + .fallbackRule, equals(expectedResolutionStrategy.fallbackRule)); } - // Test null case + // Test null case. + await camera.createCamera(testCameraDescription, null); + expect(camera.preview!.resolutionSelector, isNull); + expect(camera.imageCapture!.resolutionSelector, isNull); + expect(camera.imageAnalysis!.resolutionSelector, isNull); + }); + + test( + 'createCamera properly sets preset resolution for video capture use case', + () async { + final FakeAndroidCameraCameraX camera = + FakeAndroidCameraCameraX(shouldCreateDetachedObjectForTesting: true); + final MockProcessCameraProvider mockProcessCameraProvider = + MockProcessCameraProvider(); + const CameraLensDirection testLensDirection = CameraLensDirection.back; + const int testSensorOrientation = 90; + const CameraDescription testCameraDescription = CameraDescription( + name: 'cameraName', + lensDirection: testLensDirection, + sensorOrientation: testSensorOrientation); + const bool enableAudio = true; + final MockCamera mockCamera = MockCamera(); + final MockCameraInfo mockCameraInfo = MockCameraInfo(); + + camera.processCameraProvider = mockProcessCameraProvider; + + when(mockProcessCameraProvider.bindToLifecycle( + camera.mockBackCameraSelector, [ + camera.testPreview, + camera.testImageCapture, + camera.testImageAnalysis + ])).thenAnswer((_) async => mockCamera); + when(mockCamera.getCameraInfo()).thenAnswer((_) async => mockCameraInfo); + when(mockCameraInfo.getCameraState()) + .thenAnswer((_) async => MockLiveCameraState()); + camera.processCameraProvider = mockProcessCameraProvider; + + // Test non-null resolution presets. + for (final ResolutionPreset resolutionPreset in ResolutionPreset.values) { + await camera.createCamera(testCameraDescription, resolutionPreset, + enableAudio: enableAudio); + + VideoQualityConstraint? expectedVideoQuality; + switch (resolutionPreset) { + case ResolutionPreset.low: + // 240p is not supported by CameraX. + case ResolutionPreset.medium: + expectedVideoQuality = VideoQualityConstraint.SD; + break; + case ResolutionPreset.high: + expectedVideoQuality = VideoQualityConstraint.HD; + break; + case ResolutionPreset.veryHigh: + expectedVideoQuality = VideoQualityConstraint.FHD; + break; + case ResolutionPreset.ultraHigh: + expectedVideoQuality = VideoQualityConstraint.UHD; + break; + case ResolutionPreset.max: + expectedVideoQuality = VideoQualityConstraint.highest; + break; + } + + const VideoResolutionFallbackRule expectedFallbackRule = + VideoResolutionFallbackRule.lowerQualityThan; + final FallbackStrategy expectedFallbackStrategy = + FallbackStrategy.detached( + quality: expectedVideoQuality, + fallbackRule: expectedFallbackRule); + + expect(camera.recorder!.qualitySelector!.qualityList, + equals([expectedVideoQuality])); + expect(camera.recorder!.qualitySelector!.fallbackStrategy!.quality, + equals(expectedFallbackStrategy.quality)); + expect(camera.recorder!.qualitySelector!.fallbackStrategy!.fallbackRule, + equals(expectedFallbackStrategy.fallbackRule)); + } + + // Test null case. await camera.createCamera(testCameraDescription, null); - expect(camera.presetResolutionSelector, isNull); + expect(camera.recorder!.qualitySelector, isNull); }); test( @@ -1217,16 +1313,19 @@ class FakeAndroidCameraCameraX extends AndroidCameraCameraX { @override Preview createPreview( {required int targetRotation, ResolutionSelector? resolutionSelector}) { + when(testPreview.resolutionSelector).thenReturn(resolutionSelector); return testPreview; } @override ImageCapture createImageCapture(ResolutionSelector? resolutionSelector) { + when(testImageCapture.resolutionSelector).thenReturn(resolutionSelector); return testImageCapture; } @override Recorder createRecorder(QualitySelector? qualitySelector) { + when(testRecorder.qualitySelector).thenReturn(qualitySelector); return testRecorder; } @@ -1237,6 +1336,7 @@ class FakeAndroidCameraCameraX extends AndroidCameraCameraX { @override ImageAnalysis createImageAnalysis(ResolutionSelector? resolutionSelector) { + when(testImageAnalysis.resolutionSelector).thenReturn(resolutionSelector); return testImageAnalysis; } } From 1def51944672c9ae5824e012fb9d29e27ff0318d Mon Sep 17 00:00:00 2001 From: camsim99 Date: Thu, 17 Aug 2023 13:15:02 -0700 Subject: [PATCH 18/34] Fix integration test --- .../plugins/camerax/QualitySelectorHostApiImpl.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/QualitySelectorHostApiImpl.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/QualitySelectorHostApiImpl.java index c747c75962b..e04afd64d7f 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/QualitySelectorHostApiImpl.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/QualitySelectorHostApiImpl.java @@ -38,7 +38,8 @@ public static class QualitySelectorProxy { @Nullable FallbackStrategy fallbackStrategy) { // Convert each index of VideoQualityConstraint to Quality. List qualityList = new ArrayList(); - for (Long qualityIndex : videoQualityConstraintIndexList) { + for (int i = 0; i < videoQualityConstraintIndexList.size(); i++) { + int qualityIndex = ((Number) videoQualityConstraintIndexList.get(i)).intValue(); qualityList.add(getQualityConstant(qualityIndex)); } @@ -59,8 +60,8 @@ public static class QualitySelectorProxy { } /** Converts from index of {@link VideoQualityConstraint} to {@link Quality}. */ - private Quality getQualityConstant(@NonNull Long qualityIndex) { - VideoQualityConstraint quality = VideoQualityConstraint.values()[qualityIndex.intValue()]; + private Quality getQualityConstant(@NonNull int qualityIndex) { + VideoQualityConstraint quality = VideoQualityConstraint.values()[qualityIndex]; return getQualityFromVideoQualityConstraint(quality); } } From caf819e14b93577a9fe81f0255a19cbc0f8db536 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Thu, 17 Aug 2023 13:25:00 -0700 Subject: [PATCH 19/34] Nits --- .../lib/src/android_camera_camerax.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart index e9283053a0b..4b721937bdc 100644 --- a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart +++ b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart @@ -228,8 +228,8 @@ class AndroidCameraCameraX extends CameraPlatform { // Start listening for device orientation changes preceding camera creation. startListeningForDeviceOrientationChange( cameraIsFrontFacing, cameraDescription.sensorOrientation); - // Determine ResolutionSelector and QualitySelector based on preset for - // camera UseCases. + // Determine ResolutionSelector and QualitySelector based on + // resolutionPreset for camera UseCases. final ResolutionSelector? presetResolutionSelector = _getResolutionSelectorFromPreset(resolutionPreset); final QualitySelector? presetQualitySelector = From c775756a8c9356baaaf59c3c2d124635041795b8 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Thu, 17 Aug 2023 14:26:36 -0700 Subject: [PATCH 20/34] Update readme --- packages/camera/camera_android_camerax/README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/camera/camera_android_camerax/README.md b/packages/camera/camera_android_camerax/README.md index ee2fd1ede57..1642b815690 100644 --- a/packages/camera/camera_android_camerax/README.md +++ b/packages/camera/camera_android_camerax/README.md @@ -24,6 +24,13 @@ dependencies: ## Missing features and limitations + +### 240p resolution configuration for video recording + +240p resolution configuration for video recording is unsupported by CameraX, +and thus, the plugin will fall back to 480p if configured with a +`ResolutionPreset`. + ### Locking/Unlocking capture orientation \[[Issue #125915][125915]\] `lockCaptureOrientation` & `unLockCaptureOrientation` are unimplemented. From fabaab723053d7114bd1568108d22787c2f06fc2 Mon Sep 17 00:00:00 2001 From: Camille Simon <43054281+camsim99@users.noreply.github.com> Date: Tue, 22 Aug 2023 16:06:44 -0700 Subject: [PATCH 21/34] Update packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart Co-authored-by: Gray Mackall <34871572+gmackall@users.noreply.github.com> --- .../camera_android_camerax/lib/src/android_camera_camerax.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart index 4b721937bdc..1e195ac5e31 100644 --- a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart +++ b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart @@ -506,7 +506,7 @@ class AndroidCameraCameraX extends CameraPlatform { /// /// Note that the preset resolution is used to configure the recording, but /// 240p ([ResolutionPreset.low]) is unsupported and will fallback to - /// configure the recording as the next highest avaialable quality. + /// configure the recording as the next highest available quality. @override Future startVideoRecording(int cameraId, {Duration? maxVideoDuration}) async { From 810cb54d8c3a73a0a7f36f962ec0ee754454a0bd Mon Sep 17 00:00:00 2001 From: Camille Simon <43054281+camsim99@users.noreply.github.com> Date: Tue, 22 Aug 2023 16:07:11 -0700 Subject: [PATCH 22/34] Update packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart Co-authored-by: Gray Mackall <34871572+gmackall@users.noreply.github.com> --- .../camera_android_camerax/lib/src/android_camera_camerax.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart index 1e195ac5e31..4edc3cfa9bf 100644 --- a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart +++ b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart @@ -817,7 +817,7 @@ class AndroidCameraCameraX extends CameraPlatform { : ResolutionStrategy.highestAvailableStrategy(); break; case null: - // If not preset is specified, default to CameraX's default behvaior + // If not preset is specified, default to CameraX's default behavior // for each UseCase. return null; } From 60a47eddffca0835727e84a40304c24f5ee8794d Mon Sep 17 00:00:00 2001 From: Camille Simon <43054281+camsim99@users.noreply.github.com> Date: Tue, 22 Aug 2023 16:07:20 -0700 Subject: [PATCH 23/34] Update packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart Co-authored-by: Gray Mackall <34871572+gmackall@users.noreply.github.com> --- .../camera_android_camerax/lib/src/android_camera_camerax.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart index 4edc3cfa9bf..f4185c4b689 100644 --- a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart +++ b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart @@ -862,7 +862,7 @@ class AndroidCameraCameraX extends CameraPlatform { videoQuality = VideoQualityConstraint.highest; break; case null: - // If not preset is specified, default to CameraX's default behvaior + // If not preset is specified, default to CameraX's default behavior // for each UseCase. return null; } From 474d84c610ebc1d2ca8e1030abc87a17f9281747 Mon Sep 17 00:00:00 2001 From: Camille Simon <43054281+camsim99@users.noreply.github.com> Date: Tue, 22 Aug 2023 16:07:32 -0700 Subject: [PATCH 24/34] Update packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart Co-authored-by: Gray Mackall <34871572+gmackall@users.noreply.github.com> --- .../camera_android_camerax/lib/src/android_camera_camerax.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart index f4185c4b689..c6f916ce01f 100644 --- a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart +++ b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart @@ -868,7 +868,7 @@ class AndroidCameraCameraX extends CameraPlatform { } // We will choose the next highest video quality if the one desired - // is unavaiable. + // is unavailable. const VideoResolutionFallbackRule fallbackRule = VideoResolutionFallbackRule.lowerQualityThan; final FallbackStrategy fallbackStrategy = From 6f45ecb2432de352f0de0726eed54ffc002e4036 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Tue, 22 Aug 2023 16:55:42 -0700 Subject: [PATCH 25/34] Add comments to integration tests --- .../integration_test/integration_test.dart | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/packages/camera/camera_android_camerax/example/integration_test/integration_test.dart b/packages/camera/camera_android_camerax/example/integration_test/integration_test.dart index 88d920df500..76db89f76ca 100644 --- a/packages/camera/camera_android_camerax/example/integration_test/integration_test.dart +++ b/packages/camera/camera_android_camerax/example/integration_test/integration_test.dart @@ -89,8 +89,11 @@ void main() { await controller.initialize(); final bool presetExactlySupported = await testCaptureImageResolution(controller, preset.key); - expect(!(!previousPresetExactlySupported && presetExactlySupported), - isTrue, + // Ensures that if a lower resolution was used for previous (lower) + // resolution preset, then the current (higher) preset also is adjusted, + // as it demands a hgher resolution. + expect( + previousPresetExactlySupported || !presetExactlySupported, isTrue, reason: 'The camera took higher resolution pictures at a lower resolution.'); previousPresetExactlySupported = presetExactlySupported; @@ -120,9 +123,12 @@ void main() { } final bool presetExactlySupported = assertExpectedDimensions( - presetExpectedSizes[preset.key]!, controller.value.previewSize!); - expect(!(!previousPresetExactlySupported && presetExactlySupported), - isTrue, + preset.value, controller.value.previewSize!); + // Ensures that if a lower resolution was used for previous (lower) + // resolution preset, then the current (higher) preset also is adjusted, + // as it demands a hgher resolution. + expect( + previousPresetExactlySupported || !presetExactlySupported, isTrue, reason: 'The preview has a lower resolution than that specified.'); previousPresetExactlySupported = presetExactlySupported; await controller.dispose(); @@ -152,10 +158,13 @@ void main() { final CameraImage image = await imageCompleter.future; final bool presetExactlySupported = assertExpectedDimensions( - presetExpectedSizes[preset.key]!, + preset.value, Size(image.height.toDouble(), image.width.toDouble())); - expect(!(!previousPresetExactlySupported && presetExactlySupported), - isTrue, + // Ensures that if a lower resolution was used for previous (lower) + // resolution preset, then the current (higher) preset also is adjusted, + // as it demands a hgher resolution. + expect( + previousPresetExactlySupported || !presetExactlySupported, isTrue, reason: 'The preview has a lower resolution than that specified.'); previousPresetExactlySupported = presetExactlySupported; From e4134bda899d46ccc2872c00a621f3b160d87b3b Mon Sep 17 00:00:00 2001 From: camsim99 Date: Wed, 23 Aug 2023 09:00:44 -0700 Subject: [PATCH 26/34] Updated integration test comment --- .../example/integration_test/integration_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/camera/camera_android_camerax/example/integration_test/integration_test.dart b/packages/camera/camera_android_camerax/example/integration_test/integration_test.dart index 76db89f76ca..b016cf080da 100644 --- a/packages/camera/camera_android_camerax/example/integration_test/integration_test.dart +++ b/packages/camera/camera_android_camerax/example/integration_test/integration_test.dart @@ -31,7 +31,7 @@ void main() { // Don't bother checking for max here since it could be anything. }; - /// Verify that [actual] has dimensions that are at least as large as + /// Verify that [actual] has dimensions that are at most as large as /// [expectedSize]. Allows for a mismatch in portrait vs landscape. Returns /// whether the dimensions exactly match. bool assertExpectedDimensions(Size expectedSize, Size actual) { From bb35a61924bf85a9e3ddaef7f7a9436c752e137a Mon Sep 17 00:00:00 2001 From: camsim99 Date: Tue, 29 Aug 2023 10:18:52 -0700 Subject: [PATCH 27/34] start quality re-write --- .../pigeons/camerax_library.dart | 56 ++++++++++++++++--- 1 file changed, 49 insertions(+), 7 deletions(-) diff --git a/packages/camera/camera_android_camerax/pigeons/camerax_library.dart b/packages/camera/camera_android_camerax/pigeons/camerax_library.dart index 02ea78c049a..983e3df2299 100644 --- a/packages/camera/camera_android_camerax/pigeons/camerax_library.dart +++ b/packages/camera/camera_android_camerax/pigeons/camerax_library.dart @@ -102,13 +102,55 @@ class ExposureCompensationRange { /// These are pre-defined quality constants that are universally used for video. /// /// See https://developer.android.com/reference/androidx/camera/video/Quality. -enum VideoQualityConstraint { - SD, // 480p - HD, // 720p - FHD, // 1080p - UHD, // 2160p - lowest, - highest, +// enum VideoQualityConstraint { +// SD, // 480p +// HD, // 720p +// FHD, // 1080p +// UHD, // 2160p +// lowest, +// highest, +// } + +/// Video quality constraints that will be used by a QualitySelector to choose +/// an appropriate video resolution. +/// +/// These are pre-defined quality constants that are universally used for video. +/// +/// See https://developer.android.com/reference/androidx/camera/video/Quality. +class VideoQualityConstraint { + VideoQualityConstraint({required this.quality}); + + int quality; + + /// Lowest avaialble video quality. + /// + /// Maps to hhttps://developer.android.com/reference/android/media/CamcorderProfile#QUALITY_LOW. + static const int lowest = 0; + + /// 480p video quality. + /// + /// Maps to https://developer.android.com/reference/android/media/CamcorderProfile#QUALITY_480P. + static const int SD = 4; + + /// 720p video quality. + /// + /// Maps to https://developer.android.com/reference/android/media/CamcorderProfile#QUALITY_720P. + static const int HD = 5; + + /// 1080p video quality. + /// + /// Maps to https://developer.android.com/reference/android/media/CamcorderProfile#QUALITY_1080P. + static const int FHD = 6; + + /// 2160p video quality. + /// + /// Maps to https://developer.android.com/reference/android/media/CamcorderProfile#QUALITY_2160P. + static const int UHD = 8; + + /// Highest available video quality. + /// + /// Maps to https://developer.android.com/reference/android/media/CamcorderProfile#QUALITY_HIGH. + static const int highest = 1; } /// Fallback rules for selecting video resolution. From 5ac1c7ce937abd7bfbba10d341076956c6914d9d Mon Sep 17 00:00:00 2001 From: camsim99 Date: Tue, 29 Aug 2023 11:18:24 -0700 Subject: [PATCH 28/34] Replace vid qual const with quality/qualitydata --- .../camerax/GeneratedCameraXLibrary.java | 894 +++++++----------- .../lib/src/camerax_library.g.dart | 344 +++---- .../pigeons/camerax_library.dart | 68 +- .../test/test_camerax_library.g.dart | 741 +++++---------- 4 files changed, 764 insertions(+), 1283 deletions(-) diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/GeneratedCameraXLibrary.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/GeneratedCameraXLibrary.java index cc1d7c7c638..d742dc41ad3 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/GeneratedCameraXLibrary.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/GeneratedCameraXLibrary.java @@ -18,7 +18,9 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** Generated class from Pigeon. */ @SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression", "serial"}) @@ -33,7 +35,8 @@ public static class FlutterError extends RuntimeException { /** The error details. Must be a datatype supported by the api codec. */ public final Object details; - public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) { + public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) + { super(message); this.code = code; this.details = details; @@ -52,7 +55,7 @@ protected static ArrayList wrapError(@NonNull Throwable exception) { errorList.add(exception.toString()); errorList.add(exception.getClass().getSimpleName()); errorList.add( - "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); + "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); } return errorList; } @@ -60,7 +63,7 @@ protected static ArrayList wrapError(@NonNull Throwable exception) { /** * The states the camera can be in. * - *

See https://developer.android.com/reference/androidx/camera/core/CameraState.Type. + * See https://developer.android.com/reference/androidx/camera/core/CameraState.Type. */ public enum CameraStateType { CLOSED(0), @@ -79,19 +82,20 @@ private CameraStateType(final int index) { /** * The types (T) properly wrapped to be used as a LiveData. * - *

If you need to add another type to support a type S to use a LiveData in this plugin, - * ensure the following is done on the Dart side: + * If you need to add another type to support a type S to use a LiveData in + * this plugin, ensure the following is done on the Dart side: * - *

* In `../lib/src/live_data.dart`, add new cases for S in - * `_LiveDataHostApiImpl#getValueFromInstances` to get the current value of type S from a - * LiveData instance and in `LiveDataFlutterApiImpl#create` to create the expected type of - * LiveData when requested. + * * In `../lib/src/live_data.dart`, add new cases for S in + * `_LiveDataHostApiImpl#getValueFromInstances` to get the current value of + * type S from a LiveData instance and in `LiveDataFlutterApiImpl#create` + * to create the expected type of LiveData when requested. * - *

On the native side, ensure the following is done: + * On the native side, ensure the following is done: * - *

* Update `LiveDataHostApiImpl#getValue` is updated to properly return identifiers for - * instances of type S. * Update `ObserverFlutterApiWrapper#onChanged` to properly handle - * receiving calls with instances of type S if a LiveData instance is observed. + * * Update `LiveDataHostApiImpl#getValue` is updated to properly return + * identifiers for instances of type S. + * * Update `ObserverFlutterApiWrapper#onChanged` to properly handle receiving + * calls with instances of type S if a LiveData instance is observed. */ public enum LiveDataSupportedType { CAMERA_STATE(0), @@ -105,14 +109,14 @@ private LiveDataSupportedType(final int index) { } /** - * Video quality constraints that will be used by a QualitySelector to choose an appropriate video - * resolution. + * Video quality constraints that will be used by a QualitySelector to choose + * an appropriate video resolution. * - *

These are pre-defined quality constants that are universally used for video. + * These are pre-defined quality constants that are universally used for video. * - *

See https://developer.android.com/reference/androidx/camera/video/Quality. + * See https://developer.android.com/reference/androidx/camera/video/Quality. */ - public enum VideoQualityConstraint { + public enum Quality { SD(0), HD(1), FHD(2), @@ -122,7 +126,7 @@ public enum VideoQualityConstraint { final int index; - private VideoQualityConstraint(final int index) { + private Quality(final int index) { this.index = index; } } @@ -130,7 +134,7 @@ private VideoQualityConstraint(final int index) { /** * Fallback rules for selecting video resolution. * - *

See https://developer.android.com/reference/androidx/camera/video/FallbackStrategy. + * See https://developer.android.com/reference/androidx/camera/video/FallbackStrategy. */ public enum VideoResolutionFallbackRule { HIGHER_QUALITY_OR_LOWER_THAN(0), @@ -211,13 +215,9 @@ ArrayList toList() { static @NonNull ResolutionInfo fromList(@NonNull ArrayList list) { ResolutionInfo pigeonResult = new ResolutionInfo(); Object width = list.get(0); - pigeonResult.setWidth( - (width == null) ? null : ((width instanceof Integer) ? (Integer) width : (Long) width)); + pigeonResult.setWidth((width == null) ? null : ((width instanceof Integer) ? (Integer) width : (Long) width)); Object height = list.get(1); - pigeonResult.setHeight( - (height == null) - ? null - : ((height instanceof Integer) ? (Integer) height : (Long) height)); + pigeonResult.setHeight((height == null) ? null : ((height instanceof Integer) ? (Integer) height : (Long) height)); return pigeonResult; } } @@ -459,19 +459,62 @@ ArrayList toList() { static @NonNull ExposureCompensationRange fromList(@NonNull ArrayList list) { ExposureCompensationRange pigeonResult = new ExposureCompensationRange(); Object minCompensation = list.get(0); - pigeonResult.setMinCompensation( - (minCompensation == null) - ? null - : ((minCompensation instanceof Integer) - ? (Integer) minCompensation - : (Long) minCompensation)); + pigeonResult.setMinCompensation((minCompensation == null) ? null : ((minCompensation instanceof Integer) ? (Integer) minCompensation : (Long) minCompensation)); Object maxCompensation = list.get(1); - pigeonResult.setMaxCompensation( - (maxCompensation == null) - ? null - : ((maxCompensation instanceof Integer) - ? (Integer) maxCompensation - : (Long) maxCompensation)); + pigeonResult.setMaxCompensation((maxCompensation == null) ? null : ((maxCompensation instanceof Integer) ? (Integer) maxCompensation : (Long) maxCompensation)); + return pigeonResult; + } + } + + /** + * Convenience class for sending lists of [Quality]s. + * + * Generated class from Pigeon that represents data sent in messages. + */ + public static final class QualityData { + private @NonNull Quality quality; + + public @NonNull Quality getQuality() { + return quality; + } + + public void setQuality(@NonNull Quality setterArg) { + if (setterArg == null) { + throw new IllegalStateException("Nonnull field \"quality\" is null."); + } + this.quality = setterArg; + } + + /** Constructor is non-public to enforce null safety; use Builder. */ + QualityData() {} + + public static final class Builder { + + private @Nullable Quality quality; + + public @NonNull Builder setQuality(@NonNull Quality setterArg) { + this.quality = setterArg; + return this; + } + + public @NonNull QualityData build() { + QualityData pigeonReturn = new QualityData(); + pigeonReturn.setQuality(quality); + return pigeonReturn; + } + } + + @NonNull + ArrayList toList() { + ArrayList toListResult = new ArrayList(1); + toListResult.add(quality == null ? null : quality.index); + return toListResult; + } + + static @NonNull QualityData fromList(@NonNull ArrayList list) { + QualityData pigeonResult = new QualityData(); + Object quality = list.get(0); + pigeonResult.setQuality(quality == null ? null : Quality.values()[(int) quality]); return pigeonResult; } } @@ -487,7 +530,7 @@ public interface InstanceManagerHostApi { /** * Clear the native `InstanceManager`. * - *

This is typically only used after a hot restart. + * This is typically only used after a hot restart. */ void clear(); @@ -495,12 +538,8 @@ public interface InstanceManagerHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `InstanceManagerHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable InstanceManagerHostApi api) { + /**Sets up an instance of `InstanceManagerHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable InstanceManagerHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -512,7 +551,8 @@ static void setup( try { api.clear(); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -533,9 +573,7 @@ public interface JavaObjectHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `JavaObjectHostApi` to handle messages through the `binaryMessenger`. - */ + /**Sets up an instance of `JavaObjectHostApi` to handle messages through the `binaryMessenger`. */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable JavaObjectHostApi api) { { BasicMessageChannel channel = @@ -550,7 +588,8 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable JavaObject try { api.dispose((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -570,7 +609,7 @@ public JavaObjectFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -579,7 +618,6 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void dispose(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -592,32 +630,28 @@ public void dispose(@NonNull Long identifierArg, @NonNull Reply callback) /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface CameraInfoHostApi { - @NonNull + @NonNull Long getSensorRotationDegrees(@NonNull Long identifier); - @NonNull + @NonNull Long getCameraState(@NonNull Long identifier); - @NonNull + @NonNull Long getExposureState(@NonNull Long identifier); - @NonNull + @NonNull Long getZoomState(@NonNull Long identifier); /** The codec used by CameraInfoHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `CameraInfoHostApi` to handle messages through the `binaryMessenger`. - */ + /**Sets up an instance of `CameraInfoHostApi` to handle messages through the `binaryMessenger`. */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraInfoHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.CameraInfoHostApi.getSensorRotationDegrees", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.CameraInfoHostApi.getSensorRotationDegrees", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -625,11 +659,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraInfo ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - Long output = - api.getSensorRotationDegrees( - (identifierArg == null) ? null : identifierArg.longValue()); + Long output = api.getSensorRotationDegrees((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -650,11 +683,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraInfo ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - Long output = - api.getCameraState( - (identifierArg == null) ? null : identifierArg.longValue()); + Long output = api.getCameraState((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -667,9 +699,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraInfo { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.CameraInfoHostApi.getExposureState", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.CameraInfoHostApi.getExposureState", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -677,11 +707,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraInfo ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - Long output = - api.getExposureState( - (identifierArg == null) ? null : identifierArg.longValue()); + Long output = api.getExposureState((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -702,10 +731,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraInfo ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - Long output = - api.getZoomState((identifierArg == null) ? null : identifierArg.longValue()); + Long output = api.getZoomState((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -725,7 +754,7 @@ public CameraInfoFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -734,7 +763,6 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -749,19 +777,15 @@ public interface CameraSelectorHostApi { void create(@NonNull Long identifier, @Nullable Long lensFacing); - @NonNull + @NonNull List filter(@NonNull Long identifier, @NonNull List cameraInfoIds); /** The codec used by CameraSelectorHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `CameraSelectorHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable CameraSelectorHostApi api) { + /**Sets up an instance of `CameraSelectorHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraSelectorHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -774,11 +798,10 @@ static void setup( Number identifierArg = (Number) args.get(0); Number lensFacingArg = (Number) args.get(1); try { - api.create( - (identifierArg == null) ? null : identifierArg.longValue(), - (lensFacingArg == null) ? null : lensFacingArg.longValue()); + api.create((identifierArg == null) ? null : identifierArg.longValue(), (lensFacingArg == null) ? null : lensFacingArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -800,12 +823,10 @@ static void setup( Number identifierArg = (Number) args.get(0); List cameraInfoIdsArg = (List) args.get(1); try { - List output = - api.filter( - (identifierArg == null) ? null : identifierArg.longValue(), - cameraInfoIdsArg); + List output = api.filter((identifierArg == null) ? null : identifierArg.longValue(), cameraInfoIdsArg); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -825,7 +846,7 @@ public CameraSelectorFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -834,9 +855,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - - public void create( - @NonNull Long identifierArg, @Nullable Long lensFacingArg, @NonNull Reply callback) { + public void create(@NonNull Long identifierArg, @Nullable Long lensFacingArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.CameraSelectorFlutterApi.create", getCodec()); @@ -850,16 +869,13 @@ public interface ProcessCameraProviderHostApi { void getInstance(@NonNull Result result); - @NonNull + @NonNull List getAvailableCameraInfos(@NonNull Long identifier); - @NonNull - Long bindToLifecycle( - @NonNull Long identifier, - @NonNull Long cameraSelectorIdentifier, - @NonNull List useCaseIds); + @NonNull + Long bindToLifecycle(@NonNull Long identifier, @NonNull Long cameraSelectorIdentifier, @NonNull List useCaseIds); - @NonNull + @NonNull Boolean isBound(@NonNull Long identifier, @NonNull Long useCaseIdentifier); void unbind(@NonNull Long identifier, @NonNull List useCaseIds); @@ -870,18 +886,12 @@ Long bindToLifecycle( static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `ProcessCameraProviderHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable ProcessCameraProviderHostApi api) { + /**Sets up an instance of `ProcessCameraProviderHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ProcessCameraProviderHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.ProcessCameraProviderHostApi.getInstance", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.ProcessCameraProviderHostApi.getInstance", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -908,9 +918,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.ProcessCameraProviderHostApi.getAvailableCameraInfos", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.ProcessCameraProviderHostApi.getAvailableCameraInfos", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -918,11 +926,10 @@ public void error(Throwable error) { ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - List output = - api.getAvailableCameraInfos( - (identifierArg == null) ? null : identifierArg.longValue()); + List output = api.getAvailableCameraInfos((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -935,9 +942,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.ProcessCameraProviderHostApi.bindToLifecycle", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.ProcessCameraProviderHostApi.bindToLifecycle", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -947,15 +952,10 @@ public void error(Throwable error) { Number cameraSelectorIdentifierArg = (Number) args.get(1); List useCaseIdsArg = (List) args.get(2); try { - Long output = - api.bindToLifecycle( - (identifierArg == null) ? null : identifierArg.longValue(), - (cameraSelectorIdentifierArg == null) - ? null - : cameraSelectorIdentifierArg.longValue(), - useCaseIdsArg); + Long output = api.bindToLifecycle((identifierArg == null) ? null : identifierArg.longValue(), (cameraSelectorIdentifierArg == null) ? null : cameraSelectorIdentifierArg.longValue(), useCaseIdsArg); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -968,9 +968,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.ProcessCameraProviderHostApi.isBound", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.ProcessCameraProviderHostApi.isBound", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -979,12 +977,10 @@ public void error(Throwable error) { Number identifierArg = (Number) args.get(0); Number useCaseIdentifierArg = (Number) args.get(1); try { - Boolean output = - api.isBound( - (identifierArg == null) ? null : identifierArg.longValue(), - (useCaseIdentifierArg == null) ? null : useCaseIdentifierArg.longValue()); + Boolean output = api.isBound((identifierArg == null) ? null : identifierArg.longValue(), (useCaseIdentifierArg == null) ? null : useCaseIdentifierArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -997,9 +993,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.ProcessCameraProviderHostApi.unbind", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.ProcessCameraProviderHostApi.unbind", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1008,10 +1002,10 @@ public void error(Throwable error) { Number identifierArg = (Number) args.get(0); List useCaseIdsArg = (List) args.get(1); try { - api.unbind( - (identifierArg == null) ? null : identifierArg.longValue(), useCaseIdsArg); + api.unbind((identifierArg == null) ? null : identifierArg.longValue(), useCaseIdsArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1024,9 +1018,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.ProcessCameraProviderHostApi.unbindAll", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.ProcessCameraProviderHostApi.unbindAll", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1036,7 +1028,8 @@ public void error(Throwable error) { try { api.unbindAll((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1056,7 +1049,7 @@ public ProcessCameraProviderFlutterApi(@NonNull BinaryMessenger argBinaryMesseng this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -1065,13 +1058,10 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.ProcessCameraProviderFlutterApi.create", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.ProcessCameraProviderFlutterApi.create", getCodec()); channel.send( new ArrayList(Collections.singletonList(identifierArg)), channelReply -> callback.reply(null)); @@ -1080,14 +1070,14 @@ public void create(@NonNull Long identifierArg, @NonNull Reply callback) { /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface CameraHostApi { - @NonNull + @NonNull Long getCameraInfo(@NonNull Long identifier); /** The codec used by CameraHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** Sets up an instance of `CameraHostApi` to handle messages through the `binaryMessenger`. */ + /**Sets up an instance of `CameraHostApi` to handle messages through the `binaryMessenger`. */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraHostApi api) { { BasicMessageChannel channel = @@ -1100,10 +1090,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraHost ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - Long output = - api.getCameraInfo((identifierArg == null) ? null : identifierArg.longValue()); + Long output = api.getCameraInfo((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1123,7 +1113,7 @@ public CameraFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -1132,7 +1122,6 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1172,33 +1161,25 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface SystemServicesHostApi { - void requestCameraPermissions( - @NonNull Boolean enableAudio, @NonNull Result result); + void requestCameraPermissions(@NonNull Boolean enableAudio, @NonNull Result result); - void startListeningForDeviceOrientationChange( - @NonNull Boolean isFrontFacing, @NonNull Long sensorOrientation); + void startListeningForDeviceOrientationChange(@NonNull Boolean isFrontFacing, @NonNull Long sensorOrientation); void stopListeningForDeviceOrientationChange(); - @NonNull + @NonNull String getTempFilePath(@NonNull String prefix, @NonNull String suffix); /** The codec used by SystemServicesHostApi. */ static @NonNull MessageCodec getCodec() { return SystemServicesHostApiCodec.INSTANCE; } - /** - * Sets up an instance of `SystemServicesHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable SystemServicesHostApi api) { + /**Sets up an instance of `SystemServicesHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable SystemServicesHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.SystemServicesHostApi.requestCameraPermissions", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.SystemServicesHostApi.requestCameraPermissions", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1227,9 +1208,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.SystemServicesHostApi.startListeningForDeviceOrientationChange", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.SystemServicesHostApi.startListeningForDeviceOrientationChange", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1238,11 +1217,10 @@ public void error(Throwable error) { Boolean isFrontFacingArg = (Boolean) args.get(0); Number sensorOrientationArg = (Number) args.get(1); try { - api.startListeningForDeviceOrientationChange( - isFrontFacingArg, - (sensorOrientationArg == null) ? null : sensorOrientationArg.longValue()); + api.startListeningForDeviceOrientationChange(isFrontFacingArg, (sensorOrientationArg == null) ? null : sensorOrientationArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1255,9 +1233,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.SystemServicesHostApi.stopListeningForDeviceOrientationChange", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.SystemServicesHostApi.stopListeningForDeviceOrientationChange", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1265,7 +1241,8 @@ public void error(Throwable error) { try { api.stopListeningForDeviceOrientationChange(); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1278,9 +1255,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.SystemServicesHostApi.getTempFilePath", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.SystemServicesHostApi.getTempFilePath", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1291,7 +1266,8 @@ public void error(Throwable error) { try { String output = api.getTempFilePath(prefixArg, suffixArg); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1311,7 +1287,7 @@ public SystemServicesFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -1320,25 +1296,18 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - - public void onDeviceOrientationChanged( - @NonNull String orientationArg, @NonNull Reply callback) { + public void onDeviceOrientationChanged(@NonNull String orientationArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.SystemServicesFlutterApi.onDeviceOrientationChanged", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.SystemServicesFlutterApi.onDeviceOrientationChanged", getCodec()); channel.send( new ArrayList(Collections.singletonList(orientationArg)), channelReply -> callback.reply(null)); } - public void onCameraError(@NonNull String errorDescriptionArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.SystemServicesFlutterApi.onCameraError", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.SystemServicesFlutterApi.onCameraError", getCodec()); channel.send( new ArrayList(Collections.singletonList(errorDescriptionArg)), channelReply -> callback.reply(null)); @@ -1374,22 +1343,21 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface PreviewHostApi { - void create( - @NonNull Long identifier, @Nullable Long rotation, @Nullable Long resolutionSelectorId); + void create(@NonNull Long identifier, @Nullable Long rotation, @Nullable Long resolutionSelectorId); - @NonNull + @NonNull Long setSurfaceProvider(@NonNull Long identifier); void releaseFlutterSurfaceTexture(); - @NonNull + @NonNull ResolutionInfo getResolutionInfo(@NonNull Long identifier); /** The codec used by PreviewHostApi. */ static @NonNull MessageCodec getCodec() { return PreviewHostApiCodec.INSTANCE; } - /** Sets up an instance of `PreviewHostApi` to handle messages through the `binaryMessenger`. */ + /**Sets up an instance of `PreviewHostApi` to handle messages through the `binaryMessenger`. */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PreviewHostApi api) { { BasicMessageChannel channel = @@ -1404,14 +1372,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PreviewHos Number rotationArg = (Number) args.get(1); Number resolutionSelectorIdArg = (Number) args.get(2); try { - api.create( - (identifierArg == null) ? null : identifierArg.longValue(), - (rotationArg == null) ? null : rotationArg.longValue(), - (resolutionSelectorIdArg == null) - ? null - : resolutionSelectorIdArg.longValue()); + api.create((identifierArg == null) ? null : identifierArg.longValue(), (rotationArg == null) ? null : rotationArg.longValue(), (resolutionSelectorIdArg == null) ? null : resolutionSelectorIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1424,9 +1388,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PreviewHos { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.PreviewHostApi.setSurfaceProvider", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.PreviewHostApi.setSurfaceProvider", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1434,11 +1396,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PreviewHos ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - Long output = - api.setSurfaceProvider( - (identifierArg == null) ? null : identifierArg.longValue()); + Long output = api.setSurfaceProvider((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1451,9 +1412,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PreviewHos { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.PreviewHostApi.releaseFlutterSurfaceTexture", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.PreviewHostApi.releaseFlutterSurfaceTexture", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1461,7 +1420,8 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PreviewHos try { api.releaseFlutterSurfaceTexture(); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1482,11 +1442,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PreviewHos ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - ResolutionInfo output = - api.getResolutionInfo( - (identifierArg == null) ? null : identifierArg.longValue()); + ResolutionInfo output = api.getResolutionInfo((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1501,20 +1460,17 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PreviewHos /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface VideoCaptureHostApi { - @NonNull + @NonNull Long withOutput(@NonNull Long videoOutputId); - @NonNull + @NonNull Long getOutput(@NonNull Long identifier); /** The codec used by VideoCaptureHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `VideoCaptureHostApi` to handle messages through the - * `binaryMessenger`. - */ + /**Sets up an instance of `VideoCaptureHostApi` to handle messages through the `binaryMessenger`. */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable VideoCaptureHostApi api) { { BasicMessageChannel channel = @@ -1527,11 +1483,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable VideoCaptu ArrayList args = (ArrayList) message; Number videoOutputIdArg = (Number) args.get(0); try { - Long output = - api.withOutput( - (videoOutputIdArg == null) ? null : videoOutputIdArg.longValue()); + Long output = api.withOutput((videoOutputIdArg == null) ? null : videoOutputIdArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1552,10 +1507,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable VideoCaptu ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - Long output = - api.getOutput((identifierArg == null) ? null : identifierArg.longValue()); + Long output = api.getOutput((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1575,7 +1530,7 @@ public VideoCaptureFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -1584,7 +1539,6 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1597,28 +1551,22 @@ public void create(@NonNull Long identifierArg, @NonNull Reply callback) { /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface RecorderHostApi { - void create( - @NonNull Long identifier, - @Nullable Long aspectRatio, - @Nullable Long bitRate, - @Nullable Long qualitySelectorId); + void create(@NonNull Long identifier, @Nullable Long aspectRatio, @Nullable Long bitRate, @Nullable Long qualitySelectorId); - @NonNull + @NonNull Long getAspectRatio(@NonNull Long identifier); - @NonNull + @NonNull Long getTargetVideoEncodingBitRate(@NonNull Long identifier); - @NonNull + @NonNull Long prepareRecording(@NonNull Long identifier, @NonNull String path); /** The codec used by RecorderHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `RecorderHostApi` to handle messages through the `binaryMessenger`. - */ + /**Sets up an instance of `RecorderHostApi` to handle messages through the `binaryMessenger`. */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable RecorderHostApi api) { { BasicMessageChannel channel = @@ -1634,13 +1582,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable RecorderHo Number bitRateArg = (Number) args.get(2); Number qualitySelectorIdArg = (Number) args.get(3); try { - api.create( - (identifierArg == null) ? null : identifierArg.longValue(), - (aspectRatioArg == null) ? null : aspectRatioArg.longValue(), - (bitRateArg == null) ? null : bitRateArg.longValue(), - (qualitySelectorIdArg == null) ? null : qualitySelectorIdArg.longValue()); + api.create((identifierArg == null) ? null : identifierArg.longValue(), (aspectRatioArg == null) ? null : aspectRatioArg.longValue(), (bitRateArg == null) ? null : bitRateArg.longValue(), (qualitySelectorIdArg == null) ? null : qualitySelectorIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1661,11 +1606,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable RecorderHo ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - Long output = - api.getAspectRatio( - (identifierArg == null) ? null : identifierArg.longValue()); + Long output = api.getAspectRatio((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1678,9 +1622,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable RecorderHo { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.RecorderHostApi.getTargetVideoEncodingBitRate", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.RecorderHostApi.getTargetVideoEncodingBitRate", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1688,11 +1630,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable RecorderHo ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - Long output = - api.getTargetVideoEncodingBitRate( - (identifierArg == null) ? null : identifierArg.longValue()); + Long output = api.getTargetVideoEncodingBitRate((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1714,11 +1655,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable RecorderHo Number identifierArg = (Number) args.get(0); String pathArg = (String) args.get(1); try { - Long output = - api.prepareRecording( - (identifierArg == null) ? null : identifierArg.longValue(), pathArg); + Long output = api.prepareRecording((identifierArg == null) ? null : identifierArg.longValue(), pathArg); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1738,7 +1678,7 @@ public RecorderFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -1747,12 +1687,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - - public void create( - @NonNull Long identifierArg, - @Nullable Long aspectRatioArg, - @Nullable Long bitRateArg, - @NonNull Reply callback) { + public void create(@NonNull Long identifierArg, @Nullable Long aspectRatioArg, @Nullable Long bitRateArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.RecorderFlutterApi.create", getCodec()); @@ -1764,19 +1699,15 @@ public void create( /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface PendingRecordingHostApi { - @NonNull + @NonNull Long start(@NonNull Long identifier); /** The codec used by PendingRecordingHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `PendingRecordingHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable PendingRecordingHostApi api) { + /**Sets up an instance of `PendingRecordingHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PendingRecordingHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1788,10 +1719,10 @@ static void setup( ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - Long output = - api.start((identifierArg == null) ? null : identifierArg.longValue()); + Long output = api.start((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1811,7 +1742,7 @@ public PendingRecordingFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -1820,7 +1751,6 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1845,9 +1775,7 @@ public interface RecordingHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `RecordingHostApi` to handle messages through the `binaryMessenger`. - */ + /**Sets up an instance of `RecordingHostApi` to handle messages through the `binaryMessenger`. */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable RecordingHostApi api) { { BasicMessageChannel channel = @@ -1862,7 +1790,8 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable RecordingH try { api.close((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1885,7 +1814,8 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable RecordingH try { api.pause((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1908,7 +1838,8 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable RecordingH try { api.resume((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1931,7 +1862,8 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable RecordingH try { api.stop((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1951,7 +1883,7 @@ public RecordingFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -1960,7 +1892,6 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1973,8 +1904,7 @@ public void create(@NonNull Long identifierArg, @NonNull Reply callback) { /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface ImageCaptureHostApi { - void create( - @NonNull Long identifier, @Nullable Long flashMode, @Nullable Long resolutionSelectorId); + void create(@NonNull Long identifier, @Nullable Long flashMode, @Nullable Long resolutionSelectorId); void setFlashMode(@NonNull Long identifier, @NonNull Long flashMode); @@ -1984,10 +1914,7 @@ void create( static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `ImageCaptureHostApi` to handle messages through the - * `binaryMessenger`. - */ + /**Sets up an instance of `ImageCaptureHostApi` to handle messages through the `binaryMessenger`. */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageCaptureHostApi api) { { BasicMessageChannel channel = @@ -2002,14 +1929,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageCaptu Number flashModeArg = (Number) args.get(1); Number resolutionSelectorIdArg = (Number) args.get(2); try { - api.create( - (identifierArg == null) ? null : identifierArg.longValue(), - (flashModeArg == null) ? null : flashModeArg.longValue(), - (resolutionSelectorIdArg == null) - ? null - : resolutionSelectorIdArg.longValue()); + api.create((identifierArg == null) ? null : identifierArg.longValue(), (flashModeArg == null) ? null : flashModeArg.longValue(), (resolutionSelectorIdArg == null) ? null : resolutionSelectorIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2031,11 +1954,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageCaptu Number identifierArg = (Number) args.get(0); Number flashModeArg = (Number) args.get(1); try { - api.setFlashMode( - (identifierArg == null) ? null : identifierArg.longValue(), - (flashModeArg == null) ? null : flashModeArg.longValue()); + api.setFlashMode((identifierArg == null) ? null : identifierArg.longValue(), (flashModeArg == null) ? null : flashModeArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2068,8 +1990,7 @@ public void error(Throwable error) { } }; - api.takePicture( - (identifierArg == null) ? null : identifierArg.longValue(), resultCallback); + api.takePicture((identifierArg == null) ? null : identifierArg.longValue(), resultCallback); }); } else { channel.setMessageHandler(null); @@ -2079,8 +2000,7 @@ public void error(Throwable error) { } private static class ResolutionStrategyHostApiCodec extends StandardMessageCodec { - public static final ResolutionStrategyHostApiCodec INSTANCE = - new ResolutionStrategyHostApiCodec(); + public static final ResolutionStrategyHostApiCodec INSTANCE = new ResolutionStrategyHostApiCodec(); private ResolutionStrategyHostApiCodec() {} @@ -2108,19 +2028,14 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface ResolutionStrategyHostApi { - void create( - @NonNull Long identifier, @Nullable ResolutionInfo boundSize, @Nullable Long fallbackRule); + void create(@NonNull Long identifier, @Nullable ResolutionInfo boundSize, @Nullable Long fallbackRule); /** The codec used by ResolutionStrategyHostApi. */ static @NonNull MessageCodec getCodec() { return ResolutionStrategyHostApiCodec.INSTANCE; } - /** - * Sets up an instance of `ResolutionStrategyHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable ResolutionStrategyHostApi api) { + /**Sets up an instance of `ResolutionStrategyHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ResolutionStrategyHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2134,12 +2049,10 @@ static void setup( ResolutionInfo boundSizeArg = (ResolutionInfo) args.get(1); Number fallbackRuleArg = (Number) args.get(2); try { - api.create( - (identifierArg == null) ? null : identifierArg.longValue(), - boundSizeArg, - (fallbackRuleArg == null) ? null : fallbackRuleArg.longValue()); + api.create((identifierArg == null) ? null : identifierArg.longValue(), boundSizeArg, (fallbackRuleArg == null) ? null : fallbackRuleArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2154,21 +2067,14 @@ static void setup( /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface ResolutionSelectorHostApi { - void create( - @NonNull Long identifier, - @Nullable Long resolutionStrategyIdentifier, - @Nullable Long aspectRatioStrategyIdentifier); + void create(@NonNull Long identifier, @Nullable Long resolutionStrategyIdentifier, @Nullable Long aspectRatioStrategyIdentifier); /** The codec used by ResolutionSelectorHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `ResolutionSelectorHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable ResolutionSelectorHostApi api) { + /**Sets up an instance of `ResolutionSelectorHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ResolutionSelectorHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2182,16 +2088,10 @@ static void setup( Number resolutionStrategyIdentifierArg = (Number) args.get(1); Number aspectRatioStrategyIdentifierArg = (Number) args.get(2); try { - api.create( - (identifierArg == null) ? null : identifierArg.longValue(), - (resolutionStrategyIdentifierArg == null) - ? null - : resolutionStrategyIdentifierArg.longValue(), - (aspectRatioStrategyIdentifierArg == null) - ? null - : aspectRatioStrategyIdentifierArg.longValue()); + api.create((identifierArg == null) ? null : identifierArg.longValue(), (resolutionStrategyIdentifierArg == null) ? null : resolutionStrategyIdentifierArg.longValue(), (aspectRatioStrategyIdentifierArg == null) ? null : aspectRatioStrategyIdentifierArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2206,25 +2106,18 @@ static void setup( /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface AspectRatioStrategyHostApi { - void create( - @NonNull Long identifier, @NonNull Long preferredAspectRatio, @NonNull Long fallbackRule); + void create(@NonNull Long identifier, @NonNull Long preferredAspectRatio, @NonNull Long fallbackRule); /** The codec used by AspectRatioStrategyHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `AspectRatioStrategyHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable AspectRatioStrategyHostApi api) { + /**Sets up an instance of `AspectRatioStrategyHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable AspectRatioStrategyHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.AspectRatioStrategyHostApi.create", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.AspectRatioStrategyHostApi.create", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2234,14 +2127,10 @@ static void setup( Number preferredAspectRatioArg = (Number) args.get(1); Number fallbackRuleArg = (Number) args.get(2); try { - api.create( - (identifierArg == null) ? null : identifierArg.longValue(), - (preferredAspectRatioArg == null) - ? null - : preferredAspectRatioArg.longValue(), - (fallbackRuleArg == null) ? null : fallbackRuleArg.longValue()); + api.create((identifierArg == null) ? null : identifierArg.longValue(), (preferredAspectRatioArg == null) ? null : preferredAspectRatioArg.longValue(), (fallbackRuleArg == null) ? null : fallbackRuleArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2288,7 +2177,7 @@ public CameraStateFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2297,12 +2186,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return CameraStateFlutterApiCodec.INSTANCE; } - - public void create( - @NonNull Long identifierArg, - @NonNull CameraStateTypeData typeArg, - @Nullable Long errorIdentifierArg, - @NonNull Reply callback) { + public void create(@NonNull Long identifierArg, @NonNull CameraStateTypeData typeArg, @Nullable Long errorIdentifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.CameraStateFlutterApi.create", getCodec()); @@ -2346,7 +2230,7 @@ public ExposureStateFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2355,19 +2239,12 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return ExposureStateFlutterApiCodec.INSTANCE; } - - public void create( - @NonNull Long identifierArg, - @NonNull ExposureCompensationRange exposureCompensationRangeArg, - @NonNull Double exposureCompensationStepArg, - @NonNull Reply callback) { + public void create(@NonNull Long identifierArg, @NonNull ExposureCompensationRange exposureCompensationRangeArg, @NonNull Double exposureCompensationStepArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.ExposureStateFlutterApi.create", getCodec()); channel.send( - new ArrayList( - Arrays.asList( - identifierArg, exposureCompensationRangeArg, exposureCompensationStepArg)), + new ArrayList(Arrays.asList(identifierArg, exposureCompensationRangeArg, exposureCompensationStepArg)), channelReply -> callback.reply(null)); } } @@ -2379,7 +2256,7 @@ public ZoomStateFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2388,12 +2265,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - - public void create( - @NonNull Long identifierArg, - @NonNull Double minZoomRatioArg, - @NonNull Double maxZoomRatioArg, - @NonNull Reply callback) { + public void create(@NonNull Long identifierArg, @NonNull Double minZoomRatioArg, @NonNull Double maxZoomRatioArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.ZoomStateFlutterApi.create", getCodec()); @@ -2415,12 +2287,8 @@ public interface ImageAnalysisHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `ImageAnalysisHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable ImageAnalysisHostApi api) { + /**Sets up an instance of `ImageAnalysisHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageAnalysisHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2433,13 +2301,10 @@ static void setup( Number identifierArg = (Number) args.get(0); Number resolutionSelectorIdArg = (Number) args.get(1); try { - api.create( - (identifierArg == null) ? null : identifierArg.longValue(), - (resolutionSelectorIdArg == null) - ? null - : resolutionSelectorIdArg.longValue()); + api.create((identifierArg == null) ? null : identifierArg.longValue(), (resolutionSelectorIdArg == null) ? null : resolutionSelectorIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2461,11 +2326,10 @@ static void setup( Number identifierArg = (Number) args.get(0); Number analyzerIdentifierArg = (Number) args.get(1); try { - api.setAnalyzer( - (identifierArg == null) ? null : identifierArg.longValue(), - (analyzerIdentifierArg == null) ? null : analyzerIdentifierArg.longValue()); + api.setAnalyzer((identifierArg == null) ? null : identifierArg.longValue(), (analyzerIdentifierArg == null) ? null : analyzerIdentifierArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2478,9 +2342,7 @@ static void setup( { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.ImageAnalysisHostApi.clearAnalyzer", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.ImageAnalysisHostApi.clearAnalyzer", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2490,7 +2352,8 @@ static void setup( try { api.clearAnalyzer((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2511,9 +2374,7 @@ public interface AnalyzerHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `AnalyzerHostApi` to handle messages through the `binaryMessenger`. - */ + /**Sets up an instance of `AnalyzerHostApi` to handle messages through the `binaryMessenger`. */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable AnalyzerHostApi api) { { BasicMessageChannel channel = @@ -2528,7 +2389,8 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable AnalyzerHo try { api.create((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2549,9 +2411,7 @@ public interface ObserverHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `ObserverHostApi` to handle messages through the `binaryMessenger`. - */ + /**Sets up an instance of `ObserverHostApi` to handle messages through the `binaryMessenger`. */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ObserverHostApi api) { { BasicMessageChannel channel = @@ -2566,7 +2426,8 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ObserverHo try { api.create((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2586,7 +2447,7 @@ public ObserverFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2595,11 +2456,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - - public void onChanged( - @NonNull Long identifierArg, - @NonNull Long valueIdentifierArg, - @NonNull Reply callback) { + public void onChanged(@NonNull Long identifierArg, @NonNull Long valueIdentifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.ObserverFlutterApi.onChanged", getCodec()); @@ -2616,7 +2473,7 @@ public CameraStateErrorFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2625,9 +2482,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - - public void create( - @NonNull Long identifierArg, @NonNull Long codeArg, @NonNull Reply callback) { + public void create(@NonNull Long identifierArg, @NonNull Long codeArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.CameraStateErrorFlutterApi.create", getCodec()); @@ -2670,16 +2525,14 @@ public interface LiveDataHostApi { void removeObservers(@NonNull Long identifier); - @Nullable + @Nullable Long getValue(@NonNull Long identifier, @NonNull LiveDataSupportedTypeData type); /** The codec used by LiveDataHostApi. */ static @NonNull MessageCodec getCodec() { return LiveDataHostApiCodec.INSTANCE; } - /** - * Sets up an instance of `LiveDataHostApi` to handle messages through the `binaryMessenger`. - */ + /**Sets up an instance of `LiveDataHostApi` to handle messages through the `binaryMessenger`. */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable LiveDataHostApi api) { { BasicMessageChannel channel = @@ -2693,11 +2546,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable LiveDataHo Number identifierArg = (Number) args.get(0); Number observerIdentifierArg = (Number) args.get(1); try { - api.observe( - (identifierArg == null) ? null : identifierArg.longValue(), - (observerIdentifierArg == null) ? null : observerIdentifierArg.longValue()); + api.observe((identifierArg == null) ? null : identifierArg.longValue(), (observerIdentifierArg == null) ? null : observerIdentifierArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2720,7 +2572,8 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable LiveDataHo try { api.removeObservers((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2742,11 +2595,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable LiveDataHo Number identifierArg = (Number) args.get(0); LiveDataSupportedTypeData typeArg = (LiveDataSupportedTypeData) args.get(1); try { - Long output = - api.getValue( - (identifierArg == null) ? null : identifierArg.longValue(), typeArg); + Long output = api.getValue((identifierArg == null) ? null : identifierArg.longValue(), typeArg); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2793,7 +2645,7 @@ public LiveDataFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2802,11 +2654,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return LiveDataFlutterApiCodec.INSTANCE; } - - public void create( - @NonNull Long identifierArg, - @NonNull LiveDataSupportedTypeData typeArg, - @NonNull Reply callback) { + public void create(@NonNull Long identifierArg, @NonNull LiveDataSupportedTypeData typeArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.LiveDataFlutterApi.create", getCodec()); @@ -2823,7 +2671,7 @@ public AnalyzerFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2832,7 +2680,6 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2841,11 +2688,7 @@ public void create(@NonNull Long identifierArg, @NonNull Reply callback) { new ArrayList(Collections.singletonList(identifierArg)), channelReply -> callback.reply(null)); } - - public void analyze( - @NonNull Long identifierArg, - @NonNull Long imageProxyIdentifierArg, - @NonNull Reply callback) { + public void analyze(@NonNull Long identifierArg, @NonNull Long imageProxyIdentifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.AnalyzerFlutterApi.analyze", getCodec()); @@ -2857,7 +2700,7 @@ public void analyze( /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface ImageProxyHostApi { - @NonNull + @NonNull List getPlanes(@NonNull Long identifier); void close(@NonNull Long identifier); @@ -2866,9 +2709,7 @@ public interface ImageProxyHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `ImageProxyHostApi` to handle messages through the `binaryMessenger`. - */ + /**Sets up an instance of `ImageProxyHostApi` to handle messages through the `binaryMessenger`. */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageProxyHostApi api) { { BasicMessageChannel channel = @@ -2881,10 +2722,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageProxy ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - List output = - api.getPlanes((identifierArg == null) ? null : identifierArg.longValue()); + List output = api.getPlanes((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2907,7 +2748,8 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageProxy try { api.close((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2927,7 +2769,7 @@ public ImageProxyFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2936,13 +2778,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - - public void create( - @NonNull Long identifierArg, - @NonNull Long formatArg, - @NonNull Long heightArg, - @NonNull Long widthArg, - @NonNull Reply callback) { + public void create(@NonNull Long identifierArg, @NonNull Long formatArg, @NonNull Long heightArg, @NonNull Long widthArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.ImageProxyFlutterApi.create", getCodec()); @@ -2959,7 +2795,7 @@ public PlaneProxyFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2968,19 +2804,12 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - - public void create( - @NonNull Long identifierArg, - @NonNull byte[] bufferArg, - @NonNull Long pixelStrideArg, - @NonNull Long rowStrideArg, - @NonNull Reply callback) { + public void create(@NonNull Long identifierArg, @NonNull byte[] bufferArg, @NonNull Long pixelStrideArg, @NonNull Long rowStrideArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.PlaneProxyFlutterApi.create", getCodec()); channel.send( - new ArrayList( - Arrays.asList(identifierArg, bufferArg, pixelStrideArg, rowStrideArg)), + new ArrayList(Arrays.asList(identifierArg, bufferArg, pixelStrideArg, rowStrideArg)), channelReply -> callback.reply(null)); } } @@ -2994,6 +2823,8 @@ private QualitySelectorHostApiCodec() {} protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { switch (type) { case (byte) 128: + return QualityData.fromList((ArrayList) readValue(buffer)); + case (byte) 129: return ResolutionInfo.fromList((ArrayList) readValue(buffer)); default: return super.readValueOfType(type, buffer); @@ -3002,8 +2833,11 @@ protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { @Override protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { - if (value instanceof ResolutionInfo) { + if (value instanceof QualityData) { stream.write(128); + writeValue(stream, ((QualityData) value).toList()); + } else if (value instanceof ResolutionInfo) { + stream.write(129); writeValue(stream, ((ResolutionInfo) value).toList()); } else { super.writeValue(stream, value); @@ -3014,25 +2848,17 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface QualitySelectorHostApi { - void create( - @NonNull Long identifier, - @NonNull List videoQualityConstraintIndexList, - @Nullable Long fallbackStrategyId); + void create(@NonNull Long identifier, @NonNull List videoQualityConstraintIndexList, @Nullable Long fallbackStrategyId); - @NonNull - ResolutionInfo getResolution( - @NonNull Long cameraInfoId, @NonNull VideoQualityConstraint quality); + @NonNull + ResolutionInfo getResolution(@NonNull Long cameraInfoId, @NonNull Quality quality); /** The codec used by QualitySelectorHostApi. */ static @NonNull MessageCodec getCodec() { return QualitySelectorHostApiCodec.INSTANCE; } - /** - * Sets up an instance of `QualitySelectorHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable QualitySelectorHostApi api) { + /**Sets up an instance of `QualitySelectorHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable QualitySelectorHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -3043,15 +2869,13 @@ static void setup( ArrayList wrapped = new ArrayList(); ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); - List videoQualityConstraintIndexListArg = (List) args.get(1); + List videoQualityConstraintIndexListArg = (List) args.get(1); Number fallbackStrategyIdArg = (Number) args.get(2); try { - api.create( - (identifierArg == null) ? null : identifierArg.longValue(), - videoQualityConstraintIndexListArg, - (fallbackStrategyIdArg == null) ? null : fallbackStrategyIdArg.longValue()); + api.create((identifierArg == null) ? null : identifierArg.longValue(), videoQualityConstraintIndexListArg, (fallbackStrategyIdArg == null) ? null : fallbackStrategyIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -3064,24 +2888,19 @@ static void setup( { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.QualitySelectorHostApi.getResolution", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.QualitySelectorHostApi.getResolution", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { ArrayList wrapped = new ArrayList(); ArrayList args = (ArrayList) message; Number cameraInfoIdArg = (Number) args.get(0); - VideoQualityConstraint qualityArg = - args.get(1) == null ? null : VideoQualityConstraint.values()[(int) args.get(1)]; + Quality qualityArg = args.get(1) == null ? null : Quality.values()[(int) args.get(1)]; try { - ResolutionInfo output = - api.getResolution( - (cameraInfoIdArg == null) ? null : cameraInfoIdArg.longValue(), - qualityArg); + ResolutionInfo output = api.getResolution((cameraInfoIdArg == null) ? null : cameraInfoIdArg.longValue(), qualityArg); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -3096,21 +2915,14 @@ static void setup( /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface FallbackStrategyHostApi { - void create( - @NonNull Long identifier, - @NonNull VideoQualityConstraint quality, - @NonNull VideoResolutionFallbackRule fallbackRule); + void create(@NonNull Long identifier, @NonNull Quality quality, @NonNull VideoResolutionFallbackRule fallbackRule); /** The codec used by FallbackStrategyHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `FallbackStrategyHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable FallbackStrategyHostApi api) { + /**Sets up an instance of `FallbackStrategyHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable FallbackStrategyHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -3121,19 +2933,13 @@ static void setup( ArrayList wrapped = new ArrayList(); ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); - VideoQualityConstraint qualityArg = - args.get(1) == null ? null : VideoQualityConstraint.values()[(int) args.get(1)]; - VideoResolutionFallbackRule fallbackRuleArg = - args.get(2) == null - ? null - : VideoResolutionFallbackRule.values()[(int) args.get(2)]; + Quality qualityArg = args.get(1) == null ? null : Quality.values()[(int) args.get(1)]; + VideoResolutionFallbackRule fallbackRuleArg = args.get(2) == null ? null : VideoResolutionFallbackRule.values()[(int) args.get(2)]; try { - api.create( - (identifierArg == null) ? null : identifierArg.longValue(), - qualityArg, - fallbackRuleArg); + api.create((identifierArg == null) ? null : identifierArg.longValue(), qualityArg, fallbackRuleArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } diff --git a/packages/camera/camera_android_camerax/lib/src/camerax_library.g.dart b/packages/camera/camera_android_camerax/lib/src/camerax_library.g.dart index 0681a61e375..c4e418759bd 100644 --- a/packages/camera/camera_android_camerax/lib/src/camerax_library.g.dart +++ b/packages/camera/camera_android_camerax/lib/src/camerax_library.g.dart @@ -49,7 +49,7 @@ enum LiveDataSupportedType { /// These are pre-defined quality constants that are universally used for video. /// /// See https://developer.android.com/reference/androidx/camera/video/Quality. -enum VideoQualityConstraint { +enum Quality { SD, HD, FHD, @@ -188,6 +188,28 @@ class ExposureCompensationRange { } } +/// Convenience class for sending lists of [Quality]s. +class QualityData { + QualityData({ + required this.quality, + }); + + Quality quality; + + Object encode() { + return [ + quality.index, + ]; + } + + static QualityData decode(Object result) { + result as List; + return QualityData( + quality: Quality.values[result[0]! as int], + ); + } +} + class InstanceManagerHostApi { /// Constructor for [InstanceManagerHostApi]. The [binaryMessenger] named argument is /// available for dependency injection. If it is left null, the default @@ -205,7 +227,8 @@ class InstanceManagerHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.InstanceManagerHostApi.clear', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send(null) as List?; + final List? replyList = + await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -261,8 +284,7 @@ abstract class JavaObjectFlutterApi { void dispose(int identifier); - static void setup(JavaObjectFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(JavaObjectFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaObjectFlutterApi.dispose', codec, @@ -272,7 +294,7 @@ abstract class JavaObjectFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaObjectFlutterApi.dispose was null.'); + 'Argument for dev.flutter.pigeon.JavaObjectFlutterApi.dispose was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -409,8 +431,7 @@ abstract class CameraInfoFlutterApi { void create(int identifier); - static void setup(CameraInfoFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(CameraInfoFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraInfoFlutterApi.create', codec, @@ -420,7 +441,7 @@ abstract class CameraInfoFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraInfoFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.CameraInfoFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -447,8 +468,8 @@ class CameraSelectorHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraSelectorHostApi.create', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_lensFacing]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_lensFacing]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -465,13 +486,12 @@ class CameraSelectorHostApi { } } - Future> filter( - int arg_identifier, List arg_cameraInfoIds) async { + Future> filter(int arg_identifier, List arg_cameraInfoIds) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraSelectorHostApi.filter', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_cameraInfoIds]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_cameraInfoIds]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -499,8 +519,7 @@ abstract class CameraSelectorFlutterApi { void create(int identifier, int? lensFacing); - static void setup(CameraSelectorFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(CameraSelectorFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraSelectorFlutterApi.create', codec, @@ -510,7 +529,7 @@ abstract class CameraSelectorFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraSelectorFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.CameraSelectorFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -538,7 +557,8 @@ class ProcessCameraProviderHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ProcessCameraProviderHostApi.getInstance', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send(null) as List?; + final List? replyList = + await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -562,8 +582,7 @@ class ProcessCameraProviderHostApi { Future> getAvailableCameraInfos(int arg_identifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.ProcessCameraProviderHostApi.getAvailableCameraInfos', - codec, + 'dev.flutter.pigeon.ProcessCameraProviderHostApi.getAvailableCameraInfos', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_identifier]) as List?; @@ -588,17 +607,12 @@ class ProcessCameraProviderHostApi { } } - Future bindToLifecycle(int arg_identifier, - int arg_cameraSelectorIdentifier, List arg_useCaseIds) async { + Future bindToLifecycle(int arg_identifier, int arg_cameraSelectorIdentifier, List arg_useCaseIds) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.ProcessCameraProviderHostApi.bindToLifecycle', - codec, + 'dev.flutter.pigeon.ProcessCameraProviderHostApi.bindToLifecycle', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send([ - arg_identifier, - arg_cameraSelectorIdentifier, - arg_useCaseIds - ]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_cameraSelectorIdentifier, arg_useCaseIds]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -625,8 +639,7 @@ class ProcessCameraProviderHostApi { 'dev.flutter.pigeon.ProcessCameraProviderHostApi.isBound', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_identifier, arg_useCaseIdentifier]) - as List?; + await channel.send([arg_identifier, arg_useCaseIdentifier]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -652,8 +665,8 @@ class ProcessCameraProviderHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ProcessCameraProviderHostApi.unbind', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_useCaseIds]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_useCaseIds]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -698,8 +711,7 @@ abstract class ProcessCameraProviderFlutterApi { void create(int identifier); - static void setup(ProcessCameraProviderFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(ProcessCameraProviderFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ProcessCameraProviderFlutterApi.create', codec, @@ -709,7 +721,7 @@ abstract class ProcessCameraProviderFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ProcessCameraProviderFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.ProcessCameraProviderFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -775,7 +787,7 @@ abstract class CameraFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.CameraFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -803,7 +815,7 @@ class _SystemServicesHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return CameraPermissionsErrorData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -821,11 +833,9 @@ class SystemServicesHostApi { static const MessageCodec codec = _SystemServicesHostApiCodec(); - Future requestCameraPermissions( - bool arg_enableAudio) async { + Future requestCameraPermissions(bool arg_enableAudio) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.SystemServicesHostApi.requestCameraPermissions', - codec, + 'dev.flutter.pigeon.SystemServicesHostApi.requestCameraPermissions', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_enableAudio]) as List?; @@ -845,15 +855,12 @@ class SystemServicesHostApi { } } - Future startListeningForDeviceOrientationChange( - bool arg_isFrontFacing, int arg_sensorOrientation) async { + Future startListeningForDeviceOrientationChange(bool arg_isFrontFacing, int arg_sensorOrientation) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.SystemServicesHostApi.startListeningForDeviceOrientationChange', - codec, + 'dev.flutter.pigeon.SystemServicesHostApi.startListeningForDeviceOrientationChange', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_isFrontFacing, arg_sensorOrientation]) - as List?; + await channel.send([arg_isFrontFacing, arg_sensorOrientation]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -872,10 +879,10 @@ class SystemServicesHostApi { Future stopListeningForDeviceOrientationChange() async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.SystemServicesHostApi.stopListeningForDeviceOrientationChange', - codec, + 'dev.flutter.pigeon.SystemServicesHostApi.stopListeningForDeviceOrientationChange', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send(null) as List?; + final List? replyList = + await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -927,19 +934,17 @@ abstract class SystemServicesFlutterApi { void onCameraError(String errorDescription); - static void setup(SystemServicesFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(SystemServicesFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.SystemServicesFlutterApi.onDeviceOrientationChanged', - codec, + 'dev.flutter.pigeon.SystemServicesFlutterApi.onDeviceOrientationChanged', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.SystemServicesFlutterApi.onDeviceOrientationChanged was null.'); + 'Argument for dev.flutter.pigeon.SystemServicesFlutterApi.onDeviceOrientationChanged was null.'); final List args = (message as List?)!; final String? arg_orientation = (args[0] as String?); assert(arg_orientation != null, @@ -958,7 +963,7 @@ abstract class SystemServicesFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.SystemServicesFlutterApi.onCameraError was null.'); + 'Argument for dev.flutter.pigeon.SystemServicesFlutterApi.onCameraError was null.'); final List args = (message as List?)!; final String? arg_errorDescription = (args[0] as String?); assert(arg_errorDescription != null, @@ -986,7 +991,7 @@ class _PreviewHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return ResolutionInfo.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -1004,14 +1009,12 @@ class PreviewHostApi { static const MessageCodec codec = _PreviewHostApiCodec(); - Future create(int arg_identifier, int? arg_rotation, - int? arg_resolutionSelectorId) async { + Future create(int arg_identifier, int? arg_rotation, int? arg_resolutionSelectorId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PreviewHostApi.create', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send( - [arg_identifier, arg_rotation, arg_resolutionSelectorId]) - as List?; + final List? replyList = + await channel.send([arg_identifier, arg_rotation, arg_resolutionSelectorId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1059,7 +1062,8 @@ class PreviewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PreviewHostApi.releaseFlutterSurfaceTexture', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send(null) as List?; + final List? replyList = + await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1174,8 +1178,7 @@ abstract class VideoCaptureFlutterApi { void create(int identifier); - static void setup(VideoCaptureFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(VideoCaptureFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.VideoCaptureFlutterApi.create', codec, @@ -1185,7 +1188,7 @@ abstract class VideoCaptureFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.VideoCaptureFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.VideoCaptureFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1208,17 +1211,12 @@ class RecorderHostApi { static const MessageCodec codec = StandardMessageCodec(); - Future create(int arg_identifier, int? arg_aspectRatio, - int? arg_bitRate, int? arg_qualitySelectorId) async { + Future create(int arg_identifier, int? arg_aspectRatio, int? arg_bitRate, int? arg_qualitySelectorId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.RecorderHostApi.create', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send([ - arg_identifier, - arg_aspectRatio, - arg_bitRate, - arg_qualitySelectorId - ]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_aspectRatio, arg_bitRate, arg_qualitySelectorId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1264,8 +1262,7 @@ class RecorderHostApi { Future getTargetVideoEncodingBitRate(int arg_identifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.RecorderHostApi.getTargetVideoEncodingBitRate', - codec, + 'dev.flutter.pigeon.RecorderHostApi.getTargetVideoEncodingBitRate', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_identifier]) as List?; @@ -1294,8 +1291,8 @@ class RecorderHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.RecorderHostApi.prepareRecording', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_path]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_path]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1323,8 +1320,7 @@ abstract class RecorderFlutterApi { void create(int identifier, int? aspectRatio, int? bitRate); - static void setup(RecorderFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(RecorderFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.RecorderFlutterApi.create', codec, @@ -1334,7 +1330,7 @@ abstract class RecorderFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.RecorderFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.RecorderFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1392,8 +1388,7 @@ abstract class PendingRecordingFlutterApi { void create(int identifier); - static void setup(PendingRecordingFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(PendingRecordingFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PendingRecordingFlutterApi.create', codec, @@ -1403,7 +1398,7 @@ abstract class PendingRecordingFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PendingRecordingFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.PendingRecordingFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1520,8 +1515,7 @@ abstract class RecordingFlutterApi { void create(int identifier); - static void setup(RecordingFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(RecordingFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.RecordingFlutterApi.create', codec, @@ -1531,7 +1525,7 @@ abstract class RecordingFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.RecordingFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.RecordingFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1554,14 +1548,12 @@ class ImageCaptureHostApi { static const MessageCodec codec = StandardMessageCodec(); - Future create(int arg_identifier, int? arg_flashMode, - int? arg_resolutionSelectorId) async { + Future create(int arg_identifier, int? arg_flashMode, int? arg_resolutionSelectorId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ImageCaptureHostApi.create', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send( - [arg_identifier, arg_flashMode, arg_resolutionSelectorId]) - as List?; + final List? replyList = + await channel.send([arg_identifier, arg_flashMode, arg_resolutionSelectorId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1582,8 +1574,8 @@ class ImageCaptureHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ImageCaptureHostApi.setFlashMode', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_flashMode]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_flashMode]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1643,7 +1635,7 @@ class _ResolutionStrategyHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return ResolutionInfo.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -1661,14 +1653,12 @@ class ResolutionStrategyHostApi { static const MessageCodec codec = _ResolutionStrategyHostApiCodec(); - Future create(int arg_identifier, ResolutionInfo? arg_boundSize, - int? arg_fallbackRule) async { + Future create(int arg_identifier, ResolutionInfo? arg_boundSize, int? arg_fallbackRule) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ResolutionStrategyHostApi.create', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_boundSize, arg_fallbackRule]) - as List?; + final List? replyList = + await channel.send([arg_identifier, arg_boundSize, arg_fallbackRule]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1696,16 +1686,12 @@ class ResolutionSelectorHostApi { static const MessageCodec codec = StandardMessageCodec(); - Future create(int arg_identifier, int? arg_resolutionStrategyIdentifier, - int? arg_aspectRatioStrategyIdentifier) async { + Future create(int arg_identifier, int? arg_resolutionStrategyIdentifier, int? arg_aspectRatioStrategyIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ResolutionSelectorHostApi.create', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send([ - arg_identifier, - arg_resolutionStrategyIdentifier, - arg_aspectRatioStrategyIdentifier - ]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_resolutionStrategyIdentifier, arg_aspectRatioStrategyIdentifier]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1733,16 +1719,12 @@ class AspectRatioStrategyHostApi { static const MessageCodec codec = StandardMessageCodec(); - Future create(int arg_identifier, int arg_preferredAspectRatio, - int arg_fallbackRule) async { + Future create(int arg_identifier, int arg_preferredAspectRatio, int arg_fallbackRule) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.AspectRatioStrategyHostApi.create', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send([ - arg_identifier, - arg_preferredAspectRatio, - arg_fallbackRule - ]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_preferredAspectRatio, arg_fallbackRule]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1775,7 +1757,7 @@ class _CameraStateFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return CameraStateTypeData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -1788,8 +1770,7 @@ abstract class CameraStateFlutterApi { void create(int identifier, CameraStateTypeData type, int? errorIdentifier); - static void setup(CameraStateFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(CameraStateFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraStateFlutterApi.create', codec, @@ -1799,13 +1780,12 @@ abstract class CameraStateFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraStateFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.CameraStateFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.CameraStateFlutterApi.create was null, expected non-null int.'); - final CameraStateTypeData? arg_type = - (args[1] as CameraStateTypeData?); + final CameraStateTypeData? arg_type = (args[1] as CameraStateTypeData?); assert(arg_type != null, 'Argument for dev.flutter.pigeon.CameraStateFlutterApi.create was null, expected non-null CameraStateTypeData.'); final int? arg_errorIdentifier = (args[2] as int?); @@ -1832,7 +1812,7 @@ class _ExposureStateFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return ExposureCompensationRange.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -1843,13 +1823,9 @@ class _ExposureStateFlutterApiCodec extends StandardMessageCodec { abstract class ExposureStateFlutterApi { static const MessageCodec codec = _ExposureStateFlutterApiCodec(); - void create( - int identifier, - ExposureCompensationRange exposureCompensationRange, - double exposureCompensationStep); + void create(int identifier, ExposureCompensationRange exposureCompensationRange, double exposureCompensationStep); - static void setup(ExposureStateFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(ExposureStateFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ExposureStateFlutterApi.create', codec, @@ -1859,20 +1835,18 @@ abstract class ExposureStateFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ExposureStateFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.ExposureStateFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.ExposureStateFlutterApi.create was null, expected non-null int.'); - final ExposureCompensationRange? arg_exposureCompensationRange = - (args[1] as ExposureCompensationRange?); + final ExposureCompensationRange? arg_exposureCompensationRange = (args[1] as ExposureCompensationRange?); assert(arg_exposureCompensationRange != null, 'Argument for dev.flutter.pigeon.ExposureStateFlutterApi.create was null, expected non-null ExposureCompensationRange.'); final double? arg_exposureCompensationStep = (args[2] as double?); assert(arg_exposureCompensationStep != null, 'Argument for dev.flutter.pigeon.ExposureStateFlutterApi.create was null, expected non-null double.'); - api.create(arg_identifier!, arg_exposureCompensationRange!, - arg_exposureCompensationStep!); + api.create(arg_identifier!, arg_exposureCompensationRange!, arg_exposureCompensationStep!); return; }); } @@ -1885,8 +1859,7 @@ abstract class ZoomStateFlutterApi { void create(int identifier, double minZoomRatio, double maxZoomRatio); - static void setup(ZoomStateFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(ZoomStateFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ZoomStateFlutterApi.create', codec, @@ -1896,7 +1869,7 @@ abstract class ZoomStateFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ZoomStateFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.ZoomStateFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1930,8 +1903,7 @@ class ImageAnalysisHostApi { 'dev.flutter.pigeon.ImageAnalysisHostApi.create', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_identifier, arg_resolutionSelectorId]) - as List?; + await channel.send([arg_identifier, arg_resolutionSelectorId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1948,14 +1920,12 @@ class ImageAnalysisHostApi { } } - Future setAnalyzer( - int arg_identifier, int arg_analyzerIdentifier) async { + Future setAnalyzer(int arg_identifier, int arg_analyzerIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ImageAnalysisHostApi.setAnalyzer', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_identifier, arg_analyzerIdentifier]) - as List?; + await channel.send([arg_identifier, arg_analyzerIdentifier]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2066,8 +2036,7 @@ abstract class ObserverFlutterApi { void onChanged(int identifier, int valueIdentifier); - static void setup(ObserverFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(ObserverFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ObserverFlutterApi.onChanged', codec, @@ -2077,7 +2046,7 @@ abstract class ObserverFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ObserverFlutterApi.onChanged was null.'); + 'Argument for dev.flutter.pigeon.ObserverFlutterApi.onChanged was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -2098,8 +2067,7 @@ abstract class CameraStateErrorFlutterApi { void create(int identifier, int code); - static void setup(CameraStateErrorFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(CameraStateErrorFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraStateErrorFlutterApi.create', codec, @@ -2109,7 +2077,7 @@ abstract class CameraStateErrorFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraStateErrorFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.CameraStateErrorFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -2140,7 +2108,7 @@ class _LiveDataHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return LiveDataSupportedTypeData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -2163,8 +2131,7 @@ class LiveDataHostApi { 'dev.flutter.pigeon.LiveDataHostApi.observe', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_identifier, arg_observerIdentifier]) - as List?; + await channel.send([arg_identifier, arg_observerIdentifier]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2203,13 +2170,12 @@ class LiveDataHostApi { } } - Future getValue( - int arg_identifier, LiveDataSupportedTypeData arg_type) async { + Future getValue(int arg_identifier, LiveDataSupportedTypeData arg_type) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.LiveDataHostApi.getValue', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_type]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_type]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2242,7 +2208,7 @@ class _LiveDataFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return LiveDataSupportedTypeData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -2255,8 +2221,7 @@ abstract class LiveDataFlutterApi { void create(int identifier, LiveDataSupportedTypeData type); - static void setup(LiveDataFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(LiveDataFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.LiveDataFlutterApi.create', codec, @@ -2266,13 +2231,12 @@ abstract class LiveDataFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.LiveDataFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.LiveDataFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.LiveDataFlutterApi.create was null, expected non-null int.'); - final LiveDataSupportedTypeData? arg_type = - (args[1] as LiveDataSupportedTypeData?); + final LiveDataSupportedTypeData? arg_type = (args[1] as LiveDataSupportedTypeData?); assert(arg_type != null, 'Argument for dev.flutter.pigeon.LiveDataFlutterApi.create was null, expected non-null LiveDataSupportedTypeData.'); api.create(arg_identifier!, arg_type!); @@ -2290,8 +2254,7 @@ abstract class AnalyzerFlutterApi { void analyze(int identifier, int imageProxyIdentifier); - static void setup(AnalyzerFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(AnalyzerFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.AnalyzerFlutterApi.create', codec, @@ -2301,7 +2264,7 @@ abstract class AnalyzerFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.AnalyzerFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.AnalyzerFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -2320,7 +2283,7 @@ abstract class AnalyzerFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.AnalyzerFlutterApi.analyze was null.'); + 'Argument for dev.flutter.pigeon.AnalyzerFlutterApi.analyze was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -2401,8 +2364,7 @@ abstract class ImageProxyFlutterApi { void create(int identifier, int format, int height, int width); - static void setup(ImageProxyFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(ImageProxyFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ImageProxyFlutterApi.create', codec, @@ -2412,7 +2374,7 @@ abstract class ImageProxyFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ImageProxyFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.ImageProxyFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -2439,8 +2401,7 @@ abstract class PlaneProxyFlutterApi { void create(int identifier, Uint8List buffer, int pixelStride, int rowStride); - static void setup(PlaneProxyFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(PlaneProxyFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PlaneProxyFlutterApi.create', codec, @@ -2450,7 +2411,7 @@ abstract class PlaneProxyFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PlaneProxyFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.PlaneProxyFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -2464,8 +2425,7 @@ abstract class PlaneProxyFlutterApi { final int? arg_rowStride = (args[3] as int?); assert(arg_rowStride != null, 'Argument for dev.flutter.pigeon.PlaneProxyFlutterApi.create was null, expected non-null int.'); - api.create( - arg_identifier!, arg_buffer!, arg_pixelStride!, arg_rowStride!); + api.create(arg_identifier!, arg_buffer!, arg_pixelStride!, arg_rowStride!); return; }); } @@ -2477,9 +2437,12 @@ class _QualitySelectorHostApiCodec extends StandardMessageCodec { const _QualitySelectorHostApiCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { - if (value is ResolutionInfo) { + if (value is QualityData) { buffer.putUint8(128); writeValue(buffer, value.encode()); + } else if (value is ResolutionInfo) { + buffer.putUint8(129); + writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } @@ -2488,7 +2451,9 @@ class _QualitySelectorHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: + return QualityData.decode(readValue(buffer)!); + case 129: return ResolutionInfo.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -2506,18 +2471,12 @@ class QualitySelectorHostApi { static const MessageCodec codec = _QualitySelectorHostApiCodec(); - Future create( - int arg_identifier, - List arg_videoQualityConstraintIndexList, - int? arg_fallbackStrategyId) async { + Future create(int arg_identifier, List arg_videoQualityConstraintIndexList, int? arg_fallbackStrategyId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.QualitySelectorHostApi.create', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send([ - arg_identifier, - arg_videoQualityConstraintIndexList, - arg_fallbackStrategyId - ]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_videoQualityConstraintIndexList, arg_fallbackStrategyId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2534,13 +2493,12 @@ class QualitySelectorHostApi { } } - Future getResolution( - int arg_cameraInfoId, VideoQualityConstraint arg_quality) async { + Future getResolution(int arg_cameraInfoId, Quality arg_quality) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.QualitySelectorHostApi.getResolution', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_cameraInfoId, arg_quality.index]) as List?; + final List? replyList = + await channel.send([arg_cameraInfoId, arg_quality.index]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2573,16 +2531,12 @@ class FallbackStrategyHostApi { static const MessageCodec codec = StandardMessageCodec(); - Future create(int arg_identifier, VideoQualityConstraint arg_quality, - VideoResolutionFallbackRule arg_fallbackRule) async { + Future create(int arg_identifier, Quality arg_quality, VideoResolutionFallbackRule arg_fallbackRule) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.FallbackStrategyHostApi.create', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send([ - arg_identifier, - arg_quality.index, - arg_fallbackRule.index - ]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_quality.index, arg_fallbackRule.index]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', diff --git a/packages/camera/camera_android_camerax/pigeons/camerax_library.dart b/packages/camera/camera_android_camerax/pigeons/camerax_library.dart index 983e3df2299..47537c94812 100644 --- a/packages/camera/camera_android_camerax/pigeons/camerax_library.dart +++ b/packages/camera/camera_android_camerax/pigeons/camerax_library.dart @@ -102,55 +102,18 @@ class ExposureCompensationRange { /// These are pre-defined quality constants that are universally used for video. /// /// See https://developer.android.com/reference/androidx/camera/video/Quality. -// enum VideoQualityConstraint { -// SD, // 480p -// HD, // 720p -// FHD, // 1080p -// UHD, // 2160p -// lowest, -// highest, -// } - -/// Video quality constraints that will be used by a QualitySelector to choose -/// an appropriate video resolution. -/// -/// These are pre-defined quality constants that are universally used for video. -/// -/// See https://developer.android.com/reference/androidx/camera/video/Quality. -class VideoQualityConstraint { - VideoQualityConstraint({required this.quality}); - - int quality; - - /// Lowest avaialble video quality. - /// - /// Maps to hhttps://developer.android.com/reference/android/media/CamcorderProfile#QUALITY_LOW. - static const int lowest = 0; - - /// 480p video quality. - /// - /// Maps to https://developer.android.com/reference/android/media/CamcorderProfile#QUALITY_480P. - static const int SD = 4; - - /// 720p video quality. - /// - /// Maps to https://developer.android.com/reference/android/media/CamcorderProfile#QUALITY_720P. - static const int HD = 5; - - /// 1080p video quality. - /// - /// Maps to https://developer.android.com/reference/android/media/CamcorderProfile#QUALITY_1080P. - static const int FHD = 6; - - /// 2160p video quality. - /// - /// Maps to https://developer.android.com/reference/android/media/CamcorderProfile#QUALITY_2160P. - static const int UHD = 8; +enum Quality { + SD, // 480p + HD, // 720p + FHD, // 1080p + UHD, // 2160p + lowest, + highest, +} - /// Highest available video quality. - /// - /// Maps to https://developer.android.com/reference/android/media/CamcorderProfile#QUALITY_HIGH. - static const int highest = 1; +/// Convenience class for sending lists of [Quality]s. +class QualityData { + late Quality quality; } /// Fallback rules for selecting video resolution. @@ -443,17 +406,14 @@ abstract class PlaneProxyFlutterApi { @HostApi(dartHostTestHandler: 'TestQualitySelectorHostApi') abstract class QualitySelectorHostApi { - // TODO(camsim99): Change qualityList to List when - // enums are supported for collection types. - void create(int identifier, List videoQualityConstraintIndexList, + void create(int identifier, List videoQualityConstraintIndexList, int? fallbackStrategyId); - ResolutionInfo getResolution( - int cameraInfoId, VideoQualityConstraint quality); + ResolutionInfo getResolution(int cameraInfoId, Quality quality); } @HostApi(dartHostTestHandler: 'TestFallbackStrategyHostApi') abstract class FallbackStrategyHostApi { - void create(int identifier, VideoQualityConstraint quality, + void create(int identifier, Quality quality, VideoResolutionFallbackRule fallbackRule); } diff --git a/packages/camera/camera_android_camerax/test/test_camerax_library.g.dart b/packages/camera/camera_android_camerax/test/test_camerax_library.g.dart index d4c935e819c..b9e2ab706e5 100644 --- a/packages/camera/camera_android_camerax/test/test_camerax_library.g.dart +++ b/packages/camera/camera_android_camerax/test/test_camerax_library.g.dart @@ -14,8 +14,7 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:camera_android_camerax/src/camerax_library.g.dart'; abstract class TestInstanceManagerHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); /// Clear the native `InstanceManager`. @@ -23,19 +22,15 @@ abstract class TestInstanceManagerHostApi { /// This is typically only used after a hot restart. void clear(); - static void setup(TestInstanceManagerHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestInstanceManagerHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.InstanceManagerHostApi.clear', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { // ignore message api.clear(); return []; @@ -46,27 +41,22 @@ abstract class TestInstanceManagerHostApi { } abstract class TestJavaObjectHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void dispose(int identifier); - static void setup(TestJavaObjectHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestJavaObjectHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaObjectHostApi.dispose', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaObjectHostApi.dispose was null.'); + 'Argument for dev.flutter.pigeon.JavaObjectHostApi.dispose was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -80,8 +70,7 @@ abstract class TestJavaObjectHostApi { } abstract class TestCameraInfoHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); int getSensorRotationDegrees(int identifier); @@ -92,22 +81,17 @@ abstract class TestCameraInfoHostApi { int getZoomState(int identifier); - static void setup(TestCameraInfoHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestCameraInfoHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CameraInfoHostApi.getSensorRotationDegrees', - codec, + 'dev.flutter.pigeon.CameraInfoHostApi.getSensorRotationDegrees', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraInfoHostApi.getSensorRotationDegrees was null.'); + 'Argument for dev.flutter.pigeon.CameraInfoHostApi.getSensorRotationDegrees was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -122,14 +106,11 @@ abstract class TestCameraInfoHostApi { 'dev.flutter.pigeon.CameraInfoHostApi.getCameraState', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraInfoHostApi.getCameraState was null.'); + 'Argument for dev.flutter.pigeon.CameraInfoHostApi.getCameraState was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -144,14 +125,11 @@ abstract class TestCameraInfoHostApi { 'dev.flutter.pigeon.CameraInfoHostApi.getExposureState', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraInfoHostApi.getExposureState was null.'); + 'Argument for dev.flutter.pigeon.CameraInfoHostApi.getExposureState was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -166,14 +144,11 @@ abstract class TestCameraInfoHostApi { 'dev.flutter.pigeon.CameraInfoHostApi.getZoomState', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraInfoHostApi.getZoomState was null.'); + 'Argument for dev.flutter.pigeon.CameraInfoHostApi.getZoomState was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -187,29 +162,24 @@ abstract class TestCameraInfoHostApi { } abstract class TestCameraSelectorHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int identifier, int? lensFacing); List filter(int identifier, List cameraInfoIds); - static void setup(TestCameraSelectorHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestCameraSelectorHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraSelectorHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraSelectorHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.CameraSelectorHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -225,24 +195,19 @@ abstract class TestCameraSelectorHostApi { 'dev.flutter.pigeon.CameraSelectorHostApi.filter', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraSelectorHostApi.filter was null.'); + 'Argument for dev.flutter.pigeon.CameraSelectorHostApi.filter was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.CameraSelectorHostApi.filter was null, expected non-null int.'); - final List? arg_cameraInfoIds = - (args[1] as List?)?.cast(); + final List? arg_cameraInfoIds = (args[1] as List?)?.cast(); assert(arg_cameraInfoIds != null, 'Argument for dev.flutter.pigeon.CameraSelectorHostApi.filter was null, expected non-null List.'); - final List output = - api.filter(arg_identifier!, arg_cameraInfoIds!); + final List output = api.filter(arg_identifier!, arg_cameraInfoIds!); return [output]; }); } @@ -251,16 +216,14 @@ abstract class TestCameraSelectorHostApi { } abstract class TestProcessCameraProviderHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); Future getInstance(); List getAvailableCameraInfos(int identifier); - int bindToLifecycle( - int identifier, int cameraSelectorIdentifier, List useCaseIds); + int bindToLifecycle(int identifier, int cameraSelectorIdentifier, List useCaseIds); bool isBound(int identifier, int useCaseIdentifier); @@ -268,19 +231,15 @@ abstract class TestProcessCameraProviderHostApi { void unbindAll(int identifier); - static void setup(TestProcessCameraProviderHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestProcessCameraProviderHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ProcessCameraProviderHostApi.getInstance', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { // ignore message final int output = await api.getInstance(); return [output]; @@ -289,42 +248,33 @@ abstract class TestProcessCameraProviderHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.ProcessCameraProviderHostApi.getAvailableCameraInfos', - codec, + 'dev.flutter.pigeon.ProcessCameraProviderHostApi.getAvailableCameraInfos', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.getAvailableCameraInfos was null.'); + 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.getAvailableCameraInfos was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.getAvailableCameraInfos was null, expected non-null int.'); - final List output = - api.getAvailableCameraInfos(arg_identifier!); + final List output = api.getAvailableCameraInfos(arg_identifier!); return [output]; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.ProcessCameraProviderHostApi.bindToLifecycle', - codec, + 'dev.flutter.pigeon.ProcessCameraProviderHostApi.bindToLifecycle', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.bindToLifecycle was null.'); + 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.bindToLifecycle was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -332,12 +282,10 @@ abstract class TestProcessCameraProviderHostApi { final int? arg_cameraSelectorIdentifier = (args[1] as int?); assert(arg_cameraSelectorIdentifier != null, 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.bindToLifecycle was null, expected non-null int.'); - final List? arg_useCaseIds = - (args[2] as List?)?.cast(); + final List? arg_useCaseIds = (args[2] as List?)?.cast(); assert(arg_useCaseIds != null, 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.bindToLifecycle was null, expected non-null List.'); - final int output = api.bindToLifecycle( - arg_identifier!, arg_cameraSelectorIdentifier!, arg_useCaseIds!); + final int output = api.bindToLifecycle(arg_identifier!, arg_cameraSelectorIdentifier!, arg_useCaseIds!); return [output]; }); } @@ -347,14 +295,11 @@ abstract class TestProcessCameraProviderHostApi { 'dev.flutter.pigeon.ProcessCameraProviderHostApi.isBound', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.isBound was null.'); + 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.isBound was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -362,8 +307,7 @@ abstract class TestProcessCameraProviderHostApi { final int? arg_useCaseIdentifier = (args[1] as int?); assert(arg_useCaseIdentifier != null, 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.isBound was null, expected non-null int.'); - final bool output = - api.isBound(arg_identifier!, arg_useCaseIdentifier!); + final bool output = api.isBound(arg_identifier!, arg_useCaseIdentifier!); return [output]; }); } @@ -373,20 +317,16 @@ abstract class TestProcessCameraProviderHostApi { 'dev.flutter.pigeon.ProcessCameraProviderHostApi.unbind', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.unbind was null.'); + 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.unbind was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.unbind was null, expected non-null int.'); - final List? arg_useCaseIds = - (args[1] as List?)?.cast(); + final List? arg_useCaseIds = (args[1] as List?)?.cast(); assert(arg_useCaseIds != null, 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.unbind was null, expected non-null List.'); api.unbind(arg_identifier!, arg_useCaseIds!); @@ -399,14 +339,11 @@ abstract class TestProcessCameraProviderHostApi { 'dev.flutter.pigeon.ProcessCameraProviderHostApi.unbindAll', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.unbindAll was null.'); + 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.unbindAll was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -420,27 +357,22 @@ abstract class TestProcessCameraProviderHostApi { } abstract class TestCameraHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); int getCameraInfo(int identifier); - static void setup(TestCameraHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestCameraHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraHostApi.getCameraInfo', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraHostApi.getCameraInfo was null.'); + 'Argument for dev.flutter.pigeon.CameraHostApi.getCameraInfo was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -468,7 +400,7 @@ class _TestSystemServicesHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return CameraPermissionsErrorData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -477,60 +409,47 @@ class _TestSystemServicesHostApiCodec extends StandardMessageCodec { } abstract class TestSystemServicesHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = _TestSystemServicesHostApiCodec(); - Future requestCameraPermissions( - bool enableAudio); + Future requestCameraPermissions(bool enableAudio); - void startListeningForDeviceOrientationChange( - bool isFrontFacing, int sensorOrientation); + void startListeningForDeviceOrientationChange(bool isFrontFacing, int sensorOrientation); void stopListeningForDeviceOrientationChange(); String getTempFilePath(String prefix, String suffix); - static void setup(TestSystemServicesHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestSystemServicesHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.SystemServicesHostApi.requestCameraPermissions', - codec, + 'dev.flutter.pigeon.SystemServicesHostApi.requestCameraPermissions', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.SystemServicesHostApi.requestCameraPermissions was null.'); + 'Argument for dev.flutter.pigeon.SystemServicesHostApi.requestCameraPermissions was null.'); final List args = (message as List?)!; final bool? arg_enableAudio = (args[0] as bool?); assert(arg_enableAudio != null, 'Argument for dev.flutter.pigeon.SystemServicesHostApi.requestCameraPermissions was null, expected non-null bool.'); - final CameraPermissionsErrorData? output = - await api.requestCameraPermissions(arg_enableAudio!); + final CameraPermissionsErrorData? output = await api.requestCameraPermissions(arg_enableAudio!); return [output]; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.SystemServicesHostApi.startListeningForDeviceOrientationChange', - codec, + 'dev.flutter.pigeon.SystemServicesHostApi.startListeningForDeviceOrientationChange', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.SystemServicesHostApi.startListeningForDeviceOrientationChange was null.'); + 'Argument for dev.flutter.pigeon.SystemServicesHostApi.startListeningForDeviceOrientationChange was null.'); final List args = (message as List?)!; final bool? arg_isFrontFacing = (args[0] as bool?); assert(arg_isFrontFacing != null, @@ -538,24 +457,19 @@ abstract class TestSystemServicesHostApi { final int? arg_sensorOrientation = (args[1] as int?); assert(arg_sensorOrientation != null, 'Argument for dev.flutter.pigeon.SystemServicesHostApi.startListeningForDeviceOrientationChange was null, expected non-null int.'); - api.startListeningForDeviceOrientationChange( - arg_isFrontFacing!, arg_sensorOrientation!); + api.startListeningForDeviceOrientationChange(arg_isFrontFacing!, arg_sensorOrientation!); return []; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.SystemServicesHostApi.stopListeningForDeviceOrientationChange', - codec, + 'dev.flutter.pigeon.SystemServicesHostApi.stopListeningForDeviceOrientationChange', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { // ignore message api.stopListeningForDeviceOrientationChange(); return []; @@ -567,14 +481,11 @@ abstract class TestSystemServicesHostApi { 'dev.flutter.pigeon.SystemServicesHostApi.getTempFilePath', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.SystemServicesHostApi.getTempFilePath was null.'); + 'Argument for dev.flutter.pigeon.SystemServicesHostApi.getTempFilePath was null.'); final List args = (message as List?)!; final String? arg_prefix = (args[0] as String?); assert(arg_prefix != null, @@ -605,7 +516,7 @@ class _TestPreviewHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return ResolutionInfo.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -614,8 +525,7 @@ class _TestPreviewHostApiCodec extends StandardMessageCodec { } abstract class TestPreviewHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = _TestPreviewHostApiCodec(); void create(int identifier, int? rotation, int? resolutionSelectorId); @@ -626,21 +536,17 @@ abstract class TestPreviewHostApi { ResolutionInfo getResolutionInfo(int identifier); - static void setup(TestPreviewHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestPreviewHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PreviewHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PreviewHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.PreviewHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -657,14 +563,11 @@ abstract class TestPreviewHostApi { 'dev.flutter.pigeon.PreviewHostApi.setSurfaceProvider', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PreviewHostApi.setSurfaceProvider was null.'); + 'Argument for dev.flutter.pigeon.PreviewHostApi.setSurfaceProvider was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -676,16 +579,12 @@ abstract class TestPreviewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.PreviewHostApi.releaseFlutterSurfaceTexture', - codec, + 'dev.flutter.pigeon.PreviewHostApi.releaseFlutterSurfaceTexture', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { // ignore message api.releaseFlutterSurfaceTexture(); return []; @@ -697,14 +596,11 @@ abstract class TestPreviewHostApi { 'dev.flutter.pigeon.PreviewHostApi.getResolutionInfo', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PreviewHostApi.getResolutionInfo was null.'); + 'Argument for dev.flutter.pigeon.PreviewHostApi.getResolutionInfo was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -718,29 +614,24 @@ abstract class TestPreviewHostApi { } abstract class TestVideoCaptureHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); int withOutput(int videoOutputId); int getOutput(int identifier); - static void setup(TestVideoCaptureHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestVideoCaptureHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.VideoCaptureHostApi.withOutput', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.VideoCaptureHostApi.withOutput was null.'); + 'Argument for dev.flutter.pigeon.VideoCaptureHostApi.withOutput was null.'); final List args = (message as List?)!; final int? arg_videoOutputId = (args[0] as int?); assert(arg_videoOutputId != null, @@ -755,14 +646,11 @@ abstract class TestVideoCaptureHostApi { 'dev.flutter.pigeon.VideoCaptureHostApi.getOutput', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.VideoCaptureHostApi.getOutput was null.'); + 'Argument for dev.flutter.pigeon.VideoCaptureHostApi.getOutput was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -776,12 +664,10 @@ abstract class TestVideoCaptureHostApi { } abstract class TestRecorderHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); - void create( - int identifier, int? aspectRatio, int? bitRate, int? qualitySelectorId); + void create(int identifier, int? aspectRatio, int? bitRate, int? qualitySelectorId); int getAspectRatio(int identifier); @@ -789,21 +675,17 @@ abstract class TestRecorderHostApi { int prepareRecording(int identifier, String path); - static void setup(TestRecorderHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestRecorderHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.RecorderHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.RecorderHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.RecorderHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -811,8 +693,7 @@ abstract class TestRecorderHostApi { final int? arg_aspectRatio = (args[1] as int?); final int? arg_bitRate = (args[2] as int?); final int? arg_qualitySelectorId = (args[3] as int?); - api.create(arg_identifier!, arg_aspectRatio, arg_bitRate, - arg_qualitySelectorId); + api.create(arg_identifier!, arg_aspectRatio, arg_bitRate, arg_qualitySelectorId); return []; }); } @@ -822,14 +703,11 @@ abstract class TestRecorderHostApi { 'dev.flutter.pigeon.RecorderHostApi.getAspectRatio', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.RecorderHostApi.getAspectRatio was null.'); + 'Argument for dev.flutter.pigeon.RecorderHostApi.getAspectRatio was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -841,18 +719,14 @@ abstract class TestRecorderHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.RecorderHostApi.getTargetVideoEncodingBitRate', - codec, + 'dev.flutter.pigeon.RecorderHostApi.getTargetVideoEncodingBitRate', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.RecorderHostApi.getTargetVideoEncodingBitRate was null.'); + 'Argument for dev.flutter.pigeon.RecorderHostApi.getTargetVideoEncodingBitRate was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -867,14 +741,11 @@ abstract class TestRecorderHostApi { 'dev.flutter.pigeon.RecorderHostApi.prepareRecording', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.RecorderHostApi.prepareRecording was null.'); + 'Argument for dev.flutter.pigeon.RecorderHostApi.prepareRecording was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -891,27 +762,22 @@ abstract class TestRecorderHostApi { } abstract class TestPendingRecordingHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); int start(int identifier); - static void setup(TestPendingRecordingHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestPendingRecordingHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PendingRecordingHostApi.start', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PendingRecordingHostApi.start was null.'); + 'Argument for dev.flutter.pigeon.PendingRecordingHostApi.start was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -925,8 +791,7 @@ abstract class TestPendingRecordingHostApi { } abstract class TestRecordingHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void close(int identifier); @@ -937,21 +802,17 @@ abstract class TestRecordingHostApi { void stop(int identifier); - static void setup(TestRecordingHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestRecordingHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.RecordingHostApi.close', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.RecordingHostApi.close was null.'); + 'Argument for dev.flutter.pigeon.RecordingHostApi.close was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -966,14 +827,11 @@ abstract class TestRecordingHostApi { 'dev.flutter.pigeon.RecordingHostApi.pause', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.RecordingHostApi.pause was null.'); + 'Argument for dev.flutter.pigeon.RecordingHostApi.pause was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -988,14 +846,11 @@ abstract class TestRecordingHostApi { 'dev.flutter.pigeon.RecordingHostApi.resume', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.RecordingHostApi.resume was null.'); + 'Argument for dev.flutter.pigeon.RecordingHostApi.resume was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1010,14 +865,11 @@ abstract class TestRecordingHostApi { 'dev.flutter.pigeon.RecordingHostApi.stop', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.RecordingHostApi.stop was null.'); + 'Argument for dev.flutter.pigeon.RecordingHostApi.stop was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1031,8 +883,7 @@ abstract class TestRecordingHostApi { } abstract class TestImageCaptureHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int identifier, int? flashMode, int? resolutionSelectorId); @@ -1041,21 +892,17 @@ abstract class TestImageCaptureHostApi { Future takePicture(int identifier); - static void setup(TestImageCaptureHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestImageCaptureHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ImageCaptureHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ImageCaptureHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.ImageCaptureHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1072,14 +919,11 @@ abstract class TestImageCaptureHostApi { 'dev.flutter.pigeon.ImageCaptureHostApi.setFlashMode', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ImageCaptureHostApi.setFlashMode was null.'); + 'Argument for dev.flutter.pigeon.ImageCaptureHostApi.setFlashMode was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1097,14 +941,11 @@ abstract class TestImageCaptureHostApi { 'dev.flutter.pigeon.ImageCaptureHostApi.takePicture', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ImageCaptureHostApi.takePicture was null.'); + 'Argument for dev.flutter.pigeon.ImageCaptureHostApi.takePicture was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1132,7 +973,7 @@ class _TestResolutionStrategyHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return ResolutionInfo.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -1141,28 +982,22 @@ class _TestResolutionStrategyHostApiCodec extends StandardMessageCodec { } abstract class TestResolutionStrategyHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; - static const MessageCodec codec = - _TestResolutionStrategyHostApiCodec(); + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static const MessageCodec codec = _TestResolutionStrategyHostApiCodec(); void create(int identifier, ResolutionInfo? boundSize, int? fallbackRule); - static void setup(TestResolutionStrategyHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestResolutionStrategyHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ResolutionStrategyHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ResolutionStrategyHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.ResolutionStrategyHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1178,36 +1013,29 @@ abstract class TestResolutionStrategyHostApi { } abstract class TestResolutionSelectorHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); - void create(int identifier, int? resolutionStrategyIdentifier, - int? aspectRatioStrategyIdentifier); + void create(int identifier, int? resolutionStrategyIdentifier, int? aspectRatioStrategyIdentifier); - static void setup(TestResolutionSelectorHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestResolutionSelectorHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ResolutionSelectorHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ResolutionSelectorHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.ResolutionSelectorHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.ResolutionSelectorHostApi.create was null, expected non-null int.'); final int? arg_resolutionStrategyIdentifier = (args[1] as int?); final int? arg_aspectRatioStrategyIdentifier = (args[2] as int?); - api.create(arg_identifier!, arg_resolutionStrategyIdentifier, - arg_aspectRatioStrategyIdentifier); + api.create(arg_identifier!, arg_resolutionStrategyIdentifier, arg_aspectRatioStrategyIdentifier); return []; }); } @@ -1216,27 +1044,22 @@ abstract class TestResolutionSelectorHostApi { } abstract class TestAspectRatioStrategyHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int identifier, int preferredAspectRatio, int fallbackRule); - static void setup(TestAspectRatioStrategyHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestAspectRatioStrategyHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.AspectRatioStrategyHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.AspectRatioStrategyHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.AspectRatioStrategyHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1247,8 +1070,7 @@ abstract class TestAspectRatioStrategyHostApi { final int? arg_fallbackRule = (args[2] as int?); assert(arg_fallbackRule != null, 'Argument for dev.flutter.pigeon.AspectRatioStrategyHostApi.create was null, expected non-null int.'); - api.create( - arg_identifier!, arg_preferredAspectRatio!, arg_fallbackRule!); + api.create(arg_identifier!, arg_preferredAspectRatio!, arg_fallbackRule!); return []; }); } @@ -1257,8 +1079,7 @@ abstract class TestAspectRatioStrategyHostApi { } abstract class TestImageAnalysisHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int identifier, int? resolutionSelectorId); @@ -1267,21 +1088,17 @@ abstract class TestImageAnalysisHostApi { void clearAnalyzer(int identifier); - static void setup(TestImageAnalysisHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestImageAnalysisHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ImageAnalysisHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ImageAnalysisHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.ImageAnalysisHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1297,14 +1114,11 @@ abstract class TestImageAnalysisHostApi { 'dev.flutter.pigeon.ImageAnalysisHostApi.setAnalyzer', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ImageAnalysisHostApi.setAnalyzer was null.'); + 'Argument for dev.flutter.pigeon.ImageAnalysisHostApi.setAnalyzer was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1322,14 +1136,11 @@ abstract class TestImageAnalysisHostApi { 'dev.flutter.pigeon.ImageAnalysisHostApi.clearAnalyzer', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ImageAnalysisHostApi.clearAnalyzer was null.'); + 'Argument for dev.flutter.pigeon.ImageAnalysisHostApi.clearAnalyzer was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1343,27 +1154,22 @@ abstract class TestImageAnalysisHostApi { } abstract class TestAnalyzerHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int identifier); - static void setup(TestAnalyzerHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestAnalyzerHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.AnalyzerHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.AnalyzerHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.AnalyzerHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1377,27 +1183,22 @@ abstract class TestAnalyzerHostApi { } abstract class TestObserverHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int identifier); - static void setup(TestObserverHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestObserverHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ObserverHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ObserverHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.ObserverHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1425,7 +1226,7 @@ class _TestLiveDataHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return LiveDataSupportedTypeData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -1434,8 +1235,7 @@ class _TestLiveDataHostApiCodec extends StandardMessageCodec { } abstract class TestLiveDataHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = _TestLiveDataHostApiCodec(); void observe(int identifier, int observerIdentifier); @@ -1444,21 +1244,17 @@ abstract class TestLiveDataHostApi { int? getValue(int identifier, LiveDataSupportedTypeData type); - static void setup(TestLiveDataHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestLiveDataHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.LiveDataHostApi.observe', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.LiveDataHostApi.observe was null.'); + 'Argument for dev.flutter.pigeon.LiveDataHostApi.observe was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1476,14 +1272,11 @@ abstract class TestLiveDataHostApi { 'dev.flutter.pigeon.LiveDataHostApi.removeObservers', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.LiveDataHostApi.removeObservers was null.'); + 'Argument for dev.flutter.pigeon.LiveDataHostApi.removeObservers was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1498,20 +1291,16 @@ abstract class TestLiveDataHostApi { 'dev.flutter.pigeon.LiveDataHostApi.getValue', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.LiveDataHostApi.getValue was null.'); + 'Argument for dev.flutter.pigeon.LiveDataHostApi.getValue was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.LiveDataHostApi.getValue was null, expected non-null int.'); - final LiveDataSupportedTypeData? arg_type = - (args[1] as LiveDataSupportedTypeData?); + final LiveDataSupportedTypeData? arg_type = (args[1] as LiveDataSupportedTypeData?); assert(arg_type != null, 'Argument for dev.flutter.pigeon.LiveDataHostApi.getValue was null, expected non-null LiveDataSupportedTypeData.'); final int? output = api.getValue(arg_identifier!, arg_type!); @@ -1523,29 +1312,24 @@ abstract class TestLiveDataHostApi { } abstract class TestImageProxyHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); List getPlanes(int identifier); void close(int identifier); - static void setup(TestImageProxyHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestImageProxyHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ImageProxyHostApi.getPlanes', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ImageProxyHostApi.getPlanes was null.'); + 'Argument for dev.flutter.pigeon.ImageProxyHostApi.getPlanes was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1560,14 +1344,11 @@ abstract class TestImageProxyHostApi { 'dev.flutter.pigeon.ImageProxyHostApi.close', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ImageProxyHostApi.close was null.'); + 'Argument for dev.flutter.pigeon.ImageProxyHostApi.close was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1584,9 +1365,12 @@ class _TestQualitySelectorHostApiCodec extends StandardMessageCodec { const _TestQualitySelectorHostApiCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { - if (value is ResolutionInfo) { + if (value is QualityData) { buffer.putUint8(128); writeValue(buffer, value.encode()); + } else if (value is ResolutionInfo) { + buffer.putUint8(129); + writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } @@ -1595,7 +1379,9 @@ class _TestQualitySelectorHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: + return QualityData.decode(readValue(buffer)!); + case 129: return ResolutionInfo.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -1604,42 +1390,33 @@ class _TestQualitySelectorHostApiCodec extends StandardMessageCodec { } abstract class TestQualitySelectorHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = _TestQualitySelectorHostApiCodec(); - void create(int identifier, List videoQualityConstraintIndexList, - int? fallbackStrategyId); + void create(int identifier, List videoQualityConstraintIndexList, int? fallbackStrategyId); - ResolutionInfo getResolution( - int cameraInfoId, VideoQualityConstraint quality); + ResolutionInfo getResolution(int cameraInfoId, Quality quality); - static void setup(TestQualitySelectorHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestQualitySelectorHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.QualitySelectorHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.QualitySelectorHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.QualitySelectorHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.QualitySelectorHostApi.create was null, expected non-null int.'); - final List? arg_videoQualityConstraintIndexList = - (args[1] as List?)?.cast(); + final List? arg_videoQualityConstraintIndexList = (args[1] as List?)?.cast(); assert(arg_videoQualityConstraintIndexList != null, - 'Argument for dev.flutter.pigeon.QualitySelectorHostApi.create was null, expected non-null List.'); + 'Argument for dev.flutter.pigeon.QualitySelectorHostApi.create was null, expected non-null List.'); final int? arg_fallbackStrategyId = (args[2] as int?); - api.create(arg_identifier!, arg_videoQualityConstraintIndexList!, - arg_fallbackStrategyId); + api.create(arg_identifier!, arg_videoQualityConstraintIndexList!, arg_fallbackStrategyId); return []; }); } @@ -1649,25 +1426,19 @@ abstract class TestQualitySelectorHostApi { 'dev.flutter.pigeon.QualitySelectorHostApi.getResolution', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.QualitySelectorHostApi.getResolution was null.'); + 'Argument for dev.flutter.pigeon.QualitySelectorHostApi.getResolution was null.'); final List args = (message as List?)!; final int? arg_cameraInfoId = (args[0] as int?); assert(arg_cameraInfoId != null, 'Argument for dev.flutter.pigeon.QualitySelectorHostApi.getResolution was null, expected non-null int.'); - final VideoQualityConstraint? arg_quality = args[1] == null - ? null - : VideoQualityConstraint.values[args[1] as int]; + final Quality? arg_quality = args[1] == null ? null : Quality.values[args[1] as int]; assert(arg_quality != null, - 'Argument for dev.flutter.pigeon.QualitySelectorHostApi.getResolution was null, expected non-null VideoQualityConstraint.'); - final ResolutionInfo output = - api.getResolution(arg_cameraInfoId!, arg_quality!); + 'Argument for dev.flutter.pigeon.QualitySelectorHostApi.getResolution was null, expected non-null Quality.'); + final ResolutionInfo output = api.getResolution(arg_cameraInfoId!, arg_quality!); return [output]; }); } @@ -1676,40 +1447,30 @@ abstract class TestQualitySelectorHostApi { } abstract class TestFallbackStrategyHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); - void create(int identifier, VideoQualityConstraint quality, - VideoResolutionFallbackRule fallbackRule); + void create(int identifier, Quality quality, VideoResolutionFallbackRule fallbackRule); - static void setup(TestFallbackStrategyHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestFallbackStrategyHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.FallbackStrategyHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FallbackStrategyHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.FallbackStrategyHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.FallbackStrategyHostApi.create was null, expected non-null int.'); - final VideoQualityConstraint? arg_quality = args[1] == null - ? null - : VideoQualityConstraint.values[args[1] as int]; + final Quality? arg_quality = args[1] == null ? null : Quality.values[args[1] as int]; assert(arg_quality != null, - 'Argument for dev.flutter.pigeon.FallbackStrategyHostApi.create was null, expected non-null VideoQualityConstraint.'); - final VideoResolutionFallbackRule? arg_fallbackRule = args[2] == null - ? null - : VideoResolutionFallbackRule.values[args[2] as int]; + 'Argument for dev.flutter.pigeon.FallbackStrategyHostApi.create was null, expected non-null Quality.'); + final VideoResolutionFallbackRule? arg_fallbackRule = args[2] == null ? null : VideoResolutionFallbackRule.values[args[2] as int]; assert(arg_fallbackRule != null, 'Argument for dev.flutter.pigeon.FallbackStrategyHostApi.create was null, expected non-null VideoResolutionFallbackRule.'); api.create(arg_identifier!, arg_quality!, arg_fallbackRule!); From 860b4dbb680a0e344f37f2ba6b16ec4e8e02d11a Mon Sep 17 00:00:00 2001 From: camsim99 Date: Tue, 29 Aug 2023 14:16:31 -0700 Subject: [PATCH 29/34] Replace Quality indices with VideoQuality/VideoQualityData class --- .../camerax/FallbackStrategyHostApiImpl.java | 20 +++---- .../camerax/GeneratedCameraXLibrary.java | 54 +++++++++---------- .../camerax/QualitySelectorHostApiImpl.java | 38 ++++++------- .../plugins/camerax/FallbackStrategyTest.java | 14 ++--- .../plugins/camerax/QualitySelectorTest.java | 38 ++++++------- .../lib/src/android_camera_camerax.dart | 21 ++++---- .../lib/src/camerax_library.g.dart | 30 +++++------ .../lib/src/fallback_strategy.dart | 6 +-- .../lib/src/quality_selector.dart | 21 +++----- .../lib/src/recorder.dart | 10 ++-- .../pigeons/camerax_library.dart | 12 ++--- .../test/android_camera_camerax_test.dart | 18 ++++--- .../test/fallback_strategy_test.dart | 6 +-- .../test/fallback_strategy_test.mocks.dart | 2 +- .../test/quality_selector_test.dart | 36 +++++++++---- .../test/quality_selector_test.mocks.dart | 12 ++--- .../test/recorder_test.dart | 21 +++++--- .../test/recorder_test.mocks.dart | 14 ++--- .../test/test_camerax_library.g.dart | 30 +++++------ 19 files changed, 206 insertions(+), 197 deletions(-) diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/FallbackStrategyHostApiImpl.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/FallbackStrategyHostApiImpl.java index 0309d5476a0..6322a9ead44 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/FallbackStrategyHostApiImpl.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/FallbackStrategyHostApiImpl.java @@ -9,7 +9,7 @@ import androidx.camera.video.FallbackStrategy; import androidx.camera.video.Quality; import io.flutter.plugins.camerax.GeneratedCameraXLibrary.FallbackStrategyHostApi; -import io.flutter.plugins.camerax.GeneratedCameraXLibrary.VideoQualityConstraint; +import io.flutter.plugins.camerax.GeneratedCameraXLibrary.VideoQuality; import io.flutter.plugins.camerax.GeneratedCameraXLibrary.VideoResolutionFallbackRule; /** @@ -28,20 +28,20 @@ public class FallbackStrategyHostApiImpl implements FallbackStrategyHostApi { public static class FallbackStrategyProxy { /** Creates an instance of {@link FallbackStrategy}. */ public @NonNull FallbackStrategy create( - @NonNull VideoQualityConstraint videoQualityConstraint, + @NonNull VideoQuality videoQuality, @NonNull VideoResolutionFallbackRule fallbackRule) { - Quality videoQuality = - QualitySelectorHostApiImpl.getQualityFromVideoQualityConstraint(videoQualityConstraint); + Quality quality = + QualitySelectorHostApiImpl.getQualityFromVideoQuality(videoQuality); switch (fallbackRule) { case HIGHER_QUALITY_OR_LOWER_THAN: - return FallbackStrategy.higherQualityOrLowerThan(videoQuality); + return FallbackStrategy.higherQualityOrLowerThan(quality); case HIGHER_QUALITY_THAN: - return FallbackStrategy.higherQualityThan(videoQuality); + return FallbackStrategy.higherQualityThan(quality); case LOWER_QUALITY_OR_HIGHER_THAN: - return FallbackStrategy.lowerQualityOrHigherThan(videoQuality); + return FallbackStrategy.lowerQualityOrHigherThan(quality); case LOWER_QUALITY_THAN: - return FallbackStrategy.lowerQualityThan(videoQuality); + return FallbackStrategy.lowerQualityThan(quality); } throw new IllegalArgumentException( "Specified fallback rule " + fallbackRule + " unrecognized."); @@ -75,9 +75,9 @@ public FallbackStrategyHostApiImpl(@NonNull InstanceManager instanceManager) { @Override public void create( @NonNull Long identifier, - @NonNull VideoQualityConstraint videoQualityConstraint, + @NonNull VideoQuality videoQuality, @NonNull VideoResolutionFallbackRule fallbackRule) { instanceManager.addDartCreatedInstance( - proxy.create(videoQualityConstraint, fallbackRule), identifier); + proxy.create(videoQuality, fallbackRule), identifier); } } diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/GeneratedCameraXLibrary.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/GeneratedCameraXLibrary.java index d742dc41ad3..60c633f2f3f 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/GeneratedCameraXLibrary.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/GeneratedCameraXLibrary.java @@ -116,7 +116,7 @@ private LiveDataSupportedType(final int index) { * * See https://developer.android.com/reference/androidx/camera/video/Quality. */ - public enum Quality { + public enum VideoQuality { SD(0), HD(1), FHD(2), @@ -126,7 +126,7 @@ public enum Quality { final int index; - private Quality(final int index) { + private VideoQuality(final int index) { this.index = index; } } @@ -471,14 +471,14 @@ ArrayList toList() { * * Generated class from Pigeon that represents data sent in messages. */ - public static final class QualityData { - private @NonNull Quality quality; + public static final class VideoQualityData { + private @NonNull VideoQuality quality; - public @NonNull Quality getQuality() { + public @NonNull VideoQuality getQuality() { return quality; } - public void setQuality(@NonNull Quality setterArg) { + public void setQuality(@NonNull VideoQuality setterArg) { if (setterArg == null) { throw new IllegalStateException("Nonnull field \"quality\" is null."); } @@ -486,19 +486,19 @@ public void setQuality(@NonNull Quality setterArg) { } /** Constructor is non-public to enforce null safety; use Builder. */ - QualityData() {} + VideoQualityData() {} public static final class Builder { - private @Nullable Quality quality; + private @Nullable VideoQuality quality; - public @NonNull Builder setQuality(@NonNull Quality setterArg) { + public @NonNull Builder setQuality(@NonNull VideoQuality setterArg) { this.quality = setterArg; return this; } - public @NonNull QualityData build() { - QualityData pigeonReturn = new QualityData(); + public @NonNull VideoQualityData build() { + VideoQualityData pigeonReturn = new VideoQualityData(); pigeonReturn.setQuality(quality); return pigeonReturn; } @@ -511,10 +511,10 @@ ArrayList toList() { return toListResult; } - static @NonNull QualityData fromList(@NonNull ArrayList list) { - QualityData pigeonResult = new QualityData(); + static @NonNull VideoQualityData fromList(@NonNull ArrayList list) { + VideoQualityData pigeonResult = new VideoQualityData(); Object quality = list.get(0); - pigeonResult.setQuality(quality == null ? null : Quality.values()[(int) quality]); + pigeonResult.setQuality(quality == null ? null : VideoQuality.values()[(int) quality]); return pigeonResult; } } @@ -2823,9 +2823,9 @@ private QualitySelectorHostApiCodec() {} protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { switch (type) { case (byte) 128: - return QualityData.fromList((ArrayList) readValue(buffer)); - case (byte) 129: return ResolutionInfo.fromList((ArrayList) readValue(buffer)); + case (byte) 129: + return VideoQualityData.fromList((ArrayList) readValue(buffer)); default: return super.readValueOfType(type, buffer); } @@ -2833,12 +2833,12 @@ protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { @Override protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { - if (value instanceof QualityData) { + if (value instanceof ResolutionInfo) { stream.write(128); - writeValue(stream, ((QualityData) value).toList()); - } else if (value instanceof ResolutionInfo) { - stream.write(129); writeValue(stream, ((ResolutionInfo) value).toList()); + } else if (value instanceof VideoQualityData) { + stream.write(129); + writeValue(stream, ((VideoQualityData) value).toList()); } else { super.writeValue(stream, value); } @@ -2848,10 +2848,10 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface QualitySelectorHostApi { - void create(@NonNull Long identifier, @NonNull List videoQualityConstraintIndexList, @Nullable Long fallbackStrategyId); + void create(@NonNull Long identifier, @NonNull List videoQualityDataList, @Nullable Long fallbackStrategyId); @NonNull - ResolutionInfo getResolution(@NonNull Long cameraInfoId, @NonNull Quality quality); + ResolutionInfo getResolution(@NonNull Long cameraInfoId, @NonNull VideoQuality quality); /** The codec used by QualitySelectorHostApi. */ static @NonNull MessageCodec getCodec() { @@ -2869,10 +2869,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable QualitySel ArrayList wrapped = new ArrayList(); ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); - List videoQualityConstraintIndexListArg = (List) args.get(1); + List videoQualityDataListArg = (List) args.get(1); Number fallbackStrategyIdArg = (Number) args.get(2); try { - api.create((identifierArg == null) ? null : identifierArg.longValue(), videoQualityConstraintIndexListArg, (fallbackStrategyIdArg == null) ? null : fallbackStrategyIdArg.longValue()); + api.create((identifierArg == null) ? null : identifierArg.longValue(), videoQualityDataListArg, (fallbackStrategyIdArg == null) ? null : fallbackStrategyIdArg.longValue()); wrapped.add(0, null); } catch (Throwable exception) { @@ -2895,7 +2895,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable QualitySel ArrayList wrapped = new ArrayList(); ArrayList args = (ArrayList) message; Number cameraInfoIdArg = (Number) args.get(0); - Quality qualityArg = args.get(1) == null ? null : Quality.values()[(int) args.get(1)]; + VideoQuality qualityArg = args.get(1) == null ? null : VideoQuality.values()[(int) args.get(1)]; try { ResolutionInfo output = api.getResolution((cameraInfoIdArg == null) ? null : cameraInfoIdArg.longValue(), qualityArg); wrapped.add(0, output); @@ -2915,7 +2915,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable QualitySel /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface FallbackStrategyHostApi { - void create(@NonNull Long identifier, @NonNull Quality quality, @NonNull VideoResolutionFallbackRule fallbackRule); + void create(@NonNull Long identifier, @NonNull VideoQuality quality, @NonNull VideoResolutionFallbackRule fallbackRule); /** The codec used by FallbackStrategyHostApi. */ static @NonNull MessageCodec getCodec() { @@ -2933,7 +2933,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable FallbackSt ArrayList wrapped = new ArrayList(); ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); - Quality qualityArg = args.get(1) == null ? null : Quality.values()[(int) args.get(1)]; + VideoQuality qualityArg = args.get(1) == null ? null : VideoQuality.values()[(int) args.get(1)]; VideoResolutionFallbackRule fallbackRuleArg = args.get(2) == null ? null : VideoResolutionFallbackRule.values()[(int) args.get(2)]; try { api.create((identifierArg == null) ? null : identifierArg.longValue(), qualityArg, fallbackRuleArg); diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/QualitySelectorHostApiImpl.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/QualitySelectorHostApiImpl.java index e04afd64d7f..330c09047ce 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/QualitySelectorHostApiImpl.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/QualitySelectorHostApiImpl.java @@ -11,9 +11,10 @@ import androidx.camera.video.FallbackStrategy; import androidx.camera.video.Quality; import androidx.camera.video.QualitySelector; +import io.flutter.plugins.camerax.GeneratedCameraXLibrary.VideoQuality; +import io.flutter.plugins.camerax.GeneratedCameraXLibrary.VideoQualityData; import io.flutter.plugins.camerax.GeneratedCameraXLibrary.QualitySelectorHostApi; import io.flutter.plugins.camerax.GeneratedCameraXLibrary.ResolutionInfo; -import io.flutter.plugins.camerax.GeneratedCameraXLibrary.VideoQualityConstraint; import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -34,13 +35,12 @@ public class QualitySelectorHostApiImpl implements QualitySelectorHostApi { public static class QualitySelectorProxy { /** Creates an instance of {@link QualitySelector}. */ public @NonNull QualitySelector create( - @NonNull List videoQualityConstraintIndexList, + @NonNull List videoQualityDataList, @Nullable FallbackStrategy fallbackStrategy) { - // Convert each index of VideoQualityConstraint to Quality. + // Convert each index of VideoQuality to Quality. List qualityList = new ArrayList(); - for (int i = 0; i < videoQualityConstraintIndexList.size(); i++) { - int qualityIndex = ((Number) videoQualityConstraintIndexList.get(i)).intValue(); - qualityList.add(getQualityConstant(qualityIndex)); + for (VideoQualityData videoQualityData : videoQualityDataList) { + qualityList.add(getQualityFromVideoQuality(videoQualityData.getQuality())); } boolean fallbackStrategySpecified = fallbackStrategy != null; @@ -58,12 +58,6 @@ public static class QualitySelectorProxy { ? QualitySelector.fromOrderedList(qualityList, fallbackStrategy) : QualitySelector.fromOrderedList(qualityList); } - - /** Converts from index of {@link VideoQualityConstraint} to {@link Quality}. */ - private Quality getQualityConstant(@NonNull int qualityIndex) { - VideoQualityConstraint quality = VideoQualityConstraint.values()[qualityIndex]; - return getQualityFromVideoQualityConstraint(quality); - } } /** @@ -94,11 +88,11 @@ public QualitySelectorHostApiImpl(@NonNull InstanceManager instanceManager) { @Override public void create( @NonNull Long identifier, - @NonNull List videoQualityConstraintIndexList, + @NonNull List videoQualityDataList, @Nullable Long fallbackStrategyIdentifier) { instanceManager.addDartCreatedInstance( proxy.create( - videoQualityConstraintIndexList, + videoQualityDataList, fallbackStrategyIdentifier == null ? null : Objects.requireNonNull(instanceManager.getInstance(fallbackStrategyIdentifier))), @@ -111,11 +105,11 @@ public void create( */ @Override public @NonNull ResolutionInfo getResolution( - @NonNull Long cameraInfoIdentifier, @NonNull VideoQualityConstraint quality) { + @NonNull Long cameraInfoIdentifier, @NonNull VideoQuality quality) { final Size result = QualitySelector.getResolution( Objects.requireNonNull(instanceManager.getInstance(cameraInfoIdentifier)), - getQualityFromVideoQualityConstraint(quality)); + getQualityFromVideoQuality(quality)); return new ResolutionInfo.Builder() .setWidth(Long.valueOf(result.getWidth())) .setHeight(Long.valueOf(result.getHeight())) @@ -123,12 +117,12 @@ public void create( } /** - * Converts the specified {@link VideoQualityConstraint} to a {@link Quality} that is understood + * Converts the specified {@link VideoQuality to a {@link Quality} that is understood * by CameraX. */ - public static @NonNull Quality getQualityFromVideoQualityConstraint( - @NonNull VideoQualityConstraint videoQualityConstraint) { - switch (videoQualityConstraint) { + public static @NonNull Quality getQualityFromVideoQuality( + @NonNull VideoQuality videoQuality) { + switch (videoQuality) { case SD: return Quality.SD; case HD: @@ -143,8 +137,8 @@ public void create( return Quality.HIGHEST; } throw new IllegalArgumentException( - "VideoQualityConstraint " - + videoQualityConstraint + "VideoQuality " + + videoQuality + " is unhandled by QualitySelectorHostApiImpl."); } } diff --git a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/FallbackStrategyTest.java b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/FallbackStrategyTest.java index 4a2eeef7f13..da502edec98 100644 --- a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/FallbackStrategyTest.java +++ b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/FallbackStrategyTest.java @@ -11,7 +11,7 @@ import androidx.camera.video.FallbackStrategy; import androidx.camera.video.Quality; -import io.flutter.plugins.camerax.GeneratedCameraXLibrary.VideoQualityConstraint; +import io.flutter.plugins.camerax.GeneratedCameraXLibrary.VideoQuality; import io.flutter.plugins.camerax.GeneratedCameraXLibrary.VideoResolutionFallbackRule; import org.junit.After; import org.junit.Before; @@ -48,11 +48,11 @@ public void hostApiCreate_makesCallToCreateExpectedFallbackStrategy() { try (MockedStatic mockedFallbackStrategy = mockStatic(FallbackStrategy.class)) { - for (VideoQualityConstraint videoQualityConstraint : VideoQualityConstraint.values()) { + for (VideoQuality videoQuality : VideoQuality.values()) { for (VideoResolutionFallbackRule fallbackRule : VideoResolutionFallbackRule.values()) { - // Determine expected Quality based on videoQualityConstraint being tested. + // Determine expected Quality based on videoQuality being tested. Quality convertedQuality = null; - switch (videoQualityConstraint) { + switch (videoQuality) { case SD: convertedQuality = Quality.SD; break; @@ -73,8 +73,8 @@ public void hostApiCreate_makesCallToCreateExpectedFallbackStrategy() { break; default: fail( - "The VideoQualityConstraint " - + videoQualityConstraint.toString() + "The VideoQuality " + + videoQuality.toString() + "is unhandled by this test."); } // Set Quality as final local variable to avoid error about using non-final (or effecitvely final) local variables in lambda expressions. @@ -108,7 +108,7 @@ public void hostApiCreate_makesCallToCreateExpectedFallbackStrategy() { + fallbackRule.toString() + "is unhandled by this test."); } - hostApi.create(instanceIdentifier, videoQualityConstraint, fallbackRule); + hostApi.create(instanceIdentifier, videoQuality, fallbackRule); assertEquals(instanceManager.getInstance(instanceIdentifier), mockFallbackStrategy); // Clear/reset FallbackStrategy mock and InstanceManager. diff --git a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/QualitySelectorTest.java b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/QualitySelectorTest.java index 55195831f98..78c38f07ebe 100644 --- a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/QualitySelectorTest.java +++ b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/QualitySelectorTest.java @@ -14,7 +14,8 @@ import androidx.camera.video.Quality; import androidx.camera.video.QualitySelector; import io.flutter.plugins.camerax.GeneratedCameraXLibrary.ResolutionInfo; -import io.flutter.plugins.camerax.GeneratedCameraXLibrary.VideoQualityConstraint; +import io.flutter.plugins.camerax.GeneratedCameraXLibrary.VideoQuality; +import io.flutter.plugins.camerax.GeneratedCameraXLibrary.VideoQualityData; import java.util.Arrays; import java.util.List; import org.junit.After; @@ -47,10 +48,10 @@ public void tearDown() { @Test public void hostApiCreate_createsExpectedQualitySelectorWhenOneQualitySpecified() { - final Long expectedVideoQualityConstraintIndex = - Long.valueOf(VideoQualityConstraint.UHD.ordinal()); - final List videoQualityConstraintList = - Arrays.asList(expectedVideoQualityConstraintIndex); + final VideoQualityData expectedVideoQualityData = + new VideoQualityData.Builder().setQuality(VideoQuality.UHD).build(); + final List videoQualityDataList = + Arrays.asList(expectedVideoQualityData); final FallbackStrategy mockFallbackStrategy = mock(FallbackStrategy.class); final long fallbackStrategyIdentifier = 9; final QualitySelectorHostApiImpl hostApi = new QualitySelectorHostApiImpl(instanceManager); @@ -69,7 +70,7 @@ public void hostApiCreate_createsExpectedQualitySelectorWhenOneQualitySpecified( // Test with no fallback strategy. long instanceIdentifier = 0; - hostApi.create(instanceIdentifier, videoQualityConstraintList, null); + hostApi.create(instanceIdentifier, videoQualityDataList, null); assertEquals( instanceManager.getInstance(instanceIdentifier), @@ -77,7 +78,7 @@ public void hostApiCreate_createsExpectedQualitySelectorWhenOneQualitySpecified( // Test with fallback strategy. instanceIdentifier = 1; - hostApi.create(instanceIdentifier, videoQualityConstraintList, fallbackStrategyIdentifier); + hostApi.create(instanceIdentifier, videoQualityDataList, fallbackStrategyIdentifier); assertEquals( instanceManager.getInstance(instanceIdentifier), mockQualitySelectorWithFallbackStrategy); @@ -86,13 +87,12 @@ public void hostApiCreate_createsExpectedQualitySelectorWhenOneQualitySpecified( @Test public void hostApiCreate_createsExpectedQualitySelectorWhenOrderedListOfQualitiesSpecified() { - final List expectedIndices = + final List videoQualityDataList = Arrays.asList( - Long.valueOf(VideoQualityConstraint.UHD.ordinal()), - Long.valueOf(VideoQualityConstraint.HIGHEST.ordinal())); - final List videoQualityConstraintList = - Arrays.asList(VideoQualityConstraint.UHD, VideoQualityConstraint.HIGHEST); - final List expectedVideoQualityConstraintList = + new VideoQualityData.Builder().setQuality(VideoQuality.UHD).build(), + new VideoQualityData.Builder().setQuality(VideoQuality.HIGHEST).build() + ); + final List expectedVideoQualityList = Arrays.asList(Quality.UHD, Quality.HIGHEST); final FallbackStrategy mockFallbackStrategy = mock(FallbackStrategy.class); final long fallbackStrategyIdentifier = 9; @@ -102,20 +102,20 @@ public void hostApiCreate_createsExpectedQualitySelectorWhenOrderedListOfQualiti try (MockedStatic mockedQualitySelector = mockStatic(QualitySelector.class)) { mockedQualitySelector - .when(() -> QualitySelector.fromOrderedList(expectedVideoQualityConstraintList)) + .when(() -> QualitySelector.fromOrderedList(expectedVideoQualityList)) .thenAnswer( (Answer) invocation -> mockQualitySelectorWithoutFallbackStrategy); mockedQualitySelector .when( () -> QualitySelector.fromOrderedList( - expectedVideoQualityConstraintList, mockFallbackStrategy)) + expectedVideoQualityList, mockFallbackStrategy)) .thenAnswer( (Answer) invocation -> mockQualitySelectorWithFallbackStrategy); // Test with no fallback strategy. long instanceIdentifier = 0; - hostApi.create(instanceIdentifier, expectedIndices, null); + hostApi.create(instanceIdentifier, videoQualityDataList, null); assertEquals( instanceManager.getInstance(instanceIdentifier), @@ -123,7 +123,7 @@ public void hostApiCreate_createsExpectedQualitySelectorWhenOrderedListOfQualiti // Test with fallback strategy. instanceIdentifier = 1; - hostApi.create(instanceIdentifier, expectedIndices, fallbackStrategyIdentifier); + hostApi.create(instanceIdentifier, videoQualityDataList, fallbackStrategyIdentifier); assertEquals( instanceManager.getInstance(instanceIdentifier), mockQualitySelectorWithFallbackStrategy); @@ -134,7 +134,7 @@ public void hostApiCreate_createsExpectedQualitySelectorWhenOrderedListOfQualiti public void getResolution_returnsExpectedResolutionInfo() { final CameraInfo mockCameraInfo = mock(CameraInfo.class); final long cameraInfoIdentifier = 6; - final VideoQualityConstraint videoQualityConstraint = VideoQualityConstraint.FHD; + final VideoQuality videoQuality = VideoQuality.FHD; final Size sizeResult = new Size(30, 40); final QualitySelectorHostApiImpl hostApi = new QualitySelectorHostApiImpl(instanceManager); @@ -146,7 +146,7 @@ public void getResolution_returnsExpectedResolutionInfo() { .thenAnswer((Answer) invocation -> sizeResult); final ResolutionInfo result = - hostApi.getResolution(cameraInfoIdentifier, videoQualityConstraint); + hostApi.getResolution(cameraInfoIdentifier, videoQuality); assertEquals(result.getWidth(), Long.valueOf(sizeResult.getWidth())); assertEquals(result.getHeight(), Long.valueOf(sizeResult.getHeight())); diff --git a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart index c6f916ce01f..2e12943a442 100644 --- a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart +++ b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart @@ -842,24 +842,24 @@ class AndroidCameraCameraX extends CameraPlatform { /// If the specified [preset] is unavailable, the camera will fall back to the /// closest lower resolution available. QualitySelector? _getQualitySelectorFromPreset(ResolutionPreset? preset) { - VideoQualityConstraint? videoQuality; + VideoQuality? videoQuality; switch (preset) { case ResolutionPreset.low: // 240p is not supported by CameraX. case ResolutionPreset.medium: - videoQuality = VideoQualityConstraint.SD; + videoQuality = VideoQuality.SD; break; case ResolutionPreset.high: - videoQuality = VideoQualityConstraint.HD; + videoQuality = VideoQuality.HD; break; case ResolutionPreset.veryHigh: - videoQuality = VideoQualityConstraint.FHD; + videoQuality = VideoQuality.FHD; break; case ResolutionPreset.ultraHigh: - videoQuality = VideoQualityConstraint.UHD; + videoQuality = VideoQuality.UHD; break; case ResolutionPreset.max: - videoQuality = VideoQualityConstraint.highest; + videoQuality = VideoQuality.highest; break; case null: // If not preset is specified, default to CameraX's default behavior @@ -879,11 +879,12 @@ class AndroidCameraCameraX extends CameraPlatform { quality: videoQuality, fallbackRule: fallbackRule); return _shouldCreateDetachedObjectForTesting - ? QualitySelector.detached( - qualityList: [videoQuality], - fallbackStrategy: fallbackStrategy) + ? QualitySelector.detached(qualityList: [ + VideoQualityData(quality: videoQuality) + ], fallbackStrategy: fallbackStrategy) : QualitySelector.from( - quality: videoQuality, fallbackStrategy: fallbackStrategy); + quality: VideoQualityData(quality: videoQuality), + fallbackStrategy: fallbackStrategy); } // Methods for calls that need to be tested: diff --git a/packages/camera/camera_android_camerax/lib/src/camerax_library.g.dart b/packages/camera/camera_android_camerax/lib/src/camerax_library.g.dart index c4e418759bd..b0e9b4dffd1 100644 --- a/packages/camera/camera_android_camerax/lib/src/camerax_library.g.dart +++ b/packages/camera/camera_android_camerax/lib/src/camerax_library.g.dart @@ -49,7 +49,7 @@ enum LiveDataSupportedType { /// These are pre-defined quality constants that are universally used for video. /// /// See https://developer.android.com/reference/androidx/camera/video/Quality. -enum Quality { +enum VideoQuality { SD, HD, FHD, @@ -189,12 +189,12 @@ class ExposureCompensationRange { } /// Convenience class for sending lists of [Quality]s. -class QualityData { - QualityData({ +class VideoQualityData { + VideoQualityData({ required this.quality, }); - Quality quality; + VideoQuality quality; Object encode() { return [ @@ -202,10 +202,10 @@ class QualityData { ]; } - static QualityData decode(Object result) { + static VideoQualityData decode(Object result) { result as List; - return QualityData( - quality: Quality.values[result[0]! as int], + return VideoQualityData( + quality: VideoQuality.values[result[0]! as int], ); } } @@ -2437,10 +2437,10 @@ class _QualitySelectorHostApiCodec extends StandardMessageCodec { const _QualitySelectorHostApiCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { - if (value is QualityData) { + if (value is ResolutionInfo) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else if (value is ResolutionInfo) { + } else if (value is VideoQualityData) { buffer.putUint8(129); writeValue(buffer, value.encode()); } else { @@ -2452,9 +2452,9 @@ class _QualitySelectorHostApiCodec extends StandardMessageCodec { Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { case 128: - return QualityData.decode(readValue(buffer)!); - case 129: return ResolutionInfo.decode(readValue(buffer)!); + case 129: + return VideoQualityData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); } @@ -2471,12 +2471,12 @@ class QualitySelectorHostApi { static const MessageCodec codec = _QualitySelectorHostApiCodec(); - Future create(int arg_identifier, List arg_videoQualityConstraintIndexList, int? arg_fallbackStrategyId) async { + Future create(int arg_identifier, List arg_videoQualityDataList, int? arg_fallbackStrategyId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.QualitySelectorHostApi.create', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_identifier, arg_videoQualityConstraintIndexList, arg_fallbackStrategyId]) as List?; + await channel.send([arg_identifier, arg_videoQualityDataList, arg_fallbackStrategyId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2493,7 +2493,7 @@ class QualitySelectorHostApi { } } - Future getResolution(int arg_cameraInfoId, Quality arg_quality) async { + Future getResolution(int arg_cameraInfoId, VideoQuality arg_quality) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.QualitySelectorHostApi.getResolution', codec, binaryMessenger: _binaryMessenger); @@ -2531,7 +2531,7 @@ class FallbackStrategyHostApi { static const MessageCodec codec = StandardMessageCodec(); - Future create(int arg_identifier, Quality arg_quality, VideoResolutionFallbackRule arg_fallbackRule) async { + Future create(int arg_identifier, VideoQuality arg_quality, VideoResolutionFallbackRule arg_fallbackRule) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.FallbackStrategyHostApi.create', codec, binaryMessenger: _binaryMessenger); diff --git a/packages/camera/camera_android_camerax/lib/src/fallback_strategy.dart b/packages/camera/camera_android_camerax/lib/src/fallback_strategy.dart index ee098fafd14..ad2589dae72 100644 --- a/packages/camera/camera_android_camerax/lib/src/fallback_strategy.dart +++ b/packages/camera/camera_android_camerax/lib/src/fallback_strategy.dart @@ -40,7 +40,7 @@ class FallbackStrategy extends JavaObject { late final _FallbackStrategyHostApiImpl _api; /// The input quality used to specify this fallback strategy relative to. - final VideoQualityConstraint quality; + final VideoQuality quality; /// The fallback rule that this strategy will follow. final VideoResolutionFallbackRule fallbackRule; @@ -72,9 +72,7 @@ class _FallbackStrategyHostApiImpl extends FallbackStrategyHostApi { /// Creates a [FallbackStrategy] instance with the specified video [quality] /// and [fallbackRule]. - void createFromInstance( - FallbackStrategy instance, - VideoQualityConstraint quality, + void createFromInstance(FallbackStrategy instance, VideoQuality quality, VideoResolutionFallbackRule fallbackRule) { final int identifier = instanceManager.addDartCreatedInstance(instance, onCopy: (FallbackStrategy original) { diff --git a/packages/camera/camera_android_camerax/lib/src/quality_selector.dart b/packages/camera/camera_android_camerax/lib/src/quality_selector.dart index 303d4aecaf5..6daff7d0682 100644 --- a/packages/camera/camera_android_camerax/lib/src/quality_selector.dart +++ b/packages/camera/camera_android_camerax/lib/src/quality_selector.dart @@ -22,9 +22,9 @@ class QualitySelector extends JavaObject { QualitySelector.from( {BinaryMessenger? binaryMessenger, InstanceManager? instanceManager, - required VideoQualityConstraint quality, + required VideoQualityData quality, this.fallbackStrategy}) - : qualityList = [quality], + : qualityList = [quality], super.detached( binaryMessenger: binaryMessenger, instanceManager: instanceManager) { @@ -65,7 +65,7 @@ class QualitySelector extends JavaObject { late final _QualitySelectorHostApiImpl _api; /// Desired qualities for this selector instance. - final List qualityList; + final List qualityList; /// Desired fallback strategy for this selector instance. final FallbackStrategy? fallbackStrategy; @@ -73,7 +73,7 @@ class QualitySelector extends JavaObject { /// Retrieves the corresponding resolution from the input [quality] for the /// camera represented by [cameraInfo]. static Future getResolution( - CameraInfo cameraInfo, VideoQualityConstraint quality, + CameraInfo cameraInfo, VideoQuality quality, {BinaryMessenger? binaryMessenger, InstanceManager? instanceManager}) { final _QualitySelectorHostApiImpl api = _QualitySelectorHostApiImpl( binaryMessenger: binaryMessenger, instanceManager: instanceManager); @@ -107,10 +107,8 @@ class _QualitySelectorHostApiImpl extends QualitySelectorHostApi { /// Creates a [QualitySelector] instance with the desired qualities and /// fallback strategy specified. - void createFromInstance( - QualitySelector instance, - List qualityList, - FallbackStrategy? fallbackStrategy) { + void createFromInstance(QualitySelector instance, + List qualityList, FallbackStrategy? fallbackStrategy) { final int identifier = instanceManager.addDartCreatedInstance(instance, onCopy: (QualitySelector original) { return QualitySelector.detached( @@ -120,13 +118,10 @@ class _QualitySelectorHostApiImpl extends QualitySelectorHostApi { fallbackStrategy: original.fallbackStrategy, ); }); - final List qualityIndices = qualityList - .map((VideoQualityConstraint quality) => quality.index) - .toList(); create( identifier, - qualityIndices, + qualityList, fallbackStrategy == null ? null : instanceManager.getIdentifier(fallbackStrategy)); @@ -135,7 +130,7 @@ class _QualitySelectorHostApiImpl extends QualitySelectorHostApi { /// Retrieves the corresponding resolution from the input [quality] for the /// camera represented by [cameraInfo]. Future getResolutionFromInstance( - CameraInfo cameraInfo, VideoQualityConstraint quality) async { + CameraInfo cameraInfo, VideoQuality quality) async { final int? cameraInfoIdentifier = instanceManager.getIdentifier(cameraInfo); if (cameraInfoIdentifier == null) { diff --git a/packages/camera/camera_android_camerax/lib/src/recorder.dart b/packages/camera/camera_android_camerax/lib/src/recorder.dart index 13953621552..1fd93ec1b6e 100644 --- a/packages/camera/camera_android_camerax/lib/src/recorder.dart +++ b/packages/camera/camera_android_camerax/lib/src/recorder.dart @@ -59,13 +59,13 @@ class Recorder extends JavaObject { return QualitySelector.fromOrderedList( binaryMessenger: binaryMessenger, instanceManager: instanceManager, - qualityList: const [ - VideoQualityConstraint.FHD, - VideoQualityConstraint.HD, - VideoQualityConstraint.SD + qualityList: [ + VideoQualityData(quality: VideoQuality.FHD), + VideoQualityData(quality: VideoQuality.HD), + VideoQualityData(quality: VideoQuality.SD), ], fallbackStrategy: FallbackStrategy( - quality: VideoQualityConstraint.FHD, + quality: VideoQuality.FHD, fallbackRule: VideoResolutionFallbackRule.higherQualityOrLowerThan), ); } diff --git a/packages/camera/camera_android_camerax/pigeons/camerax_library.dart b/packages/camera/camera_android_camerax/pigeons/camerax_library.dart index 47537c94812..9ebf34b73be 100644 --- a/packages/camera/camera_android_camerax/pigeons/camerax_library.dart +++ b/packages/camera/camera_android_camerax/pigeons/camerax_library.dart @@ -102,7 +102,7 @@ class ExposureCompensationRange { /// These are pre-defined quality constants that are universally used for video. /// /// See https://developer.android.com/reference/androidx/camera/video/Quality. -enum Quality { +enum VideoQuality { SD, // 480p HD, // 720p FHD, // 1080p @@ -112,8 +112,8 @@ enum Quality { } /// Convenience class for sending lists of [Quality]s. -class QualityData { - late Quality quality; +class VideoQualityData { + late VideoQuality quality; } /// Fallback rules for selecting video resolution. @@ -406,14 +406,14 @@ abstract class PlaneProxyFlutterApi { @HostApi(dartHostTestHandler: 'TestQualitySelectorHostApi') abstract class QualitySelectorHostApi { - void create(int identifier, List videoQualityConstraintIndexList, + void create(int identifier, List videoQualityDataList, int? fallbackStrategyId); - ResolutionInfo getResolution(int cameraInfoId, Quality quality); + ResolutionInfo getResolution(int cameraInfoId, VideoQuality quality); } @HostApi(dartHostTestHandler: 'TestFallbackStrategyHostApi') abstract class FallbackStrategyHostApi { - void create(int identifier, Quality quality, + void create(int identifier, VideoQuality quality, VideoResolutionFallbackRule fallbackRule); } diff --git a/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart b/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart index 82820f56728..cc1f6aa5c40 100644 --- a/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart +++ b/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart @@ -407,24 +407,24 @@ void main() { await camera.createCamera(testCameraDescription, resolutionPreset, enableAudio: enableAudio); - VideoQualityConstraint? expectedVideoQuality; + VideoQuality? expectedVideoQuality; switch (resolutionPreset) { case ResolutionPreset.low: // 240p is not supported by CameraX. case ResolutionPreset.medium: - expectedVideoQuality = VideoQualityConstraint.SD; + expectedVideoQuality = VideoQuality.SD; break; case ResolutionPreset.high: - expectedVideoQuality = VideoQualityConstraint.HD; + expectedVideoQuality = VideoQuality.HD; break; case ResolutionPreset.veryHigh: - expectedVideoQuality = VideoQualityConstraint.FHD; + expectedVideoQuality = VideoQuality.FHD; break; case ResolutionPreset.ultraHigh: - expectedVideoQuality = VideoQualityConstraint.UHD; + expectedVideoQuality = VideoQuality.UHD; break; case ResolutionPreset.max: - expectedVideoQuality = VideoQualityConstraint.highest; + expectedVideoQuality = VideoQuality.highest; break; } @@ -435,8 +435,10 @@ void main() { quality: expectedVideoQuality, fallbackRule: expectedFallbackRule); - expect(camera.recorder!.qualitySelector!.qualityList, - equals([expectedVideoQuality])); + expect(camera.recorder!.qualitySelector!.qualityList.length, + equals(1)); + expect(camera.recorder!.qualitySelector!.qualityList.first.quality, + equals(expectedVideoQuality)); expect(camera.recorder!.qualitySelector!.fallbackStrategy!.quality, equals(expectedFallbackStrategy.quality)); expect(camera.recorder!.qualitySelector!.fallbackStrategy!.fallbackRule, diff --git a/packages/camera/camera_android_camerax/test/fallback_strategy_test.dart b/packages/camera/camera_android_camerax/test/fallback_strategy_test.dart index 8c6960c082c..f54e40df62d 100644 --- a/packages/camera/camera_android_camerax/test/fallback_strategy_test.dart +++ b/packages/camera/camera_android_camerax/test/fallback_strategy_test.dart @@ -33,14 +33,14 @@ void main() { ); FallbackStrategy.detached( - quality: VideoQualityConstraint.UHD, + quality: VideoQuality.UHD, fallbackRule: VideoResolutionFallbackRule.higherQualityThan, instanceManager: instanceManager, ); verifyNever(mockApi.create( argThat(isA()), - argThat(isA()), + argThat(isA()), argThat(isA()), )); }); @@ -55,7 +55,7 @@ void main() { onWeakReferenceRemoved: (_) {}, ); - const VideoQualityConstraint quality = VideoQualityConstraint.HD; + const VideoQuality quality = VideoQuality.HD; const VideoResolutionFallbackRule fallbackRule = VideoResolutionFallbackRule.lowerQualityThan; diff --git a/packages/camera/camera_android_camerax/test/fallback_strategy_test.mocks.dart b/packages/camera/camera_android_camerax/test/fallback_strategy_test.mocks.dart index 02d185a7222..8ba811c7b46 100644 --- a/packages/camera/camera_android_camerax/test/fallback_strategy_test.mocks.dart +++ b/packages/camera/camera_android_camerax/test/fallback_strategy_test.mocks.dart @@ -33,7 +33,7 @@ class MockTestFallbackStrategyHostApi extends _i1.Mock @override void create( int? identifier, - _i3.VideoQualityConstraint? quality, + _i3.VideoQuality? quality, _i3.VideoResolutionFallbackRule? fallbackRule, ) => super.noSuchMethod( diff --git a/packages/camera/camera_android_camerax/test/quality_selector_test.dart b/packages/camera/camera_android_camerax/test/quality_selector_test.dart index 8c05aa7be43..bfaa568c254 100644 --- a/packages/camera/camera_android_camerax/test/quality_selector_test.dart +++ b/packages/camera/camera_android_camerax/test/quality_selector_test.dart @@ -41,7 +41,9 @@ void main() { ); QualitySelector.detached( - qualityList: const [VideoQualityConstraint.FHD], + qualityList: [ + VideoQualityData(quality: VideoQuality.UHD) + ], fallbackStrategy: MockFallbackStrategy(), instanceManager: instanceManager, ); @@ -60,7 +62,8 @@ void main() { onWeakReferenceRemoved: (_) {}, ); - const VideoQualityConstraint quality = VideoQualityConstraint.FHD; + const VideoQuality videoQuality = VideoQuality.FHD; + final VideoQualityData quality = VideoQualityData(quality: videoQuality); final FallbackStrategy fallbackStrategy = MockFallbackStrategy(); const int fallbackStrategyIdentifier = 9; @@ -76,11 +79,15 @@ void main() { instanceManager: instanceManager, ); - verify(mockApi.create( + final VerificationResult verificationResult = verify(mockApi.create( instanceManager.getIdentifier(instance), - [2], + captureAny, fallbackStrategyIdentifier, )); + final List videoQualityData = + verificationResult.captured.single as List; + expect(videoQualityData.length, equals(1)); + expect(videoQualityData.first!.quality, equals(videoQuality)); }); test('quality list constructor calls create on the Java side', () { @@ -93,9 +100,9 @@ void main() { onWeakReferenceRemoved: (_) {}, ); - const List qualityList = [ - VideoQualityConstraint.FHD, - VideoQualityConstraint.highest + final List qualityList = [ + VideoQualityData(quality: VideoQuality.FHD), + VideoQualityData(quality: VideoQuality.highest), ]; final FallbackStrategy fallbackStrategy = MockFallbackStrategy(); @@ -113,11 +120,16 @@ void main() { instanceManager: instanceManager, ); - verify(mockApi.create( + final VerificationResult verificationResult = verify(mockApi.create( instanceManager.getIdentifier(instance), - [2, 5], + captureAny, fallbackStrategyIdentifier, )); + final List videoQualityData = + verificationResult.captured.single as List; + expect(videoQualityData.length, equals(2)); + expect(videoQualityData.first!.quality, equals(VideoQuality.FHD)); + expect(videoQualityData.last!.quality, equals(VideoQuality.highest)); }); test('getResolution returns expected resolution info', () async { @@ -131,7 +143,9 @@ void main() { final QualitySelector instance = QualitySelector.detached( instanceManager: instanceManager, - qualityList: const [VideoQualityConstraint.HD], + qualityList: [ + VideoQualityData(quality: VideoQuality.HD) + ], fallbackStrategy: MockFallbackStrategy(), ); const int instanceIdentifier = 0; @@ -153,7 +167,7 @@ void main() { onCopy: (_) => MockCameraInfo(), ); - const VideoQualityConstraint quality = VideoQualityConstraint.FHD; + const VideoQuality quality = VideoQuality.FHD; final ResolutionInfo expectedResult = ResolutionInfo(width: 34, height: 23); diff --git a/packages/camera/camera_android_camerax/test/quality_selector_test.mocks.dart b/packages/camera/camera_android_camerax/test/quality_selector_test.mocks.dart index ba08711ba73..65741af996a 100644 --- a/packages/camera/camera_android_camerax/test/quality_selector_test.mocks.dart +++ b/packages/camera/camera_android_camerax/test/quality_selector_test.mocks.dart @@ -135,10 +135,10 @@ class MockFallbackStrategy extends _i1.Mock implements _i9.FallbackStrategy { } @override - _i4.VideoQualityConstraint get quality => (super.noSuchMethod( + _i4.VideoQuality get quality => (super.noSuchMethod( Invocation.getter(#quality), - returnValue: _i4.VideoQualityConstraint.SD, - ) as _i4.VideoQualityConstraint); + returnValue: _i4.VideoQuality.SD, + ) as _i4.VideoQuality); @override _i4.VideoResolutionFallbackRule get fallbackRule => (super.noSuchMethod( Invocation.getter(#fallbackRule), @@ -158,7 +158,7 @@ class MockTestQualitySelectorHostApi extends _i1.Mock @override void create( int? identifier, - List? videoQualityConstraintIndexList, + List<_i4.VideoQualityData?>? videoQualityDataList, int? fallbackStrategyId, ) => super.noSuchMethod( @@ -166,7 +166,7 @@ class MockTestQualitySelectorHostApi extends _i1.Mock #create, [ identifier, - videoQualityConstraintIndexList, + videoQualityDataList, fallbackStrategyId, ], ), @@ -175,7 +175,7 @@ class MockTestQualitySelectorHostApi extends _i1.Mock @override _i4.ResolutionInfo getResolution( int? cameraInfoId, - _i4.VideoQualityConstraint? quality, + _i4.VideoQuality? quality, ) => (super.noSuchMethod( Invocation.method( diff --git a/packages/camera/camera_android_camerax/test/recorder_test.dart b/packages/camera/camera_android_camerax/test/recorder_test.dart index 994c0f91b83..c7b189f6130 100644 --- a/packages/camera/camera_android_camerax/test/recorder_test.dart +++ b/packages/camera/camera_android_camerax/test/recorder_test.dart @@ -84,16 +84,21 @@ void main() { final QualitySelector defaultQualitySelector = Recorder.getDefaultQualitySelector(); + final List expectedVideoQualities = [ + VideoQuality.FHD, + VideoQuality.HD, + VideoQuality.SD + ]; + + expect(defaultQualitySelector.qualityList.length, equals(3)); + for (int i = 0; i < 3; i++) { + final VideoQuality currentVideoQuality = + defaultQualitySelector.qualityList[i].quality; + expect(currentVideoQuality, equals(expectedVideoQualities[i])); + } - expect( - defaultQualitySelector.qualityList, - equals(const [ - VideoQualityConstraint.FHD, - VideoQualityConstraint.HD, - VideoQualityConstraint.SD - ])); expect(defaultQualitySelector.fallbackStrategy!.quality, - equals(VideoQualityConstraint.FHD)); + equals(VideoQuality.FHD)); expect(defaultQualitySelector.fallbackStrategy!.fallbackRule, equals(VideoResolutionFallbackRule.higherQualityOrLowerThan)); diff --git a/packages/camera/camera_android_camerax/test/recorder_test.mocks.dart b/packages/camera/camera_android_camerax/test/recorder_test.mocks.dart index c7850c70e53..7a678e28645 100644 --- a/packages/camera/camera_android_camerax/test/recorder_test.mocks.dart +++ b/packages/camera/camera_android_camerax/test/recorder_test.mocks.dart @@ -57,10 +57,10 @@ class MockQualitySelector extends _i1.Mock implements _i4.QualitySelector { } @override - List<_i2.VideoQualityConstraint> get qualityList => (super.noSuchMethod( + List<_i2.VideoQualityData> get qualityList => (super.noSuchMethod( Invocation.getter(#qualityList), - returnValue: <_i2.VideoQualityConstraint>[], - ) as List<_i2.VideoQualityConstraint>); + returnValue: <_i2.VideoQualityData>[], + ) as List<_i2.VideoQualityData>); } /// A class which mocks [TestInstanceManagerHostApi]. @@ -94,7 +94,7 @@ class MockTestFallbackStrategyHostApi extends _i1.Mock @override void create( int? identifier, - _i2.VideoQualityConstraint? quality, + _i2.VideoQuality? quality, _i2.VideoResolutionFallbackRule? fallbackRule, ) => super.noSuchMethod( @@ -183,7 +183,7 @@ class MockTestQualitySelectorHostApi extends _i1.Mock @override void create( int? identifier, - List? videoQualityConstraintIndexList, + List<_i2.VideoQualityData?>? videoQualityDataList, int? fallbackStrategyId, ) => super.noSuchMethod( @@ -191,7 +191,7 @@ class MockTestQualitySelectorHostApi extends _i1.Mock #create, [ identifier, - videoQualityConstraintIndexList, + videoQualityDataList, fallbackStrategyId, ], ), @@ -200,7 +200,7 @@ class MockTestQualitySelectorHostApi extends _i1.Mock @override _i2.ResolutionInfo getResolution( int? cameraInfoId, - _i2.VideoQualityConstraint? quality, + _i2.VideoQuality? quality, ) => (super.noSuchMethod( Invocation.method( diff --git a/packages/camera/camera_android_camerax/test/test_camerax_library.g.dart b/packages/camera/camera_android_camerax/test/test_camerax_library.g.dart index b9e2ab706e5..e293aa2f6a4 100644 --- a/packages/camera/camera_android_camerax/test/test_camerax_library.g.dart +++ b/packages/camera/camera_android_camerax/test/test_camerax_library.g.dart @@ -1365,10 +1365,10 @@ class _TestQualitySelectorHostApiCodec extends StandardMessageCodec { const _TestQualitySelectorHostApiCodec(); @override void writeValue(WriteBuffer buffer, Object? value) { - if (value is QualityData) { + if (value is ResolutionInfo) { buffer.putUint8(128); writeValue(buffer, value.encode()); - } else if (value is ResolutionInfo) { + } else if (value is VideoQualityData) { buffer.putUint8(129); writeValue(buffer, value.encode()); } else { @@ -1380,9 +1380,9 @@ class _TestQualitySelectorHostApiCodec extends StandardMessageCodec { Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { case 128: - return QualityData.decode(readValue(buffer)!); - case 129: return ResolutionInfo.decode(readValue(buffer)!); + case 129: + return VideoQualityData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); } @@ -1393,9 +1393,9 @@ abstract class TestQualitySelectorHostApi { static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = _TestQualitySelectorHostApiCodec(); - void create(int identifier, List videoQualityConstraintIndexList, int? fallbackStrategyId); + void create(int identifier, List videoQualityDataList, int? fallbackStrategyId); - ResolutionInfo getResolution(int cameraInfoId, Quality quality); + ResolutionInfo getResolution(int cameraInfoId, VideoQuality quality); static void setup(TestQualitySelectorHostApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -1412,11 +1412,11 @@ abstract class TestQualitySelectorHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.QualitySelectorHostApi.create was null, expected non-null int.'); - final List? arg_videoQualityConstraintIndexList = (args[1] as List?)?.cast(); - assert(arg_videoQualityConstraintIndexList != null, - 'Argument for dev.flutter.pigeon.QualitySelectorHostApi.create was null, expected non-null List.'); + final List? arg_videoQualityDataList = (args[1] as List?)?.cast(); + assert(arg_videoQualityDataList != null, + 'Argument for dev.flutter.pigeon.QualitySelectorHostApi.create was null, expected non-null List.'); final int? arg_fallbackStrategyId = (args[2] as int?); - api.create(arg_identifier!, arg_videoQualityConstraintIndexList!, arg_fallbackStrategyId); + api.create(arg_identifier!, arg_videoQualityDataList!, arg_fallbackStrategyId); return []; }); } @@ -1435,9 +1435,9 @@ abstract class TestQualitySelectorHostApi { final int? arg_cameraInfoId = (args[0] as int?); assert(arg_cameraInfoId != null, 'Argument for dev.flutter.pigeon.QualitySelectorHostApi.getResolution was null, expected non-null int.'); - final Quality? arg_quality = args[1] == null ? null : Quality.values[args[1] as int]; + final VideoQuality? arg_quality = args[1] == null ? null : VideoQuality.values[args[1] as int]; assert(arg_quality != null, - 'Argument for dev.flutter.pigeon.QualitySelectorHostApi.getResolution was null, expected non-null Quality.'); + 'Argument for dev.flutter.pigeon.QualitySelectorHostApi.getResolution was null, expected non-null VideoQuality.'); final ResolutionInfo output = api.getResolution(arg_cameraInfoId!, arg_quality!); return [output]; }); @@ -1450,7 +1450,7 @@ abstract class TestFallbackStrategyHostApi { static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); - void create(int identifier, Quality quality, VideoResolutionFallbackRule fallbackRule); + void create(int identifier, VideoQuality quality, VideoResolutionFallbackRule fallbackRule); static void setup(TestFallbackStrategyHostApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -1467,9 +1467,9 @@ abstract class TestFallbackStrategyHostApi { final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.FallbackStrategyHostApi.create was null, expected non-null int.'); - final Quality? arg_quality = args[1] == null ? null : Quality.values[args[1] as int]; + final VideoQuality? arg_quality = args[1] == null ? null : VideoQuality.values[args[1] as int]; assert(arg_quality != null, - 'Argument for dev.flutter.pigeon.FallbackStrategyHostApi.create was null, expected non-null Quality.'); + 'Argument for dev.flutter.pigeon.FallbackStrategyHostApi.create was null, expected non-null VideoQuality.'); final VideoResolutionFallbackRule? arg_fallbackRule = args[2] == null ? null : VideoResolutionFallbackRule.values[args[2] as int]; assert(arg_fallbackRule != null, 'Argument for dev.flutter.pigeon.FallbackStrategyHostApi.create was null, expected non-null VideoResolutionFallbackRule.'); From a163f0eae6586e9ed08cf988fd47b64aaf59e24e Mon Sep 17 00:00:00 2001 From: camsim99 Date: Tue, 29 Aug 2023 14:20:45 -0700 Subject: [PATCH 30/34] Fix versionining --- packages/camera/camera_android_camerax/CHANGELOG.md | 5 +++-- packages/camera/camera_android_camerax/pubspec.yaml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/camera/camera_android_camerax/CHANGELOG.md b/packages/camera/camera_android_camerax/CHANGELOG.md index 73b49ea0ada..7a5bb37537a 100644 --- a/packages/camera/camera_android_camerax/CHANGELOG.md +++ b/packages/camera/camera_android_camerax/CHANGELOG.md @@ -1,8 +1,9 @@ -## 0.5.0+16 +## 0.5.0+17 + +* Implements resolution configuration for all camera use cases. * Adds pub topics to package metadata. * Updates minimum supported SDK version to Flutter 3.7/Dart 2.19. -* Implements resolution configuration for all camera use cases. ## 0.5.0+15 diff --git a/packages/camera/camera_android_camerax/pubspec.yaml b/packages/camera/camera_android_camerax/pubspec.yaml index 0e57c52a292..54c895b4fa9 100644 --- a/packages/camera/camera_android_camerax/pubspec.yaml +++ b/packages/camera/camera_android_camerax/pubspec.yaml @@ -2,7 +2,7 @@ name: camera_android_camerax description: Android implementation of the camera plugin using the CameraX library. repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_android_camerax issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22 -version: 0.5.0+16 +version: 0.5.0+17 environment: sdk: ">=2.19.0 <4.0.0" From 2a9671eaefbf7d70595bda49341049bc1947c1a0 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Tue, 29 Aug 2023 14:40:13 -0700 Subject: [PATCH 31/34] Format --- .../camerax/FallbackStrategyHostApiImpl.java | 9 +- .../camerax/GeneratedCameraXLibrary.java | 830 ++++++++++++------ .../camerax/QualitySelectorHostApiImpl.java | 11 +- .../plugins/camerax/FallbackStrategyTest.java | 5 +- .../plugins/camerax/QualitySelectorTest.java | 20 +- .../lib/src/camerax_library.g.dart | 315 ++++--- .../test/android_camera_camerax_test.dart | 3 +- .../test/test_camerax_library.g.dart | 725 ++++++++++----- 8 files changed, 1234 insertions(+), 684 deletions(-) diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/FallbackStrategyHostApiImpl.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/FallbackStrategyHostApiImpl.java index 6322a9ead44..da9f58a3f71 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/FallbackStrategyHostApiImpl.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/FallbackStrategyHostApiImpl.java @@ -28,10 +28,8 @@ public class FallbackStrategyHostApiImpl implements FallbackStrategyHostApi { public static class FallbackStrategyProxy { /** Creates an instance of {@link FallbackStrategy}. */ public @NonNull FallbackStrategy create( - @NonNull VideoQuality videoQuality, - @NonNull VideoResolutionFallbackRule fallbackRule) { - Quality quality = - QualitySelectorHostApiImpl.getQualityFromVideoQuality(videoQuality); + @NonNull VideoQuality videoQuality, @NonNull VideoResolutionFallbackRule fallbackRule) { + Quality quality = QualitySelectorHostApiImpl.getQualityFromVideoQuality(videoQuality); switch (fallbackRule) { case HIGHER_QUALITY_OR_LOWER_THAN: @@ -77,7 +75,6 @@ public void create( @NonNull Long identifier, @NonNull VideoQuality videoQuality, @NonNull VideoResolutionFallbackRule fallbackRule) { - instanceManager.addDartCreatedInstance( - proxy.create(videoQuality, fallbackRule), identifier); + instanceManager.addDartCreatedInstance(proxy.create(videoQuality, fallbackRule), identifier); } } diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/GeneratedCameraXLibrary.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/GeneratedCameraXLibrary.java index 60c633f2f3f..fe9a935989f 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/GeneratedCameraXLibrary.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/GeneratedCameraXLibrary.java @@ -18,9 +18,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; -import java.util.HashMap; import java.util.List; -import java.util.Map; /** Generated class from Pigeon. */ @SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression", "serial"}) @@ -35,8 +33,7 @@ public static class FlutterError extends RuntimeException { /** The error details. Must be a datatype supported by the api codec. */ public final Object details; - public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) - { + public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) { super(message); this.code = code; this.details = details; @@ -55,7 +52,7 @@ protected static ArrayList wrapError(@NonNull Throwable exception) { errorList.add(exception.toString()); errorList.add(exception.getClass().getSimpleName()); errorList.add( - "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); + "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); } return errorList; } @@ -63,7 +60,7 @@ protected static ArrayList wrapError(@NonNull Throwable exception) { /** * The states the camera can be in. * - * See https://developer.android.com/reference/androidx/camera/core/CameraState.Type. + *

See https://developer.android.com/reference/androidx/camera/core/CameraState.Type. */ public enum CameraStateType { CLOSED(0), @@ -82,20 +79,19 @@ private CameraStateType(final int index) { /** * The types (T) properly wrapped to be used as a LiveData. * - * If you need to add another type to support a type S to use a LiveData in - * this plugin, ensure the following is done on the Dart side: + *

If you need to add another type to support a type S to use a LiveData in this plugin, + * ensure the following is done on the Dart side: * - * * In `../lib/src/live_data.dart`, add new cases for S in - * `_LiveDataHostApiImpl#getValueFromInstances` to get the current value of - * type S from a LiveData instance and in `LiveDataFlutterApiImpl#create` - * to create the expected type of LiveData when requested. + *

* In `../lib/src/live_data.dart`, add new cases for S in + * `_LiveDataHostApiImpl#getValueFromInstances` to get the current value of type S from a + * LiveData instance and in `LiveDataFlutterApiImpl#create` to create the expected type of + * LiveData when requested. * - * On the native side, ensure the following is done: + *

On the native side, ensure the following is done: * - * * Update `LiveDataHostApiImpl#getValue` is updated to properly return - * identifiers for instances of type S. - * * Update `ObserverFlutterApiWrapper#onChanged` to properly handle receiving - * calls with instances of type S if a LiveData instance is observed. + *

* Update `LiveDataHostApiImpl#getValue` is updated to properly return identifiers for + * instances of type S. * Update `ObserverFlutterApiWrapper#onChanged` to properly handle + * receiving calls with instances of type S if a LiveData instance is observed. */ public enum LiveDataSupportedType { CAMERA_STATE(0), @@ -109,12 +105,12 @@ private LiveDataSupportedType(final int index) { } /** - * Video quality constraints that will be used by a QualitySelector to choose - * an appropriate video resolution. + * Video quality constraints that will be used by a QualitySelector to choose an appropriate video + * resolution. * - * These are pre-defined quality constants that are universally used for video. + *

These are pre-defined quality constants that are universally used for video. * - * See https://developer.android.com/reference/androidx/camera/video/Quality. + *

See https://developer.android.com/reference/androidx/camera/video/Quality. */ public enum VideoQuality { SD(0), @@ -134,7 +130,7 @@ private VideoQuality(final int index) { /** * Fallback rules for selecting video resolution. * - * See https://developer.android.com/reference/androidx/camera/video/FallbackStrategy. + *

See https://developer.android.com/reference/androidx/camera/video/FallbackStrategy. */ public enum VideoResolutionFallbackRule { HIGHER_QUALITY_OR_LOWER_THAN(0), @@ -215,9 +211,13 @@ ArrayList toList() { static @NonNull ResolutionInfo fromList(@NonNull ArrayList list) { ResolutionInfo pigeonResult = new ResolutionInfo(); Object width = list.get(0); - pigeonResult.setWidth((width == null) ? null : ((width instanceof Integer) ? (Integer) width : (Long) width)); + pigeonResult.setWidth( + (width == null) ? null : ((width instanceof Integer) ? (Integer) width : (Long) width)); Object height = list.get(1); - pigeonResult.setHeight((height == null) ? null : ((height instanceof Integer) ? (Integer) height : (Long) height)); + pigeonResult.setHeight( + (height == null) + ? null + : ((height instanceof Integer) ? (Integer) height : (Long) height)); return pigeonResult; } } @@ -459,9 +459,19 @@ ArrayList toList() { static @NonNull ExposureCompensationRange fromList(@NonNull ArrayList list) { ExposureCompensationRange pigeonResult = new ExposureCompensationRange(); Object minCompensation = list.get(0); - pigeonResult.setMinCompensation((minCompensation == null) ? null : ((minCompensation instanceof Integer) ? (Integer) minCompensation : (Long) minCompensation)); + pigeonResult.setMinCompensation( + (minCompensation == null) + ? null + : ((minCompensation instanceof Integer) + ? (Integer) minCompensation + : (Long) minCompensation)); Object maxCompensation = list.get(1); - pigeonResult.setMaxCompensation((maxCompensation == null) ? null : ((maxCompensation instanceof Integer) ? (Integer) maxCompensation : (Long) maxCompensation)); + pigeonResult.setMaxCompensation( + (maxCompensation == null) + ? null + : ((maxCompensation instanceof Integer) + ? (Integer) maxCompensation + : (Long) maxCompensation)); return pigeonResult; } } @@ -469,7 +479,7 @@ ArrayList toList() { /** * Convenience class for sending lists of [Quality]s. * - * Generated class from Pigeon that represents data sent in messages. + *

Generated class from Pigeon that represents data sent in messages. */ public static final class VideoQualityData { private @NonNull VideoQuality quality; @@ -530,7 +540,7 @@ public interface InstanceManagerHostApi { /** * Clear the native `InstanceManager`. * - * This is typically only used after a hot restart. + *

This is typically only used after a hot restart. */ void clear(); @@ -538,8 +548,12 @@ public interface InstanceManagerHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `InstanceManagerHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable InstanceManagerHostApi api) { + /** + * Sets up an instance of `InstanceManagerHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable InstanceManagerHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -551,8 +565,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable InstanceMa try { api.clear(); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -573,7 +586,9 @@ public interface JavaObjectHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `JavaObjectHostApi` to handle messages through the `binaryMessenger`. */ + /** + * Sets up an instance of `JavaObjectHostApi` to handle messages through the `binaryMessenger`. + */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable JavaObjectHostApi api) { { BasicMessageChannel channel = @@ -588,8 +603,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable JavaObject try { api.dispose((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -609,7 +623,7 @@ public JavaObjectFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -618,6 +632,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + public void dispose(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -630,28 +645,32 @@ public void dispose(@NonNull Long identifierArg, @NonNull Reply callback) /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface CameraInfoHostApi { - @NonNull + @NonNull Long getSensorRotationDegrees(@NonNull Long identifier); - @NonNull + @NonNull Long getCameraState(@NonNull Long identifier); - @NonNull + @NonNull Long getExposureState(@NonNull Long identifier); - @NonNull + @NonNull Long getZoomState(@NonNull Long identifier); /** The codec used by CameraInfoHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `CameraInfoHostApi` to handle messages through the `binaryMessenger`. */ + /** + * Sets up an instance of `CameraInfoHostApi` to handle messages through the `binaryMessenger`. + */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraInfoHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.CameraInfoHostApi.getSensorRotationDegrees", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.CameraInfoHostApi.getSensorRotationDegrees", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -659,10 +678,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraInfo ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - Long output = api.getSensorRotationDegrees((identifierArg == null) ? null : identifierArg.longValue()); + Long output = + api.getSensorRotationDegrees( + (identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -683,10 +703,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraInfo ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - Long output = api.getCameraState((identifierArg == null) ? null : identifierArg.longValue()); + Long output = + api.getCameraState( + (identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -699,7 +720,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraInfo { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.CameraInfoHostApi.getExposureState", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.CameraInfoHostApi.getExposureState", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -707,10 +730,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraInfo ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - Long output = api.getExposureState((identifierArg == null) ? null : identifierArg.longValue()); + Long output = + api.getExposureState( + (identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -731,10 +755,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraInfo ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - Long output = api.getZoomState((identifierArg == null) ? null : identifierArg.longValue()); + Long output = + api.getZoomState((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -754,7 +778,7 @@ public CameraInfoFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -763,6 +787,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -777,15 +802,19 @@ public interface CameraSelectorHostApi { void create(@NonNull Long identifier, @Nullable Long lensFacing); - @NonNull + @NonNull List filter(@NonNull Long identifier, @NonNull List cameraInfoIds); /** The codec used by CameraSelectorHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `CameraSelectorHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraSelectorHostApi api) { + /** + * Sets up an instance of `CameraSelectorHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable CameraSelectorHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -798,10 +827,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraSele Number identifierArg = (Number) args.get(0); Number lensFacingArg = (Number) args.get(1); try { - api.create((identifierArg == null) ? null : identifierArg.longValue(), (lensFacingArg == null) ? null : lensFacingArg.longValue()); + api.create( + (identifierArg == null) ? null : identifierArg.longValue(), + (lensFacingArg == null) ? null : lensFacingArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -823,10 +853,12 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraSele Number identifierArg = (Number) args.get(0); List cameraInfoIdsArg = (List) args.get(1); try { - List output = api.filter((identifierArg == null) ? null : identifierArg.longValue(), cameraInfoIdsArg); + List output = + api.filter( + (identifierArg == null) ? null : identifierArg.longValue(), + cameraInfoIdsArg); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -846,7 +878,7 @@ public CameraSelectorFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -855,7 +887,9 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void create(@NonNull Long identifierArg, @Nullable Long lensFacingArg, @NonNull Reply callback) { + + public void create( + @NonNull Long identifierArg, @Nullable Long lensFacingArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.CameraSelectorFlutterApi.create", getCodec()); @@ -869,13 +903,16 @@ public interface ProcessCameraProviderHostApi { void getInstance(@NonNull Result result); - @NonNull + @NonNull List getAvailableCameraInfos(@NonNull Long identifier); - @NonNull - Long bindToLifecycle(@NonNull Long identifier, @NonNull Long cameraSelectorIdentifier, @NonNull List useCaseIds); + @NonNull + Long bindToLifecycle( + @NonNull Long identifier, + @NonNull Long cameraSelectorIdentifier, + @NonNull List useCaseIds); - @NonNull + @NonNull Boolean isBound(@NonNull Long identifier, @NonNull Long useCaseIdentifier); void unbind(@NonNull Long identifier, @NonNull List useCaseIds); @@ -886,12 +923,18 @@ public interface ProcessCameraProviderHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `ProcessCameraProviderHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ProcessCameraProviderHostApi api) { + /** + * Sets up an instance of `ProcessCameraProviderHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable ProcessCameraProviderHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.ProcessCameraProviderHostApi.getInstance", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.ProcessCameraProviderHostApi.getInstance", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -918,7 +961,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.ProcessCameraProviderHostApi.getAvailableCameraInfos", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.ProcessCameraProviderHostApi.getAvailableCameraInfos", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -926,10 +971,11 @@ public void error(Throwable error) { ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - List output = api.getAvailableCameraInfos((identifierArg == null) ? null : identifierArg.longValue()); + List output = + api.getAvailableCameraInfos( + (identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -942,7 +988,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.ProcessCameraProviderHostApi.bindToLifecycle", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.ProcessCameraProviderHostApi.bindToLifecycle", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -952,10 +1000,15 @@ public void error(Throwable error) { Number cameraSelectorIdentifierArg = (Number) args.get(1); List useCaseIdsArg = (List) args.get(2); try { - Long output = api.bindToLifecycle((identifierArg == null) ? null : identifierArg.longValue(), (cameraSelectorIdentifierArg == null) ? null : cameraSelectorIdentifierArg.longValue(), useCaseIdsArg); + Long output = + api.bindToLifecycle( + (identifierArg == null) ? null : identifierArg.longValue(), + (cameraSelectorIdentifierArg == null) + ? null + : cameraSelectorIdentifierArg.longValue(), + useCaseIdsArg); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -968,7 +1021,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.ProcessCameraProviderHostApi.isBound", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.ProcessCameraProviderHostApi.isBound", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -977,10 +1032,12 @@ public void error(Throwable error) { Number identifierArg = (Number) args.get(0); Number useCaseIdentifierArg = (Number) args.get(1); try { - Boolean output = api.isBound((identifierArg == null) ? null : identifierArg.longValue(), (useCaseIdentifierArg == null) ? null : useCaseIdentifierArg.longValue()); + Boolean output = + api.isBound( + (identifierArg == null) ? null : identifierArg.longValue(), + (useCaseIdentifierArg == null) ? null : useCaseIdentifierArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -993,7 +1050,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.ProcessCameraProviderHostApi.unbind", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.ProcessCameraProviderHostApi.unbind", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1002,10 +1061,10 @@ public void error(Throwable error) { Number identifierArg = (Number) args.get(0); List useCaseIdsArg = (List) args.get(1); try { - api.unbind((identifierArg == null) ? null : identifierArg.longValue(), useCaseIdsArg); + api.unbind( + (identifierArg == null) ? null : identifierArg.longValue(), useCaseIdsArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1018,7 +1077,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.ProcessCameraProviderHostApi.unbindAll", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.ProcessCameraProviderHostApi.unbindAll", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1028,8 +1089,7 @@ public void error(Throwable error) { try { api.unbindAll((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1049,7 +1109,7 @@ public ProcessCameraProviderFlutterApi(@NonNull BinaryMessenger argBinaryMesseng this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -1058,10 +1118,13 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.ProcessCameraProviderFlutterApi.create", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.ProcessCameraProviderFlutterApi.create", + getCodec()); channel.send( new ArrayList(Collections.singletonList(identifierArg)), channelReply -> callback.reply(null)); @@ -1070,14 +1133,14 @@ public void create(@NonNull Long identifierArg, @NonNull Reply callback) { /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface CameraHostApi { - @NonNull + @NonNull Long getCameraInfo(@NonNull Long identifier); /** The codec used by CameraHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `CameraHostApi` to handle messages through the `binaryMessenger`. */ + /** Sets up an instance of `CameraHostApi` to handle messages through the `binaryMessenger`. */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraHostApi api) { { BasicMessageChannel channel = @@ -1090,10 +1153,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraHost ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - Long output = api.getCameraInfo((identifierArg == null) ? null : identifierArg.longValue()); + Long output = + api.getCameraInfo((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1113,7 +1176,7 @@ public CameraFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -1122,6 +1185,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1161,25 +1225,33 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface SystemServicesHostApi { - void requestCameraPermissions(@NonNull Boolean enableAudio, @NonNull Result result); + void requestCameraPermissions( + @NonNull Boolean enableAudio, @NonNull Result result); - void startListeningForDeviceOrientationChange(@NonNull Boolean isFrontFacing, @NonNull Long sensorOrientation); + void startListeningForDeviceOrientationChange( + @NonNull Boolean isFrontFacing, @NonNull Long sensorOrientation); void stopListeningForDeviceOrientationChange(); - @NonNull + @NonNull String getTempFilePath(@NonNull String prefix, @NonNull String suffix); /** The codec used by SystemServicesHostApi. */ static @NonNull MessageCodec getCodec() { return SystemServicesHostApiCodec.INSTANCE; } - /**Sets up an instance of `SystemServicesHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable SystemServicesHostApi api) { + /** + * Sets up an instance of `SystemServicesHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable SystemServicesHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.SystemServicesHostApi.requestCameraPermissions", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.SystemServicesHostApi.requestCameraPermissions", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1208,7 +1280,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.SystemServicesHostApi.startListeningForDeviceOrientationChange", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.SystemServicesHostApi.startListeningForDeviceOrientationChange", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1217,10 +1291,11 @@ public void error(Throwable error) { Boolean isFrontFacingArg = (Boolean) args.get(0); Number sensorOrientationArg = (Number) args.get(1); try { - api.startListeningForDeviceOrientationChange(isFrontFacingArg, (sensorOrientationArg == null) ? null : sensorOrientationArg.longValue()); + api.startListeningForDeviceOrientationChange( + isFrontFacingArg, + (sensorOrientationArg == null) ? null : sensorOrientationArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1233,7 +1308,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.SystemServicesHostApi.stopListeningForDeviceOrientationChange", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.SystemServicesHostApi.stopListeningForDeviceOrientationChange", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1241,8 +1318,7 @@ public void error(Throwable error) { try { api.stopListeningForDeviceOrientationChange(); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1255,7 +1331,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.SystemServicesHostApi.getTempFilePath", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.SystemServicesHostApi.getTempFilePath", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1266,8 +1344,7 @@ public void error(Throwable error) { try { String output = api.getTempFilePath(prefixArg, suffixArg); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1287,7 +1364,7 @@ public SystemServicesFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -1296,18 +1373,25 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void onDeviceOrientationChanged(@NonNull String orientationArg, @NonNull Reply callback) { + + public void onDeviceOrientationChanged( + @NonNull String orientationArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.SystemServicesFlutterApi.onDeviceOrientationChanged", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.SystemServicesFlutterApi.onDeviceOrientationChanged", + getCodec()); channel.send( new ArrayList(Collections.singletonList(orientationArg)), channelReply -> callback.reply(null)); } + public void onCameraError(@NonNull String errorDescriptionArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.SystemServicesFlutterApi.onCameraError", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.SystemServicesFlutterApi.onCameraError", + getCodec()); channel.send( new ArrayList(Collections.singletonList(errorDescriptionArg)), channelReply -> callback.reply(null)); @@ -1343,21 +1427,22 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface PreviewHostApi { - void create(@NonNull Long identifier, @Nullable Long rotation, @Nullable Long resolutionSelectorId); + void create( + @NonNull Long identifier, @Nullable Long rotation, @Nullable Long resolutionSelectorId); - @NonNull + @NonNull Long setSurfaceProvider(@NonNull Long identifier); void releaseFlutterSurfaceTexture(); - @NonNull + @NonNull ResolutionInfo getResolutionInfo(@NonNull Long identifier); /** The codec used by PreviewHostApi. */ static @NonNull MessageCodec getCodec() { return PreviewHostApiCodec.INSTANCE; } - /**Sets up an instance of `PreviewHostApi` to handle messages through the `binaryMessenger`. */ + /** Sets up an instance of `PreviewHostApi` to handle messages through the `binaryMessenger`. */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PreviewHostApi api) { { BasicMessageChannel channel = @@ -1372,10 +1457,14 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PreviewHos Number rotationArg = (Number) args.get(1); Number resolutionSelectorIdArg = (Number) args.get(2); try { - api.create((identifierArg == null) ? null : identifierArg.longValue(), (rotationArg == null) ? null : rotationArg.longValue(), (resolutionSelectorIdArg == null) ? null : resolutionSelectorIdArg.longValue()); + api.create( + (identifierArg == null) ? null : identifierArg.longValue(), + (rotationArg == null) ? null : rotationArg.longValue(), + (resolutionSelectorIdArg == null) + ? null + : resolutionSelectorIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1388,7 +1477,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PreviewHos { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.PreviewHostApi.setSurfaceProvider", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.PreviewHostApi.setSurfaceProvider", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1396,10 +1487,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PreviewHos ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - Long output = api.setSurfaceProvider((identifierArg == null) ? null : identifierArg.longValue()); + Long output = + api.setSurfaceProvider( + (identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1412,7 +1504,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PreviewHos { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.PreviewHostApi.releaseFlutterSurfaceTexture", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.PreviewHostApi.releaseFlutterSurfaceTexture", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1420,8 +1514,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PreviewHos try { api.releaseFlutterSurfaceTexture(); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1442,10 +1535,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PreviewHos ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - ResolutionInfo output = api.getResolutionInfo((identifierArg == null) ? null : identifierArg.longValue()); + ResolutionInfo output = + api.getResolutionInfo( + (identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1460,17 +1554,20 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PreviewHos /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface VideoCaptureHostApi { - @NonNull + @NonNull Long withOutput(@NonNull Long videoOutputId); - @NonNull + @NonNull Long getOutput(@NonNull Long identifier); /** The codec used by VideoCaptureHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `VideoCaptureHostApi` to handle messages through the `binaryMessenger`. */ + /** + * Sets up an instance of `VideoCaptureHostApi` to handle messages through the + * `binaryMessenger`. + */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable VideoCaptureHostApi api) { { BasicMessageChannel channel = @@ -1483,10 +1580,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable VideoCaptu ArrayList args = (ArrayList) message; Number videoOutputIdArg = (Number) args.get(0); try { - Long output = api.withOutput((videoOutputIdArg == null) ? null : videoOutputIdArg.longValue()); + Long output = + api.withOutput( + (videoOutputIdArg == null) ? null : videoOutputIdArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1507,10 +1605,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable VideoCaptu ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - Long output = api.getOutput((identifierArg == null) ? null : identifierArg.longValue()); + Long output = + api.getOutput((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1530,7 +1628,7 @@ public VideoCaptureFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -1539,6 +1637,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1551,22 +1650,28 @@ public void create(@NonNull Long identifierArg, @NonNull Reply callback) { /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface RecorderHostApi { - void create(@NonNull Long identifier, @Nullable Long aspectRatio, @Nullable Long bitRate, @Nullable Long qualitySelectorId); + void create( + @NonNull Long identifier, + @Nullable Long aspectRatio, + @Nullable Long bitRate, + @Nullable Long qualitySelectorId); - @NonNull + @NonNull Long getAspectRatio(@NonNull Long identifier); - @NonNull + @NonNull Long getTargetVideoEncodingBitRate(@NonNull Long identifier); - @NonNull + @NonNull Long prepareRecording(@NonNull Long identifier, @NonNull String path); /** The codec used by RecorderHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `RecorderHostApi` to handle messages through the `binaryMessenger`. */ + /** + * Sets up an instance of `RecorderHostApi` to handle messages through the `binaryMessenger`. + */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable RecorderHostApi api) { { BasicMessageChannel channel = @@ -1582,10 +1687,13 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable RecorderHo Number bitRateArg = (Number) args.get(2); Number qualitySelectorIdArg = (Number) args.get(3); try { - api.create((identifierArg == null) ? null : identifierArg.longValue(), (aspectRatioArg == null) ? null : aspectRatioArg.longValue(), (bitRateArg == null) ? null : bitRateArg.longValue(), (qualitySelectorIdArg == null) ? null : qualitySelectorIdArg.longValue()); + api.create( + (identifierArg == null) ? null : identifierArg.longValue(), + (aspectRatioArg == null) ? null : aspectRatioArg.longValue(), + (bitRateArg == null) ? null : bitRateArg.longValue(), + (qualitySelectorIdArg == null) ? null : qualitySelectorIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1606,10 +1714,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable RecorderHo ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - Long output = api.getAspectRatio((identifierArg == null) ? null : identifierArg.longValue()); + Long output = + api.getAspectRatio( + (identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1622,7 +1731,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable RecorderHo { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.RecorderHostApi.getTargetVideoEncodingBitRate", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.RecorderHostApi.getTargetVideoEncodingBitRate", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1630,10 +1741,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable RecorderHo ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - Long output = api.getTargetVideoEncodingBitRate((identifierArg == null) ? null : identifierArg.longValue()); + Long output = + api.getTargetVideoEncodingBitRate( + (identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1655,10 +1767,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable RecorderHo Number identifierArg = (Number) args.get(0); String pathArg = (String) args.get(1); try { - Long output = api.prepareRecording((identifierArg == null) ? null : identifierArg.longValue(), pathArg); + Long output = + api.prepareRecording( + (identifierArg == null) ? null : identifierArg.longValue(), pathArg); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1678,7 +1791,7 @@ public RecorderFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -1687,7 +1800,12 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void create(@NonNull Long identifierArg, @Nullable Long aspectRatioArg, @Nullable Long bitRateArg, @NonNull Reply callback) { + + public void create( + @NonNull Long identifierArg, + @Nullable Long aspectRatioArg, + @Nullable Long bitRateArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.RecorderFlutterApi.create", getCodec()); @@ -1699,15 +1817,19 @@ public void create(@NonNull Long identifierArg, @Nullable Long aspectRatioArg, @ /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface PendingRecordingHostApi { - @NonNull + @NonNull Long start(@NonNull Long identifier); /** The codec used by PendingRecordingHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `PendingRecordingHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PendingRecordingHostApi api) { + /** + * Sets up an instance of `PendingRecordingHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable PendingRecordingHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1719,10 +1841,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PendingRec ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - Long output = api.start((identifierArg == null) ? null : identifierArg.longValue()); + Long output = + api.start((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1742,7 +1864,7 @@ public PendingRecordingFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -1751,6 +1873,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1775,7 +1898,9 @@ public interface RecordingHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `RecordingHostApi` to handle messages through the `binaryMessenger`. */ + /** + * Sets up an instance of `RecordingHostApi` to handle messages through the `binaryMessenger`. + */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable RecordingHostApi api) { { BasicMessageChannel channel = @@ -1790,8 +1915,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable RecordingH try { api.close((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1814,8 +1938,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable RecordingH try { api.pause((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1838,8 +1961,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable RecordingH try { api.resume((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1862,8 +1984,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable RecordingH try { api.stop((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1883,7 +2004,7 @@ public RecordingFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -1892,6 +2013,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1904,7 +2026,8 @@ public void create(@NonNull Long identifierArg, @NonNull Reply callback) { /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface ImageCaptureHostApi { - void create(@NonNull Long identifier, @Nullable Long flashMode, @Nullable Long resolutionSelectorId); + void create( + @NonNull Long identifier, @Nullable Long flashMode, @Nullable Long resolutionSelectorId); void setFlashMode(@NonNull Long identifier, @NonNull Long flashMode); @@ -1914,7 +2037,10 @@ public interface ImageCaptureHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `ImageCaptureHostApi` to handle messages through the `binaryMessenger`. */ + /** + * Sets up an instance of `ImageCaptureHostApi` to handle messages through the + * `binaryMessenger`. + */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageCaptureHostApi api) { { BasicMessageChannel channel = @@ -1929,10 +2055,14 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageCaptu Number flashModeArg = (Number) args.get(1); Number resolutionSelectorIdArg = (Number) args.get(2); try { - api.create((identifierArg == null) ? null : identifierArg.longValue(), (flashModeArg == null) ? null : flashModeArg.longValue(), (resolutionSelectorIdArg == null) ? null : resolutionSelectorIdArg.longValue()); + api.create( + (identifierArg == null) ? null : identifierArg.longValue(), + (flashModeArg == null) ? null : flashModeArg.longValue(), + (resolutionSelectorIdArg == null) + ? null + : resolutionSelectorIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1954,10 +2084,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageCaptu Number identifierArg = (Number) args.get(0); Number flashModeArg = (Number) args.get(1); try { - api.setFlashMode((identifierArg == null) ? null : identifierArg.longValue(), (flashModeArg == null) ? null : flashModeArg.longValue()); + api.setFlashMode( + (identifierArg == null) ? null : identifierArg.longValue(), + (flashModeArg == null) ? null : flashModeArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1990,7 +2121,8 @@ public void error(Throwable error) { } }; - api.takePicture((identifierArg == null) ? null : identifierArg.longValue(), resultCallback); + api.takePicture( + (identifierArg == null) ? null : identifierArg.longValue(), resultCallback); }); } else { channel.setMessageHandler(null); @@ -2000,7 +2132,8 @@ public void error(Throwable error) { } private static class ResolutionStrategyHostApiCodec extends StandardMessageCodec { - public static final ResolutionStrategyHostApiCodec INSTANCE = new ResolutionStrategyHostApiCodec(); + public static final ResolutionStrategyHostApiCodec INSTANCE = + new ResolutionStrategyHostApiCodec(); private ResolutionStrategyHostApiCodec() {} @@ -2028,14 +2161,19 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface ResolutionStrategyHostApi { - void create(@NonNull Long identifier, @Nullable ResolutionInfo boundSize, @Nullable Long fallbackRule); + void create( + @NonNull Long identifier, @Nullable ResolutionInfo boundSize, @Nullable Long fallbackRule); /** The codec used by ResolutionStrategyHostApi. */ static @NonNull MessageCodec getCodec() { return ResolutionStrategyHostApiCodec.INSTANCE; } - /**Sets up an instance of `ResolutionStrategyHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ResolutionStrategyHostApi api) { + /** + * Sets up an instance of `ResolutionStrategyHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable ResolutionStrategyHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2049,10 +2187,12 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable Resolution ResolutionInfo boundSizeArg = (ResolutionInfo) args.get(1); Number fallbackRuleArg = (Number) args.get(2); try { - api.create((identifierArg == null) ? null : identifierArg.longValue(), boundSizeArg, (fallbackRuleArg == null) ? null : fallbackRuleArg.longValue()); + api.create( + (identifierArg == null) ? null : identifierArg.longValue(), + boundSizeArg, + (fallbackRuleArg == null) ? null : fallbackRuleArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2067,14 +2207,21 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable Resolution /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface ResolutionSelectorHostApi { - void create(@NonNull Long identifier, @Nullable Long resolutionStrategyIdentifier, @Nullable Long aspectRatioStrategyIdentifier); + void create( + @NonNull Long identifier, + @Nullable Long resolutionStrategyIdentifier, + @Nullable Long aspectRatioStrategyIdentifier); /** The codec used by ResolutionSelectorHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `ResolutionSelectorHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ResolutionSelectorHostApi api) { + /** + * Sets up an instance of `ResolutionSelectorHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable ResolutionSelectorHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2088,10 +2235,16 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable Resolution Number resolutionStrategyIdentifierArg = (Number) args.get(1); Number aspectRatioStrategyIdentifierArg = (Number) args.get(2); try { - api.create((identifierArg == null) ? null : identifierArg.longValue(), (resolutionStrategyIdentifierArg == null) ? null : resolutionStrategyIdentifierArg.longValue(), (aspectRatioStrategyIdentifierArg == null) ? null : aspectRatioStrategyIdentifierArg.longValue()); + api.create( + (identifierArg == null) ? null : identifierArg.longValue(), + (resolutionStrategyIdentifierArg == null) + ? null + : resolutionStrategyIdentifierArg.longValue(), + (aspectRatioStrategyIdentifierArg == null) + ? null + : aspectRatioStrategyIdentifierArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2106,18 +2259,25 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable Resolution /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface AspectRatioStrategyHostApi { - void create(@NonNull Long identifier, @NonNull Long preferredAspectRatio, @NonNull Long fallbackRule); + void create( + @NonNull Long identifier, @NonNull Long preferredAspectRatio, @NonNull Long fallbackRule); /** The codec used by AspectRatioStrategyHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `AspectRatioStrategyHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable AspectRatioStrategyHostApi api) { + /** + * Sets up an instance of `AspectRatioStrategyHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable AspectRatioStrategyHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.AspectRatioStrategyHostApi.create", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.AspectRatioStrategyHostApi.create", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2127,10 +2287,14 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable AspectRati Number preferredAspectRatioArg = (Number) args.get(1); Number fallbackRuleArg = (Number) args.get(2); try { - api.create((identifierArg == null) ? null : identifierArg.longValue(), (preferredAspectRatioArg == null) ? null : preferredAspectRatioArg.longValue(), (fallbackRuleArg == null) ? null : fallbackRuleArg.longValue()); + api.create( + (identifierArg == null) ? null : identifierArg.longValue(), + (preferredAspectRatioArg == null) + ? null + : preferredAspectRatioArg.longValue(), + (fallbackRuleArg == null) ? null : fallbackRuleArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2177,7 +2341,7 @@ public CameraStateFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2186,7 +2350,12 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return CameraStateFlutterApiCodec.INSTANCE; } - public void create(@NonNull Long identifierArg, @NonNull CameraStateTypeData typeArg, @Nullable Long errorIdentifierArg, @NonNull Reply callback) { + + public void create( + @NonNull Long identifierArg, + @NonNull CameraStateTypeData typeArg, + @Nullable Long errorIdentifierArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.CameraStateFlutterApi.create", getCodec()); @@ -2230,7 +2399,7 @@ public ExposureStateFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2239,12 +2408,19 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return ExposureStateFlutterApiCodec.INSTANCE; } - public void create(@NonNull Long identifierArg, @NonNull ExposureCompensationRange exposureCompensationRangeArg, @NonNull Double exposureCompensationStepArg, @NonNull Reply callback) { + + public void create( + @NonNull Long identifierArg, + @NonNull ExposureCompensationRange exposureCompensationRangeArg, + @NonNull Double exposureCompensationStepArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.ExposureStateFlutterApi.create", getCodec()); channel.send( - new ArrayList(Arrays.asList(identifierArg, exposureCompensationRangeArg, exposureCompensationStepArg)), + new ArrayList( + Arrays.asList( + identifierArg, exposureCompensationRangeArg, exposureCompensationStepArg)), channelReply -> callback.reply(null)); } } @@ -2256,7 +2432,7 @@ public ZoomStateFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2265,7 +2441,12 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void create(@NonNull Long identifierArg, @NonNull Double minZoomRatioArg, @NonNull Double maxZoomRatioArg, @NonNull Reply callback) { + + public void create( + @NonNull Long identifierArg, + @NonNull Double minZoomRatioArg, + @NonNull Double maxZoomRatioArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.ZoomStateFlutterApi.create", getCodec()); @@ -2287,8 +2468,12 @@ public interface ImageAnalysisHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `ImageAnalysisHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageAnalysisHostApi api) { + /** + * Sets up an instance of `ImageAnalysisHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable ImageAnalysisHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2301,10 +2486,13 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageAnaly Number identifierArg = (Number) args.get(0); Number resolutionSelectorIdArg = (Number) args.get(1); try { - api.create((identifierArg == null) ? null : identifierArg.longValue(), (resolutionSelectorIdArg == null) ? null : resolutionSelectorIdArg.longValue()); + api.create( + (identifierArg == null) ? null : identifierArg.longValue(), + (resolutionSelectorIdArg == null) + ? null + : resolutionSelectorIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2326,10 +2514,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageAnaly Number identifierArg = (Number) args.get(0); Number analyzerIdentifierArg = (Number) args.get(1); try { - api.setAnalyzer((identifierArg == null) ? null : identifierArg.longValue(), (analyzerIdentifierArg == null) ? null : analyzerIdentifierArg.longValue()); + api.setAnalyzer( + (identifierArg == null) ? null : identifierArg.longValue(), + (analyzerIdentifierArg == null) ? null : analyzerIdentifierArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2342,7 +2531,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageAnaly { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.ImageAnalysisHostApi.clearAnalyzer", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.ImageAnalysisHostApi.clearAnalyzer", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2352,8 +2543,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageAnaly try { api.clearAnalyzer((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2374,7 +2564,9 @@ public interface AnalyzerHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `AnalyzerHostApi` to handle messages through the `binaryMessenger`. */ + /** + * Sets up an instance of `AnalyzerHostApi` to handle messages through the `binaryMessenger`. + */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable AnalyzerHostApi api) { { BasicMessageChannel channel = @@ -2389,8 +2581,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable AnalyzerHo try { api.create((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2411,7 +2602,9 @@ public interface ObserverHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `ObserverHostApi` to handle messages through the `binaryMessenger`. */ + /** + * Sets up an instance of `ObserverHostApi` to handle messages through the `binaryMessenger`. + */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ObserverHostApi api) { { BasicMessageChannel channel = @@ -2426,8 +2619,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ObserverHo try { api.create((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2447,7 +2639,7 @@ public ObserverFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2456,7 +2648,11 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void onChanged(@NonNull Long identifierArg, @NonNull Long valueIdentifierArg, @NonNull Reply callback) { + + public void onChanged( + @NonNull Long identifierArg, + @NonNull Long valueIdentifierArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.ObserverFlutterApi.onChanged", getCodec()); @@ -2473,7 +2669,7 @@ public CameraStateErrorFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2482,7 +2678,9 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void create(@NonNull Long identifierArg, @NonNull Long codeArg, @NonNull Reply callback) { + + public void create( + @NonNull Long identifierArg, @NonNull Long codeArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.CameraStateErrorFlutterApi.create", getCodec()); @@ -2525,14 +2723,16 @@ public interface LiveDataHostApi { void removeObservers(@NonNull Long identifier); - @Nullable + @Nullable Long getValue(@NonNull Long identifier, @NonNull LiveDataSupportedTypeData type); /** The codec used by LiveDataHostApi. */ static @NonNull MessageCodec getCodec() { return LiveDataHostApiCodec.INSTANCE; } - /**Sets up an instance of `LiveDataHostApi` to handle messages through the `binaryMessenger`. */ + /** + * Sets up an instance of `LiveDataHostApi` to handle messages through the `binaryMessenger`. + */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable LiveDataHostApi api) { { BasicMessageChannel channel = @@ -2546,10 +2746,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable LiveDataHo Number identifierArg = (Number) args.get(0); Number observerIdentifierArg = (Number) args.get(1); try { - api.observe((identifierArg == null) ? null : identifierArg.longValue(), (observerIdentifierArg == null) ? null : observerIdentifierArg.longValue()); + api.observe( + (identifierArg == null) ? null : identifierArg.longValue(), + (observerIdentifierArg == null) ? null : observerIdentifierArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2572,8 +2773,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable LiveDataHo try { api.removeObservers((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2595,10 +2795,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable LiveDataHo Number identifierArg = (Number) args.get(0); LiveDataSupportedTypeData typeArg = (LiveDataSupportedTypeData) args.get(1); try { - Long output = api.getValue((identifierArg == null) ? null : identifierArg.longValue(), typeArg); + Long output = + api.getValue( + (identifierArg == null) ? null : identifierArg.longValue(), typeArg); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2645,7 +2846,7 @@ public LiveDataFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2654,7 +2855,11 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return LiveDataFlutterApiCodec.INSTANCE; } - public void create(@NonNull Long identifierArg, @NonNull LiveDataSupportedTypeData typeArg, @NonNull Reply callback) { + + public void create( + @NonNull Long identifierArg, + @NonNull LiveDataSupportedTypeData typeArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.LiveDataFlutterApi.create", getCodec()); @@ -2671,7 +2876,7 @@ public AnalyzerFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2680,6 +2885,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2688,7 +2894,11 @@ public void create(@NonNull Long identifierArg, @NonNull Reply callback) { new ArrayList(Collections.singletonList(identifierArg)), channelReply -> callback.reply(null)); } - public void analyze(@NonNull Long identifierArg, @NonNull Long imageProxyIdentifierArg, @NonNull Reply callback) { + + public void analyze( + @NonNull Long identifierArg, + @NonNull Long imageProxyIdentifierArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.AnalyzerFlutterApi.analyze", getCodec()); @@ -2700,7 +2910,7 @@ public void analyze(@NonNull Long identifierArg, @NonNull Long imageProxyIdentif /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface ImageProxyHostApi { - @NonNull + @NonNull List getPlanes(@NonNull Long identifier); void close(@NonNull Long identifier); @@ -2709,7 +2919,9 @@ public interface ImageProxyHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `ImageProxyHostApi` to handle messages through the `binaryMessenger`. */ + /** + * Sets up an instance of `ImageProxyHostApi` to handle messages through the `binaryMessenger`. + */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageProxyHostApi api) { { BasicMessageChannel channel = @@ -2722,10 +2934,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageProxy ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - List output = api.getPlanes((identifierArg == null) ? null : identifierArg.longValue()); + List output = + api.getPlanes((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2748,8 +2960,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageProxy try { api.close((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2769,7 +2980,7 @@ public ImageProxyFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2778,7 +2989,13 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void create(@NonNull Long identifierArg, @NonNull Long formatArg, @NonNull Long heightArg, @NonNull Long widthArg, @NonNull Reply callback) { + + public void create( + @NonNull Long identifierArg, + @NonNull Long formatArg, + @NonNull Long heightArg, + @NonNull Long widthArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.ImageProxyFlutterApi.create", getCodec()); @@ -2795,7 +3012,7 @@ public PlaneProxyFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2804,12 +3021,19 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void create(@NonNull Long identifierArg, @NonNull byte[] bufferArg, @NonNull Long pixelStrideArg, @NonNull Long rowStrideArg, @NonNull Reply callback) { + + public void create( + @NonNull Long identifierArg, + @NonNull byte[] bufferArg, + @NonNull Long pixelStrideArg, + @NonNull Long rowStrideArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.PlaneProxyFlutterApi.create", getCodec()); channel.send( - new ArrayList(Arrays.asList(identifierArg, bufferArg, pixelStrideArg, rowStrideArg)), + new ArrayList( + Arrays.asList(identifierArg, bufferArg, pixelStrideArg, rowStrideArg)), channelReply -> callback.reply(null)); } } @@ -2848,17 +3072,24 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface QualitySelectorHostApi { - void create(@NonNull Long identifier, @NonNull List videoQualityDataList, @Nullable Long fallbackStrategyId); + void create( + @NonNull Long identifier, + @NonNull List videoQualityDataList, + @Nullable Long fallbackStrategyId); - @NonNull + @NonNull ResolutionInfo getResolution(@NonNull Long cameraInfoId, @NonNull VideoQuality quality); /** The codec used by QualitySelectorHostApi. */ static @NonNull MessageCodec getCodec() { return QualitySelectorHostApiCodec.INSTANCE; } - /**Sets up an instance of `QualitySelectorHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable QualitySelectorHostApi api) { + /** + * Sets up an instance of `QualitySelectorHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable QualitySelectorHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2869,13 +3100,16 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable QualitySel ArrayList wrapped = new ArrayList(); ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); - List videoQualityDataListArg = (List) args.get(1); + List videoQualityDataListArg = + (List) args.get(1); Number fallbackStrategyIdArg = (Number) args.get(2); try { - api.create((identifierArg == null) ? null : identifierArg.longValue(), videoQualityDataListArg, (fallbackStrategyIdArg == null) ? null : fallbackStrategyIdArg.longValue()); + api.create( + (identifierArg == null) ? null : identifierArg.longValue(), + videoQualityDataListArg, + (fallbackStrategyIdArg == null) ? null : fallbackStrategyIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2888,19 +3122,24 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable QualitySel { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.QualitySelectorHostApi.getResolution", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.QualitySelectorHostApi.getResolution", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { ArrayList wrapped = new ArrayList(); ArrayList args = (ArrayList) message; Number cameraInfoIdArg = (Number) args.get(0); - VideoQuality qualityArg = args.get(1) == null ? null : VideoQuality.values()[(int) args.get(1)]; + VideoQuality qualityArg = + args.get(1) == null ? null : VideoQuality.values()[(int) args.get(1)]; try { - ResolutionInfo output = api.getResolution((cameraInfoIdArg == null) ? null : cameraInfoIdArg.longValue(), qualityArg); + ResolutionInfo output = + api.getResolution( + (cameraInfoIdArg == null) ? null : cameraInfoIdArg.longValue(), + qualityArg); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2915,14 +3154,21 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable QualitySel /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface FallbackStrategyHostApi { - void create(@NonNull Long identifier, @NonNull VideoQuality quality, @NonNull VideoResolutionFallbackRule fallbackRule); + void create( + @NonNull Long identifier, + @NonNull VideoQuality quality, + @NonNull VideoResolutionFallbackRule fallbackRule); /** The codec used by FallbackStrategyHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `FallbackStrategyHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable FallbackStrategyHostApi api) { + /** + * Sets up an instance of `FallbackStrategyHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable FallbackStrategyHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2933,13 +3179,19 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable FallbackSt ArrayList wrapped = new ArrayList(); ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); - VideoQuality qualityArg = args.get(1) == null ? null : VideoQuality.values()[(int) args.get(1)]; - VideoResolutionFallbackRule fallbackRuleArg = args.get(2) == null ? null : VideoResolutionFallbackRule.values()[(int) args.get(2)]; + VideoQuality qualityArg = + args.get(1) == null ? null : VideoQuality.values()[(int) args.get(1)]; + VideoResolutionFallbackRule fallbackRuleArg = + args.get(2) == null + ? null + : VideoResolutionFallbackRule.values()[(int) args.get(2)]; try { - api.create((identifierArg == null) ? null : identifierArg.longValue(), qualityArg, fallbackRuleArg); + api.create( + (identifierArg == null) ? null : identifierArg.longValue(), + qualityArg, + fallbackRuleArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/QualitySelectorHostApiImpl.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/QualitySelectorHostApiImpl.java index 330c09047ce..675225454c5 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/QualitySelectorHostApiImpl.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/QualitySelectorHostApiImpl.java @@ -11,10 +11,10 @@ import androidx.camera.video.FallbackStrategy; import androidx.camera.video.Quality; import androidx.camera.video.QualitySelector; -import io.flutter.plugins.camerax.GeneratedCameraXLibrary.VideoQuality; -import io.flutter.plugins.camerax.GeneratedCameraXLibrary.VideoQualityData; import io.flutter.plugins.camerax.GeneratedCameraXLibrary.QualitySelectorHostApi; import io.flutter.plugins.camerax.GeneratedCameraXLibrary.ResolutionInfo; +import io.flutter.plugins.camerax.GeneratedCameraXLibrary.VideoQuality; +import io.flutter.plugins.camerax.GeneratedCameraXLibrary.VideoQualityData; import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -120,8 +120,7 @@ public void create( * Converts the specified {@link VideoQuality to a {@link Quality} that is understood * by CameraX. */ - public static @NonNull Quality getQualityFromVideoQuality( - @NonNull VideoQuality videoQuality) { + public static @NonNull Quality getQualityFromVideoQuality(@NonNull VideoQuality videoQuality) { switch (videoQuality) { case SD: return Quality.SD; @@ -137,8 +136,6 @@ public void create( return Quality.HIGHEST; } throw new IllegalArgumentException( - "VideoQuality " - + videoQuality - + " is unhandled by QualitySelectorHostApiImpl."); + "VideoQuality " + videoQuality + " is unhandled by QualitySelectorHostApiImpl."); } } diff --git a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/FallbackStrategyTest.java b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/FallbackStrategyTest.java index da502edec98..a68384fc720 100644 --- a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/FallbackStrategyTest.java +++ b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/FallbackStrategyTest.java @@ -72,10 +72,7 @@ public void hostApiCreate_makesCallToCreateExpectedFallbackStrategy() { convertedQuality = Quality.HIGHEST; break; default: - fail( - "The VideoQuality " - + videoQuality.toString() - + "is unhandled by this test."); + fail("The VideoQuality " + videoQuality.toString() + "is unhandled by this test."); } // Set Quality as final local variable to avoid error about using non-final (or effecitvely final) local variables in lambda expressions. final Quality expectedQuality = convertedQuality; diff --git a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/QualitySelectorTest.java b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/QualitySelectorTest.java index 78c38f07ebe..83617a713d8 100644 --- a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/QualitySelectorTest.java +++ b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/QualitySelectorTest.java @@ -49,9 +49,8 @@ public void tearDown() { @Test public void hostApiCreate_createsExpectedQualitySelectorWhenOneQualitySpecified() { final VideoQualityData expectedVideoQualityData = - new VideoQualityData.Builder().setQuality(VideoQuality.UHD).build(); - final List videoQualityDataList = - Arrays.asList(expectedVideoQualityData); + new VideoQualityData.Builder().setQuality(VideoQuality.UHD).build(); + final List videoQualityDataList = Arrays.asList(expectedVideoQualityData); final FallbackStrategy mockFallbackStrategy = mock(FallbackStrategy.class); final long fallbackStrategyIdentifier = 9; final QualitySelectorHostApiImpl hostApi = new QualitySelectorHostApiImpl(instanceManager); @@ -89,11 +88,9 @@ public void hostApiCreate_createsExpectedQualitySelectorWhenOneQualitySpecified( public void hostApiCreate_createsExpectedQualitySelectorWhenOrderedListOfQualitiesSpecified() { final List videoQualityDataList = Arrays.asList( - new VideoQualityData.Builder().setQuality(VideoQuality.UHD).build(), - new VideoQualityData.Builder().setQuality(VideoQuality.HIGHEST).build() - ); - final List expectedVideoQualityList = - Arrays.asList(Quality.UHD, Quality.HIGHEST); + new VideoQualityData.Builder().setQuality(VideoQuality.UHD).build(), + new VideoQualityData.Builder().setQuality(VideoQuality.HIGHEST).build()); + final List expectedVideoQualityList = Arrays.asList(Quality.UHD, Quality.HIGHEST); final FallbackStrategy mockFallbackStrategy = mock(FallbackStrategy.class); final long fallbackStrategyIdentifier = 9; final QualitySelectorHostApiImpl hostApi = new QualitySelectorHostApiImpl(instanceManager); @@ -107,9 +104,7 @@ public void hostApiCreate_createsExpectedQualitySelectorWhenOrderedListOfQualiti (Answer) invocation -> mockQualitySelectorWithoutFallbackStrategy); mockedQualitySelector .when( - () -> - QualitySelector.fromOrderedList( - expectedVideoQualityList, mockFallbackStrategy)) + () -> QualitySelector.fromOrderedList(expectedVideoQualityList, mockFallbackStrategy)) .thenAnswer( (Answer) invocation -> mockQualitySelectorWithFallbackStrategy); @@ -145,8 +140,7 @@ public void getResolution_returnsExpectedResolutionInfo() { .when(() -> QualitySelector.getResolution(mockCameraInfo, Quality.FHD)) .thenAnswer((Answer) invocation -> sizeResult); - final ResolutionInfo result = - hostApi.getResolution(cameraInfoIdentifier, videoQuality); + final ResolutionInfo result = hostApi.getResolution(cameraInfoIdentifier, videoQuality); assertEquals(result.getWidth(), Long.valueOf(sizeResult.getWidth())); assertEquals(result.getHeight(), Long.valueOf(sizeResult.getHeight())); diff --git a/packages/camera/camera_android_camerax/lib/src/camerax_library.g.dart b/packages/camera/camera_android_camerax/lib/src/camerax_library.g.dart index b0e9b4dffd1..dda3a81442d 100644 --- a/packages/camera/camera_android_camerax/lib/src/camerax_library.g.dart +++ b/packages/camera/camera_android_camerax/lib/src/camerax_library.g.dart @@ -227,8 +227,7 @@ class InstanceManagerHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.InstanceManagerHostApi.clear', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -284,7 +283,8 @@ abstract class JavaObjectFlutterApi { void dispose(int identifier); - static void setup(JavaObjectFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(JavaObjectFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaObjectFlutterApi.dispose', codec, @@ -294,7 +294,7 @@ abstract class JavaObjectFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaObjectFlutterApi.dispose was null.'); + 'Argument for dev.flutter.pigeon.JavaObjectFlutterApi.dispose was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -431,7 +431,8 @@ abstract class CameraInfoFlutterApi { void create(int identifier); - static void setup(CameraInfoFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(CameraInfoFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraInfoFlutterApi.create', codec, @@ -441,7 +442,7 @@ abstract class CameraInfoFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraInfoFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.CameraInfoFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -468,8 +469,8 @@ class CameraSelectorHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraSelectorHostApi.create', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_lensFacing]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_lensFacing]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -486,12 +487,13 @@ class CameraSelectorHostApi { } } - Future> filter(int arg_identifier, List arg_cameraInfoIds) async { + Future> filter( + int arg_identifier, List arg_cameraInfoIds) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraSelectorHostApi.filter', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_cameraInfoIds]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_cameraInfoIds]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -519,7 +521,8 @@ abstract class CameraSelectorFlutterApi { void create(int identifier, int? lensFacing); - static void setup(CameraSelectorFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(CameraSelectorFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraSelectorFlutterApi.create', codec, @@ -529,7 +532,7 @@ abstract class CameraSelectorFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraSelectorFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.CameraSelectorFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -557,8 +560,7 @@ class ProcessCameraProviderHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ProcessCameraProviderHostApi.getInstance', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -582,7 +584,8 @@ class ProcessCameraProviderHostApi { Future> getAvailableCameraInfos(int arg_identifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.ProcessCameraProviderHostApi.getAvailableCameraInfos', codec, + 'dev.flutter.pigeon.ProcessCameraProviderHostApi.getAvailableCameraInfos', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_identifier]) as List?; @@ -607,12 +610,17 @@ class ProcessCameraProviderHostApi { } } - Future bindToLifecycle(int arg_identifier, int arg_cameraSelectorIdentifier, List arg_useCaseIds) async { + Future bindToLifecycle(int arg_identifier, + int arg_cameraSelectorIdentifier, List arg_useCaseIds) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.ProcessCameraProviderHostApi.bindToLifecycle', codec, + 'dev.flutter.pigeon.ProcessCameraProviderHostApi.bindToLifecycle', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_cameraSelectorIdentifier, arg_useCaseIds]) as List?; + final List? replyList = await channel.send([ + arg_identifier, + arg_cameraSelectorIdentifier, + arg_useCaseIds + ]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -639,7 +647,8 @@ class ProcessCameraProviderHostApi { 'dev.flutter.pigeon.ProcessCameraProviderHostApi.isBound', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_identifier, arg_useCaseIdentifier]) as List?; + await channel.send([arg_identifier, arg_useCaseIdentifier]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -665,8 +674,8 @@ class ProcessCameraProviderHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ProcessCameraProviderHostApi.unbind', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_useCaseIds]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_useCaseIds]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -711,7 +720,8 @@ abstract class ProcessCameraProviderFlutterApi { void create(int identifier); - static void setup(ProcessCameraProviderFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(ProcessCameraProviderFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ProcessCameraProviderFlutterApi.create', codec, @@ -721,7 +731,7 @@ abstract class ProcessCameraProviderFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ProcessCameraProviderFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.ProcessCameraProviderFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -787,7 +797,7 @@ abstract class CameraFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.CameraFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -815,7 +825,7 @@ class _SystemServicesHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return CameraPermissionsErrorData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -833,9 +843,11 @@ class SystemServicesHostApi { static const MessageCodec codec = _SystemServicesHostApiCodec(); - Future requestCameraPermissions(bool arg_enableAudio) async { + Future requestCameraPermissions( + bool arg_enableAudio) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.SystemServicesHostApi.requestCameraPermissions', codec, + 'dev.flutter.pigeon.SystemServicesHostApi.requestCameraPermissions', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_enableAudio]) as List?; @@ -855,12 +867,15 @@ class SystemServicesHostApi { } } - Future startListeningForDeviceOrientationChange(bool arg_isFrontFacing, int arg_sensorOrientation) async { + Future startListeningForDeviceOrientationChange( + bool arg_isFrontFacing, int arg_sensorOrientation) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.SystemServicesHostApi.startListeningForDeviceOrientationChange', codec, + 'dev.flutter.pigeon.SystemServicesHostApi.startListeningForDeviceOrientationChange', + codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_isFrontFacing, arg_sensorOrientation]) as List?; + await channel.send([arg_isFrontFacing, arg_sensorOrientation]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -879,10 +894,10 @@ class SystemServicesHostApi { Future stopListeningForDeviceOrientationChange() async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.SystemServicesHostApi.stopListeningForDeviceOrientationChange', codec, + 'dev.flutter.pigeon.SystemServicesHostApi.stopListeningForDeviceOrientationChange', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -934,17 +949,19 @@ abstract class SystemServicesFlutterApi { void onCameraError(String errorDescription); - static void setup(SystemServicesFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(SystemServicesFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.SystemServicesFlutterApi.onDeviceOrientationChanged', codec, + 'dev.flutter.pigeon.SystemServicesFlutterApi.onDeviceOrientationChanged', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.SystemServicesFlutterApi.onDeviceOrientationChanged was null.'); + 'Argument for dev.flutter.pigeon.SystemServicesFlutterApi.onDeviceOrientationChanged was null.'); final List args = (message as List?)!; final String? arg_orientation = (args[0] as String?); assert(arg_orientation != null, @@ -963,7 +980,7 @@ abstract class SystemServicesFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.SystemServicesFlutterApi.onCameraError was null.'); + 'Argument for dev.flutter.pigeon.SystemServicesFlutterApi.onCameraError was null.'); final List args = (message as List?)!; final String? arg_errorDescription = (args[0] as String?); assert(arg_errorDescription != null, @@ -991,7 +1008,7 @@ class _PreviewHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return ResolutionInfo.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -1009,12 +1026,14 @@ class PreviewHostApi { static const MessageCodec codec = _PreviewHostApiCodec(); - Future create(int arg_identifier, int? arg_rotation, int? arg_resolutionSelectorId) async { + Future create(int arg_identifier, int? arg_rotation, + int? arg_resolutionSelectorId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PreviewHostApi.create', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_rotation, arg_resolutionSelectorId]) as List?; + final List? replyList = await channel.send( + [arg_identifier, arg_rotation, arg_resolutionSelectorId]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1062,8 +1081,7 @@ class PreviewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PreviewHostApi.releaseFlutterSurfaceTexture', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1178,7 +1196,8 @@ abstract class VideoCaptureFlutterApi { void create(int identifier); - static void setup(VideoCaptureFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(VideoCaptureFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.VideoCaptureFlutterApi.create', codec, @@ -1188,7 +1207,7 @@ abstract class VideoCaptureFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.VideoCaptureFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.VideoCaptureFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1211,12 +1230,17 @@ class RecorderHostApi { static const MessageCodec codec = StandardMessageCodec(); - Future create(int arg_identifier, int? arg_aspectRatio, int? arg_bitRate, int? arg_qualitySelectorId) async { + Future create(int arg_identifier, int? arg_aspectRatio, + int? arg_bitRate, int? arg_qualitySelectorId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.RecorderHostApi.create', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_aspectRatio, arg_bitRate, arg_qualitySelectorId]) as List?; + final List? replyList = await channel.send([ + arg_identifier, + arg_aspectRatio, + arg_bitRate, + arg_qualitySelectorId + ]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1262,7 +1286,8 @@ class RecorderHostApi { Future getTargetVideoEncodingBitRate(int arg_identifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.RecorderHostApi.getTargetVideoEncodingBitRate', codec, + 'dev.flutter.pigeon.RecorderHostApi.getTargetVideoEncodingBitRate', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_identifier]) as List?; @@ -1291,8 +1316,8 @@ class RecorderHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.RecorderHostApi.prepareRecording', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_path]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_path]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1320,7 +1345,8 @@ abstract class RecorderFlutterApi { void create(int identifier, int? aspectRatio, int? bitRate); - static void setup(RecorderFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(RecorderFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.RecorderFlutterApi.create', codec, @@ -1330,7 +1356,7 @@ abstract class RecorderFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.RecorderFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.RecorderFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1388,7 +1414,8 @@ abstract class PendingRecordingFlutterApi { void create(int identifier); - static void setup(PendingRecordingFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(PendingRecordingFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PendingRecordingFlutterApi.create', codec, @@ -1398,7 +1425,7 @@ abstract class PendingRecordingFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PendingRecordingFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.PendingRecordingFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1515,7 +1542,8 @@ abstract class RecordingFlutterApi { void create(int identifier); - static void setup(RecordingFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(RecordingFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.RecordingFlutterApi.create', codec, @@ -1525,7 +1553,7 @@ abstract class RecordingFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.RecordingFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.RecordingFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1548,12 +1576,14 @@ class ImageCaptureHostApi { static const MessageCodec codec = StandardMessageCodec(); - Future create(int arg_identifier, int? arg_flashMode, int? arg_resolutionSelectorId) async { + Future create(int arg_identifier, int? arg_flashMode, + int? arg_resolutionSelectorId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ImageCaptureHostApi.create', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_flashMode, arg_resolutionSelectorId]) as List?; + final List? replyList = await channel.send( + [arg_identifier, arg_flashMode, arg_resolutionSelectorId]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1574,8 +1604,8 @@ class ImageCaptureHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ImageCaptureHostApi.setFlashMode', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_flashMode]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_flashMode]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1635,7 +1665,7 @@ class _ResolutionStrategyHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return ResolutionInfo.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -1653,12 +1683,14 @@ class ResolutionStrategyHostApi { static const MessageCodec codec = _ResolutionStrategyHostApiCodec(); - Future create(int arg_identifier, ResolutionInfo? arg_boundSize, int? arg_fallbackRule) async { + Future create(int arg_identifier, ResolutionInfo? arg_boundSize, + int? arg_fallbackRule) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ResolutionStrategyHostApi.create', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_boundSize, arg_fallbackRule]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_boundSize, arg_fallbackRule]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1686,12 +1718,16 @@ class ResolutionSelectorHostApi { static const MessageCodec codec = StandardMessageCodec(); - Future create(int arg_identifier, int? arg_resolutionStrategyIdentifier, int? arg_aspectRatioStrategyIdentifier) async { + Future create(int arg_identifier, int? arg_resolutionStrategyIdentifier, + int? arg_aspectRatioStrategyIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ResolutionSelectorHostApi.create', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_resolutionStrategyIdentifier, arg_aspectRatioStrategyIdentifier]) as List?; + final List? replyList = await channel.send([ + arg_identifier, + arg_resolutionStrategyIdentifier, + arg_aspectRatioStrategyIdentifier + ]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1719,12 +1755,16 @@ class AspectRatioStrategyHostApi { static const MessageCodec codec = StandardMessageCodec(); - Future create(int arg_identifier, int arg_preferredAspectRatio, int arg_fallbackRule) async { + Future create(int arg_identifier, int arg_preferredAspectRatio, + int arg_fallbackRule) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.AspectRatioStrategyHostApi.create', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_preferredAspectRatio, arg_fallbackRule]) as List?; + final List? replyList = await channel.send([ + arg_identifier, + arg_preferredAspectRatio, + arg_fallbackRule + ]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1757,7 +1797,7 @@ class _CameraStateFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return CameraStateTypeData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -1770,7 +1810,8 @@ abstract class CameraStateFlutterApi { void create(int identifier, CameraStateTypeData type, int? errorIdentifier); - static void setup(CameraStateFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(CameraStateFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraStateFlutterApi.create', codec, @@ -1780,12 +1821,13 @@ abstract class CameraStateFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraStateFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.CameraStateFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.CameraStateFlutterApi.create was null, expected non-null int.'); - final CameraStateTypeData? arg_type = (args[1] as CameraStateTypeData?); + final CameraStateTypeData? arg_type = + (args[1] as CameraStateTypeData?); assert(arg_type != null, 'Argument for dev.flutter.pigeon.CameraStateFlutterApi.create was null, expected non-null CameraStateTypeData.'); final int? arg_errorIdentifier = (args[2] as int?); @@ -1812,7 +1854,7 @@ class _ExposureStateFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return ExposureCompensationRange.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -1823,9 +1865,13 @@ class _ExposureStateFlutterApiCodec extends StandardMessageCodec { abstract class ExposureStateFlutterApi { static const MessageCodec codec = _ExposureStateFlutterApiCodec(); - void create(int identifier, ExposureCompensationRange exposureCompensationRange, double exposureCompensationStep); + void create( + int identifier, + ExposureCompensationRange exposureCompensationRange, + double exposureCompensationStep); - static void setup(ExposureStateFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(ExposureStateFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ExposureStateFlutterApi.create', codec, @@ -1835,18 +1881,20 @@ abstract class ExposureStateFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ExposureStateFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.ExposureStateFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.ExposureStateFlutterApi.create was null, expected non-null int.'); - final ExposureCompensationRange? arg_exposureCompensationRange = (args[1] as ExposureCompensationRange?); + final ExposureCompensationRange? arg_exposureCompensationRange = + (args[1] as ExposureCompensationRange?); assert(arg_exposureCompensationRange != null, 'Argument for dev.flutter.pigeon.ExposureStateFlutterApi.create was null, expected non-null ExposureCompensationRange.'); final double? arg_exposureCompensationStep = (args[2] as double?); assert(arg_exposureCompensationStep != null, 'Argument for dev.flutter.pigeon.ExposureStateFlutterApi.create was null, expected non-null double.'); - api.create(arg_identifier!, arg_exposureCompensationRange!, arg_exposureCompensationStep!); + api.create(arg_identifier!, arg_exposureCompensationRange!, + arg_exposureCompensationStep!); return; }); } @@ -1859,7 +1907,8 @@ abstract class ZoomStateFlutterApi { void create(int identifier, double minZoomRatio, double maxZoomRatio); - static void setup(ZoomStateFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(ZoomStateFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ZoomStateFlutterApi.create', codec, @@ -1869,7 +1918,7 @@ abstract class ZoomStateFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ZoomStateFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.ZoomStateFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1903,7 +1952,8 @@ class ImageAnalysisHostApi { 'dev.flutter.pigeon.ImageAnalysisHostApi.create', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_identifier, arg_resolutionSelectorId]) as List?; + await channel.send([arg_identifier, arg_resolutionSelectorId]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1920,12 +1970,14 @@ class ImageAnalysisHostApi { } } - Future setAnalyzer(int arg_identifier, int arg_analyzerIdentifier) async { + Future setAnalyzer( + int arg_identifier, int arg_analyzerIdentifier) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ImageAnalysisHostApi.setAnalyzer', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_identifier, arg_analyzerIdentifier]) as List?; + await channel.send([arg_identifier, arg_analyzerIdentifier]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2036,7 +2088,8 @@ abstract class ObserverFlutterApi { void onChanged(int identifier, int valueIdentifier); - static void setup(ObserverFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(ObserverFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ObserverFlutterApi.onChanged', codec, @@ -2046,7 +2099,7 @@ abstract class ObserverFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ObserverFlutterApi.onChanged was null.'); + 'Argument for dev.flutter.pigeon.ObserverFlutterApi.onChanged was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -2067,7 +2120,8 @@ abstract class CameraStateErrorFlutterApi { void create(int identifier, int code); - static void setup(CameraStateErrorFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(CameraStateErrorFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraStateErrorFlutterApi.create', codec, @@ -2077,7 +2131,7 @@ abstract class CameraStateErrorFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraStateErrorFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.CameraStateErrorFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -2108,7 +2162,7 @@ class _LiveDataHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return LiveDataSupportedTypeData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -2131,7 +2185,8 @@ class LiveDataHostApi { 'dev.flutter.pigeon.LiveDataHostApi.observe', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_identifier, arg_observerIdentifier]) as List?; + await channel.send([arg_identifier, arg_observerIdentifier]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2170,12 +2225,13 @@ class LiveDataHostApi { } } - Future getValue(int arg_identifier, LiveDataSupportedTypeData arg_type) async { + Future getValue( + int arg_identifier, LiveDataSupportedTypeData arg_type) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.LiveDataHostApi.getValue', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_type]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_type]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2208,7 +2264,7 @@ class _LiveDataFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return LiveDataSupportedTypeData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -2221,7 +2277,8 @@ abstract class LiveDataFlutterApi { void create(int identifier, LiveDataSupportedTypeData type); - static void setup(LiveDataFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(LiveDataFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.LiveDataFlutterApi.create', codec, @@ -2231,12 +2288,13 @@ abstract class LiveDataFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.LiveDataFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.LiveDataFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.LiveDataFlutterApi.create was null, expected non-null int.'); - final LiveDataSupportedTypeData? arg_type = (args[1] as LiveDataSupportedTypeData?); + final LiveDataSupportedTypeData? arg_type = + (args[1] as LiveDataSupportedTypeData?); assert(arg_type != null, 'Argument for dev.flutter.pigeon.LiveDataFlutterApi.create was null, expected non-null LiveDataSupportedTypeData.'); api.create(arg_identifier!, arg_type!); @@ -2254,7 +2312,8 @@ abstract class AnalyzerFlutterApi { void analyze(int identifier, int imageProxyIdentifier); - static void setup(AnalyzerFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(AnalyzerFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.AnalyzerFlutterApi.create', codec, @@ -2264,7 +2323,7 @@ abstract class AnalyzerFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.AnalyzerFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.AnalyzerFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -2283,7 +2342,7 @@ abstract class AnalyzerFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.AnalyzerFlutterApi.analyze was null.'); + 'Argument for dev.flutter.pigeon.AnalyzerFlutterApi.analyze was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -2364,7 +2423,8 @@ abstract class ImageProxyFlutterApi { void create(int identifier, int format, int height, int width); - static void setup(ImageProxyFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(ImageProxyFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ImageProxyFlutterApi.create', codec, @@ -2374,7 +2434,7 @@ abstract class ImageProxyFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ImageProxyFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.ImageProxyFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -2401,7 +2461,8 @@ abstract class PlaneProxyFlutterApi { void create(int identifier, Uint8List buffer, int pixelStride, int rowStride); - static void setup(PlaneProxyFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(PlaneProxyFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PlaneProxyFlutterApi.create', codec, @@ -2411,7 +2472,7 @@ abstract class PlaneProxyFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PlaneProxyFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.PlaneProxyFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -2425,7 +2486,8 @@ abstract class PlaneProxyFlutterApi { final int? arg_rowStride = (args[3] as int?); assert(arg_rowStride != null, 'Argument for dev.flutter.pigeon.PlaneProxyFlutterApi.create was null, expected non-null int.'); - api.create(arg_identifier!, arg_buffer!, arg_pixelStride!, arg_rowStride!); + api.create( + arg_identifier!, arg_buffer!, arg_pixelStride!, arg_rowStride!); return; }); } @@ -2451,9 +2513,9 @@ class _QualitySelectorHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return ResolutionInfo.decode(readValue(buffer)!); - case 129: + case 129: return VideoQualityData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -2471,12 +2533,18 @@ class QualitySelectorHostApi { static const MessageCodec codec = _QualitySelectorHostApiCodec(); - Future create(int arg_identifier, List arg_videoQualityDataList, int? arg_fallbackStrategyId) async { + Future create( + int arg_identifier, + List arg_videoQualityDataList, + int? arg_fallbackStrategyId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.QualitySelectorHostApi.create', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_videoQualityDataList, arg_fallbackStrategyId]) as List?; + final List? replyList = await channel.send([ + arg_identifier, + arg_videoQualityDataList, + arg_fallbackStrategyId + ]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2493,12 +2561,13 @@ class QualitySelectorHostApi { } } - Future getResolution(int arg_cameraInfoId, VideoQuality arg_quality) async { + Future getResolution( + int arg_cameraInfoId, VideoQuality arg_quality) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.QualitySelectorHostApi.getResolution', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_cameraInfoId, arg_quality.index]) as List?; + final List? replyList = await channel + .send([arg_cameraInfoId, arg_quality.index]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2531,12 +2600,16 @@ class FallbackStrategyHostApi { static const MessageCodec codec = StandardMessageCodec(); - Future create(int arg_identifier, VideoQuality arg_quality, VideoResolutionFallbackRule arg_fallbackRule) async { + Future create(int arg_identifier, VideoQuality arg_quality, + VideoResolutionFallbackRule arg_fallbackRule) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.FallbackStrategyHostApi.create', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_quality.index, arg_fallbackRule.index]) as List?; + final List? replyList = await channel.send([ + arg_identifier, + arg_quality.index, + arg_fallbackRule.index + ]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', diff --git a/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart b/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart index cc1f6aa5c40..bece9281bb8 100644 --- a/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart +++ b/packages/camera/camera_android_camerax/test/android_camera_camerax_test.dart @@ -435,8 +435,7 @@ void main() { quality: expectedVideoQuality, fallbackRule: expectedFallbackRule); - expect(camera.recorder!.qualitySelector!.qualityList.length, - equals(1)); + expect(camera.recorder!.qualitySelector!.qualityList.length, equals(1)); expect(camera.recorder!.qualitySelector!.qualityList.first.quality, equals(expectedVideoQuality)); expect(camera.recorder!.qualitySelector!.fallbackStrategy!.quality, diff --git a/packages/camera/camera_android_camerax/test/test_camerax_library.g.dart b/packages/camera/camera_android_camerax/test/test_camerax_library.g.dart index e293aa2f6a4..c649a735215 100644 --- a/packages/camera/camera_android_camerax/test/test_camerax_library.g.dart +++ b/packages/camera/camera_android_camerax/test/test_camerax_library.g.dart @@ -14,7 +14,8 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:camera_android_camerax/src/camerax_library.g.dart'; abstract class TestInstanceManagerHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); /// Clear the native `InstanceManager`. @@ -22,15 +23,19 @@ abstract class TestInstanceManagerHostApi { /// This is typically only used after a hot restart. void clear(); - static void setup(TestInstanceManagerHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestInstanceManagerHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.InstanceManagerHostApi.clear', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { // ignore message api.clear(); return []; @@ -41,22 +46,27 @@ abstract class TestInstanceManagerHostApi { } abstract class TestJavaObjectHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void dispose(int identifier); - static void setup(TestJavaObjectHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestJavaObjectHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaObjectHostApi.dispose', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaObjectHostApi.dispose was null.'); + 'Argument for dev.flutter.pigeon.JavaObjectHostApi.dispose was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -70,7 +80,8 @@ abstract class TestJavaObjectHostApi { } abstract class TestCameraInfoHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); int getSensorRotationDegrees(int identifier); @@ -81,17 +92,22 @@ abstract class TestCameraInfoHostApi { int getZoomState(int identifier); - static void setup(TestCameraInfoHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestCameraInfoHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CameraInfoHostApi.getSensorRotationDegrees', codec, + 'dev.flutter.pigeon.CameraInfoHostApi.getSensorRotationDegrees', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraInfoHostApi.getSensorRotationDegrees was null.'); + 'Argument for dev.flutter.pigeon.CameraInfoHostApi.getSensorRotationDegrees was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -106,11 +122,14 @@ abstract class TestCameraInfoHostApi { 'dev.flutter.pigeon.CameraInfoHostApi.getCameraState', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraInfoHostApi.getCameraState was null.'); + 'Argument for dev.flutter.pigeon.CameraInfoHostApi.getCameraState was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -125,11 +144,14 @@ abstract class TestCameraInfoHostApi { 'dev.flutter.pigeon.CameraInfoHostApi.getExposureState', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraInfoHostApi.getExposureState was null.'); + 'Argument for dev.flutter.pigeon.CameraInfoHostApi.getExposureState was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -144,11 +166,14 @@ abstract class TestCameraInfoHostApi { 'dev.flutter.pigeon.CameraInfoHostApi.getZoomState', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraInfoHostApi.getZoomState was null.'); + 'Argument for dev.flutter.pigeon.CameraInfoHostApi.getZoomState was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -162,24 +187,29 @@ abstract class TestCameraInfoHostApi { } abstract class TestCameraSelectorHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int identifier, int? lensFacing); List filter(int identifier, List cameraInfoIds); - static void setup(TestCameraSelectorHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestCameraSelectorHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraSelectorHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraSelectorHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.CameraSelectorHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -195,19 +225,24 @@ abstract class TestCameraSelectorHostApi { 'dev.flutter.pigeon.CameraSelectorHostApi.filter', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraSelectorHostApi.filter was null.'); + 'Argument for dev.flutter.pigeon.CameraSelectorHostApi.filter was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.CameraSelectorHostApi.filter was null, expected non-null int.'); - final List? arg_cameraInfoIds = (args[1] as List?)?.cast(); + final List? arg_cameraInfoIds = + (args[1] as List?)?.cast(); assert(arg_cameraInfoIds != null, 'Argument for dev.flutter.pigeon.CameraSelectorHostApi.filter was null, expected non-null List.'); - final List output = api.filter(arg_identifier!, arg_cameraInfoIds!); + final List output = + api.filter(arg_identifier!, arg_cameraInfoIds!); return [output]; }); } @@ -216,14 +251,16 @@ abstract class TestCameraSelectorHostApi { } abstract class TestProcessCameraProviderHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); Future getInstance(); List getAvailableCameraInfos(int identifier); - int bindToLifecycle(int identifier, int cameraSelectorIdentifier, List useCaseIds); + int bindToLifecycle( + int identifier, int cameraSelectorIdentifier, List useCaseIds); bool isBound(int identifier, int useCaseIdentifier); @@ -231,15 +268,19 @@ abstract class TestProcessCameraProviderHostApi { void unbindAll(int identifier); - static void setup(TestProcessCameraProviderHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestProcessCameraProviderHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ProcessCameraProviderHostApi.getInstance', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { // ignore message final int output = await api.getInstance(); return [output]; @@ -248,33 +289,42 @@ abstract class TestProcessCameraProviderHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.ProcessCameraProviderHostApi.getAvailableCameraInfos', codec, + 'dev.flutter.pigeon.ProcessCameraProviderHostApi.getAvailableCameraInfos', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.getAvailableCameraInfos was null.'); + 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.getAvailableCameraInfos was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.getAvailableCameraInfos was null, expected non-null int.'); - final List output = api.getAvailableCameraInfos(arg_identifier!); + final List output = + api.getAvailableCameraInfos(arg_identifier!); return [output]; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.ProcessCameraProviderHostApi.bindToLifecycle', codec, + 'dev.flutter.pigeon.ProcessCameraProviderHostApi.bindToLifecycle', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.bindToLifecycle was null.'); + 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.bindToLifecycle was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -282,10 +332,12 @@ abstract class TestProcessCameraProviderHostApi { final int? arg_cameraSelectorIdentifier = (args[1] as int?); assert(arg_cameraSelectorIdentifier != null, 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.bindToLifecycle was null, expected non-null int.'); - final List? arg_useCaseIds = (args[2] as List?)?.cast(); + final List? arg_useCaseIds = + (args[2] as List?)?.cast(); assert(arg_useCaseIds != null, 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.bindToLifecycle was null, expected non-null List.'); - final int output = api.bindToLifecycle(arg_identifier!, arg_cameraSelectorIdentifier!, arg_useCaseIds!); + final int output = api.bindToLifecycle( + arg_identifier!, arg_cameraSelectorIdentifier!, arg_useCaseIds!); return [output]; }); } @@ -295,11 +347,14 @@ abstract class TestProcessCameraProviderHostApi { 'dev.flutter.pigeon.ProcessCameraProviderHostApi.isBound', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.isBound was null.'); + 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.isBound was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -307,7 +362,8 @@ abstract class TestProcessCameraProviderHostApi { final int? arg_useCaseIdentifier = (args[1] as int?); assert(arg_useCaseIdentifier != null, 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.isBound was null, expected non-null int.'); - final bool output = api.isBound(arg_identifier!, arg_useCaseIdentifier!); + final bool output = + api.isBound(arg_identifier!, arg_useCaseIdentifier!); return [output]; }); } @@ -317,16 +373,20 @@ abstract class TestProcessCameraProviderHostApi { 'dev.flutter.pigeon.ProcessCameraProviderHostApi.unbind', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.unbind was null.'); + 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.unbind was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.unbind was null, expected non-null int.'); - final List? arg_useCaseIds = (args[1] as List?)?.cast(); + final List? arg_useCaseIds = + (args[1] as List?)?.cast(); assert(arg_useCaseIds != null, 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.unbind was null, expected non-null List.'); api.unbind(arg_identifier!, arg_useCaseIds!); @@ -339,11 +399,14 @@ abstract class TestProcessCameraProviderHostApi { 'dev.flutter.pigeon.ProcessCameraProviderHostApi.unbindAll', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.unbindAll was null.'); + 'Argument for dev.flutter.pigeon.ProcessCameraProviderHostApi.unbindAll was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -357,22 +420,27 @@ abstract class TestProcessCameraProviderHostApi { } abstract class TestCameraHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); int getCameraInfo(int identifier); - static void setup(TestCameraHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestCameraHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraHostApi.getCameraInfo', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraHostApi.getCameraInfo was null.'); + 'Argument for dev.flutter.pigeon.CameraHostApi.getCameraInfo was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -400,7 +468,7 @@ class _TestSystemServicesHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return CameraPermissionsErrorData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -409,47 +477,60 @@ class _TestSystemServicesHostApiCodec extends StandardMessageCodec { } abstract class TestSystemServicesHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = _TestSystemServicesHostApiCodec(); - Future requestCameraPermissions(bool enableAudio); + Future requestCameraPermissions( + bool enableAudio); - void startListeningForDeviceOrientationChange(bool isFrontFacing, int sensorOrientation); + void startListeningForDeviceOrientationChange( + bool isFrontFacing, int sensorOrientation); void stopListeningForDeviceOrientationChange(); String getTempFilePath(String prefix, String suffix); - static void setup(TestSystemServicesHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestSystemServicesHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.SystemServicesHostApi.requestCameraPermissions', codec, + 'dev.flutter.pigeon.SystemServicesHostApi.requestCameraPermissions', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.SystemServicesHostApi.requestCameraPermissions was null.'); + 'Argument for dev.flutter.pigeon.SystemServicesHostApi.requestCameraPermissions was null.'); final List args = (message as List?)!; final bool? arg_enableAudio = (args[0] as bool?); assert(arg_enableAudio != null, 'Argument for dev.flutter.pigeon.SystemServicesHostApi.requestCameraPermissions was null, expected non-null bool.'); - final CameraPermissionsErrorData? output = await api.requestCameraPermissions(arg_enableAudio!); + final CameraPermissionsErrorData? output = + await api.requestCameraPermissions(arg_enableAudio!); return [output]; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.SystemServicesHostApi.startListeningForDeviceOrientationChange', codec, + 'dev.flutter.pigeon.SystemServicesHostApi.startListeningForDeviceOrientationChange', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.SystemServicesHostApi.startListeningForDeviceOrientationChange was null.'); + 'Argument for dev.flutter.pigeon.SystemServicesHostApi.startListeningForDeviceOrientationChange was null.'); final List args = (message as List?)!; final bool? arg_isFrontFacing = (args[0] as bool?); assert(arg_isFrontFacing != null, @@ -457,19 +538,24 @@ abstract class TestSystemServicesHostApi { final int? arg_sensorOrientation = (args[1] as int?); assert(arg_sensorOrientation != null, 'Argument for dev.flutter.pigeon.SystemServicesHostApi.startListeningForDeviceOrientationChange was null, expected non-null int.'); - api.startListeningForDeviceOrientationChange(arg_isFrontFacing!, arg_sensorOrientation!); + api.startListeningForDeviceOrientationChange( + arg_isFrontFacing!, arg_sensorOrientation!); return []; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.SystemServicesHostApi.stopListeningForDeviceOrientationChange', codec, + 'dev.flutter.pigeon.SystemServicesHostApi.stopListeningForDeviceOrientationChange', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { // ignore message api.stopListeningForDeviceOrientationChange(); return []; @@ -481,11 +567,14 @@ abstract class TestSystemServicesHostApi { 'dev.flutter.pigeon.SystemServicesHostApi.getTempFilePath', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.SystemServicesHostApi.getTempFilePath was null.'); + 'Argument for dev.flutter.pigeon.SystemServicesHostApi.getTempFilePath was null.'); final List args = (message as List?)!; final String? arg_prefix = (args[0] as String?); assert(arg_prefix != null, @@ -516,7 +605,7 @@ class _TestPreviewHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return ResolutionInfo.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -525,7 +614,8 @@ class _TestPreviewHostApiCodec extends StandardMessageCodec { } abstract class TestPreviewHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = _TestPreviewHostApiCodec(); void create(int identifier, int? rotation, int? resolutionSelectorId); @@ -536,17 +626,21 @@ abstract class TestPreviewHostApi { ResolutionInfo getResolutionInfo(int identifier); - static void setup(TestPreviewHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestPreviewHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PreviewHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PreviewHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.PreviewHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -563,11 +657,14 @@ abstract class TestPreviewHostApi { 'dev.flutter.pigeon.PreviewHostApi.setSurfaceProvider', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PreviewHostApi.setSurfaceProvider was null.'); + 'Argument for dev.flutter.pigeon.PreviewHostApi.setSurfaceProvider was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -579,12 +676,16 @@ abstract class TestPreviewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.PreviewHostApi.releaseFlutterSurfaceTexture', codec, + 'dev.flutter.pigeon.PreviewHostApi.releaseFlutterSurfaceTexture', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { // ignore message api.releaseFlutterSurfaceTexture(); return []; @@ -596,11 +697,14 @@ abstract class TestPreviewHostApi { 'dev.flutter.pigeon.PreviewHostApi.getResolutionInfo', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PreviewHostApi.getResolutionInfo was null.'); + 'Argument for dev.flutter.pigeon.PreviewHostApi.getResolutionInfo was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -614,24 +718,29 @@ abstract class TestPreviewHostApi { } abstract class TestVideoCaptureHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); int withOutput(int videoOutputId); int getOutput(int identifier); - static void setup(TestVideoCaptureHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestVideoCaptureHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.VideoCaptureHostApi.withOutput', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.VideoCaptureHostApi.withOutput was null.'); + 'Argument for dev.flutter.pigeon.VideoCaptureHostApi.withOutput was null.'); final List args = (message as List?)!; final int? arg_videoOutputId = (args[0] as int?); assert(arg_videoOutputId != null, @@ -646,11 +755,14 @@ abstract class TestVideoCaptureHostApi { 'dev.flutter.pigeon.VideoCaptureHostApi.getOutput', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.VideoCaptureHostApi.getOutput was null.'); + 'Argument for dev.flutter.pigeon.VideoCaptureHostApi.getOutput was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -664,10 +776,12 @@ abstract class TestVideoCaptureHostApi { } abstract class TestRecorderHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); - void create(int identifier, int? aspectRatio, int? bitRate, int? qualitySelectorId); + void create( + int identifier, int? aspectRatio, int? bitRate, int? qualitySelectorId); int getAspectRatio(int identifier); @@ -675,17 +789,21 @@ abstract class TestRecorderHostApi { int prepareRecording(int identifier, String path); - static void setup(TestRecorderHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestRecorderHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.RecorderHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.RecorderHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.RecorderHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -693,7 +811,8 @@ abstract class TestRecorderHostApi { final int? arg_aspectRatio = (args[1] as int?); final int? arg_bitRate = (args[2] as int?); final int? arg_qualitySelectorId = (args[3] as int?); - api.create(arg_identifier!, arg_aspectRatio, arg_bitRate, arg_qualitySelectorId); + api.create(arg_identifier!, arg_aspectRatio, arg_bitRate, + arg_qualitySelectorId); return []; }); } @@ -703,11 +822,14 @@ abstract class TestRecorderHostApi { 'dev.flutter.pigeon.RecorderHostApi.getAspectRatio', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.RecorderHostApi.getAspectRatio was null.'); + 'Argument for dev.flutter.pigeon.RecorderHostApi.getAspectRatio was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -719,14 +841,18 @@ abstract class TestRecorderHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.RecorderHostApi.getTargetVideoEncodingBitRate', codec, + 'dev.flutter.pigeon.RecorderHostApi.getTargetVideoEncodingBitRate', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.RecorderHostApi.getTargetVideoEncodingBitRate was null.'); + 'Argument for dev.flutter.pigeon.RecorderHostApi.getTargetVideoEncodingBitRate was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -741,11 +867,14 @@ abstract class TestRecorderHostApi { 'dev.flutter.pigeon.RecorderHostApi.prepareRecording', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.RecorderHostApi.prepareRecording was null.'); + 'Argument for dev.flutter.pigeon.RecorderHostApi.prepareRecording was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -762,22 +891,27 @@ abstract class TestRecorderHostApi { } abstract class TestPendingRecordingHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); int start(int identifier); - static void setup(TestPendingRecordingHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestPendingRecordingHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PendingRecordingHostApi.start', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PendingRecordingHostApi.start was null.'); + 'Argument for dev.flutter.pigeon.PendingRecordingHostApi.start was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -791,7 +925,8 @@ abstract class TestPendingRecordingHostApi { } abstract class TestRecordingHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void close(int identifier); @@ -802,17 +937,21 @@ abstract class TestRecordingHostApi { void stop(int identifier); - static void setup(TestRecordingHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestRecordingHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.RecordingHostApi.close', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.RecordingHostApi.close was null.'); + 'Argument for dev.flutter.pigeon.RecordingHostApi.close was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -827,11 +966,14 @@ abstract class TestRecordingHostApi { 'dev.flutter.pigeon.RecordingHostApi.pause', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.RecordingHostApi.pause was null.'); + 'Argument for dev.flutter.pigeon.RecordingHostApi.pause was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -846,11 +988,14 @@ abstract class TestRecordingHostApi { 'dev.flutter.pigeon.RecordingHostApi.resume', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.RecordingHostApi.resume was null.'); + 'Argument for dev.flutter.pigeon.RecordingHostApi.resume was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -865,11 +1010,14 @@ abstract class TestRecordingHostApi { 'dev.flutter.pigeon.RecordingHostApi.stop', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.RecordingHostApi.stop was null.'); + 'Argument for dev.flutter.pigeon.RecordingHostApi.stop was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -883,7 +1031,8 @@ abstract class TestRecordingHostApi { } abstract class TestImageCaptureHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int identifier, int? flashMode, int? resolutionSelectorId); @@ -892,17 +1041,21 @@ abstract class TestImageCaptureHostApi { Future takePicture(int identifier); - static void setup(TestImageCaptureHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestImageCaptureHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ImageCaptureHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ImageCaptureHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.ImageCaptureHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -919,11 +1072,14 @@ abstract class TestImageCaptureHostApi { 'dev.flutter.pigeon.ImageCaptureHostApi.setFlashMode', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ImageCaptureHostApi.setFlashMode was null.'); + 'Argument for dev.flutter.pigeon.ImageCaptureHostApi.setFlashMode was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -941,11 +1097,14 @@ abstract class TestImageCaptureHostApi { 'dev.flutter.pigeon.ImageCaptureHostApi.takePicture', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ImageCaptureHostApi.takePicture was null.'); + 'Argument for dev.flutter.pigeon.ImageCaptureHostApi.takePicture was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -973,7 +1132,7 @@ class _TestResolutionStrategyHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return ResolutionInfo.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -982,22 +1141,28 @@ class _TestResolutionStrategyHostApiCodec extends StandardMessageCodec { } abstract class TestResolutionStrategyHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; - static const MessageCodec codec = _TestResolutionStrategyHostApiCodec(); + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; + static const MessageCodec codec = + _TestResolutionStrategyHostApiCodec(); void create(int identifier, ResolutionInfo? boundSize, int? fallbackRule); - static void setup(TestResolutionStrategyHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestResolutionStrategyHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ResolutionStrategyHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ResolutionStrategyHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.ResolutionStrategyHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1013,29 +1178,36 @@ abstract class TestResolutionStrategyHostApi { } abstract class TestResolutionSelectorHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); - void create(int identifier, int? resolutionStrategyIdentifier, int? aspectRatioStrategyIdentifier); + void create(int identifier, int? resolutionStrategyIdentifier, + int? aspectRatioStrategyIdentifier); - static void setup(TestResolutionSelectorHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestResolutionSelectorHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ResolutionSelectorHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ResolutionSelectorHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.ResolutionSelectorHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.ResolutionSelectorHostApi.create was null, expected non-null int.'); final int? arg_resolutionStrategyIdentifier = (args[1] as int?); final int? arg_aspectRatioStrategyIdentifier = (args[2] as int?); - api.create(arg_identifier!, arg_resolutionStrategyIdentifier, arg_aspectRatioStrategyIdentifier); + api.create(arg_identifier!, arg_resolutionStrategyIdentifier, + arg_aspectRatioStrategyIdentifier); return []; }); } @@ -1044,22 +1216,27 @@ abstract class TestResolutionSelectorHostApi { } abstract class TestAspectRatioStrategyHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int identifier, int preferredAspectRatio, int fallbackRule); - static void setup(TestAspectRatioStrategyHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestAspectRatioStrategyHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.AspectRatioStrategyHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.AspectRatioStrategyHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.AspectRatioStrategyHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1070,7 +1247,8 @@ abstract class TestAspectRatioStrategyHostApi { final int? arg_fallbackRule = (args[2] as int?); assert(arg_fallbackRule != null, 'Argument for dev.flutter.pigeon.AspectRatioStrategyHostApi.create was null, expected non-null int.'); - api.create(arg_identifier!, arg_preferredAspectRatio!, arg_fallbackRule!); + api.create( + arg_identifier!, arg_preferredAspectRatio!, arg_fallbackRule!); return []; }); } @@ -1079,7 +1257,8 @@ abstract class TestAspectRatioStrategyHostApi { } abstract class TestImageAnalysisHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int identifier, int? resolutionSelectorId); @@ -1088,17 +1267,21 @@ abstract class TestImageAnalysisHostApi { void clearAnalyzer(int identifier); - static void setup(TestImageAnalysisHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestImageAnalysisHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ImageAnalysisHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ImageAnalysisHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.ImageAnalysisHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1114,11 +1297,14 @@ abstract class TestImageAnalysisHostApi { 'dev.flutter.pigeon.ImageAnalysisHostApi.setAnalyzer', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ImageAnalysisHostApi.setAnalyzer was null.'); + 'Argument for dev.flutter.pigeon.ImageAnalysisHostApi.setAnalyzer was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1136,11 +1322,14 @@ abstract class TestImageAnalysisHostApi { 'dev.flutter.pigeon.ImageAnalysisHostApi.clearAnalyzer', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ImageAnalysisHostApi.clearAnalyzer was null.'); + 'Argument for dev.flutter.pigeon.ImageAnalysisHostApi.clearAnalyzer was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1154,22 +1343,27 @@ abstract class TestImageAnalysisHostApi { } abstract class TestAnalyzerHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int identifier); - static void setup(TestAnalyzerHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestAnalyzerHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.AnalyzerHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.AnalyzerHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.AnalyzerHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1183,22 +1377,27 @@ abstract class TestAnalyzerHostApi { } abstract class TestObserverHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int identifier); - static void setup(TestObserverHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestObserverHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ObserverHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ObserverHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.ObserverHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1226,7 +1425,7 @@ class _TestLiveDataHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return LiveDataSupportedTypeData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -1235,7 +1434,8 @@ class _TestLiveDataHostApiCodec extends StandardMessageCodec { } abstract class TestLiveDataHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = _TestLiveDataHostApiCodec(); void observe(int identifier, int observerIdentifier); @@ -1244,17 +1444,21 @@ abstract class TestLiveDataHostApi { int? getValue(int identifier, LiveDataSupportedTypeData type); - static void setup(TestLiveDataHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestLiveDataHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.LiveDataHostApi.observe', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.LiveDataHostApi.observe was null.'); + 'Argument for dev.flutter.pigeon.LiveDataHostApi.observe was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1272,11 +1476,14 @@ abstract class TestLiveDataHostApi { 'dev.flutter.pigeon.LiveDataHostApi.removeObservers', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.LiveDataHostApi.removeObservers was null.'); + 'Argument for dev.flutter.pigeon.LiveDataHostApi.removeObservers was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1291,16 +1498,20 @@ abstract class TestLiveDataHostApi { 'dev.flutter.pigeon.LiveDataHostApi.getValue', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.LiveDataHostApi.getValue was null.'); + 'Argument for dev.flutter.pigeon.LiveDataHostApi.getValue was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.LiveDataHostApi.getValue was null, expected non-null int.'); - final LiveDataSupportedTypeData? arg_type = (args[1] as LiveDataSupportedTypeData?); + final LiveDataSupportedTypeData? arg_type = + (args[1] as LiveDataSupportedTypeData?); assert(arg_type != null, 'Argument for dev.flutter.pigeon.LiveDataHostApi.getValue was null, expected non-null LiveDataSupportedTypeData.'); final int? output = api.getValue(arg_identifier!, arg_type!); @@ -1312,24 +1523,29 @@ abstract class TestLiveDataHostApi { } abstract class TestImageProxyHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); List getPlanes(int identifier); void close(int identifier); - static void setup(TestImageProxyHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestImageProxyHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ImageProxyHostApi.getPlanes', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ImageProxyHostApi.getPlanes was null.'); + 'Argument for dev.flutter.pigeon.ImageProxyHostApi.getPlanes was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1344,11 +1560,14 @@ abstract class TestImageProxyHostApi { 'dev.flutter.pigeon.ImageProxyHostApi.close', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ImageProxyHostApi.close was null.'); + 'Argument for dev.flutter.pigeon.ImageProxyHostApi.close was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1379,9 +1598,9 @@ class _TestQualitySelectorHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return ResolutionInfo.decode(readValue(buffer)!); - case 129: + case 129: return VideoQualityData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -1390,33 +1609,41 @@ class _TestQualitySelectorHostApiCodec extends StandardMessageCodec { } abstract class TestQualitySelectorHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = _TestQualitySelectorHostApiCodec(); - void create(int identifier, List videoQualityDataList, int? fallbackStrategyId); + void create(int identifier, List videoQualityDataList, + int? fallbackStrategyId); ResolutionInfo getResolution(int cameraInfoId, VideoQuality quality); - static void setup(TestQualitySelectorHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestQualitySelectorHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.QualitySelectorHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.QualitySelectorHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.QualitySelectorHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.QualitySelectorHostApi.create was null, expected non-null int.'); - final List? arg_videoQualityDataList = (args[1] as List?)?.cast(); + final List? arg_videoQualityDataList = + (args[1] as List?)?.cast(); assert(arg_videoQualityDataList != null, 'Argument for dev.flutter.pigeon.QualitySelectorHostApi.create was null, expected non-null List.'); final int? arg_fallbackStrategyId = (args[2] as int?); - api.create(arg_identifier!, arg_videoQualityDataList!, arg_fallbackStrategyId); + api.create(arg_identifier!, arg_videoQualityDataList!, + arg_fallbackStrategyId); return []; }); } @@ -1426,19 +1653,24 @@ abstract class TestQualitySelectorHostApi { 'dev.flutter.pigeon.QualitySelectorHostApi.getResolution', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.QualitySelectorHostApi.getResolution was null.'); + 'Argument for dev.flutter.pigeon.QualitySelectorHostApi.getResolution was null.'); final List args = (message as List?)!; final int? arg_cameraInfoId = (args[0] as int?); assert(arg_cameraInfoId != null, 'Argument for dev.flutter.pigeon.QualitySelectorHostApi.getResolution was null, expected non-null int.'); - final VideoQuality? arg_quality = args[1] == null ? null : VideoQuality.values[args[1] as int]; + final VideoQuality? arg_quality = + args[1] == null ? null : VideoQuality.values[args[1] as int]; assert(arg_quality != null, 'Argument for dev.flutter.pigeon.QualitySelectorHostApi.getResolution was null, expected non-null VideoQuality.'); - final ResolutionInfo output = api.getResolution(arg_cameraInfoId!, arg_quality!); + final ResolutionInfo output = + api.getResolution(arg_cameraInfoId!, arg_quality!); return [output]; }); } @@ -1447,30 +1679,39 @@ abstract class TestQualitySelectorHostApi { } abstract class TestFallbackStrategyHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); - void create(int identifier, VideoQuality quality, VideoResolutionFallbackRule fallbackRule); + void create(int identifier, VideoQuality quality, + VideoResolutionFallbackRule fallbackRule); - static void setup(TestFallbackStrategyHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestFallbackStrategyHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.FallbackStrategyHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FallbackStrategyHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.FallbackStrategyHostApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, 'Argument for dev.flutter.pigeon.FallbackStrategyHostApi.create was null, expected non-null int.'); - final VideoQuality? arg_quality = args[1] == null ? null : VideoQuality.values[args[1] as int]; + final VideoQuality? arg_quality = + args[1] == null ? null : VideoQuality.values[args[1] as int]; assert(arg_quality != null, 'Argument for dev.flutter.pigeon.FallbackStrategyHostApi.create was null, expected non-null VideoQuality.'); - final VideoResolutionFallbackRule? arg_fallbackRule = args[2] == null ? null : VideoResolutionFallbackRule.values[args[2] as int]; + final VideoResolutionFallbackRule? arg_fallbackRule = args[2] == null + ? null + : VideoResolutionFallbackRule.values[args[2] as int]; assert(arg_fallbackRule != null, 'Argument for dev.flutter.pigeon.FallbackStrategyHostApi.create was null, expected non-null VideoResolutionFallbackRule.'); api.create(arg_identifier!, arg_quality!, arg_fallbackRule!); From 01784935aa326ebfd27fea3a57016cb9820b88af Mon Sep 17 00:00:00 2001 From: camsim99 Date: Tue, 29 Aug 2023 15:22:53 -0700 Subject: [PATCH 32/34] run tests From ff9bd3a2070ea8387f88982f500cf18962611822 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Thu, 7 Sep 2023 14:18:19 -0700 Subject: [PATCH 33/34] nits --- .../lib/src/android_camera_camerax.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart index 2e12943a442..fd42cc69566 100644 --- a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart +++ b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax.dart @@ -817,7 +817,7 @@ class AndroidCameraCameraX extends CameraPlatform { : ResolutionStrategy.highestAvailableStrategy(); break; case null: - // If not preset is specified, default to CameraX's default behavior + // If no preset is specified, default to CameraX's default behavior // for each UseCase. return null; } @@ -862,7 +862,7 @@ class AndroidCameraCameraX extends CameraPlatform { videoQuality = VideoQuality.highest; break; case null: - // If not preset is specified, default to CameraX's default behavior + // If no preset is specified, default to CameraX's default behavior // for each UseCase. return null; } From 206fbb646179e05839ed248e6b6f962b110ec5f8 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Thu, 7 Sep 2023 14:19:18 -0700 Subject: [PATCH 34/34] Fix changelog --- packages/camera/camera_android_camerax/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/camera/camera_android_camerax/CHANGELOG.md b/packages/camera/camera_android_camerax/CHANGELOG.md index 7a5bb37537a..61aff809f22 100644 --- a/packages/camera/camera_android_camerax/CHANGELOG.md +++ b/packages/camera/camera_android_camerax/CHANGELOG.md @@ -2,6 +2,8 @@ * Implements resolution configuration for all camera use cases. +## 0.5.0+16 + * Adds pub topics to package metadata. * Updates minimum supported SDK version to Flutter 3.7/Dart 2.19.