From dec3d697b4622d0edc5f7665215bda6f06706258 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Mon, 1 May 2023 16:34:43 -0700 Subject: [PATCH 01/29] Merge remote-tracking branch 'upstream/main' into camx_occ --- .../camera_android_camerax/CHANGELOG.md | 1 + .../camerax/CameraInfoHostApiImpl.java | 38 ++ .../camerax/GeneratedCameraXLibrary.java | 627 ++++++++++-------- .../plugins/camerax/CameraInfoTest.java | 1 + .../lib/src/android_camera_camerax.dart | 55 ++ ...roid_camera_camerax_flutter_api_impls.dart | 70 +- .../lib/src/camera_info.dart | 22 + .../lib/src/camerax_library.g.dart | 327 ++++++--- .../pigeons/camerax_library.dart | 25 + .../test/android_camera_camerax_test.dart | 65 +- .../android_camera_camerax_test.mocks.dart | 9 + .../test/camera_info_test.dart | 1 + .../test/camera_info_test.mocks.dart | 8 + .../test/camera_test.dart | 4 +- .../test/test_camerax_library.g.dart | 431 +++++------- 15 files changed, 977 insertions(+), 707 deletions(-) diff --git a/packages/camera/camera_android_camerax/CHANGELOG.md b/packages/camera/camera_android_camerax/CHANGELOG.md index 1c901a82bfa..24fbec47e8b 100644 --- a/packages/camera/camera_android_camerax/CHANGELOG.md +++ b/packages/camera/camera_android_camerax/CHANGELOG.md @@ -21,3 +21,4 @@ * Implements image streaming. * Provides LifecycleOwner implementation for Activities that use the plugin that do not implement it themselves. * Implements retrieval of camera information. +* Implements onCameraClosing callback method for indicating the camera is closing and bumps CameraX version to 1.3.0-alpha05. diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/CameraInfoHostApiImpl.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/CameraInfoHostApiImpl.java index f9fd7722fc8..973e2928d78 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/CameraInfoHostApiImpl.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/CameraInfoHostApiImpl.java @@ -6,8 +6,10 @@ import androidx.annotation.NonNull; import androidx.camera.core.CameraInfo; +import androidx.camera.core.CameraState; import androidx.camera.core.ExposureState; import androidx.camera.core.ZoomState; +import androidx.lifecycle.LiveData; import io.flutter.plugin.common.BinaryMessenger; import io.flutter.plugins.camerax.GeneratedCameraXLibrary.CameraInfoHostApi; import java.util.Objects; @@ -66,4 +68,40 @@ public Long getZoomState(@NonNull Long identifier) { return instanceManager.getIdentifierForStrongReference(zoomState); } + + /** + * Retrieves the {@link ExposureState} of the {@link CameraInfo} with the specified identifier. + */ + @Override + @NonNull + public Long getExposureState(@NonNull Long identifier) { + CameraInfo cameraInfo = + (CameraInfo) Objects.requireNonNull(instanceManager.getInstance(identifier)); + ExposureState exposureState = cameraInfo.getExposureState(); + + ExposureStateFlutterApiImpl exposureStateFlutterApiImpl = + new ExposureStateFlutterApiImpl(binaryMessenger, instanceManager); + exposureStateFlutterApiImpl.create(exposureState, result -> {}); + + return instanceManager.getIdentifierForStrongReference(exposureState); + } + + /** + * Retrieves the current {@link ZoomState} value of the {@link CameraInfo} with the specified + * identifier. + */ + @NonNull + @Override + public Long getZoomState(@NonNull Long identifier) { + CameraInfo cameraInfo = + (CameraInfo) Objects.requireNonNull(instanceManager.getInstance(identifier)); + // TODO(camsim99): Create/return LiveData once https://github.com/flutter/packages/pull/3419 lands. + ZoomState zoomState = cameraInfo.getZoomState().getValue(); + + ZoomStateFlutterApiImpl zoomStateFlutterApiImpl = + new ZoomStateFlutterApiImpl(binaryMessenger, instanceManager); + zoomStateFlutterApiImpl.create(zoomState, result -> {}); + + return instanceManager.getIdentifierForStrongReference(zoomState); + } } 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 882c1d14632..d48feb044a3 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; } @@ -123,13 +126,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; } } @@ -273,19 +272,82 @@ 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; + } + } + + /** Generated class from Pigeon that represents data sent in messages. */ + public static final class ExposureCompensationRange { + private @NonNull Long minCompensation; + + public @NonNull Long getMinCompensation() { + return minCompensation; + } + + public void setMinCompensation(@NonNull Long setterArg) { + if (setterArg == null) { + throw new IllegalStateException("Nonnull field \"minCompensation\" is null."); + } + this.minCompensation = setterArg; + } + + private @NonNull Long maxCompensation; + + public @NonNull Long getMaxCompensation() { + return maxCompensation; + } + + public void setMaxCompensation(@NonNull Long setterArg) { + if (setterArg == null) { + throw new IllegalStateException("Nonnull field \"maxCompensation\" is null."); + } + this.maxCompensation = setterArg; + } + + /** Constructor is non-public to enforce null safety; use Builder. */ + ExposureCompensationRange() {} + + public static final class Builder { + + private @Nullable Long minCompensation; + + public @NonNull Builder setMinCompensation(@NonNull Long setterArg) { + this.minCompensation = setterArg; + return this; + } + + private @Nullable Long maxCompensation; + + public @NonNull Builder setMaxCompensation(@NonNull Long setterArg) { + this.maxCompensation = setterArg; + return this; + } + + public @NonNull ExposureCompensationRange build() { + ExposureCompensationRange pigeonReturn = new ExposureCompensationRange(); + pigeonReturn.setMinCompensation(minCompensation); + pigeonReturn.setMaxCompensation(maxCompensation); + return pigeonReturn; + } + } + + @NonNull + ArrayList toList() { + ArrayList toListResult = new ArrayList(2); + toListResult.add(minCompensation); + toListResult.add(maxCompensation); + return toListResult; + } + + 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)); + Object maxCompensation = list.get(1); + pigeonResult.setMaxCompensation((maxCompensation == null) ? null : ((maxCompensation instanceof Integer) ? (Integer) maxCompensation : (Long) maxCompensation)); return pigeonResult; } } @@ -301,7 +363,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(); @@ -309,12 +371,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<>( @@ -326,7 +384,8 @@ static void setup( try { api.clear(); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -347,9 +406,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 = @@ -364,7 +421,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; } @@ -384,7 +442,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); @@ -393,7 +451,6 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void dispose(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -406,29 +463,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 getLiveCameraState(@NonNull Long identifier); + + @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) -> { @@ -436,11 +492,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; } @@ -453,9 +508,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.getLiveCameraState", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -463,11 +516,34 @@ 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.getLiveCameraState((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CameraInfoHostApi.getExposureState", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + ArrayList args = (ArrayList) message; + Number identifierArg = (Number) args.get(0); + try { + Long output = api.getExposureState((identifierArg == null) ? null : identifierArg.longValue()); + wrapped.add(0, output); + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -488,10 +564,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; } @@ -511,7 +587,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); @@ -520,7 +596,6 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -535,19 +610,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<>( @@ -560,11 +631,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; } @@ -586,12 +656,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; } @@ -611,7 +679,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); @@ -620,9 +688,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()); @@ -636,16 +702,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); @@ -656,18 +719,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) -> { @@ -694,9 +751,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) -> { @@ -704,11 +759,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; } @@ -721,9 +775,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) -> { @@ -733,15 +785,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; } @@ -754,9 +801,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) -> { @@ -765,12 +810,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; } @@ -783,9 +826,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) -> { @@ -794,10 +835,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; } @@ -810,9 +851,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) -> { @@ -822,7 +861,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; } @@ -842,7 +882,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); @@ -851,13 +891,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)); @@ -866,14 +903,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 = @@ -886,10 +923,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; } @@ -909,7 +946,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); @@ -918,7 +955,6 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -958,11 +994,9 @@ 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(); @@ -970,18 +1004,12 @@ void startListeningForDeviceOrientationChange( 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) -> { @@ -1010,9 +1038,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) -> { @@ -1021,11 +1047,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; } @@ -1038,9 +1063,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) -> { @@ -1048,7 +1071,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; } @@ -1068,7 +1092,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); @@ -1077,25 +1101,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)); @@ -1136,24 +1153,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 ResolutionInfo targetResolution); + void create(@NonNull Long identifier, @Nullable Long rotation, @Nullable ResolutionInfo targetResolution); - @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 = @@ -1168,12 +1182,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PreviewHos Number rotationArg = (Number) args.get(1); ResolutionInfo targetResolutionArg = (ResolutionInfo) 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(), targetResolutionArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1186,9 +1198,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) -> { @@ -1196,11 +1206,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; } @@ -1213,9 +1222,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) -> { @@ -1223,7 +1230,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; } @@ -1244,11 +1252,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; } @@ -1290,10 +1297,7 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object 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 ResolutionInfo targetResolution); void setFlashMode(@NonNull Long identifier, @NonNull Long flashMode); @@ -1303,10 +1307,7 @@ void create( static @NonNull MessageCodec getCodec() { return ImageCaptureHostApiCodec.INSTANCE; } - /** - * 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 = @@ -1321,12 +1322,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageCaptu Number flashModeArg = (Number) args.get(1); ResolutionInfo targetResolutionArg = (ResolutionInfo) 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(), targetResolutionArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1348,11 +1347,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; } @@ -1385,8 +1383,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); @@ -1429,7 +1426,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); @@ -1438,19 +1435,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)); } } @@ -1462,7 +1452,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); @@ -1471,12 +1461,86 @@ 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) { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.ZoomStateFlutterApi.create", getCodec()); + channel.send( + new ArrayList(Arrays.asList(identifierArg, minZoomRatioArg, maxZoomRatioArg)), + channelReply -> callback.reply(null)); + } + } + + private static class ExposureStateFlutterApiCodec extends StandardMessageCodec { + public static final ExposureStateFlutterApiCodec INSTANCE = new ExposureStateFlutterApiCodec(); + + private ExposureStateFlutterApiCodec() {} + + @Override + protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { + switch (type) { + case (byte) 128: + return ExposureCompensationRange.fromList((ArrayList) readValue(buffer)); + default: + return super.readValueOfType(type, buffer); + } + } + + @Override + protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { + if (value instanceof ExposureCompensationRange) { + stream.write(128); + writeValue(stream, ((ExposureCompensationRange) value).toList()); + } else { + super.writeValue(stream, value); + } + } + } + + /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ + public static class ExposureStateFlutterApi { + private final @NonNull BinaryMessenger binaryMessenger; - public void create( - @NonNull Long identifierArg, - @NonNull Double minZoomRatioArg, - @NonNull Double maxZoomRatioArg, - @NonNull Reply callback) { + public ExposureStateFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { + this.binaryMessenger = argBinaryMessenger; + } + + /** Public interface for sending reply. */ + @SuppressWarnings("UnknownNullness") + public interface Reply { + void reply(T reply); + } + /** The codec used by ExposureStateFlutterApi. */ + static @NonNull MessageCodec getCodec() { + return ExposureStateFlutterApiCodec.INSTANCE; + } + 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)), + channelReply -> callback.reply(null)); + } + } + /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ + public static class ZoomStateFlutterApi { + private final @NonNull BinaryMessenger binaryMessenger; + + public ZoomStateFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { + this.binaryMessenger = argBinaryMessenger; + } + + /** Public interface for sending reply. */ + @SuppressWarnings("UnknownNullness") + public interface Reply { + void reply(T reply); + } + /** The codec used by ZoomStateFlutterApi. */ + static @NonNull MessageCodec getCodec() { + return new StandardMessageCodec(); + } + 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()); @@ -1525,12 +1589,8 @@ public interface ImageAnalysisHostApi { static @NonNull MessageCodec getCodec() { return ImageAnalysisHostApiCodec.INSTANCE; } - /** - * 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<>( @@ -1543,11 +1603,10 @@ static void setup( Number identifierArg = (Number) args.get(0); ResolutionInfo targetResolutionIdentifierArg = (ResolutionInfo) args.get(1); try { - api.create( - (identifierArg == null) ? null : identifierArg.longValue(), - targetResolutionIdentifierArg); + api.create((identifierArg == null) ? null : identifierArg.longValue(), targetResolutionIdentifierArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1569,11 +1628,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; } @@ -1586,9 +1644,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) -> { @@ -1598,7 +1654,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; } @@ -1619,9 +1676,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 = @@ -1636,7 +1691,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; } @@ -1656,7 +1712,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); @@ -1665,7 +1721,6 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1674,11 +1729,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()); @@ -1690,7 +1741,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); @@ -1699,9 +1750,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 = @@ -1714,10 +1763,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; } @@ -1740,7 +1789,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; } @@ -1760,7 +1810,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); @@ -1769,13 +1819,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()); @@ -1792,7 +1836,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); @@ -1801,19 +1845,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)); } } diff --git a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/CameraInfoTest.java b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/CameraInfoTest.java index 5cfd06935b8..379cf3f3b05 100644 --- a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/CameraInfoTest.java +++ b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/CameraInfoTest.java @@ -13,6 +13,7 @@ import static org.mockito.Mockito.when; import androidx.camera.core.CameraInfo; +import androidx.camera.core.CameraState; import androidx.camera.core.ExposureState; import androidx.camera.core.ZoomState; import androidx.lifecycle.LiveData; 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 174a373e3b9..f0eac80d9ee 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 @@ -45,6 +45,10 @@ class AndroidCameraCameraX extends CameraPlatform { @visibleForTesting CameraInfo? cameraInfo; + /// The [LiveData] of the [CameraState] that represents the state of the + /// [camera] instance. + LiveData? liveCameraState; + /// The [Preview] instance that can be configured to present a live camera preview. @visibleForTesting Preview? preview; @@ -196,6 +200,7 @@ class AndroidCameraCameraX extends CameraPlatform { // instance as bound but not paused. camera = await processCameraProvider! .bindToLifecycle(cameraSelector!, [preview!, imageCapture!]); + await _updateLiveCameraState(flutterSurfaceTextureId); cameraInfo = await camera!.getCameraInfo(); _previewIsPaused = false; @@ -325,6 +330,55 @@ class AndroidCameraCameraX extends CameraPlatform { return exposureState.minZoomRatio; } + /// Gets the minimum supported exposure offset for the selected camera in EV units. + /// + /// [cameraId] not used. + @override + Future getMinExposureOffset(int cameraId) async { + final ExposureState exposureState = await cameraInfo!.getExposureState(); + return exposureState.exposureCompensationRange.minCompensation * + exposureState.exposureCompensationStep; + } + + /// Gets the maximum supported exposure offset for the selected camera in EV units. + /// + /// [cameraId] not used. + @override + Future getMaxExposureOffset(int cameraId) async { + final ExposureState exposureState = await cameraInfo!.getExposureState(); + return exposureState.exposureCompensationRange.maxCompensation * + exposureState.exposureCompensationStep; + } + + /// Gets the supported step size for exposure offset for the selected camera in EV units. + /// + /// Returns 0 when exposure compensation is not supported. + /// + /// [cameraId] not used. + @override + Future getExposureOffsetStepSize(int cameraId) async { + final ExposureState exposureState = await cameraInfo!.getExposureState(); + return exposureState.exposureCompensationStep; + } + + /// Gets the maximum supported zoom level for the selected camera. + /// + /// [cameraId] not used. + @override + Future getMaxZoomLevel(int cameraId) async { + final ZoomState exposureState = await cameraInfo!.getZoomState(); + return exposureState.maxZoomRatio; + } + + /// Gets the minimum supported zoom level for the selected camera. + /// + /// [cameraId] not used. + @override + Future getMinZoomLevel(int cameraId) async { + final ZoomState exposureState = await cameraInfo!.getZoomState(); + return exposureState.minZoomRatio; + } + /// The ui orientation changed. @override Stream onDeviceOrientationChanged() { @@ -413,6 +467,7 @@ class AndroidCameraCameraX extends CameraPlatform { camera = await processCameraProvider! .bindToLifecycle(cameraSelector!, [preview!]); + await _updateLiveCameraState(cameraId); cameraInfo = await camera!.getCameraInfo(); } diff --git a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax_flutter_api_impls.dart b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax_flutter_api_impls.dart index c5692ae105f..f92ef834926 100644 --- a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax_flutter_api_impls.dart +++ b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax_flutter_api_impls.dart @@ -19,33 +19,46 @@ import 'zoom_state.dart'; class AndroidCameraXCameraFlutterApis { /// Creates a [AndroidCameraXCameraFlutterApis]. AndroidCameraXCameraFlutterApis({ - JavaObjectFlutterApiImpl? javaObjectFlutterApi, - CameraFlutterApiImpl? cameraFlutterApi, - CameraInfoFlutterApiImpl? cameraInfoFlutterApi, - CameraSelectorFlutterApiImpl? cameraSelectorFlutterApi, - ProcessCameraProviderFlutterApiImpl? processCameraProviderFlutterApi, - SystemServicesFlutterApiImpl? systemServicesFlutterApi, + JavaObjectFlutterApiImpl? javaObjectFlutterApiImpl, + CameraFlutterApiImpl? cameraFlutterApiImpl, + CameraInfoFlutterApiImpl? cameraInfoFlutterApiImpl, + CameraSelectorFlutterApiImpl? cameraSelectorFlutterApiImpl, + ProcessCameraProviderFlutterApiImpl? processCameraProviderFlutterApiImpl, + SystemServicesFlutterApiImpl? systemServicesFlutterApiImpl, + CameraStateErrorFlutterApiImpl? cameraStateErrorFlutterApiImpl, + CameraStateFlutterApiImpl? cameraStateFlutterApiImpl, ExposureStateFlutterApiImpl? exposureStateFlutterApiImpl, ZoomStateFlutterApiImpl? zoomStateFlutterApiImpl, - AnalyzerFlutterApiImpl? analyzerFlutterApiImpl, + LiveDataFlutterApiImpl? liveDataFlutterApiImpl, + ObserverFlutterApiImpl? observerFlutterApiImpl, ImageProxyFlutterApiImpl? imageProxyFlutterApiImpl, PlaneProxyFlutterApiImpl? planeProxyFlutterApiImpl, + AnalyzerFlutterApiImpl? analyzerFlutterApiImpl, }) { - this.javaObjectFlutterApi = - javaObjectFlutterApi ?? JavaObjectFlutterApiImpl(); - this.cameraInfoFlutterApi = - cameraInfoFlutterApi ?? CameraInfoFlutterApiImpl(); - this.cameraSelectorFlutterApi = - cameraSelectorFlutterApi ?? CameraSelectorFlutterApiImpl(); - this.processCameraProviderFlutterApi = processCameraProviderFlutterApi ?? - ProcessCameraProviderFlutterApiImpl(); - this.cameraFlutterApi = cameraFlutterApi ?? CameraFlutterApiImpl(); - this.systemServicesFlutterApi = - systemServicesFlutterApi ?? SystemServicesFlutterApiImpl(); + this.javaObjectFlutterApiImpl = + javaObjectFlutterApiImpl ?? JavaObjectFlutterApiImpl(); + this.cameraInfoFlutterApiImpl = + cameraInfoFlutterApiImpl ?? CameraInfoFlutterApiImpl(); + this.cameraSelectorFlutterApiImpl = + cameraSelectorFlutterApiImpl ?? CameraSelectorFlutterApiImpl(); + this.processCameraProviderFlutterApiImpl = + processCameraProviderFlutterApiImpl ?? + ProcessCameraProviderFlutterApiImpl(); + this.cameraFlutterApiImpl = cameraFlutterApiImpl ?? CameraFlutterApiImpl(); + this.systemServicesFlutterApiImpl = + systemServicesFlutterApiImpl ?? SystemServicesFlutterApiImpl(); + this.cameraStateErrorFlutterApiImpl = + cameraStateErrorFlutterApiImpl ?? CameraStateErrorFlutterApiImpl(); + this.cameraStateFlutterApiImpl = + cameraStateFlutterApiImpl ?? CameraStateFlutterApiImpl(); this.exposureStateFlutterApiImpl = exposureStateFlutterApiImpl ?? ExposureStateFlutterApiImpl(); this.zoomStateFlutterApiImpl = zoomStateFlutterApiImpl ?? ZoomStateFlutterApiImpl(); + this.liveDataFlutterApiImpl = + liveDataFlutterApiImpl ?? LiveDataFlutterApiImpl(); + this.observerFlutterApiImpl = + observerFlutterApiImpl ?? ObserverFlutterApiImpl(); this.analyzerFlutterApiImpl = analyzerFlutterApiImpl ?? AnalyzerFlutterApiImpl(); this.imageProxyFlutterApiImpl = @@ -87,6 +100,12 @@ class AndroidCameraXCameraFlutterApis { /// Flutter Api for [ZoomState]. late final ZoomStateFlutterApiImpl zoomStateFlutterApiImpl; + /// Flutter Api for [ExposureState]. + late final ExposureStateFlutterApiImpl exposureStateFlutterApiImpl; + + /// Flutter Api for [ZoomState]. + late final ZoomStateFlutterApiImpl zoomStateFlutterApiImpl; + /// Flutter Api implementation for [Analyzer]. late final AnalyzerFlutterApiImpl analyzerFlutterApiImpl; @@ -99,12 +118,15 @@ class AndroidCameraXCameraFlutterApis { /// Ensures all the Flutter APIs have been setup to receive calls from native code. void ensureSetUp() { if (!_haveBeenSetUp) { - JavaObjectFlutterApi.setup(javaObjectFlutterApi); - CameraInfoFlutterApi.setup(cameraInfoFlutterApi); - CameraSelectorFlutterApi.setup(cameraSelectorFlutterApi); - ProcessCameraProviderFlutterApi.setup(processCameraProviderFlutterApi); - CameraFlutterApi.setup(cameraFlutterApi); - SystemServicesFlutterApi.setup(systemServicesFlutterApi); + JavaObjectFlutterApi.setup(javaObjectFlutterApiImpl); + CameraInfoFlutterApi.setup(cameraInfoFlutterApiImpl); + CameraSelectorFlutterApi.setup(cameraSelectorFlutterApiImpl); + ProcessCameraProviderFlutterApi.setup( + processCameraProviderFlutterApiImpl); + CameraFlutterApi.setup(cameraFlutterApiImpl); + SystemServicesFlutterApi.setup(systemServicesFlutterApiImpl); + CameraStateErrorFlutterApi.setup(cameraStateErrorFlutterApiImpl); + CameraStateFlutterApi.setup(cameraStateFlutterApiImpl); ExposureStateFlutterApi.setup(exposureStateFlutterApiImpl); ZoomStateFlutterApi.setup(zoomStateFlutterApiImpl); AnalyzerFlutterApi.setup(analyzerFlutterApiImpl); diff --git a/packages/camera/camera_android_camerax/lib/src/camera_info.dart b/packages/camera/camera_android_camerax/lib/src/camera_info.dart index f2fdc1fdc87..07e6816fc70 100644 --- a/packages/camera/camera_android_camerax/lib/src/camera_info.dart +++ b/packages/camera/camera_android_camerax/lib/src/camera_info.dart @@ -9,6 +9,7 @@ import 'camerax_library.g.dart'; import 'exposure_state.dart'; import 'instance_manager.dart'; import 'java_object.dart'; +import 'live_data.dart'; import 'zoom_state.dart'; /// Represents the metadata of a camera. @@ -32,6 +33,10 @@ class CameraInfo extends JavaObject { Future getSensorRotationDegrees() => _api.getSensorRotationDegreesFromInstance(this); + /// Starts listening for the camera closing. + Future> getLiveCameraState() => + _api.getLiveCameraStateFromInstance(this); + /// Gets the exposure state of the camera. Future getExposureState() => _api.getExposureStateFromInstance(this); @@ -76,6 +81,23 @@ class _CameraInfoHostApiImpl extends CameraInfoHostApi { return instanceManager .getInstanceWithWeakReference(zoomStateIdentifier)!; } + + /// Gets the [ExposureState] of the specified [CameraInfo] instance. + Future getExposureStateFromInstance( + CameraInfo instance) async { + final int? identifier = instanceManager.getIdentifier(instance); + final int exposureStateIdentifier = await getExposureState(identifier!); + return instanceManager + .getInstanceWithWeakReference(exposureStateIdentifier)!; + } + + /// Gets the [ZoomState] of the specified [CameraInfo] instance. + Future getZoomStateFromInstance(CameraInfo instance) async { + final int? identifier = instanceManager.getIdentifier(instance); + final int zoomStateIdentifier = await getZoomState(identifier!); + return instanceManager + .getInstanceWithWeakReference(zoomStateIdentifier)!; + } } /// Flutter API implementation of [CameraInfo]. 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 f2d2e17152f..b5afcaa735a 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 @@ -89,6 +89,32 @@ class ExposureCompensationRange { } } +class ExposureCompensationRange { + ExposureCompensationRange({ + required this.minCompensation, + required this.maxCompensation, + }); + + int minCompensation; + + int maxCompensation; + + Object encode() { + return [ + minCompensation, + maxCompensation, + ]; + } + + static ExposureCompensationRange decode(Object result) { + result as List; + return ExposureCompensationRange( + minCompensation: result[0]! as int, + maxCompensation: 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 @@ -106,7 +132,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', @@ -162,8 +189,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, @@ -173,7 +199,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, @@ -223,6 +249,33 @@ class CameraInfoHostApi { } } + Future getLiveCameraState(int arg_identifier) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.CameraInfoHostApi.getLiveCameraState', codec, + binaryMessenger: _binaryMessenger); + final List? replyList = + await channel.send([arg_identifier]) 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 if (replyList[0] == null) { + throw PlatformException( + code: 'null-error', + message: 'Host platform returned null value for non-null return value.', + ); + } else { + return (replyList[0] as int?)!; + } + } + Future getExposureState(int arg_identifier) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraInfoHostApi.getExposureState', codec, @@ -283,8 +336,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, @@ -294,7 +346,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, @@ -321,8 +373,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', @@ -339,13 +391,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', @@ -373,8 +424,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, @@ -384,7 +434,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, @@ -412,7 +462,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', @@ -436,8 +487,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?; @@ -462,17 +512,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', @@ -499,8 +544,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', @@ -526,8 +570,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', @@ -572,8 +616,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, @@ -583,7 +626,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, @@ -649,7 +692,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, @@ -677,7 +720,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); @@ -695,11 +738,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?; @@ -719,15 +760,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', @@ -746,10 +784,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', @@ -774,19 +812,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, @@ -805,7 +841,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, @@ -836,9 +872,9 @@ class _PreviewHostApiCodec 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 ResolutionInfo.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -856,14 +892,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, ResolutionInfo? arg_targetResolution) 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?; + final List? replyList = + await channel.send([arg_identifier, arg_rotation, arg_targetResolution]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -911,7 +945,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', @@ -971,7 +1006,7 @@ class _ImageCaptureHostApiCodec 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); @@ -989,14 +1024,12 @@ class ImageCaptureHostApi { static const MessageCodec codec = _ImageCaptureHostApiCodec(); - Future create(int arg_identifier, int? arg_flashMode, - ResolutionInfo? arg_targetResolution) async { + Future create(int arg_identifier, int? arg_flashMode, ResolutionInfo? arg_targetResolution) 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?; + final List? replyList = + await channel.send([arg_identifier, arg_flashMode, arg_targetResolution]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1017,8 +1050,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', @@ -1078,7 +1111,98 @@ 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); + } + } +} + +abstract class ExposureStateFlutterApi { + static const MessageCodec codec = _ExposureStateFlutterApiCodec(); + + void create(int identifier, ExposureCompensationRange exposureCompensationRange, double exposureCompensationStep); + + static void setup(ExposureStateFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.ExposureStateFlutterApi.create', codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != 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?); + 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!); + return; + }); + } + } + } +} + +abstract class ZoomStateFlutterApi { + static const MessageCodec codec = StandardMessageCodec(); + + void create(int identifier, double minZoomRatio, double maxZoomRatio); + + static void setup(ZoomStateFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.ZoomStateFlutterApi.create', codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != 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, + 'Argument for dev.flutter.pigeon.ZoomStateFlutterApi.create was null, expected non-null int.'); + final double? arg_minZoomRatio = (args[1] as double?); + assert(arg_minZoomRatio != null, + 'Argument for dev.flutter.pigeon.ZoomStateFlutterApi.create was null, expected non-null double.'); + final double? arg_maxZoomRatio = (args[2] as double?); + assert(arg_maxZoomRatio != null, + 'Argument for dev.flutter.pigeon.ZoomStateFlutterApi.create was null, expected non-null double.'); + api.create(arg_identifier!, arg_minZoomRatio!, arg_maxZoomRatio!); + return; + }); + } + } + } +} + +class _ExposureStateFlutterApiCodec extends StandardMessageCodec { + const _ExposureStateFlutterApiCodec(); + @override + void writeValue(WriteBuffer buffer, Object? value) { + if (value is ExposureCompensationRange) { + buffer.putUint8(128); + writeValue(buffer, value.encode()); + } else { + super.writeValue(buffer, value); + } + } + + @override + Object? readValueOfType(int type, ReadBuffer buffer) { + switch (type) { + case 128: return ExposureCompensationRange.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -1089,13 +1213,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, @@ -1105,20 +1225,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; }); } @@ -1131,8 +1249,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, @@ -1142,7 +1259,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, @@ -1176,7 +1293,7 @@ class _ImageAnalysisHostApiCodec 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); @@ -1194,14 +1311,12 @@ class ImageAnalysisHostApi { static const MessageCodec codec = _ImageAnalysisHostApiCodec(); - Future create(int arg_identifier, - ResolutionInfo? arg_targetResolutionIdentifier) async { + Future create(int arg_identifier, ResolutionInfo? arg_targetResolutionIdentifier) 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?; + final List? replyList = + await channel.send([arg_identifier, arg_targetResolutionIdentifier]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1218,14 +1333,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', @@ -1305,8 +1418,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, @@ -1316,7 +1428,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, @@ -1335,7 +1447,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, @@ -1416,8 +1528,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, @@ -1427,7 +1538,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, @@ -1454,8 +1565,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, @@ -1465,7 +1575,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, @@ -1479,8 +1589,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; }); } diff --git a/packages/camera/camera_android_camerax/pigeons/camerax_library.dart b/packages/camera/camera_android_camerax/pigeons/camerax_library.dart index c8b3885d064..8e4b0ca7431 100644 --- a/packages/camera/camera_android_camerax/pigeons/camerax_library.dart +++ b/packages/camera/camera_android_camerax/pigeons/camerax_library.dart @@ -56,6 +56,16 @@ class ExposureCompensationRange { int maxCompensation; } +class ExposureCompensationRange { + ExposureCompensationRange({ + required this.minCompensation, + required this.maxCompensation, + }); + + int minCompensation; + int maxCompensation; +} + @HostApi(dartHostTestHandler: 'TestInstanceManagerHostApi') abstract class InstanceManagerHostApi { /// Clear the native `InstanceManager`. @@ -78,6 +88,8 @@ abstract class JavaObjectFlutterApi { abstract class CameraInfoHostApi { int getSensorRotationDegrees(int identifier); + int getLiveCameraState(int identifier); + int getExposureState(int identifier); int getZoomState(int identifier); @@ -184,6 +196,19 @@ abstract class ZoomStateFlutterApi { void create(int identifier, double minZoomRatio, double maxZoomRatio); } +@FlutterApi() +abstract class ExposureStateFlutterApi { + void create( + int identifier, + ExposureCompensationRange exposureCompensationRange, + double exposureCompensationStep); +} + +@FlutterApi() +abstract class ZoomStateFlutterApi { + void create(int identifier, double minZoomRatio, double maxZoomRatio); +} + @HostApi(dartHostTestHandler: 'TestImageAnalysisHostApi') abstract class ImageAnalysisHostApi { void create(int identifier, ResolutionInfo? targetResolutionIdentifier); 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 e7a6707d6e3..079abe0f2fd 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 @@ -132,12 +132,19 @@ void main() { camera.processCameraProvider = mockProcessCameraProvider; + camera.processCameraProvider = mockProcessCameraProvider; + when(camera.testPreview.setSurfaceProvider()) .thenAnswer((_) async => testSurfaceTextureId); - when(mockProcessCameraProvider.bindToLifecycle(any, any)) - .thenAnswer((_) => Future.value(mockCamera)); - when(mockCamera.getCameraInfo()) - .thenAnswer((_) => Future.value(MockCameraInfo())); + when(mockProcessCameraProvider.bindToLifecycle( + camera.mockBackCameraSelector, + [camera.testPreview, camera.testImageCapture])) + .thenAnswer((_) async => mockCamera); + when(mockCamera.getCameraInfo()).thenAnswer((_) async => mockCameraInfo); + when(mockCameraInfo.getLiveCameraState()) + .thenAnswer((_) async => mockLiveCameraState); + camera.processCameraProvider = mockProcessCameraProvider; + camera.createDetachedObjectForTesting = true; expect( await camera.createCamera(testCameraDescription, testResolutionPreset, @@ -165,7 +172,7 @@ void main() { 'createCamera binds Preview and ImageCapture use cases to ProcessCameraProvider instance', () async { final MockAndroidCameraCameraX camera = MockAndroidCameraCameraX(); - final MockProcessCameraProvider mockProcessCameraProvider = + final ProcessCameraProvider mockProcessCameraProvider = MockProcessCameraProvider(); final MockCamera mockCamera = MockCamera(); final MockCameraInfo mockCameraInfo = MockCameraInfo(); @@ -178,6 +185,16 @@ void main() { const ResolutionPreset testResolutionPreset = ResolutionPreset.veryHigh; const bool enableAudio = true; + when(mockProcessCameraProvider.bindToLifecycle( + camera.mockBackCameraSelector, + [camera.testPreview, camera.testImageCapture])) + .thenAnswer((_) async => mockCamera); + when(mockCamera.getCameraInfo()).thenAnswer((_) async => mockCameraInfo); + when(mockCameraInfo.getLiveCameraState()) + .thenAnswer((_) async => MockLiveData()); + camera.processCameraProvider = mockProcessCameraProvider; + camera.createDetachedObjectForTesting = true; + camera.processCameraProvider = mockProcessCameraProvider; when(mockProcessCameraProvider.bindToLifecycle( @@ -254,6 +271,16 @@ void main() { await camera.createCamera(testCameraDescription, testResolutionPreset, enableAudio: enableAudio); + when(mockProcessCameraProvider.bindToLifecycle(any, any)) + .thenAnswer((_) async => mockCamera); + when(mockCamera.getCameraInfo()) + .thenAnswer((_) => Future.value(MockCameraInfo())); + when(camera.testPreview.getResolutionInfo()) + .thenAnswer((_) async => testResolutionInfo); + + await camera.createCamera(testCameraDescription, testResolutionPreset, + enableAudio: enableAudio); + // Start listening to camera events stream to verify the proper CameraInitializedEvent is sent. camera.cameraEventStreamController.stream.listen((CameraEvent event) { expect(event, const TypeMatcher()); @@ -381,6 +408,7 @@ void main() { verifyNever(camera.processCameraProvider! .bindToLifecycle(camera.cameraSelector!, [camera.preview!])); + verifyNever(mockLiveCameraState.observe(any)); expect(camera.cameraInfo, isNot(mockCameraInfo)); }); @@ -396,6 +424,11 @@ void main() { camera.cameraSelector = MockCameraSelector(); camera.preview = MockPreview(); + when(mockProcessCameraProvider.bindToLifecycle(any, any)) + .thenAnswer((_) => Future.value(mockCamera)); + when(mockCamera.getCameraInfo()) + .thenAnswer((_) => Future.value(mockCameraInfo)); + when(mockProcessCameraProvider.bindToLifecycle(any, any)) .thenAnswer((_) => Future.value(mockCamera)); when(mockCamera.getCameraInfo()) @@ -405,6 +438,13 @@ void main() { verify(camera.processCameraProvider! .bindToLifecycle(camera.cameraSelector!, [camera.preview!])); + expect( + await testCameraClosingObserver( + camera, + 78, + verify(mockLiveCameraState.observe(captureAny)).captured.single + as Observer), + isTrue); expect(camera.cameraInfo, equals(mockCameraInfo)); }); @@ -421,6 +461,11 @@ void main() { camera.cameraSelector = MockCameraSelector(); camera.preview = MockPreview(); + when(mockProcessCameraProvider.bindToLifecycle(any, any)) + .thenAnswer((_) => Future.value(mockCamera)); + when(mockCamera.getCameraInfo()) + .thenAnswer((_) => Future.value(MockCameraInfo())); + when(mockProcessCameraProvider.bindToLifecycle(any, any)) .thenAnswer((_) => Future.value(mockCamera)); when(mockCamera.getCameraInfo()) @@ -457,6 +502,11 @@ void main() { camera.cameraSelector = MockCameraSelector(); camera.preview = MockPreview(); + when(mockProcessCameraProvider.bindToLifecycle(any, any)) + .thenAnswer((_) => Future.value(mockCamera)); + when(mockCamera.getCameraInfo()) + .thenAnswer((_) => Future.value(mockCameraInfo)); + when(mockProcessCameraProvider.bindToLifecycle(any, any)) .thenAnswer((_) => Future.value(mockCamera)); when(mockCamera.getCameraInfo()) @@ -581,6 +631,11 @@ void main() { camera.cameraSelector = MockCameraSelector(); camera.createDetachedCallbacks = true; + when(mockProcessCameraProvider.bindToLifecycle(any, any)) + .thenAnswer((_) => Future.value(mockCamera)); + when(mockCamera.getCameraInfo()) + .thenAnswer((_) => Future.value(MockCameraInfo())); + when(mockProcessCameraProvider.bindToLifecycle(any, any)) .thenAnswer((_) => Future.value(mockCamera)); when(mockCamera.getCameraInfo()) 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 b7365a2e90d..0c88413c1ad 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 @@ -203,6 +203,15 @@ class MockCameraInfo extends _i1.Mock implements _i2.CameraInfo { returnValueForMissingStub: _i11.Future.value(0), ) as _i11.Future); @override + _i11.Future getLiveCameraState() => (super.noSuchMethod( + Invocation.method( + #getLiveCameraState, + [], + ), + returnValue: _i11.Future.value(), + returnValueForMissingStub: _i11.Future.value(), + ) as _i11.Future); + @override _i11.Future<_i3.ExposureState> getExposureState() => (super.noSuchMethod( Invocation.method( #getExposureState, diff --git a/packages/camera/camera_android_camerax/test/camera_info_test.dart b/packages/camera/camera_android_camerax/test/camera_info_test.dart index 9826b88e367..7edf6c409fe 100644 --- a/packages/camera/camera_android_camerax/test/camera_info_test.dart +++ b/packages/camera/camera_android_camerax/test/camera_info_test.dart @@ -6,6 +6,7 @@ import 'package:camera_android_camerax/src/camera_info.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/instance_manager.dart'; +import 'package:camera_android_camerax/src/live_data.dart'; import 'package:camera_android_camerax/src/zoom_state.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/annotations.dart'; diff --git a/packages/camera/camera_android_camerax/test/camera_info_test.mocks.dart b/packages/camera/camera_android_camerax/test/camera_info_test.mocks.dart index 968dc6e8b62..4c1bdf69693 100644 --- a/packages/camera/camera_android_camerax/test/camera_info_test.mocks.dart +++ b/packages/camera/camera_android_camerax/test/camera_info_test.mocks.dart @@ -36,6 +36,14 @@ class MockTestCameraInfoHostApi extends _i1.Mock returnValue: 0, ) as int); @override + int getLiveCameraState(int? identifier) => (super.noSuchMethod( + Invocation.method( + #getLiveCameraState, + [identifier], + ), + returnValue: 0, + ) as int); + @override int getExposureState(int? identifier) => (super.noSuchMethod( Invocation.method( #getExposureState, diff --git a/packages/camera/camera_android_camerax/test/camera_test.dart b/packages/camera/camera_android_camerax/test/camera_test.dart index 742a60799e6..05f5fe7dd02 100644 --- a/packages/camera/camera_android_camerax/test/camera_test.dart +++ b/packages/camera/camera_android_camerax/test/camera_test.dart @@ -20,6 +20,8 @@ void main() { TestInstanceManagerHostApi.setup(MockTestInstanceManagerHostApi()); group('Camera', () { + tearDown(() => TestCameraHostApi.setup(null)); + test('getCameraInfo makes call to retrieve expected CameraInfo', () async { final MockTestCameraHostApi mockApi = MockTestCameraHostApi(); TestCameraHostApi.setup(mockApi); @@ -52,7 +54,7 @@ void main() { verify(mockApi.getCameraInfo(cameraIdentifier)); }); - test('flutterApiCreateTest', () { + test('flutterApiCreate makes call to add instance to instance manager', () { final InstanceManager instanceManager = InstanceManager( onWeakReferenceRemoved: (_) {}, ); 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 40bd8f2e433..098b297bcf0 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,32 +70,28 @@ 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); + int getLiveCameraState(int identifier); + int getExposureState(int identifier); 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, @@ -115,19 +101,35 @@ abstract class TestCameraInfoHostApi { }); } } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.CameraInfoHostApi.getLiveCameraState', 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.CameraInfoHostApi.getLiveCameraState 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.CameraInfoHostApi.getLiveCameraState was null, expected non-null int.'); + final int output = api.getLiveCameraState(arg_identifier!); + return [output]; + }); + } + } { final BasicMessageChannel channel = BasicMessageChannel( '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, @@ -142,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, @@ -163,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, @@ -201,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]; }); } @@ -227,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); @@ -244,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]; @@ -265,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, @@ -308,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]; }); } @@ -323,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, @@ -338,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]; }); } @@ -349,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!); @@ -375,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, @@ -396,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, @@ -444,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); @@ -453,58 +409,45 @@ 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(); - 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, @@ -512,24 +455,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 []; @@ -557,9 +495,9 @@ class _TestPreviewHostApiCodec 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 ResolutionInfo.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -568,8 +506,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, ResolutionInfo? targetResolution); @@ -580,28 +517,23 @@ 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, '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?); + final ResolutionInfo? arg_targetResolution = (args[2] as ResolutionInfo?); api.create(arg_identifier!, arg_rotation, arg_targetResolution); return []; }); @@ -612,14 +544,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, @@ -631,16 +560,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 []; @@ -652,14 +577,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, @@ -687,7 +609,7 @@ class _TestImageCaptureHostApiCodec 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); @@ -696,8 +618,7 @@ class _TestImageCaptureHostApiCodec extends StandardMessageCodec { } abstract class TestImageCaptureHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = _TestImageCaptureHostApiCodec(); void create(int identifier, int? flashMode, ResolutionInfo? targetResolution); @@ -706,28 +627,23 @@ 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, '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?); + final ResolutionInfo? arg_targetResolution = (args[2] as ResolutionInfo?); api.create(arg_identifier!, arg_flashMode, arg_targetResolution); return []; }); @@ -738,14 +654,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, @@ -763,14 +676,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, @@ -798,7 +708,7 @@ class _TestImageAnalysisHostApiCodec 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); @@ -807,8 +717,7 @@ class _TestImageAnalysisHostApiCodec extends StandardMessageCodec { } abstract class TestImageAnalysisHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = _TestImageAnalysisHostApiCodec(); void create(int identifier, ResolutionInfo? targetResolutionIdentifier); @@ -817,27 +726,22 @@ 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, 'Argument for dev.flutter.pigeon.ImageAnalysisHostApi.create was null, expected non-null int.'); - final ResolutionInfo? arg_targetResolutionIdentifier = - (args[1] as ResolutionInfo?); + final ResolutionInfo? arg_targetResolutionIdentifier = (args[1] as ResolutionInfo?); api.create(arg_identifier!, arg_targetResolutionIdentifier); return []; }); @@ -848,14 +752,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, @@ -873,14 +774,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, @@ -894,27 +792,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, @@ -928,29 +821,24 @@ abstract class TestAnalyzerHostApi { } 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, @@ -965,14 +853,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, From fed96215bdf28cd0d04913c07060091a9fb74e84 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Wed, 10 May 2023 09:39:45 -0700 Subject: [PATCH 02/29] Undo changes --- .../camerax/CameraInfoHostApiImpl.java | 36 - .../camerax/GeneratedCameraXLibrary.java | 618 +++++++++--------- .../lib/src/android_camera_camerax.dart | 49 -- ...roid_camera_camerax_flutter_api_impls.dart | 6 - .../lib/src/camera_info.dart | 17 - .../lib/src/camerax_library.g.dart | 124 ---- .../pigeons/camerax_library.dart | 23 - .../test/android_camera_camerax_test.dart | 42 -- 8 files changed, 291 insertions(+), 624 deletions(-) diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/CameraInfoHostApiImpl.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/CameraInfoHostApiImpl.java index f9eca979d90..e72d08da34d 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/CameraInfoHostApiImpl.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/CameraInfoHostApiImpl.java @@ -92,40 +92,4 @@ public Long getZoomState(@NonNull Long identifier) { return instanceManager.getIdentifierForStrongReference(zoomState); } - - /** - * Retrieves the {@link ExposureState} of the {@link CameraInfo} with the specified identifier. - */ - @Override - @NonNull - public Long getExposureState(@NonNull Long identifier) { - CameraInfo cameraInfo = - (CameraInfo) Objects.requireNonNull(instanceManager.getInstance(identifier)); - ExposureState exposureState = cameraInfo.getExposureState(); - - ExposureStateFlutterApiImpl exposureStateFlutterApiImpl = - new ExposureStateFlutterApiImpl(binaryMessenger, instanceManager); - exposureStateFlutterApiImpl.create(exposureState, result -> {}); - - return instanceManager.getIdentifierForStrongReference(exposureState); - } - - /** - * Retrieves the current {@link ZoomState} value of the {@link CameraInfo} with the specified - * identifier. - */ - @NonNull - @Override - public Long getZoomState(@NonNull Long identifier) { - CameraInfo cameraInfo = - (CameraInfo) Objects.requireNonNull(instanceManager.getInstance(identifier)); - // TODO(camsim99): Create/return LiveData once https://github.com/flutter/packages/pull/3419 lands. - ZoomState zoomState = cameraInfo.getZoomState().getValue(); - - ZoomStateFlutterApiImpl zoomStateFlutterApiImpl = - new ZoomStateFlutterApiImpl(binaryMessenger, instanceManager); - zoomStateFlutterApiImpl.create(zoomState, result -> {}); - - return instanceManager.getIdentifierForStrongReference(zoomState); - } } 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 8b505930f37..c6f62799377 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; } @@ -156,9 +153,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; } } @@ -400,82 +401,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)); - return pigeonResult; - } - } - - /** Generated class from Pigeon that represents data sent in messages. */ - public static final class ExposureCompensationRange { - private @NonNull Long minCompensation; - - public @NonNull Long getMinCompensation() { - return minCompensation; - } - - public void setMinCompensation(@NonNull Long setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"minCompensation\" is null."); - } - this.minCompensation = setterArg; - } - - private @NonNull Long maxCompensation; - - public @NonNull Long getMaxCompensation() { - return maxCompensation; - } - - public void setMaxCompensation(@NonNull Long setterArg) { - if (setterArg == null) { - throw new IllegalStateException("Nonnull field \"maxCompensation\" is null."); - } - this.maxCompensation = setterArg; - } - - /** Constructor is non-public to enforce null safety; use Builder. */ - ExposureCompensationRange() {} - - public static final class Builder { - - private @Nullable Long minCompensation; - - public @NonNull Builder setMinCompensation(@NonNull Long setterArg) { - this.minCompensation = setterArg; - return this; - } - - private @Nullable Long maxCompensation; - - public @NonNull Builder setMaxCompensation(@NonNull Long setterArg) { - this.maxCompensation = setterArg; - return this; - } - - public @NonNull ExposureCompensationRange build() { - ExposureCompensationRange pigeonReturn = new ExposureCompensationRange(); - pigeonReturn.setMinCompensation(minCompensation); - pigeonReturn.setMaxCompensation(maxCompensation); - return pigeonReturn; - } - } - - @NonNull - ArrayList toList() { - ArrayList toListResult = new ArrayList(2); - toListResult.add(minCompensation); - toListResult.add(maxCompensation); - return toListResult; - } - - 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)); - 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; } } @@ -491,7 +429,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(); @@ -499,8 +437,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<>( @@ -512,8 +454,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; } @@ -534,7 +475,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 = @@ -549,8 +492,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; } @@ -570,7 +512,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,6 +521,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + public void dispose(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -591,7 +534,7 @@ 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 @@ -600,19 +543,23 @@ public interface CameraInfoHostApi { @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) -> { @@ -620,10 +567,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; } @@ -671,34 +619,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraInfo ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - Long output = api.getLiveCameraState((identifierArg == null) ? null : identifierArg.longValue()); - wrapped.add(0, output); - } - catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.CameraInfoHostApi.getExposureState", getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList(); - 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; } @@ -719,10 +644,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; } @@ -742,7 +667,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); @@ -751,6 +676,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -765,15 +691,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<>( @@ -786,10 +716,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; } @@ -811,10 +742,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; } @@ -834,7 +767,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); @@ -843,7 +776,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()); @@ -857,13 +792,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); @@ -874,12 +812,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) -> { @@ -906,7 +850,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) -> { @@ -914,10 +860,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; } @@ -930,7 +877,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) -> { @@ -940,10 +889,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; } @@ -956,7 +910,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) -> { @@ -965,10 +921,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; } @@ -981,7 +939,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) -> { @@ -990,10 +950,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; } @@ -1006,7 +966,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) -> { @@ -1016,8 +978,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; } @@ -1037,7 +998,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); @@ -1046,10 +1007,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)); @@ -1058,14 +1022,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 = @@ -1078,10 +1042,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; } @@ -1101,7 +1065,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); @@ -1110,6 +1074,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1149,9 +1114,11 @@ 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(); @@ -1162,12 +1129,18 @@ public interface 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) -> { @@ -1196,7 +1169,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) -> { @@ -1205,10 +1180,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; } @@ -1221,7 +1197,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) -> { @@ -1229,8 +1207,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; } @@ -1276,7 +1253,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); @@ -1285,18 +1262,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)); @@ -1337,21 +1321,24 @@ 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 ResolutionInfo targetResolution); - @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 = @@ -1366,10 +1353,12 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PreviewHos Number rotationArg = (Number) args.get(1); ResolutionInfo targetResolutionArg = (ResolutionInfo) 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(), + targetResolutionArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1382,7 +1371,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) -> { @@ -1390,10 +1381,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; } @@ -1406,7 +1398,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) -> { @@ -1414,8 +1408,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; } @@ -1436,10 +1429,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; } @@ -1947,7 +1941,10 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object 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 ResolutionInfo targetResolution); void setFlashMode(@NonNull Long identifier, @NonNull Long flashMode); @@ -1957,7 +1954,10 @@ public interface ImageCaptureHostApi { static @NonNull MessageCodec getCodec() { return ImageCaptureHostApiCodec.INSTANCE; } - /**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 = @@ -1972,10 +1972,12 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageCaptu Number flashModeArg = (Number) args.get(1); ResolutionInfo targetResolutionArg = (ResolutionInfo) 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(), + targetResolutionArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1997,10 +1999,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; } @@ -2033,7 +2036,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); @@ -2134,7 +2138,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); @@ -2143,91 +2147,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) { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.ExposureStateFlutterApi.create", getCodec()); - channel.send( - new ArrayList(Arrays.asList(identifierArg, exposureCompensationRangeArg, exposureCompensationStepArg)), - channelReply -> callback.reply(null)); - } - } - /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ - public static class ZoomStateFlutterApi { - private final @NonNull BinaryMessenger binaryMessenger; - - public ZoomStateFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { - this.binaryMessenger = argBinaryMessenger; - } - - /** Public interface for sending reply. */ - @SuppressWarnings("UnknownNullness") - public interface Reply { - void reply(T reply); - } - /** The codec used by ZoomStateFlutterApi. */ - static @NonNull MessageCodec getCodec() { - return new StandardMessageCodec(); - } - 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()); - channel.send( - new ArrayList(Arrays.asList(identifierArg, minZoomRatioArg, maxZoomRatioArg)), - channelReply -> callback.reply(null)); - } - } - - private static class ExposureStateFlutterApiCodec extends StandardMessageCodec { - public static final ExposureStateFlutterApiCodec INSTANCE = new ExposureStateFlutterApiCodec(); - - private ExposureStateFlutterApiCodec() {} - - @Override - protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { - switch (type) { - case (byte) 128: - return ExposureCompensationRange.fromList((ArrayList) readValue(buffer)); - default: - return super.readValueOfType(type, buffer); - } - } - - @Override - protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { - if (value instanceof ExposureCompensationRange) { - stream.write(128); - writeValue(stream, ((ExposureCompensationRange) value).toList()); - } else { - super.writeValue(stream, value); - } - } - } - /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ - public static class ExposureStateFlutterApi { - private final @NonNull BinaryMessenger binaryMessenger; - - public ExposureStateFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { - this.binaryMessenger = argBinaryMessenger; - } - - /** Public interface for sending reply. */ - @SuppressWarnings("UnknownNullness") - public interface Reply { - void reply(T reply); - } - /** The codec used by ExposureStateFlutterApi. */ - 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)); } } @@ -2239,7 +2171,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); @@ -2248,7 +2180,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()); @@ -2297,8 +2234,12 @@ public interface ImageAnalysisHostApi { static @NonNull MessageCodec getCodec() { return ImageAnalysisHostApiCodec.INSTANCE; } - /**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<>( @@ -2311,10 +2252,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageAnaly Number identifierArg = (Number) args.get(0); ResolutionInfo targetResolutionIdentifierArg = (ResolutionInfo) args.get(1); try { - api.create((identifierArg == null) ? null : identifierArg.longValue(), targetResolutionIdentifierArg); + api.create( + (identifierArg == null) ? null : identifierArg.longValue(), + targetResolutionIdentifierArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2336,10 +2278,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; } @@ -2352,7 +2295,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) -> { @@ -2362,8 +2307,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; } @@ -2384,7 +2328,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 = @@ -2399,8 +2345,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; } @@ -2695,7 +2640,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); @@ -2704,6 +2649,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2712,7 +2658,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()); @@ -2724,7 +2674,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); @@ -2733,7 +2683,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 = @@ -2746,10 +2698,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; } @@ -2772,8 +2724,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; } @@ -2793,7 +2744,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); @@ -2802,7 +2753,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()); @@ -2819,7 +2776,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); @@ -2828,12 +2785,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)); } } 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 1f3a4d632ce..959f35b0980 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 @@ -412,55 +412,6 @@ class AndroidCameraCameraX extends CameraPlatform { return zoomState.minZoomRatio; } - /// Gets the minimum supported exposure offset for the selected camera in EV units. - /// - /// [cameraId] not used. - @override - Future getMinExposureOffset(int cameraId) async { - final ExposureState exposureState = await cameraInfo!.getExposureState(); - return exposureState.exposureCompensationRange.minCompensation * - exposureState.exposureCompensationStep; - } - - /// Gets the maximum supported exposure offset for the selected camera in EV units. - /// - /// [cameraId] not used. - @override - Future getMaxExposureOffset(int cameraId) async { - final ExposureState exposureState = await cameraInfo!.getExposureState(); - return exposureState.exposureCompensationRange.maxCompensation * - exposureState.exposureCompensationStep; - } - - /// Gets the supported step size for exposure offset for the selected camera in EV units. - /// - /// Returns 0 when exposure compensation is not supported. - /// - /// [cameraId] not used. - @override - Future getExposureOffsetStepSize(int cameraId) async { - final ExposureState exposureState = await cameraInfo!.getExposureState(); - return exposureState.exposureCompensationStep; - } - - /// Gets the maximum supported zoom level for the selected camera. - /// - /// [cameraId] not used. - @override - Future getMaxZoomLevel(int cameraId) async { - final ZoomState exposureState = await cameraInfo!.getZoomState(); - return exposureState.maxZoomRatio; - } - - /// Gets the minimum supported zoom level for the selected camera. - /// - /// [cameraId] not used. - @override - Future getMinZoomLevel(int cameraId) async { - final ZoomState exposureState = await cameraInfo!.getZoomState(); - return exposureState.minZoomRatio; - } - /// The ui orientation changed. @override Stream onDeviceOrientationChanged() { diff --git a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax_flutter_api_impls.dart b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax_flutter_api_impls.dart index e60fbdec519..b268323ccfe 100644 --- a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax_flutter_api_impls.dart +++ b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax_flutter_api_impls.dart @@ -144,12 +144,6 @@ class AndroidCameraXCameraFlutterApis { /// Flutter Api for [ZoomState]. late final ZoomStateFlutterApiImpl zoomStateFlutterApiImpl; - /// Flutter Api for [ExposureState]. - late final ExposureStateFlutterApiImpl exposureStateFlutterApiImpl; - - /// Flutter Api for [ZoomState]. - late final ZoomStateFlutterApiImpl zoomStateFlutterApiImpl; - /// Flutter Api implementation for [Analyzer]. late final AnalyzerFlutterApiImpl analyzerFlutterApiImpl; diff --git a/packages/camera/camera_android_camerax/lib/src/camera_info.dart b/packages/camera/camera_android_camerax/lib/src/camera_info.dart index 48c03e675bb..4ed78ddfbf3 100644 --- a/packages/camera/camera_android_camerax/lib/src/camera_info.dart +++ b/packages/camera/camera_android_camerax/lib/src/camera_info.dart @@ -98,23 +98,6 @@ class _CameraInfoHostApiImpl extends CameraInfoHostApi { return instanceManager.getInstanceWithWeakReference>( zoomStateIdentifier)!; } - - /// Gets the [ExposureState] of the specified [CameraInfo] instance. - Future getExposureStateFromInstance( - CameraInfo instance) async { - final int? identifier = instanceManager.getIdentifier(instance); - final int exposureStateIdentifier = await getExposureState(identifier!); - return instanceManager - .getInstanceWithWeakReference(exposureStateIdentifier)!; - } - - /// Gets the [ZoomState] of the specified [CameraInfo] instance. - Future getZoomStateFromInstance(CameraInfo instance) async { - final int? identifier = instanceManager.getIdentifier(instance); - final int zoomStateIdentifier = await getZoomState(identifier!); - return instanceManager - .getInstanceWithWeakReference(zoomStateIdentifier)!; - } } /// Flutter API implementation of [CameraInfo]. 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 a1546ccf373..2a1b2813f1a 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 @@ -147,32 +147,6 @@ class ExposureCompensationRange { } } -class ExposureCompensationRange { - ExposureCompensationRange({ - required this.minCompensation, - required this.maxCompensation, - }); - - int minCompensation; - - int maxCompensation; - - Object encode() { - return [ - minCompensation, - maxCompensation, - ]; - } - - static ExposureCompensationRange decode(Object result) { - result as List; - return ExposureCompensationRange( - minCompensation: result[0]! as int, - maxCompensation: 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 @@ -1793,104 +1767,6 @@ abstract class ZoomStateFlutterApi { } } -class _ExposureStateFlutterApiCodec extends StandardMessageCodec { - const _ExposureStateFlutterApiCodec(); - @override - void writeValue(WriteBuffer buffer, Object? value) { - if (value is ExposureCompensationRange) { - buffer.putUint8(128); - writeValue(buffer, value.encode()); - } else { - super.writeValue(buffer, value); - } - } - - @override - Object? readValueOfType(int type, ReadBuffer buffer) { - switch (type) { - case 128: - return ExposureCompensationRange.decode(readValue(buffer)!); - default: - return super.readValueOfType(type, buffer); - } - } -} - -abstract class ExposureStateFlutterApi { - static const MessageCodec codec = _ExposureStateFlutterApiCodec(); - - void create( - int identifier, - ExposureCompensationRange exposureCompensationRange, - double exposureCompensationStep); - - static void setup(ExposureStateFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { - { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.ExposureStateFlutterApi.create', codec, - binaryMessenger: binaryMessenger); - if (api == null) { - channel.setMessageHandler(null); - } else { - channel.setMessageHandler((Object? message) async { - assert(message != 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?); - 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!); - return; - }); - } - } - } -} - -abstract class ZoomStateFlutterApi { - static const MessageCodec codec = StandardMessageCodec(); - - void create(int identifier, double minZoomRatio, double maxZoomRatio); - - static void setup(ZoomStateFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { - { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.ZoomStateFlutterApi.create', codec, - binaryMessenger: binaryMessenger); - if (api == null) { - channel.setMessageHandler(null); - } else { - channel.setMessageHandler((Object? message) async { - assert(message != 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, - 'Argument for dev.flutter.pigeon.ZoomStateFlutterApi.create was null, expected non-null int.'); - final double? arg_minZoomRatio = (args[1] as double?); - assert(arg_minZoomRatio != null, - 'Argument for dev.flutter.pigeon.ZoomStateFlutterApi.create was null, expected non-null double.'); - final double? arg_maxZoomRatio = (args[2] as double?); - assert(arg_maxZoomRatio != null, - 'Argument for dev.flutter.pigeon.ZoomStateFlutterApi.create was null, expected non-null double.'); - api.create(arg_identifier!, arg_minZoomRatio!, arg_maxZoomRatio!); - return; - }); - } - } - } -} - class _ImageAnalysisHostApiCodec extends StandardMessageCodec { const _ImageAnalysisHostApiCodec(); @override diff --git a/packages/camera/camera_android_camerax/pigeons/camerax_library.dart b/packages/camera/camera_android_camerax/pigeons/camerax_library.dart index ac14add39ac..601601dbf36 100644 --- a/packages/camera/camera_android_camerax/pigeons/camerax_library.dart +++ b/packages/camera/camera_android_camerax/pigeons/camerax_library.dart @@ -96,16 +96,6 @@ class ExposureCompensationRange { int maxCompensation; } -class ExposureCompensationRange { - ExposureCompensationRange({ - required this.minCompensation, - required this.maxCompensation, - }); - - int minCompensation; - int maxCompensation; -} - @HostApi(dartHostTestHandler: 'TestInstanceManagerHostApi') abstract class InstanceManagerHostApi { /// Clear the native `InstanceManager`. @@ -297,19 +287,6 @@ abstract class ZoomStateFlutterApi { void create(int identifier, double minZoomRatio, double maxZoomRatio); } -@FlutterApi() -abstract class ExposureStateFlutterApi { - void create( - int identifier, - ExposureCompensationRange exposureCompensationRange, - double exposureCompensationStep); -} - -@FlutterApi() -abstract class ZoomStateFlutterApi { - void create(int identifier, double minZoomRatio, double maxZoomRatio); -} - @HostApi(dartHostTestHandler: 'TestImageAnalysisHostApi') abstract class ImageAnalysisHostApi { void create(int identifier, ResolutionInfo? targetResolutionIdentifier); 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 88b381fc414..d6e2531cf08 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 @@ -181,8 +181,6 @@ void main() { final MockCameraInfo mockCameraInfo = MockCameraInfo(); final MockLiveCameraState mockLiveCameraState = MockLiveCameraState(); - camera.processCameraProvider = mockProcessCameraProvider; - when(camera.testPreview.setSurfaceProvider()) .thenAnswer((_) async => testSurfaceTextureId); when(mockProcessCameraProvider.bindToLifecycle( @@ -247,16 +245,6 @@ void main() { final MockCamera mockCamera = MockCamera(); final MockCameraInfo mockCameraInfo = MockCameraInfo(); - when(mockProcessCameraProvider.bindToLifecycle( - camera.mockBackCameraSelector, - [camera.testPreview, camera.testImageCapture])) - .thenAnswer((_) async => mockCamera); - when(mockCamera.getCameraInfo()).thenAnswer((_) async => mockCameraInfo); - when(mockCameraInfo.getLiveCameraState()) - .thenAnswer((_) async => MockLiveData()); - camera.processCameraProvider = mockProcessCameraProvider; - camera.createDetachedObjectForTesting = true; - camera.processCameraProvider = mockProcessCameraProvider; when(mockProcessCameraProvider.bindToLifecycle( @@ -340,16 +328,6 @@ void main() { await camera.createCamera(testCameraDescription, testResolutionPreset, enableAudio: enableAudio); - when(mockProcessCameraProvider.bindToLifecycle(any, any)) - .thenAnswer((_) async => mockCamera); - when(mockCamera.getCameraInfo()) - .thenAnswer((_) => Future.value(MockCameraInfo())); - when(camera.testPreview.getResolutionInfo()) - .thenAnswer((_) async => testResolutionInfo); - - await camera.createCamera(testCameraDescription, testResolutionPreset, - enableAudio: enableAudio); - // Start listening to camera events stream to verify the proper CameraInitializedEvent is sent. camera.cameraEventStreamController.stream.listen((CameraEvent event) { expect(event, const TypeMatcher()); @@ -537,11 +515,6 @@ void main() { when(mockCameraInfo.getCameraState()) .thenAnswer((_) async => mockLiveCameraState); - when(mockProcessCameraProvider.bindToLifecycle(any, any)) - .thenAnswer((_) => Future.value(mockCamera)); - when(mockCamera.getCameraInfo()) - .thenAnswer((_) => Future.value(mockCameraInfo)); - await camera.resumePreview(78); verify(camera.processCameraProvider! @@ -578,11 +551,6 @@ void main() { when(mockCameraInfo.getCameraState()) .thenAnswer((_) async => MockLiveCameraState()); - when(mockProcessCameraProvider.bindToLifecycle(any, any)) - .thenAnswer((_) => Future.value(mockCamera)); - when(mockCamera.getCameraInfo()) - .thenAnswer((_) => Future.value(MockCameraInfo())); - final FutureBuilder previewWidget = camera.buildPreview(textureId) as FutureBuilder; @@ -622,11 +590,6 @@ void main() { when(mockCameraInfo.getCameraState()) .thenAnswer((_) async => MockLiveCameraState()); - when(mockProcessCameraProvider.bindToLifecycle(any, any)) - .thenAnswer((_) => Future.value(mockCamera)); - when(mockCamera.getCameraInfo()) - .thenAnswer((_) => Future.value(mockCameraInfo)); - final FutureBuilder previewWidget = camera.buildPreview(textureId) as FutureBuilder; @@ -929,11 +892,6 @@ void main() { camera.processCameraProvider = mockProcessCameraProvider; camera.cameraSelector = MockCameraSelector(); - when(mockProcessCameraProvider.bindToLifecycle(any, any)) - .thenAnswer((_) => Future.value(mockCamera)); - when(mockCamera.getCameraInfo()) - .thenAnswer((_) => Future.value(MockCameraInfo())); - when(mockProcessCameraProvider.bindToLifecycle(any, any)) .thenAnswer((_) => Future.value(mockCamera)); when(mockCamera.getCameraInfo()) From 5c1470e4ee5458f347a1405601a978985d4346bd Mon Sep 17 00:00:00 2001 From: camsim99 Date: Tue, 31 Oct 2023 12:45:07 -0700 Subject: [PATCH 03/29] Rotation things :) --- .../android/app/src/main/AndroidManifest.xml | 3 +- .../camerax/GeneratedCameraXLibrary.java | 138 +++++++++++++++++- .../camerax/ImageAnalysisHostApiImpl.java | 13 +- .../camerax/ImageCaptureHostApiImpl.java | 28 +++- .../plugins/camerax/PreviewHostApiImpl.java | 16 +- .../camerax/VideoCaptureHostApiImpl.java | 17 ++- .../example/lib/main.dart | 6 +- .../lib/src/android_camera_camerax.dart | 63 +++++++- .../lib/src/camerax_library.g.dart | 112 ++++++++++++-- .../lib/src/image_analysis.dart | 42 +++++- .../lib/src/image_capture.dart | 36 ++++- .../lib/src/preview.dart | 15 ++ .../lib/src/video_capture.dart | 13 ++ .../pigeons/camerax_library.dart | 13 +- .../test/android_camera_camerax_test.dart | 6 +- .../test/test_camerax_library.g.dart | 127 +++++++++++++++- 16 files changed, 592 insertions(+), 56 deletions(-) diff --git a/packages/camera/camera_android/example/android/app/src/main/AndroidManifest.xml b/packages/camera/camera_android/example/android/app/src/main/AndroidManifest.xml index cef23162ddb..69d5c91d5fb 100644 --- a/packages/camera/camera_android/example/android/app/src/main/AndroidManifest.xml +++ b/packages/camera/camera_android/example/android/app/src/main/AndroidManifest.xml @@ -3,7 +3,8 @@ + android:label="camera_example" + android:name="${applicationName}"> getCodec() { return PreviewHostApiCodec.INSTANCE; @@ -1577,6 +1579,32 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PreviewHos channel.setMessageHandler(null); } } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PreviewHostApi.setTargetRotation", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + ArrayList args = (ArrayList) message; + Number identifierArg = (Number) args.get(0); + Number rotationArg = (Number) args.get(1); + try { + api.setTargetRotation( + (identifierArg == null) ? null : identifierArg.longValue(), + (rotationArg == null) ? null : rotationArg.longValue()); + wrapped.add(0, null); + } catch (Throwable exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } } } /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ @@ -1588,6 +1616,8 @@ public interface VideoCaptureHostApi { @NonNull Long getOutput(@NonNull Long identifier); + void setTargetRotation(@NonNull Long identifier, @NonNull Long rotation); + /** The codec used by VideoCaptureHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); @@ -1646,6 +1676,34 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable VideoCaptu channel.setMessageHandler(null); } } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.VideoCaptureHostApi.setTargetRotation", + getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + ArrayList args = (ArrayList) message; + Number identifierArg = (Number) args.get(0); + Number rotationArg = (Number) args.get(1); + try { + api.setTargetRotation( + (identifierArg == null) ? null : identifierArg.longValue(), + (rotationArg == null) ? null : rotationArg.longValue()); + wrapped.add(0, null); + } catch (Throwable exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } } } /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ @@ -2055,12 +2113,17 @@ public void create(@NonNull Long identifierArg, @NonNull Reply callback) { public interface ImageCaptureHostApi { void create( - @NonNull Long identifier, @Nullable Long flashMode, @Nullable Long resolutionSelectorId); + @NonNull Long identifier, + @Nullable Long targetRotation, + @Nullable Long flashMode, + @Nullable Long resolutionSelectorId); void setFlashMode(@NonNull Long identifier, @NonNull Long flashMode); void takePicture(@NonNull Long identifier, @NonNull Result result); + void setTargetRotation(@NonNull Long identifier, @NonNull Long rotation); + /** The codec used by ImageCaptureHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); @@ -2080,11 +2143,13 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageCaptu ArrayList wrapped = new ArrayList(); ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); - Number flashModeArg = (Number) args.get(1); - Number resolutionSelectorIdArg = (Number) args.get(2); + Number targetRotationArg = (Number) args.get(1); + Number flashModeArg = (Number) args.get(2); + Number resolutionSelectorIdArg = (Number) args.get(3); try { api.create( (identifierArg == null) ? null : identifierArg.longValue(), + (targetRotationArg == null) ? null : targetRotationArg.longValue(), (flashModeArg == null) ? null : flashModeArg.longValue(), (resolutionSelectorIdArg == null) ? null @@ -2156,6 +2221,34 @@ public void error(Throwable error) { channel.setMessageHandler(null); } } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.ImageCaptureHostApi.setTargetRotation", + getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + ArrayList args = (ArrayList) message; + Number identifierArg = (Number) args.get(0); + Number rotationArg = (Number) args.get(1); + try { + api.setTargetRotation( + (identifierArg == null) ? null : identifierArg.longValue(), + (rotationArg == null) ? null : rotationArg.longValue()); + wrapped.add(0, null); + } catch (Throwable exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } } } @@ -2486,12 +2579,17 @@ public void create( /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface ImageAnalysisHostApi { - void create(@NonNull Long identifier, @Nullable Long resolutionSelectorId); + void create( + @NonNull Long identifier, + @Nullable Long targetRotation, + @Nullable Long resolutionSelectorId); void setAnalyzer(@NonNull Long identifier, @NonNull Long analyzerIdentifier); void clearAnalyzer(@NonNull Long identifier); + void setTargetRotation(@NonNull Long identifier, @NonNull Long rotation); + /** The codec used by ImageAnalysisHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); @@ -2512,10 +2610,12 @@ static void setup( ArrayList wrapped = new ArrayList(); ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); - Number resolutionSelectorIdArg = (Number) args.get(1); + Number targetRotationArg = (Number) args.get(1); + Number resolutionSelectorIdArg = (Number) args.get(2); try { api.create( (identifierArg == null) ? null : identifierArg.longValue(), + (targetRotationArg == null) ? null : targetRotationArg.longValue(), (resolutionSelectorIdArg == null) ? null : resolutionSelectorIdArg.longValue()); @@ -2581,6 +2681,34 @@ static void setup( channel.setMessageHandler(null); } } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, + "dev.flutter.pigeon.ImageAnalysisHostApi.setTargetRotation", + getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + ArrayList args = (ArrayList) message; + Number identifierArg = (Number) args.get(0); + Number rotationArg = (Number) args.get(1); + try { + api.setTargetRotation( + (identifierArg == null) ? null : identifierArg.longValue(), + (rotationArg == null) ? null : rotationArg.longValue()); + wrapped.add(0, null); + } catch (Throwable exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } } } /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ 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 00bceb76a7e..f44db11cba1 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 @@ -41,9 +41,13 @@ 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 Long resolutionSelectorId) { + public void create( + @NonNull Long identifier, @Nullable Long rotation, @Nullable Long resolutionSelectorId) { ImageAnalysis.Builder imageAnalysisBuilder = cameraXProxy.createImageAnalysisBuilder(); + if (rotation != null) { + imageAnalysisBuilder.setTargetRotation(rotation.intValue()); + } if (resolutionSelectorId != null) { ResolutionSelector resolutionSelector = Objects.requireNonNull(instanceManager.getInstance(resolutionSelectorId)); @@ -75,6 +79,13 @@ public void clearAnalyzer(@NonNull Long identifier) { imageAnalysis.clearAnalyzer(); } + /** Dynamically sets the target rotation of the {@link ImageAnalysis}. */ + @Override + public void setTargetRotation(@NonNull Long identifier, @NonNull Long rotation) { + ImageAnalysis imageAnalysis = getImageAnalysisInstance(identifier); + imageAnalysis.setTargetRotation(rotation.intValue()); + } + /** * Retrieives the {@link ImageAnalysis} instance associated with the specified {@code identifier}. */ 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 88ec2debb7a..e17d386632f 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 @@ -53,9 +53,15 @@ public void setContext(@NonNull Context context) { */ @Override public void create( - @NonNull Long identifier, @Nullable Long flashMode, @Nullable Long resolutionSelectorId) { + @NonNull Long identifier, + @Nullable Long rotation, + @Nullable Long flashMode, + @Nullable Long resolutionSelectorId) { ImageCapture.Builder imageCaptureBuilder = cameraXProxy.createImageCaptureBuilder(); + if (rotation != null) { + imageCaptureBuilder.setTargetRotation(rotation.intValue()); + } if (flashMode != null) { // This sets the requested flash mode, but may fail silently. imageCaptureBuilder.setFlashMode(flashMode.intValue()); @@ -73,8 +79,7 @@ public void create( /** Sets the flash mode of the {@link ImageCapture} instance with the specified identifier. */ @Override public void setFlashMode(@NonNull Long identifier, @NonNull Long flashMode) { - ImageCapture imageCapture = - (ImageCapture) Objects.requireNonNull(instanceManager.getInstance(identifier)); + ImageCapture imageCapture = getImageCaptureInstance(identifier); imageCapture.setFlashMode(flashMode.intValue()); } @@ -82,8 +87,7 @@ public void setFlashMode(@NonNull Long identifier, @NonNull Long flashMode) { @Override public void takePicture( @NonNull Long identifier, @NonNull GeneratedCameraXLibrary.Result result) { - ImageCapture imageCapture = - (ImageCapture) Objects.requireNonNull(instanceManager.getInstance(identifier)); + ImageCapture imageCapture = getImageCaptureInstance(identifier); final File outputDir = context.getCacheDir(); File temporaryCaptureFile; try { @@ -118,4 +122,18 @@ public void onError(@NonNull ImageCaptureException exception) { } }; } + + /** Dynamically sets the target rotation of the {@link ImageCapture}. */ + @Override + public void setTargetRotation(@NonNull Long identifier, @NonNull Long rotation) { + ImageCapture imageCapture = getImageCaptureInstance(identifier); + imageCapture.setTargetRotation(rotation.intValue()); + } + + /** + * Retrieves the {@link ImageCapture} instance associated with the specified {@code identifier}. + */ + private ImageCapture getImageCaptureInstance(@NonNull Long identifier) { + return Objects.requireNonNull(instanceManager.getInstance(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 07b581ebf96..7b1ba1214cd 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 @@ -61,7 +61,7 @@ public void create( */ @Override public @NonNull Long setSurfaceProvider(@NonNull Long identifier) { - Preview preview = (Preview) Objects.requireNonNull(instanceManager.getInstance(identifier)); + Preview preview = getPreviewInstance(identifier); flutterSurfaceTexture = textureRegistry.createSurfaceTexture(); SurfaceTexture surfaceTexture = flutterSurfaceTexture.surfaceTexture(); Preview.SurfaceProvider surfaceProvider = createSurfaceProvider(surfaceTexture); @@ -142,7 +142,7 @@ public void releaseFlutterSurfaceTexture() { @Override public @NonNull GeneratedCameraXLibrary.ResolutionInfo getResolutionInfo( @NonNull Long identifier) { - Preview preview = (Preview) Objects.requireNonNull(instanceManager.getInstance(identifier)); + Preview preview = getPreviewInstance(identifier); Size resolution = preview.getResolutionInfo().getResolution(); GeneratedCameraXLibrary.ResolutionInfo.Builder resolutionInfo = @@ -151,4 +151,16 @@ public void releaseFlutterSurfaceTexture() { .setHeight(Long.valueOf(resolution.getHeight())); return resolutionInfo.build(); } + + /** Dynamically sets the target rotation of the {@link Preview}. */ + @Override + public void setTargetRotation(@NonNull Long identifier, @NonNull Long rotation) { + Preview preview = getPreviewInstance(identifier); + preview.setTargetRotation(rotation.intValue()); + } + + /** Retrieves the {@link Preview} instance associated with the specified {@code identifier}. */ + private Preview getPreviewInstance(@NonNull Long identifier) { + return Objects.requireNonNull(instanceManager.getInstance(identifier)); + } } diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/VideoCaptureHostApiImpl.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/VideoCaptureHostApiImpl.java index 7e764cdff4a..ba6b9678b6f 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/VideoCaptureHostApiImpl.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/VideoCaptureHostApiImpl.java @@ -37,8 +37,7 @@ public Long withOutput(@NonNull Long videoOutputId) { @Override @NonNull public Long getOutput(@NonNull Long identifier) { - VideoCapture videoCapture = - Objects.requireNonNull(instanceManager.getInstance(identifier)); + VideoCapture videoCapture = getVideoCaptureInstance(identifier); Recorder recorder = videoCapture.getOutput(); return Objects.requireNonNull(instanceManager.getIdentifierForStrongReference(recorder)); } @@ -49,4 +48,18 @@ public VideoCaptureFlutterApiImpl getVideoCaptureFlutterApiImpl( @NonNull BinaryMessenger binaryMessenger, @NonNull InstanceManager instanceManager) { return new VideoCaptureFlutterApiImpl(binaryMessenger, instanceManager); } + + /** Dynamically sets the target rotation of the {@link VideoCapture}. */ + @Override + public void setTargetRotation(@NonNull Long identifier, @NonNull Long rotation) { + VideoCapture videoCapture = getVideoCaptureInstance(identifier); + videoCapture.setTargetRotation(rotation.intValue()); + } + + /** + * Retrieives the {@link VideoCapture} instance associated with the specified {@code identifier}. + */ + private VideoCapture getVideoCaptureInstance(@NonNull Long identifier) { + return Objects.requireNonNull(instanceManager.getInstance(identifier)); + } } diff --git a/packages/camera/camera_android_camerax/example/lib/main.dart b/packages/camera/camera_android_camerax/example/lib/main.dart index a4434e7d5a9..420677e5611 100644 --- a/packages/camera/camera_android_camerax/example/lib/main.dart +++ b/packages/camera/camera_android_camerax/example/lib/main.dart @@ -296,14 +296,16 @@ class _CameraExampleHomeState extends State IconButton( icon: Icon(enableAudio ? Icons.volume_up : Icons.volume_mute), color: Colors.blue, - onPressed: () {}, // TODO(camsim99): Add functionality back here. + onPressed: controller != null ? onAudioModeButtonPressed : null, ), IconButton( icon: Icon(controller?.value.isCaptureOrientationLocked ?? false ? Icons.screen_lock_rotation : Icons.screen_rotation), color: Colors.blue, - onPressed: () {}, // TODO(camsim99): Add functionality back here. + onPressed: controller != null + ? onCaptureOrientationLockButtonPressed + : null, ), ], ), 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 7227bb6cd28..598f6d33bba 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 @@ -6,6 +6,7 @@ import 'dart:async'; import 'package:async/async.dart'; import 'package:camera_platform_interface/camera_platform_interface.dart'; +import 'package:flutter/services.dart' show DeviceOrientation; import 'package:flutter/widgets.dart'; import 'package:stream_transform/stream_transform.dart'; @@ -244,24 +245,33 @@ class AndroidCameraCameraX extends CameraPlatform { processCameraProvider ??= await ProcessCameraProvider.getInstance(); processCameraProvider!.unbindAll(); - // Configure Preview instance. + // Retrieve target rotation for UseCases. final int targetRotation = _getTargetRotation(cameraDescription.sensorOrientation); + + // Configure Preview instance. preview = createPreview( targetRotation: targetRotation, resolutionSelector: presetResolutionSelector); final int flutterSurfaceTextureId = await preview!.setSurfaceProvider(); // Configure ImageCapture instance. - imageCapture = createImageCapture(presetResolutionSelector); + imageCapture = createImageCapture( + targetRotation: targetRotation, + resolutionSelector: presetResolutionSelector); // Configure ImageAnalysis instance. // Defaults to YUV_420_888 image format. - imageAnalysis = createImageAnalysis(presetResolutionSelector); + imageAnalysis = createImageAnalysis( + targetRotation: targetRotation, + resolutionSelector: presetResolutionSelector); // Configure VideoCapture and Recorder instances. + // TODO(camsim99): Investigate if this should be refactored to allow for + // setting target rotation when creating VideoCapture instance. recorder = createRecorder(presetQualitySelector); videoCapture = await createVideoCapture(recorder!); + await videoCapture!.setTargetRotation(targetRotation); // Bind configured UseCases to ProcessCameraProvider instance & mark Preview // instance as bound but not paused. Video capture is bound at first use @@ -374,6 +384,25 @@ class AndroidCameraCameraX extends CameraPlatform { return _cameraEvents(cameraId).whereType(); } + /// Locks the capture orientation. + @override + Future lockCaptureOrientation( + int cameraId, + DeviceOrientation orientation, + ) async { + final int targetRotation = + _getTargetRotationFromDeviceOrientation(orientation); + + /// Update UseCases to use target device orientation. + await imageAnalysis!.setTargetRotation(targetRotation); + await imageCapture!.setTargetRotation(targetRotation); + await videoCapture!.setTargetRotation(targetRotation); + } + + /// Unlocks the capture orientation. + @override + Future unlockCaptureOrientation(int cameraId) async {} + /// Gets the minimum supported exposure offset for the selected camera in EV units. /// /// [cameraId] not used. @@ -850,6 +879,22 @@ class AndroidCameraCameraX extends CameraPlatform { } } + /// Returns [Surface] target rotation constant that maps to specified + /// [DeviceOrientation]. + int _getTargetRotationFromDeviceOrientation( + DeviceOrientation deviceOrientation) { + switch (deviceOrientation) { + case DeviceOrientation.portraitUp: + return Surface.ROTATION_0; + case DeviceOrientation.landscapeLeft: + return Surface.ROTATION_90; + case DeviceOrientation.portraitDown: + return Surface.ROTATION_180; + case DeviceOrientation.landscapeRight: + return Surface.ROTATION_270; + } + } + /// Returns the [ResolutionSelector] that maps to the specified resolution /// preset for camera [UseCase]s. /// @@ -996,8 +1041,10 @@ class AndroidCameraCameraX extends CameraPlatform { /// Returns an [ImageCapture] configured with specified flash mode and /// the specified [ResolutionSelector]. @visibleForTesting - ImageCapture createImageCapture(ResolutionSelector? resolutionSelector) { - return ImageCapture(resolutionSelector: resolutionSelector); + ImageCapture createImageCapture( + {required int targetRotation, ResolutionSelector? resolutionSelector}) { + return ImageCapture( + targetRotation: targetRotation, resolutionSelector: resolutionSelector); } /// Returns a [Recorder] for use in video capture configured with the @@ -1016,7 +1063,9 @@ class AndroidCameraCameraX extends CameraPlatform { /// Returns an [ImageAnalysis] configured with the specified /// [ResolutionSelector]. @visibleForTesting - ImageAnalysis createImageAnalysis(ResolutionSelector? resolutionSelector) { - return ImageAnalysis(resolutionSelector: resolutionSelector); + ImageAnalysis createImageAnalysis( + {required int targetRotation, ResolutionSelector? resolutionSelector}) { + return ImageAnalysis( + targetRotation: targetRotation, 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 4dd5253bd2d..2569b1a952d 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 @@ -1151,6 +1151,28 @@ class PreviewHostApi { return (replyList[0] as ResolutionInfo?)!; } } + + Future setTargetRotation(int arg_identifier, int arg_rotation) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.PreviewHostApi.setTargetRotation', codec, + binaryMessenger: _binaryMessenger); + final List? replyList = await channel + .send([arg_identifier, arg_rotation]) 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; + } + } } class VideoCaptureHostApi { @@ -1216,6 +1238,28 @@ class VideoCaptureHostApi { return (replyList[0] as int?)!; } } + + Future setTargetRotation(int arg_identifier, int arg_rotation) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.VideoCaptureHostApi.setTargetRotation', codec, + binaryMessenger: _binaryMessenger); + final List? replyList = await channel + .send([arg_identifier, arg_rotation]) 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; + } + } } abstract class VideoCaptureFlutterApi { @@ -1603,14 +1647,17 @@ 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_targetRotation, + 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_targetRotation, + arg_flashMode, + arg_resolutionSelectorId + ]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1675,6 +1722,28 @@ class ImageCaptureHostApi { return (replyList[0] as String?)!; } } + + Future setTargetRotation(int arg_identifier, int arg_rotation) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.ImageCaptureHostApi.setTargetRotation', codec, + binaryMessenger: _binaryMessenger); + final List? replyList = await channel + .send([arg_identifier, arg_rotation]) 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; + } + } } class _ResolutionStrategyHostApiCodec extends StandardMessageCodec { @@ -1974,13 +2043,16 @@ class ImageAnalysisHostApi { static const MessageCodec codec = StandardMessageCodec(); - Future create(int arg_identifier, int? arg_resolutionSelectorId) async { + Future create(int arg_identifier, int? arg_targetRotation, + 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_resolutionSelectorId]) - as List?; + final List? replyList = await channel.send([ + arg_identifier, + arg_targetRotation, + arg_resolutionSelectorId + ]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2042,6 +2114,28 @@ class ImageAnalysisHostApi { return; } } + + Future setTargetRotation(int arg_identifier, int arg_rotation) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.ImageAnalysisHostApi.setTargetRotation', codec, + binaryMessenger: _binaryMessenger); + final List? replyList = await channel + .send([arg_identifier, arg_rotation]) 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; + } + } } class AnalyzerHostApi { 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 e28457c6d19..07d3abe3e98 100644 --- a/packages/camera/camera_android_camerax/lib/src/image_analysis.dart +++ b/packages/camera/camera_android_camerax/lib/src/image_analysis.dart @@ -21,23 +21,32 @@ import 'use_case.dart'; @immutable class ImageAnalysis extends UseCase { /// Creates an [ImageAnalysis]. + /// + /// [targetRotation] should be specified in terms of one of the [Surface] + /// rotation constants. ImageAnalysis( {BinaryMessenger? binaryMessenger, InstanceManager? instanceManager, + this.targetRotation, this.resolutionSelector}) : super.detached( binaryMessenger: binaryMessenger, instanceManager: instanceManager) { _api = _ImageAnalysisHostApiImpl( binaryMessenger: binaryMessenger, instanceManager: instanceManager); - _api.createfromInstances(this, resolutionSelector); + _api.createFromInstances(this, targetRotation, resolutionSelector); AndroidCameraXCameraFlutterApis.instance.ensureSetUp(); } - /// Constructs an [ImageAnalysis] that is not automatically attached to a native object. + /// Constructs an [ImageAnalysis] that is not automatically attached to a + /// native object. + /// + /// [targetRotation] should be specified in terms of one of the [Surface] + /// rotation constants. ImageAnalysis.detached( {BinaryMessenger? binaryMessenger, InstanceManager? instanceManager, + this.targetRotation, this.resolutionSelector}) : super.detached( binaryMessenger: binaryMessenger, @@ -49,6 +58,9 @@ class ImageAnalysis extends UseCase { late final _ImageAnalysisHostApiImpl _api; + /// Target rotation of the camera used for the preview stream. + final int? targetRotation; + /// Target resolution of the camera preview stream. /// /// If not set, this [UseCase] will default to the behavior described in: @@ -57,10 +69,16 @@ class ImageAnalysis extends UseCase { /// Sets an [Analyzer] to receive and analyze images. Future setAnalyzer(Analyzer analyzer) => - _api.setAnalyzerfromInstances(this, analyzer); + _api.setAnalyzerFromInstances(this, analyzer); /// Removes a previously set [Analyzer]. - Future clearAnalyzer() => _api.clearAnalyzerfromInstances(this); + Future clearAnalyzer() => _api.clearAnalyzerFromInstances(this); + + /// Dynamically sets the target rotation of this instance. + /// + /// [rotation] should be one of the [Surface] rotation constants. + Future setTargetRotation(int rotation) => + _api.setTargetRotationFromInstances(this, rotation); } /// Host API implementation of [ImageAnalysis]. @@ -85,19 +103,22 @@ class _ImageAnalysisHostApiImpl extends ImageAnalysisHostApi { /// Creates an [ImageAnalysis] instance with the specified target resolution /// on the native side. - Future createfromInstances( + Future createFromInstances( ImageAnalysis instance, + int? targetRotation, ResolutionSelector? resolutionSelector, ) { return create( instanceManager.addDartCreatedInstance( instance, onCopy: (ImageAnalysis original) => ImageAnalysis.detached( + targetRotation: original.targetRotation, resolutionSelector: original.resolutionSelector, binaryMessenger: binaryMessenger, instanceManager: instanceManager, ), ), + targetRotation, resolutionSelector == null ? null : instanceManager.getIdentifier(resolutionSelector), @@ -105,7 +126,7 @@ class _ImageAnalysisHostApiImpl extends ImageAnalysisHostApi { } /// Sets the [analyzer] to receive and analyze images on the [instance]. - Future setAnalyzerfromInstances( + Future setAnalyzerFromInstances( ImageAnalysis instance, Analyzer analyzer, ) { @@ -116,11 +137,18 @@ class _ImageAnalysisHostApiImpl extends ImageAnalysisHostApi { } /// Removes a previously set analyzer from the [instance]. - Future clearAnalyzerfromInstances( + Future clearAnalyzerFromInstances( ImageAnalysis instance, ) { return clearAnalyzer( instanceManager.getIdentifier(instance)!, ); } + + /// Dynamically sets the target rotation of [instance] to [rotation]. + Future setTargetRotationFromInstances( + ImageAnalysis instance, int rotation) { + return setTargetRotation( + instanceManager.getIdentifier(instance)!, rotation); + } } 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 76fd9c4ae5c..7498734fc81 100644 --- a/packages/camera/camera_android_camerax/lib/src/image_capture.dart +++ b/packages/camera/camera_android_camerax/lib/src/image_capture.dart @@ -17,9 +17,13 @@ import 'use_case.dart'; @immutable class ImageCapture extends UseCase { /// Creates an [ImageCapture]. + /// + /// [targetRotation] should be specified in terms of one of the [Surface] + /// rotation constants. ImageCapture({ BinaryMessenger? binaryMessenger, InstanceManager? instanceManager, + this.targetRotation, this.targetFlashMode, this.resolutionSelector, }) : super.detached( @@ -28,13 +32,19 @@ class ImageCapture extends UseCase { ) { _api = ImageCaptureHostApiImpl( binaryMessenger: binaryMessenger, instanceManager: instanceManager); - _api.createFromInstance(this, targetFlashMode, resolutionSelector); + _api.createFromInstance( + this, targetRotation, targetFlashMode, resolutionSelector); } - /// Constructs a [ImageCapture] that is not automatically attached to a native object. + /// Constructs a [ImageCapture] that is not automatically attached to a + /// native object. + /// + /// [targetRotation] should be specified in terms of one of the [Surface] + /// rotation constants. ImageCapture.detached({ BinaryMessenger? binaryMessenger, InstanceManager? instanceManager, + this.targetRotation, this.targetFlashMode, this.resolutionSelector, }) : super.detached( @@ -47,6 +57,9 @@ class ImageCapture extends UseCase { late final ImageCaptureHostApiImpl _api; + /// Target rotation of the camera used for the preview stream. + final int? targetRotation; + /// Flash mode used to take a picture. final int? targetFlashMode; @@ -96,6 +109,12 @@ class ImageCapture extends UseCase { Future takePicture() async { return _api.takePictureFromInstance(this); } + + /// Dynamically sets the target rotation of this instance. + /// + /// [rotation] should be one of the [Surface] rotation constants. + Future setTargetRotation(int rotation) => + _api.setTargetRotationFromInstances(this, rotation); } /// Host API implementation of [ImageCapture]. @@ -124,18 +143,20 @@ class ImageCaptureHostApiImpl extends ImageCaptureHostApi { /// Creates an [ImageCapture] instance with the flash mode and target resolution /// if specified. - void createFromInstance(ImageCapture instance, int? targetFlashMode, - ResolutionSelector? resolutionSelector) { + void createFromInstance(ImageCapture instance, int? targetRotation, + int? targetFlashMode, ResolutionSelector? resolutionSelector) { final int identifier = instanceManager.addDartCreatedInstance(instance, onCopy: (ImageCapture original) { return ImageCapture.detached( binaryMessenger: binaryMessenger, instanceManager: instanceManager, + targetRotation: original.targetRotation, targetFlashMode: original.targetFlashMode, resolutionSelector: original.resolutionSelector); }); create( identifier, + targetRotation, targetFlashMode, resolutionSelector == null ? null @@ -162,4 +183,11 @@ class ImageCaptureHostApiImpl extends ImageCaptureHostApi { final String picturePath = await takePicture(identifier!); return picturePath; } + + /// Dynamically sets the target rotation of [instance] to [rotation]. + Future setTargetRotationFromInstances( + ImageCapture instance, int rotation) { + return setTargetRotation( + instanceManager.getIdentifier(instance)!, rotation); + } } diff --git a/packages/camera/camera_android_camerax/lib/src/preview.dart b/packages/camera/camera_android_camerax/lib/src/preview.dart index f0568078bed..49bc8b8986b 100644 --- a/packages/camera/camera_android_camerax/lib/src/preview.dart +++ b/packages/camera/camera_android_camerax/lib/src/preview.dart @@ -17,6 +17,9 @@ import 'use_case.dart'; @immutable class Preview extends UseCase { /// Creates a [Preview]. + /// + /// [targetRotation] should be specified in terms of one of the [Surface] + /// rotation constants. Preview( {BinaryMessenger? binaryMessenger, InstanceManager? instanceManager, @@ -72,6 +75,12 @@ class Preview extends UseCase { Future getResolutionInfo() { return _api.getResolutionInfoFromInstance(this); } + + /// Dynamically sets the target rotation of this instance. + /// + /// [rotation] should be one of the [Surface] rotation constants. + Future setTargetRotation(int rotation) => + _api.setTargetRotationFromInstances(this, rotation); } /// Host API implementation of [Preview]. @@ -136,4 +145,10 @@ class PreviewHostApiImpl extends PreviewHostApi { return resolutionInfo; } + + /// Dynamically sets the target rotation of [instance] to [rotation]. + Future setTargetRotationFromInstances(Preview instance, int rotation) { + return setTargetRotation( + instanceManager.getIdentifier(instance)!, rotation); + } } diff --git a/packages/camera/camera_android_camerax/lib/src/video_capture.dart b/packages/camera/camera_android_camerax/lib/src/video_capture.dart index bb657cffc4b..ae08da5d8d0 100644 --- a/packages/camera/camera_android_camerax/lib/src/video_capture.dart +++ b/packages/camera/camera_android_camerax/lib/src/video_capture.dart @@ -43,6 +43,12 @@ class VideoCapture extends UseCase { return _api.getOutputFromInstance(this); } + /// Dynamically sets the target rotation of this instance. + /// + /// [rotation] should be one of the [Surface] rotation constants. + Future setTargetRotation(int rotation) => + _api.setTargetRotationFromInstances(this, rotation); + late final VideoCaptureHostApiImpl _api; } @@ -82,6 +88,13 @@ class VideoCaptureHostApiImpl extends VideoCaptureHostApi { final int recorderId = await getOutput(identifier!); return instanceManager.getInstanceWithWeakReference(recorderId)!; } + + /// Dynamically sets the target rotation of [instance] to [rotation]. + Future setTargetRotationFromInstances( + VideoCapture instance, int rotation) { + return setTargetRotation( + instanceManager.getIdentifier(instance)!, rotation); + } } /// Flutter API implementation of [VideoCapture]. diff --git a/packages/camera/camera_android_camerax/pigeons/camerax_library.dart b/packages/camera/camera_android_camerax/pigeons/camerax_library.dart index 22827a803eb..de691b7d650 100644 --- a/packages/camera/camera_android_camerax/pigeons/camerax_library.dart +++ b/packages/camera/camera_android_camerax/pigeons/camerax_library.dart @@ -235,6 +235,8 @@ abstract class PreviewHostApi { void releaseFlutterSurfaceTexture(); ResolutionInfo getResolutionInfo(int identifier); + + void setTargetRotation(int identifier, int rotation); } @HostApi(dartHostTestHandler: 'TestVideoCaptureHostApi') @@ -242,6 +244,8 @@ abstract class VideoCaptureHostApi { int withOutput(int videoOutputId); int getOutput(int identifier); + + void setTargetRotation(int identifier, int rotation); } @FlutterApi() @@ -294,12 +298,15 @@ abstract class RecordingFlutterApi { @HostApi(dartHostTestHandler: 'TestImageCaptureHostApi') abstract class ImageCaptureHostApi { - void create(int identifier, int? flashMode, int? resolutionSelectorId); + void create(int identifier, int? targetRotation, int? flashMode, + int? resolutionSelectorId); void setFlashMode(int identifier, int flashMode); @async String takePicture(int identifier); + + void setTargetRotation(int identifier, int rotation); } @HostApi(dartHostTestHandler: 'TestResolutionStrategyHostApi') @@ -341,11 +348,13 @@ abstract class ZoomStateFlutterApi { @HostApi(dartHostTestHandler: 'TestImageAnalysisHostApi') abstract class ImageAnalysisHostApi { - void create(int identifier, int? resolutionSelectorId); + void create(int identifier, int? targetRotation, int? resolutionSelectorId); void setAnalyzer(int identifier, int analyzerIdentifier); void clearAnalyzer(int identifier); + + void setTargetRotation(int identifier, int rotation); } @HostApi(dartHostTestHandler: 'TestAnalyzerHostApi') 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 1b2b7c50a84..34e1c370b27 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 @@ -1458,7 +1458,8 @@ class FakeAndroidCameraCameraX extends AndroidCameraCameraX { } @override - ImageCapture createImageCapture(ResolutionSelector? resolutionSelector) { + ImageCapture createImageCapture( + {required int targetRotation, ResolutionSelector? resolutionSelector}) { when(testImageCapture.resolutionSelector).thenReturn(resolutionSelector); return testImageCapture; } @@ -1475,7 +1476,8 @@ class FakeAndroidCameraCameraX extends AndroidCameraCameraX { } @override - ImageAnalysis createImageAnalysis(ResolutionSelector? resolutionSelector) { + ImageAnalysis createImageAnalysis( + {required int targetRotation, ResolutionSelector? resolutionSelector}) { when(testImageAnalysis.resolutionSelector).thenReturn(resolutionSelector); return testImageAnalysis; } 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 4773effcb73..aef0e1be5b0 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 @@ -650,6 +650,8 @@ abstract class TestPreviewHostApi { ResolutionInfo getResolutionInfo(int identifier); + void setTargetRotation(int identifier, int rotation); + static void setup(TestPreviewHostApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -738,6 +740,31 @@ abstract class TestPreviewHostApi { }); } } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.PreviewHostApi.setTargetRotation', 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.PreviewHostApi.setTargetRotation 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.PreviewHostApi.setTargetRotation was null, expected non-null int.'); + final int? arg_rotation = (args[1] as int?); + assert(arg_rotation != null, + 'Argument for dev.flutter.pigeon.PreviewHostApi.setTargetRotation was null, expected non-null int.'); + api.setTargetRotation(arg_identifier!, arg_rotation!); + return []; + }); + } + } } } @@ -750,6 +777,8 @@ abstract class TestVideoCaptureHostApi { int getOutput(int identifier); + void setTargetRotation(int identifier, int rotation); + static void setup(TestVideoCaptureHostApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -796,6 +825,31 @@ abstract class TestVideoCaptureHostApi { }); } } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.VideoCaptureHostApi.setTargetRotation', 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.VideoCaptureHostApi.setTargetRotation 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.VideoCaptureHostApi.setTargetRotation was null, expected non-null int.'); + final int? arg_rotation = (args[1] as int?); + assert(arg_rotation != null, + 'Argument for dev.flutter.pigeon.VideoCaptureHostApi.setTargetRotation was null, expected non-null int.'); + api.setTargetRotation(arg_identifier!, arg_rotation!); + return []; + }); + } + } } } @@ -1059,12 +1113,15 @@ abstract class TestImageCaptureHostApi { TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); - void create(int identifier, int? flashMode, int? resolutionSelectorId); + void create(int identifier, int? targetRotation, int? flashMode, + int? resolutionSelectorId); void setFlashMode(int identifier, int flashMode); Future takePicture(int identifier); + void setTargetRotation(int identifier, int rotation); + static void setup(TestImageCaptureHostApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -1084,9 +1141,11 @@ abstract class TestImageCaptureHostApi { final int? arg_identifier = (args[0] as int?); 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 int? arg_resolutionSelectorId = (args[2] as int?); - api.create(arg_identifier!, arg_flashMode, arg_resolutionSelectorId); + final int? arg_targetRotation = (args[1] as int?); + final int? arg_flashMode = (args[2] as int?); + final int? arg_resolutionSelectorId = (args[3] as int?); + api.create(arg_identifier!, arg_targetRotation, arg_flashMode, + arg_resolutionSelectorId); return []; }); } @@ -1138,6 +1197,31 @@ abstract class TestImageCaptureHostApi { }); } } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.ImageCaptureHostApi.setTargetRotation', 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.ImageCaptureHostApi.setTargetRotation 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.ImageCaptureHostApi.setTargetRotation was null, expected non-null int.'); + final int? arg_rotation = (args[1] as int?); + assert(arg_rotation != null, + 'Argument for dev.flutter.pigeon.ImageCaptureHostApi.setTargetRotation was null, expected non-null int.'); + api.setTargetRotation(arg_identifier!, arg_rotation!); + return []; + }); + } + } } } @@ -1285,12 +1369,14 @@ abstract class TestImageAnalysisHostApi { TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); - void create(int identifier, int? resolutionSelectorId); + void create(int identifier, int? targetRotation, int? resolutionSelectorId); void setAnalyzer(int identifier, int analyzerIdentifier); void clearAnalyzer(int identifier); + void setTargetRotation(int identifier, int rotation); + static void setup(TestImageAnalysisHostApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -1310,8 +1396,10 @@ 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 int? arg_resolutionSelectorId = (args[1] as int?); - api.create(arg_identifier!, arg_resolutionSelectorId); + final int? arg_targetRotation = (args[1] as int?); + final int? arg_resolutionSelectorId = (args[2] as int?); + api.create( + arg_identifier!, arg_targetRotation, arg_resolutionSelectorId); return []; }); } @@ -1363,6 +1451,31 @@ abstract class TestImageAnalysisHostApi { }); } } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.ImageAnalysisHostApi.setTargetRotation', 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.ImageAnalysisHostApi.setTargetRotation 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.ImageAnalysisHostApi.setTargetRotation was null, expected non-null int.'); + final int? arg_rotation = (args[1] as int?); + assert(arg_rotation != null, + 'Argument for dev.flutter.pigeon.ImageAnalysisHostApi.setTargetRotation was null, expected non-null int.'); + api.setTargetRotation(arg_identifier!, arg_rotation!); + return []; + }); + } + } } } From 13fd29eea79bbc6307afed25bac987ac0eea935a Mon Sep 17 00:00:00 2001 From: camsim99 Date: Tue, 31 Oct 2023 14:01:52 -0700 Subject: [PATCH 04/29] Implement unlockCaptureOrientation --- .../android/app/src/main/AndroidManifest.xml | 3 +-- .../lib/src/android_camera_camerax.dart | 26 ++++++++++++++++--- .../lib/src/system_services.dart | 5 ++++ 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/packages/camera/camera_android/example/android/app/src/main/AndroidManifest.xml b/packages/camera/camera_android/example/android/app/src/main/AndroidManifest.xml index 69d5c91d5fb..cef23162ddb 100644 --- a/packages/camera/camera_android/example/android/app/src/main/AndroidManifest.xml +++ b/packages/camera/camera_android/example/android/app/src/main/AndroidManifest.xml @@ -3,8 +3,7 @@ + android:label="camera_example"> unlockCaptureOrientation(int cameraId) async {} + Future unlockCaptureOrientation(int cameraId) async { + int? currentDeviceOrientation; + if (SystemServices.lastRecordedDeviceOrientation == null) { + currentDeviceOrientation = initialSensorOrientation; + } else { + currentDeviceOrientation = _getTargetRotationFromDeviceOrientation( + SystemServices.lastRecordedDeviceOrientation!); + } + + /// Update UseCases to use current device orientation. + await imageAnalysis!.setTargetRotation(currentDeviceOrientation!); + await imageCapture!.setTargetRotation(currentDeviceOrientation!); + await videoCapture!.setTargetRotation(currentDeviceOrientation!); + } /// Gets the minimum supported exposure offset for the selected camera in EV units. /// diff --git a/packages/camera/camera_android_camerax/lib/src/system_services.dart b/packages/camera/camera_android_camerax/lib/src/system_services.dart index a2513e03766..af42508cde2 100644 --- a/packages/camera/camera_android_camerax/lib/src/system_services.dart +++ b/packages/camera/camera_android_camerax/lib/src/system_services.dart @@ -26,6 +26,10 @@ class SystemServices { deviceOrientationChangedStreamController = StreamController.broadcast(); + /// The last [DeviceOrientation] picked up by + /// [deviceOrientationChangedStreamController]. + static DeviceOrientation? lastRecordedDeviceOrientation; + /// Stream that emits the errors caused by camera usage on the native side. static final StreamController cameraErrorStreamController = StreamController.broadcast(); @@ -127,6 +131,7 @@ class SystemServicesFlutterApiImpl implements SystemServicesFlutterApi { deserializeDeviceOrientation(orientation); SystemServices.deviceOrientationChangedStreamController .add(DeviceOrientationChangedEvent(deviceOrientation)); + SystemServices.lastRecordedDeviceOrientation = deviceOrientation; } /// Deserializes device orientation in [String] format into a From 6096c3736e651f3ec5503cce4103b8b8d6086f6e Mon Sep 17 00:00:00 2001 From: camsim99 Date: Tue, 7 Nov 2023 15:23:09 -0800 Subject: [PATCH 05/29] Refactor DeviceOrientationManager --- .../camerax/CameraAndroidCameraxPlugin.java | 4 + .../camerax/GeneratedCameraXLibrary.java | 1033 +++++++---------- .../camerax/SystemServicesFlutterApiImpl.java | 5 - .../camerax/SystemServicesHostApiImpl.java | 42 - .../lib/src/android_camera_camerax.dart | 23 +- ...roid_camera_camerax_flutter_api_impls.dart | 11 + .../lib/src/camerax_library.g.dart | 478 ++++---- .../lib/src/system_services.dart | 70 +- .../pigeons/camerax_library.dart | 18 +- .../test/test_camerax_library.g.dart | 873 ++++++-------- 10 files changed, 1012 insertions(+), 1545 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 eeb3c02dd15..13626070d51 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 @@ -27,6 +27,7 @@ public final class CameraAndroidCameraxPlugin implements FlutterPlugin, Activity private ImageCaptureHostApiImpl imageCaptureHostApiImpl; private CameraControlHostApiImpl cameraControlHostApiImpl; public @Nullable SystemServicesHostApiImpl systemServicesHostApiImpl; + public @Nullable DeviceOrientationManagerHostApiImpl deviceOrientationManagerHostApiImpl; @VisibleForTesting public @Nullable ProcessCameraProviderHostApiImpl processCameraProviderHostApiImpl; @@ -71,6 +72,8 @@ public void setUp( systemServicesHostApiImpl = new SystemServicesHostApiImpl(binaryMessenger, instanceManager, context); GeneratedCameraXLibrary.SystemServicesHostApi.setup(binaryMessenger, systemServicesHostApiImpl); + deviceOrientationManagerHostApiImpl = new DeviceOrientationManagerHostApiImpl(binaryMessenger, instanceManager); + GeneratedCameraXLibrary.DeviceOrientationManagerHostApi.setup(binaryMessenger, deviceOrientationManagerHostApiImpl); GeneratedCameraXLibrary.PreviewHostApi.setup( binaryMessenger, new PreviewHostApiImpl(binaryMessenger, instanceManager, textureRegistry)); imageCaptureHostApiImpl = @@ -145,6 +148,7 @@ public void onAttachedToActivity(@NonNull ActivityPluginBinding activityPluginBi systemServicesHostApiImpl.setActivity(activity); systemServicesHostApiImpl.setPermissionsRegistry( activityPluginBinding::addRequestPermissionsResultListener); + deviceOrientationManagerHostApiImpl.setActivity(activity); } @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 900aec3e5ec..dbf1ac731a2 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,12 +109,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), @@ -130,7 +134,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), @@ -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,9 @@ 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; } } @@ -479,7 +469,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; @@ -540,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(); @@ -548,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<>( @@ -565,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; } @@ -586,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 = @@ -603,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; } @@ -623,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); @@ -632,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<>( @@ -645,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) -> { @@ -678,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; } @@ -703,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; } @@ -720,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) -> { @@ -730,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; } @@ -755,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; } @@ -778,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); @@ -787,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<>( @@ -802,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<>( @@ -827,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; } @@ -853,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; } @@ -878,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); @@ -887,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()); @@ -903,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); @@ -923,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) -> { @@ -961,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) -> { @@ -971,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; } @@ -988,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) -> { @@ -1000,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; } @@ -1021,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) -> { @@ -1032,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; } @@ -1050,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) -> { @@ -1061,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; } @@ -1077,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) -> { @@ -1089,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; } @@ -1109,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); @@ -1118,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)); @@ -1133,17 +1070,17 @@ 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); - @NonNull + @NonNull Long getCameraControl(@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 = @@ -1156,10 +1093,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; } @@ -1180,11 +1117,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraHost ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - Long output = - api.getCameraControl( - (identifierArg == null) ? null : identifierArg.longValue()); + Long output = api.getCameraControl((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1204,7 +1140,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); @@ -1213,7 +1149,6 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1253,33 +1188,21 @@ 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 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) -> { @@ -1308,9 +1231,79 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.SystemServicesHostApi.startListeningForDeviceOrientationChange", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.SystemServicesHostApi.getTempFilePath", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + ArrayList args = (ArrayList) message; + String prefixArg = (String) args.get(0); + String suffixArg = (String) args.get(1); + try { + String output = api.getTempFilePath(prefixArg, suffixArg); + wrapped.add(0, output); + } + catch (Throwable exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + } + } + /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ + public static class SystemServicesFlutterApi { + private final @NonNull BinaryMessenger binaryMessenger; + + 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 @NonNull MessageCodec getCodec() { + return new StandardMessageCodec(); + } + public void onCameraError(@NonNull String errorDescriptionArg, @NonNull Reply callback) { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.SystemServicesFlutterApi.onCameraError", getCodec()); + channel.send( + new ArrayList(Collections.singletonList(errorDescriptionArg)), + channelReply -> callback.reply(null)); + } + } + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ + public interface DeviceOrientationManagerHostApi { + + void startListeningForDeviceOrientationChange(@NonNull Boolean isFrontFacing, @NonNull Long sensorOrientation); + + void stopListeningForDeviceOrientationChange(); + + @NonNull + Long getPhotoOrientation(); + + @NonNull + Long getVideoOrientation(); + + /** The codec used by DeviceOrientationManagerHostApi. */ + static @NonNull MessageCodec getCodec() { + return new StandardMessageCodec(); + } + /**Sets up an instance of `DeviceOrientationManagerHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable DeviceOrientationManagerHostApi api) { + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.DeviceOrientationManagerHostApi.startListeningForDeviceOrientationChange", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1319,11 +1312,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; } @@ -1336,9 +1328,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.SystemServicesHostApi.stopListeningForDeviceOrientationChange", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.DeviceOrientationManagerHostApi.stopListeningForDeviceOrientationChange", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1346,7 +1336,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; } @@ -1359,20 +1350,38 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.SystemServicesHostApi.getTempFilePath", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.DeviceOrientationManagerHostApi.getPhotoOrientation", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { ArrayList wrapped = new ArrayList(); - ArrayList args = (ArrayList) message; - String prefixArg = (String) args.get(0); - String suffixArg = (String) args.get(1); try { - String output = api.getTempFilePath(prefixArg, suffixArg); + Long output = api.getPhotoOrientation(); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.DeviceOrientationManagerHostApi.getVideoOrientation", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + Long output = api.getVideoOrientation(); + wrapped.add(0, output); + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1385,45 +1394,30 @@ public void error(Throwable error) { } } /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ - public static class SystemServicesFlutterApi { + public static class DeviceOrientationManagerFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; - public SystemServicesFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { + public DeviceOrientationManagerFlutterApi(@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); } - /** The codec used by SystemServicesFlutterApi. */ + /** The codec used by DeviceOrientationManagerFlutterApi. */ 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.DeviceOrientationManagerFlutterApi.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()); - channel.send( - new ArrayList(Collections.singletonList(errorDescriptionArg)), - channelReply -> callback.reply(null)); - } } private static class PreviewHostApiCodec extends StandardMessageCodec { @@ -1455,15 +1449,14 @@ 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); void setTargetRotation(@NonNull Long identifier, @NonNull Long rotation); @@ -1472,7 +1465,7 @@ void create( 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 = @@ -1487,14 +1480,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; } @@ -1507,9 +1496,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) -> { @@ -1517,11 +1504,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; } @@ -1534,9 +1520,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) -> { @@ -1544,7 +1528,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; } @@ -1565,11 +1550,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; } @@ -1591,11 +1575,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PreviewHos Number identifierArg = (Number) args.get(0); Number rotationArg = (Number) args.get(1); try { - api.setTargetRotation( - (identifierArg == null) ? null : identifierArg.longValue(), - (rotationArg == null) ? null : rotationArg.longValue()); + api.setTargetRotation((identifierArg == null) ? null : identifierArg.longValue(), (rotationArg == null) ? null : rotationArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1610,10 +1593,10 @@ 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); void setTargetRotation(@NonNull Long identifier, @NonNull Long rotation); @@ -1622,10 +1605,7 @@ public interface 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 = @@ -1638,11 +1618,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; } @@ -1663,10 +1642,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; } @@ -1679,9 +1658,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable VideoCaptu { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.VideoCaptureHostApi.setTargetRotation", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.VideoCaptureHostApi.setTargetRotation", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1690,11 +1667,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable VideoCaptu Number identifierArg = (Number) args.get(0); Number rotationArg = (Number) args.get(1); try { - api.setTargetRotation( - (identifierArg == null) ? null : identifierArg.longValue(), - (rotationArg == null) ? null : rotationArg.longValue()); + api.setTargetRotation((identifierArg == null) ? null : identifierArg.longValue(), (rotationArg == null) ? null : rotationArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1714,7 +1690,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); @@ -1723,7 +1699,6 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1736,28 +1711,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 = @@ -1773,13 +1742,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; } @@ -1800,11 +1766,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; } @@ -1817,9 +1782,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) -> { @@ -1827,11 +1790,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; } @@ -1853,11 +1815,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; } @@ -1877,7 +1838,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); @@ -1886,12 +1847,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()); @@ -1903,19 +1859,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<>( @@ -1927,10 +1879,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; } @@ -1950,7 +1902,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); @@ -1959,7 +1911,6 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1984,9 +1935,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 = @@ -2001,7 +1950,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; } @@ -2024,7 +1974,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; } @@ -2047,7 +1998,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; } @@ -2070,7 +2022,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; } @@ -2090,7 +2043,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); @@ -2099,7 +2052,6 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2112,11 +2064,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 targetRotation, - @Nullable Long flashMode, - @Nullable Long resolutionSelectorId); + void create(@NonNull Long identifier, @Nullable Long targetRotation, @Nullable Long flashMode, @Nullable Long resolutionSelectorId); void setFlashMode(@NonNull Long identifier, @NonNull Long flashMode); @@ -2128,10 +2076,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 = @@ -2147,15 +2092,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageCaptu Number flashModeArg = (Number) args.get(2); Number resolutionSelectorIdArg = (Number) args.get(3); try { - api.create( - (identifierArg == null) ? null : identifierArg.longValue(), - (targetRotationArg == null) ? null : targetRotationArg.longValue(), - (flashModeArg == null) ? null : flashModeArg.longValue(), - (resolutionSelectorIdArg == null) - ? null - : resolutionSelectorIdArg.longValue()); + api.create((identifierArg == null) ? null : identifierArg.longValue(), (targetRotationArg == null) ? null : targetRotationArg.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; } @@ -2177,11 +2117,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; } @@ -2214,8 +2153,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); @@ -2224,9 +2162,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.ImageCaptureHostApi.setTargetRotation", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.ImageCaptureHostApi.setTargetRotation", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2235,11 +2171,10 @@ public void error(Throwable error) { Number identifierArg = (Number) args.get(0); Number rotationArg = (Number) args.get(1); try { - api.setTargetRotation( - (identifierArg == null) ? null : identifierArg.longValue(), - (rotationArg == null) ? null : rotationArg.longValue()); + api.setTargetRotation((identifierArg == null) ? null : identifierArg.longValue(), (rotationArg == null) ? null : rotationArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2253,8 +2188,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() {} @@ -2282,19 +2216,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<>( @@ -2308,12 +2237,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; } @@ -2328,21 +2255,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<>( @@ -2356,16 +2276,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; } @@ -2380,25 +2294,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) -> { @@ -2408,14 +2315,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; } @@ -2462,7 +2365,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); @@ -2471,12 +2374,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()); @@ -2520,7 +2418,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); @@ -2529,19 +2427,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)); } } @@ -2553,7 +2444,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); @@ -2562,12 +2453,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()); @@ -2579,10 +2465,7 @@ public void create( /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface ImageAnalysisHostApi { - void create( - @NonNull Long identifier, - @Nullable Long targetRotation, - @Nullable Long resolutionSelectorId); + void create(@NonNull Long identifier, @Nullable Long targetRotation, @Nullable Long resolutionSelectorId); void setAnalyzer(@NonNull Long identifier, @NonNull Long analyzerIdentifier); @@ -2594,12 +2477,8 @@ void create( 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<>( @@ -2613,14 +2492,10 @@ static void setup( Number targetRotationArg = (Number) args.get(1); Number resolutionSelectorIdArg = (Number) args.get(2); try { - api.create( - (identifierArg == null) ? null : identifierArg.longValue(), - (targetRotationArg == null) ? null : targetRotationArg.longValue(), - (resolutionSelectorIdArg == null) - ? null - : resolutionSelectorIdArg.longValue()); + api.create((identifierArg == null) ? null : identifierArg.longValue(), (targetRotationArg == null) ? null : targetRotationArg.longValue(), (resolutionSelectorIdArg == null) ? null : resolutionSelectorIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2642,11 +2517,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; } @@ -2659,9 +2533,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) -> { @@ -2671,7 +2543,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; } @@ -2684,9 +2557,7 @@ static void setup( { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.ImageAnalysisHostApi.setTargetRotation", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.ImageAnalysisHostApi.setTargetRotation", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2695,11 +2566,10 @@ static void setup( Number identifierArg = (Number) args.get(0); Number rotationArg = (Number) args.get(1); try { - api.setTargetRotation( - (identifierArg == null) ? null : identifierArg.longValue(), - (rotationArg == null) ? null : rotationArg.longValue()); + api.setTargetRotation((identifierArg == null) ? null : identifierArg.longValue(), (rotationArg == null) ? null : rotationArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2720,9 +2590,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 = @@ -2737,7 +2605,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; } @@ -2758,9 +2627,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 = @@ -2775,7 +2642,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; } @@ -2795,7 +2663,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); @@ -2804,11 +2672,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()); @@ -2825,7 +2689,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); @@ -2834,9 +2698,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()); @@ -2879,16 +2741,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 = @@ -2902,11 +2762,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; } @@ -2929,7 +2788,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; } @@ -2951,11 +2811,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; } @@ -3002,7 +2861,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); @@ -3011,11 +2870,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()); @@ -3032,7 +2887,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); @@ -3041,7 +2896,6 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -3050,11 +2904,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()); @@ -3066,7 +2916,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); @@ -3075,9 +2925,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 = @@ -3090,10 +2938,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; } @@ -3116,7 +2964,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; } @@ -3136,7 +2985,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); @@ -3145,13 +2994,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()); @@ -3168,7 +3011,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); @@ -3177,19 +3020,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)); } } @@ -3228,24 +3064,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 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<>( @@ -3256,16 +3085,13 @@ static void setup( 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; } @@ -3278,24 +3104,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); - 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; } @@ -3310,21 +3131,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 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<>( @@ -3335,19 +3149,13 @@ static void setup( 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; } @@ -3362,22 +3170,16 @@ static void setup( /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface CameraControlHostApi { - void enableTorch( - @NonNull Long identifier, @NonNull Boolean torch, @NonNull Result result); + void enableTorch(@NonNull Long identifier, @NonNull Boolean torch, @NonNull Result result); - void setZoomRatio( - @NonNull Long identifier, @NonNull Double ratio, @NonNull Result result); + void setZoomRatio(@NonNull Long identifier, @NonNull Double ratio, @NonNull Result result); /** The codec used by CameraControlHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `CameraControlHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable CameraControlHostApi api) { + /**Sets up an instance of `CameraControlHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraControlHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -3402,10 +3204,7 @@ public void error(Throwable error) { } }; - api.enableTorch( - (identifierArg == null) ? null : identifierArg.longValue(), - torchArg, - resultCallback); + api.enableTorch((identifierArg == null) ? null : identifierArg.longValue(), torchArg, resultCallback); }); } else { channel.setMessageHandler(null); @@ -3414,9 +3213,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.CameraControlHostApi.setZoomRatio", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.CameraControlHostApi.setZoomRatio", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3437,10 +3234,7 @@ public void error(Throwable error) { } }; - api.setZoomRatio( - (identifierArg == null) ? null : identifierArg.longValue(), - ratioArg, - resultCallback); + api.setZoomRatio((identifierArg == null) ? null : identifierArg.longValue(), ratioArg, resultCallback); }); } else { channel.setMessageHandler(null); @@ -3456,7 +3250,7 @@ public CameraControlFlutterApi(@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); @@ -3465,7 +3259,6 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/SystemServicesFlutterApiImpl.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/SystemServicesFlutterApiImpl.java index 63158974f43..2cb4ea1b227 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/SystemServicesFlutterApiImpl.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/SystemServicesFlutterApiImpl.java @@ -13,11 +13,6 @@ public SystemServicesFlutterApiImpl(@NonNull BinaryMessenger binaryMessenger) { super(binaryMessenger); } - public void sendDeviceOrientationChangedEvent( - @NonNull String orientation, @NonNull Reply reply) { - super.onDeviceOrientationChanged(orientation, reply); - } - public void sendCameraError(@NonNull String errorDescription, @NonNull Reply reply) { super.onCameraError(errorDescription, reply); } diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/SystemServicesHostApiImpl.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/SystemServicesHostApiImpl.java index b8f4d6b0c62..f9ac1f0a0cf 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/SystemServicesHostApiImpl.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/SystemServicesHostApiImpl.java @@ -9,7 +9,6 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; -import io.flutter.embedding.engine.systemchannels.PlatformChannel.DeviceOrientation; import io.flutter.plugin.common.BinaryMessenger; import io.flutter.plugins.camerax.CameraPermissionsManager.PermissionsRegistry; import io.flutter.plugins.camerax.GeneratedCameraXLibrary.CameraPermissionsErrorData; @@ -25,7 +24,6 @@ public class SystemServicesHostApiImpl implements SystemServicesHostApi { private Context context; @VisibleForTesting public @NonNull CameraXProxy cameraXProxy = new CameraXProxy(); - @VisibleForTesting public @Nullable DeviceOrientationManager deviceOrientationManager; @VisibleForTesting public @NonNull SystemServicesFlutterApiImpl systemServicesFlutterApi; private Activity activity; @@ -84,46 +82,6 @@ public void requestCameraPermissions( }); } - /** - * Starts listening for device orientation changes using an instance of a {@link - * DeviceOrientationManager}. - * - *

Whenever a change in device orientation is detected by the {@code DeviceOrientationManager}, - * the {@link SystemServicesFlutterApi} will be used to notify the Dart side. - */ - @Override - public void startListeningForDeviceOrientationChange( - @NonNull Boolean isFrontFacing, @NonNull Long sensorOrientation) { - deviceOrientationManager = - cameraXProxy.createDeviceOrientationManager( - activity, - isFrontFacing, - sensorOrientation.intValue(), - (DeviceOrientation newOrientation) -> { - systemServicesFlutterApi.sendDeviceOrientationChangedEvent( - serializeDeviceOrientation(newOrientation), reply -> {}); - }); - deviceOrientationManager.start(); - } - - /** Serializes {@code DeviceOrientation} into a String that the Dart side is able to recognize. */ - String serializeDeviceOrientation(DeviceOrientation orientation) { - return orientation.toString(); - } - - /** - * Tells the {@code deviceOrientationManager} to stop listening for orientation updates. - * - *

Has no effect if the {@code deviceOrientationManager} was never created to listen for device - * orientation updates. - */ - @Override - public void stopListeningForDeviceOrientationChange() { - if (deviceOrientationManager != null) { - deviceOrientationManager.stop(); - } - } - /** Returns a path to be used to create a temp file in the current cache directory. */ @Override @NonNull 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 a46ec548b0e..7bb94e25059 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 @@ -17,6 +17,7 @@ import 'camera_info.dart'; import 'camera_selector.dart'; import 'camera_state.dart'; import 'camerax_library.g.dart'; +import 'device_orientation_manager.dart'; import 'exposure_state.dart'; import 'fallback_strategy.dart'; import 'image_analysis.dart'; @@ -407,18 +408,15 @@ class AndroidCameraCameraX extends CameraPlatform { /// Unlocks the capture orientation. @override Future unlockCaptureOrientation(int cameraId) async { - int? currentDeviceOrientation; - if (SystemServices.lastRecordedDeviceOrientation == null) { - currentDeviceOrientation = initialSensorOrientation; - } else { - currentDeviceOrientation = _getTargetRotationFromDeviceOrientation( - SystemServices.lastRecordedDeviceOrientation!); - } + final int currentPhotoOrientation = _getTargetRotation( + await DeviceOrientationManager.getPhotoOrientation()); + final int currentVideoOrientation = _getTargetRotation( + await DeviceOrientationManager.getVideoOrientation()); /// Update UseCases to use current device orientation. - await imageAnalysis!.setTargetRotation(currentDeviceOrientation!); - await imageCapture!.setTargetRotation(currentDeviceOrientation!); - await videoCapture!.setTargetRotation(currentDeviceOrientation!); + await imageAnalysis!.setTargetRotation(currentPhotoOrientation); + await imageCapture!.setTargetRotation(currentPhotoOrientation); + await videoCapture!.setTargetRotation(currentVideoOrientation); } /// Gets the minimum supported exposure offset for the selected camera in EV units. @@ -500,7 +498,8 @@ class AndroidCameraCameraX extends CameraPlatform { /// The ui orientation changed. @override Stream onDeviceOrientationChanged() { - return SystemServices.deviceOrientationChangedStreamController.stream; + return DeviceOrientationManager + .deviceOrientationChangedStreamController.stream; } /// Pause the active preview on the current frame for the selected camera. @@ -1030,7 +1029,7 @@ class AndroidCameraCameraX extends CameraPlatform { @visibleForTesting void startListeningForDeviceOrientationChange( bool cameraIsFrontFacing, int sensorOrientation) { - SystemServices.startListeningForDeviceOrientationChange( + DeviceOrientationManager.startListeningForDeviceOrientationChange( cameraIsFrontFacing, sensorOrientation); } diff --git a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax_flutter_api_impls.dart b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax_flutter_api_impls.dart index b59e0df30da..59838e62549 100644 --- a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax_flutter_api_impls.dart +++ b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax_flutter_api_impls.dart @@ -10,6 +10,7 @@ import 'camera_selector.dart'; import 'camera_state.dart'; import 'camera_state_error.dart'; import 'camerax_library.g.dart'; +import 'device_orientation_manager.dart'; import 'exposure_state.dart'; import 'image_proxy.dart'; import 'java_object.dart'; @@ -34,6 +35,8 @@ class AndroidCameraXCameraFlutterApis { CameraSelectorFlutterApiImpl? cameraSelectorFlutterApiImpl, ProcessCameraProviderFlutterApiImpl? processCameraProviderFlutterApiImpl, SystemServicesFlutterApiImpl? systemServicesFlutterApiImpl, + DeviceOrientationManagerFlutterApiImpl? + deviceOrientationManagerFlutterApiImpl, CameraStateErrorFlutterApiImpl? cameraStateErrorFlutterApiImpl, CameraStateFlutterApiImpl? cameraStateFlutterApiImpl, PendingRecordingFlutterApiImpl? pendingRecordingFlutterApiImpl, @@ -60,6 +63,9 @@ class AndroidCameraXCameraFlutterApis { this.cameraFlutterApiImpl = cameraFlutterApiImpl ?? CameraFlutterApiImpl(); this.systemServicesFlutterApiImpl = systemServicesFlutterApiImpl ?? SystemServicesFlutterApiImpl(); + this.deviceOrientationManagerFlutterApiImpl = + deviceOrientationManagerFlutterApiImpl ?? + DeviceOrientationManagerFlutterApiImpl(); this.cameraStateErrorFlutterApiImpl = cameraStateErrorFlutterApiImpl ?? CameraStateErrorFlutterApiImpl(); this.cameraStateFlutterApiImpl = @@ -117,6 +123,10 @@ class AndroidCameraXCameraFlutterApis { /// Flutter Api implementation for [SystemServices]. late final SystemServicesFlutterApiImpl systemServicesFlutterApiImpl; + /// Flutter Api implementation for [DeviceOrientationManager]. + late final DeviceOrientationManagerFlutterApiImpl + deviceOrientationManagerFlutterApiImpl; + /// Flutter Api implementation for [CameraStateError]. late final CameraStateErrorFlutterApiImpl? cameraStateErrorFlutterApiImpl; @@ -169,6 +179,7 @@ class AndroidCameraXCameraFlutterApis { processCameraProviderFlutterApiImpl); CameraFlutterApi.setup(cameraFlutterApiImpl); SystemServicesFlutterApi.setup(systemServicesFlutterApiImpl); + DeviceOrientationManagerFlutterApi.setup(deviceOrientationManagerFlutterApiImpl); CameraStateErrorFlutterApi.setup(cameraStateErrorFlutterApiImpl); CameraStateFlutterApi.setup(cameraStateFlutterApiImpl); PendingRecordingFlutterApi.setup(pendingRecordingFlutterApiImpl); 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 2569b1a952d..156b84290ed 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,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', @@ -283,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, @@ -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,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, @@ -442,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, @@ -469,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', @@ -487,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', @@ -521,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, @@ -532,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, @@ -560,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', @@ -584,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?; @@ -610,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', @@ -647,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', @@ -674,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', @@ -720,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, @@ -731,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, @@ -824,7 +814,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, @@ -852,7 +842,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); @@ -870,11 +860,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?; @@ -894,15 +882,78 @@ class SystemServicesHostApi { } } - Future startListeningForDeviceOrientationChange( - bool arg_isFrontFacing, int arg_sensorOrientation) async { + Future getTempFilePath(String arg_prefix, String arg_suffix) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.SystemServicesHostApi.startListeningForDeviceOrientationChange', - codec, + 'dev.flutter.pigeon.SystemServicesHostApi.getTempFilePath', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_isFrontFacing, arg_sensorOrientation]) - as List?; + await channel.send([arg_prefix, arg_suffix]) 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 if (replyList[0] == null) { + throw PlatformException( + code: 'null-error', + message: 'Host platform returned null value for non-null return value.', + ); + } else { + return (replyList[0] as String?)!; + } + } +} + +abstract class SystemServicesFlutterApi { + static const MessageCodec codec = StandardMessageCodec(); + + void onCameraError(String errorDescription); + + static void setup(SystemServicesFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.SystemServicesFlutterApi.onCameraError', codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != 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, + 'Argument for dev.flutter.pigeon.SystemServicesFlutterApi.onCameraError was null, expected non-null String.'); + api.onCameraError(arg_errorDescription!); + return; + }); + } + } + } +} + +class DeviceOrientationManagerHostApi { + /// Constructor for [DeviceOrientationManagerHostApi]. 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. + DeviceOrientationManagerHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; + final BinaryMessenger? _binaryMessenger; + + static const MessageCodec codec = StandardMessageCodec(); + + Future startListeningForDeviceOrientationChange(bool arg_isFrontFacing, int arg_sensorOrientation) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.startListeningForDeviceOrientationChange', codec, + binaryMessenger: _binaryMessenger); + final List? replyList = + await channel.send([arg_isFrontFacing, arg_sensorOrientation]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -921,10 +972,10 @@ class SystemServicesHostApi { Future stopListeningForDeviceOrientationChange() async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.SystemServicesHostApi.stopListeningForDeviceOrientationChange', - codec, + 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.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', @@ -941,12 +992,12 @@ class SystemServicesHostApi { } } - Future getTempFilePath(String arg_prefix, String arg_suffix) async { + Future getPhotoOrientation() async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.SystemServicesHostApi.getTempFilePath', codec, + 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.getPhotoOrientation', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_prefix, arg_suffix]) as List?; + await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -964,59 +1015,63 @@ class SystemServicesHostApi { message: 'Host platform returned null value for non-null return value.', ); } else { - return (replyList[0] as String?)!; + return (replyList[0] as int?)!; + } + } + + Future getVideoOrientation() async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.getVideoOrientation', codec, + binaryMessenger: _binaryMessenger); + final List? replyList = + await channel.send(null) 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 if (replyList[0] == null) { + throw PlatformException( + code: 'null-error', + message: 'Host platform returned null value for non-null return value.', + ); + } else { + return (replyList[0] as int?)!; } } } -abstract class SystemServicesFlutterApi { +abstract class DeviceOrientationManagerFlutterApi { static const MessageCodec codec = StandardMessageCodec(); void onDeviceOrientationChanged(String orientation); - void onCameraError(String errorDescription); - - static void setup(SystemServicesFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(DeviceOrientationManagerFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.SystemServicesFlutterApi.onDeviceOrientationChanged', - codec, + 'dev.flutter.pigeon.DeviceOrientationManagerFlutterApi.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.DeviceOrientationManagerFlutterApi.onDeviceOrientationChanged was null.'); final List args = (message as List?)!; final String? arg_orientation = (args[0] as String?); assert(arg_orientation != null, - 'Argument for dev.flutter.pigeon.SystemServicesFlutterApi.onDeviceOrientationChanged was null, expected non-null String.'); + 'Argument for dev.flutter.pigeon.DeviceOrientationManagerFlutterApi.onDeviceOrientationChanged was null, expected non-null String.'); api.onDeviceOrientationChanged(arg_orientation!); return; }); } } - { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.SystemServicesFlutterApi.onCameraError', codec, - binaryMessenger: binaryMessenger); - if (api == null) { - channel.setMessageHandler(null); - } else { - channel.setMessageHandler((Object? message) async { - assert(message != 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, - 'Argument for dev.flutter.pigeon.SystemServicesFlutterApi.onCameraError was null, expected non-null String.'); - api.onCameraError(arg_errorDescription!); - return; - }); - } - } } } @@ -1035,7 +1090,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); @@ -1053,14 +1108,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', @@ -1108,7 +1161,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', @@ -1156,8 +1210,8 @@ class PreviewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PreviewHostApi.setTargetRotation', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_rotation]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_rotation]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1243,8 +1297,8 @@ class VideoCaptureHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.VideoCaptureHostApi.setTargetRotation', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_rotation]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_rotation]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1267,8 +1321,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, @@ -1278,7 +1331,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, @@ -1301,17 +1354,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', @@ -1357,8 +1405,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?; @@ -1387,8 +1434,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', @@ -1416,8 +1463,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, @@ -1427,7 +1473,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, @@ -1485,8 +1531,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, @@ -1496,7 +1541,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, @@ -1613,8 +1658,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, @@ -1624,7 +1668,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, @@ -1647,17 +1691,12 @@ class ImageCaptureHostApi { static const MessageCodec codec = StandardMessageCodec(); - Future create(int arg_identifier, int? arg_targetRotation, - int? arg_flashMode, int? arg_resolutionSelectorId) async { + Future create(int arg_identifier, int? arg_targetRotation, 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_targetRotation, - arg_flashMode, - arg_resolutionSelectorId - ]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_targetRotation, arg_flashMode, arg_resolutionSelectorId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1678,8 +1717,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', @@ -1727,8 +1766,8 @@ class ImageCaptureHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ImageCaptureHostApi.setTargetRotation', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_rotation]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_rotation]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1761,7 +1800,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); @@ -1779,14 +1818,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', @@ -1814,16 +1851,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', @@ -1851,16 +1884,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', @@ -1893,7 +1922,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); @@ -1906,8 +1935,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, @@ -1917,13 +1945,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?); @@ -1950,7 +1977,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); @@ -1961,13 +1988,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, @@ -1977,20 +2000,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; }); } @@ -2003,8 +2024,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, @@ -2014,7 +2034,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, @@ -2043,16 +2063,12 @@ class ImageAnalysisHostApi { static const MessageCodec codec = StandardMessageCodec(); - Future create(int arg_identifier, int? arg_targetRotation, - int? arg_resolutionSelectorId) async { + Future create(int arg_identifier, int? arg_targetRotation, 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_targetRotation, - arg_resolutionSelectorId - ]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_targetRotation, arg_resolutionSelectorId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2069,14 +2085,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', @@ -2119,8 +2133,8 @@ class ImageAnalysisHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ImageAnalysisHostApi.setTargetRotation', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_rotation]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_rotation]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2209,8 +2223,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, @@ -2220,7 +2233,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, @@ -2241,8 +2254,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, @@ -2252,7 +2264,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, @@ -2283,7 +2295,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); @@ -2306,8 +2318,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', @@ -2346,13 +2357,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', @@ -2385,7 +2395,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); @@ -2398,8 +2408,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, @@ -2409,13 +2418,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!); @@ -2433,8 +2441,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, @@ -2444,7 +2451,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, @@ -2463,7 +2470,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, @@ -2544,8 +2551,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, @@ -2555,7 +2561,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, @@ -2582,8 +2588,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, @@ -2593,7 +2598,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, @@ -2607,8 +2612,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; }); } @@ -2634,9 +2638,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); @@ -2654,18 +2658,12 @@ 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', @@ -2682,13 +2680,12 @@ 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', @@ -2721,16 +2718,12 @@ 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', @@ -2762,8 +2755,8 @@ class CameraControlHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraControlHostApi.enableTorch', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_torch]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_torch]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2784,8 +2777,8 @@ class CameraControlHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraControlHostApi.setZoomRatio', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_ratio]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_ratio]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2808,8 +2801,7 @@ abstract class CameraControlFlutterApi { void create(int identifier); - static void setup(CameraControlFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(CameraControlFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraControlFlutterApi.create', codec, @@ -2819,7 +2811,7 @@ abstract class CameraControlFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraControlFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.CameraControlFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, diff --git a/packages/camera/camera_android_camerax/lib/src/system_services.dart b/packages/camera/camera_android_camerax/lib/src/system_services.dart index af42508cde2..b75a1cb9803 100644 --- a/packages/camera/camera_android_camerax/lib/src/system_services.dart +++ b/packages/camera/camera_android_camerax/lib/src/system_services.dart @@ -5,10 +5,9 @@ import 'dart:async'; import 'package:camera_platform_interface/camera_platform_interface.dart' - show CameraException, DeviceOrientationChangedEvent; + show CameraException; import 'package:flutter/services.dart'; -import 'android_camera_camerax_flutter_api_impls.dart'; import 'camerax_library.g.dart'; // Ignoring lint indicating this class only contains static members @@ -18,18 +17,6 @@ import 'camerax_library.g.dart'; /// Utility class that offers access to Android system services needed for /// camera usage and other informational streams. class SystemServices { - /// Stream that emits the device orientation whenever it is changed. - /// - /// Values may start being added to the stream once - /// `startListeningForDeviceOrientationChange(...)` is called. - static final StreamController - deviceOrientationChangedStreamController = - StreamController.broadcast(); - - /// The last [DeviceOrientation] picked up by - /// [deviceOrientationChangedStreamController]. - static DeviceOrientation? lastRecordedDeviceOrientation; - /// Stream that emits the errors caused by camera usage on the native side. static final StreamController cameraErrorStreamController = StreamController.broadcast(); @@ -43,29 +30,6 @@ class SystemServices { return api.sendCameraPermissionsRequest(enableAudio); } - /// Requests that [deviceOrientationChangedStreamController] start - /// emitting values for any change in device orientation. - static void startListeningForDeviceOrientationChange( - bool isFrontFacing, int sensorOrientation, - {BinaryMessenger? binaryMessenger}) { - AndroidCameraXCameraFlutterApis.instance.ensureSetUp(); - final SystemServicesHostApi api = - SystemServicesHostApi(binaryMessenger: binaryMessenger); - - api.startListeningForDeviceOrientationChange( - isFrontFacing, sensorOrientation); - } - - /// Stops the [deviceOrientationChangedStreamController] from emitting values - /// for changes in device orientation. - static void stopListeningForDeviceOrientationChange( - {BinaryMessenger? binaryMessenger}) { - final SystemServicesHostApi api = - SystemServicesHostApi(binaryMessenger: binaryMessenger); - - api.stopListeningForDeviceOrientationChange(); - } - /// Returns a file path which was used to create a temporary file. /// Prefix is a part of the file name, and suffix is the file extension. /// @@ -120,38 +84,6 @@ class SystemServicesFlutterApiImpl implements SystemServicesFlutterApi { /// Constructs an [SystemServicesFlutterApiImpl]. SystemServicesFlutterApiImpl(); - /// Callback method for any changes in device orientation. - /// - /// Will only be called if - /// `SystemServices.startListeningForDeviceOrientationChange(...)` was called - /// to start listening for device orientation updates. - @override - void onDeviceOrientationChanged(String orientation) { - final DeviceOrientation deviceOrientation = - deserializeDeviceOrientation(orientation); - SystemServices.deviceOrientationChangedStreamController - .add(DeviceOrientationChangedEvent(deviceOrientation)); - SystemServices.lastRecordedDeviceOrientation = deviceOrientation; - } - - /// Deserializes device orientation in [String] format into a - /// [DeviceOrientation]. - DeviceOrientation deserializeDeviceOrientation(String orientation) { - switch (orientation) { - case 'LANDSCAPE_LEFT': - return DeviceOrientation.landscapeLeft; - case 'LANDSCAPE_RIGHT': - return DeviceOrientation.landscapeRight; - case 'PORTRAIT_DOWN': - return DeviceOrientation.portraitDown; - case 'PORTRAIT_UP': - return DeviceOrientation.portraitUp; - default: - throw ArgumentError( - '"$orientation" is not a valid DeviceOrientation value'); - } - } - /// Callback method for any errors caused by camera usage on the Java side. @override void onCameraError(String errorDescription) { diff --git a/packages/camera/camera_android_camerax/pigeons/camerax_library.dart b/packages/camera/camera_android_camerax/pigeons/camerax_library.dart index de691b7d650..ff2ad45ee52 100644 --- a/packages/camera/camera_android_camerax/pigeons/camerax_library.dart +++ b/packages/camera/camera_android_camerax/pigeons/camerax_library.dart @@ -211,19 +211,29 @@ abstract class SystemServicesHostApi { @async CameraPermissionsErrorData? requestCameraPermissions(bool enableAudio); + String getTempFilePath(String prefix, String suffix); +} + +@FlutterApi() +abstract class SystemServicesFlutterApi { + void onCameraError(String errorDescription); +} + +@HostApi(dartHostTestHandler: 'TestDeviceOrientationManagerHostApi') +abstract class DeviceOrientationManagerHostApi { void startListeningForDeviceOrientationChange( bool isFrontFacing, int sensorOrientation); void stopListeningForDeviceOrientationChange(); - String getTempFilePath(String prefix, String suffix); + int getPhotoOrientation(); + + int getVideoOrientation(); } @FlutterApi() -abstract class SystemServicesFlutterApi { +abstract class DeviceOrientationManagerFlutterApi { void onDeviceOrientationChanged(String orientation); - - void onCameraError(String errorDescription); } @HostApi(dartHostTestHandler: 'TestPreviewHostApi') 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 aef0e1be5b0..b9989b256b9 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,29 +357,24 @@ 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); int getCameraControl(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, @@ -457,14 +389,11 @@ abstract class TestCameraHostApi { 'dev.flutter.pigeon.CameraHostApi.getCameraControl', 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.getCameraControl was null.'); + 'Argument for dev.flutter.pigeon.CameraHostApi.getCameraControl was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -492,7 +421,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); @@ -501,85 +430,101 @@ 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); - - void startListeningForDeviceOrientationChange( - bool isFrontFacing, int sensorOrientation); - - void stopListeningForDeviceOrientationChange(); + Future requestCameraPermissions(bool enableAudio); 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.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.startListeningForDeviceOrientationChange 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, + 'Argument for dev.flutter.pigeon.SystemServicesHostApi.getTempFilePath was null, expected non-null String.'); + final String? arg_suffix = (args[1] as String?); + assert(arg_suffix != null, + 'Argument for dev.flutter.pigeon.SystemServicesHostApi.getTempFilePath was null, expected non-null String.'); + final String output = api.getTempFilePath(arg_prefix!, arg_suffix!); + return [output]; + }); + } + } + } +} + +abstract class TestDeviceOrientationManagerHostApi { + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static const MessageCodec codec = StandardMessageCodec(); + + void startListeningForDeviceOrientationChange(bool isFrontFacing, int sensorOrientation); + + void stopListeningForDeviceOrientationChange(); + + int getPhotoOrientation(); + + int getVideoOrientation(); + + static void setup(TestDeviceOrientationManagerHostApi? api, {BinaryMessenger? binaryMessenger}) { + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.startListeningForDeviceOrientationChange', 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.DeviceOrientationManagerHostApi.startListeningForDeviceOrientationChange was null.'); final List args = (message as List?)!; final bool? arg_isFrontFacing = (args[0] as bool?); assert(arg_isFrontFacing != null, - 'Argument for dev.flutter.pigeon.SystemServicesHostApi.startListeningForDeviceOrientationChange was null, expected non-null bool.'); + 'Argument for dev.flutter.pigeon.DeviceOrientationManagerHostApi.startListeningForDeviceOrientationChange was null, expected non-null bool.'); 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!); + 'Argument for dev.flutter.pigeon.DeviceOrientationManagerHostApi.startListeningForDeviceOrientationChange was null, expected non-null int.'); + api.startListeningForDeviceOrientationChange(arg_isFrontFacing!, arg_sensorOrientation!); return []; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.SystemServicesHostApi.stopListeningForDeviceOrientationChange', - codec, + 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.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 []; @@ -588,25 +533,28 @@ abstract class TestSystemServicesHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.SystemServicesHostApi.getTempFilePath', codec, + 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.getPhotoOrientation', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { - assert(message != 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, - 'Argument for dev.flutter.pigeon.SystemServicesHostApi.getTempFilePath was null, expected non-null String.'); - final String? arg_suffix = (args[1] as String?); - assert(arg_suffix != null, - 'Argument for dev.flutter.pigeon.SystemServicesHostApi.getTempFilePath was null, expected non-null String.'); - final String output = api.getTempFilePath(arg_prefix!, arg_suffix!); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + // ignore message + final int output = api.getPhotoOrientation(); + return [output]; + }); + } + } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.getVideoOrientation', codec, + binaryMessenger: binaryMessenger); + if (api == null) { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + } else { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + // ignore message + final int output = api.getVideoOrientation(); return [output]; }); } @@ -629,7 +577,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); @@ -638,8 +586,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); @@ -652,21 +599,17 @@ abstract class TestPreviewHostApi { void setTargetRotation(int identifier, int rotation); - 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, @@ -683,14 +626,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, @@ -702,16 +642,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 []; @@ -723,14 +659,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, @@ -745,14 +678,11 @@ abstract class TestPreviewHostApi { 'dev.flutter.pigeon.PreviewHostApi.setTargetRotation', 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.setTargetRotation was null.'); + 'Argument for dev.flutter.pigeon.PreviewHostApi.setTargetRotation was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -769,8 +699,7 @@ 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); @@ -779,21 +708,17 @@ abstract class TestVideoCaptureHostApi { void setTargetRotation(int identifier, int rotation); - 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, @@ -808,14 +733,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, @@ -830,14 +752,11 @@ abstract class TestVideoCaptureHostApi { 'dev.flutter.pigeon.VideoCaptureHostApi.setTargetRotation', 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.setTargetRotation was null.'); + 'Argument for dev.flutter.pigeon.VideoCaptureHostApi.setTargetRotation was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -854,12 +773,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); @@ -867,21 +784,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, @@ -889,8 +802,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 []; }); } @@ -900,14 +812,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, @@ -919,18 +828,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, @@ -945,14 +850,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, @@ -969,27 +871,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, @@ -1003,8 +900,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); @@ -1015,21 +911,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, @@ -1044,14 +936,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, @@ -1066,14 +955,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, @@ -1088,14 +974,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, @@ -1109,12 +992,10 @@ 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? targetRotation, int? flashMode, - int? resolutionSelectorId); + void create(int identifier, int? targetRotation, int? flashMode, int? resolutionSelectorId); void setFlashMode(int identifier, int flashMode); @@ -1122,21 +1003,17 @@ abstract class TestImageCaptureHostApi { void setTargetRotation(int identifier, int rotation); - 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, @@ -1144,8 +1021,7 @@ abstract class TestImageCaptureHostApi { final int? arg_targetRotation = (args[1] as int?); final int? arg_flashMode = (args[2] as int?); final int? arg_resolutionSelectorId = (args[3] as int?); - api.create(arg_identifier!, arg_targetRotation, arg_flashMode, - arg_resolutionSelectorId); + api.create(arg_identifier!, arg_targetRotation, arg_flashMode, arg_resolutionSelectorId); return []; }); } @@ -1155,14 +1031,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, @@ -1180,14 +1053,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, @@ -1202,14 +1072,11 @@ abstract class TestImageCaptureHostApi { 'dev.flutter.pigeon.ImageCaptureHostApi.setTargetRotation', 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.setTargetRotation was null.'); + 'Argument for dev.flutter.pigeon.ImageCaptureHostApi.setTargetRotation was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1240,7 +1107,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); @@ -1249,28 +1116,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, @@ -1286,36 +1147,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 []; }); } @@ -1324,27 +1178,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, @@ -1355,8 +1204,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 []; }); } @@ -1365,8 +1213,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? targetRotation, int? resolutionSelectorId); @@ -1377,29 +1224,24 @@ abstract class TestImageAnalysisHostApi { void setTargetRotation(int identifier, int rotation); - 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, 'Argument for dev.flutter.pigeon.ImageAnalysisHostApi.create was null, expected non-null int.'); final int? arg_targetRotation = (args[1] as int?); final int? arg_resolutionSelectorId = (args[2] as int?); - api.create( - arg_identifier!, arg_targetRotation, arg_resolutionSelectorId); + api.create(arg_identifier!, arg_targetRotation, arg_resolutionSelectorId); return []; }); } @@ -1409,14 +1251,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, @@ -1434,14 +1273,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, @@ -1456,14 +1292,11 @@ abstract class TestImageAnalysisHostApi { 'dev.flutter.pigeon.ImageAnalysisHostApi.setTargetRotation', 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.setTargetRotation was null.'); + 'Argument for dev.flutter.pigeon.ImageAnalysisHostApi.setTargetRotation was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1480,27 +1313,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, @@ -1514,27 +1342,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, @@ -1562,7 +1385,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); @@ -1571,8 +1394,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); @@ -1581,21 +1403,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, @@ -1613,14 +1431,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, @@ -1635,20 +1450,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!); @@ -1660,29 +1471,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, @@ -1697,14 +1503,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, @@ -1735,9 +1538,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); @@ -1746,41 +1549,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 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 []; }); } @@ -1790,24 +1585,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 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]; }); } @@ -1816,39 +1606,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, 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!); @@ -1860,29 +1641,24 @@ abstract class TestFallbackStrategyHostApi { } abstract class TestCameraControlHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); Future enableTorch(int identifier, bool torch); Future setZoomRatio(int identifier, double ratio); - static void setup(TestCameraControlHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestCameraControlHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraControlHostApi.enableTorch', 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.CameraControlHostApi.enableTorch was null.'); + 'Argument for dev.flutter.pigeon.CameraControlHostApi.enableTorch was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1900,14 +1676,11 @@ abstract class TestCameraControlHostApi { 'dev.flutter.pigeon.CameraControlHostApi.setZoomRatio', 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.CameraControlHostApi.setZoomRatio was null.'); + 'Argument for dev.flutter.pigeon.CameraControlHostApi.setZoomRatio was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, From fd99476e1107cae25bd94b00c7132bb3b693f0b7 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Tue, 7 Nov 2023 15:28:27 -0800 Subject: [PATCH 06/29] Add new files --- ...eviceOrientationManagerFlutterApiImpl.java | 20 ++++ .../DeviceOrientationManagerHostApiImpl.java | 104 +++++++++++++++++ .../lib/src/device_orientation_manager.dart | 107 ++++++++++++++++++ 3 files changed, 231 insertions(+) create mode 100644 packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerFlutterApiImpl.java create mode 100644 packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerHostApiImpl.java create mode 100644 packages/camera/camera_android_camerax/lib/src/device_orientation_manager.dart diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerFlutterApiImpl.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerFlutterApiImpl.java new file mode 100644 index 00000000000..e3e514cfd78 --- /dev/null +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerFlutterApiImpl.java @@ -0,0 +1,20 @@ +// 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 io.flutter.plugin.common.BinaryMessenger; +import io.flutter.plugins.camerax.GeneratedCameraXLibrary.DeviceOrientationManagerFlutterApi; + +public class DeviceOrientationManagerFlutterApiImpl extends DeviceOrientationManagerFlutterApi { + public DeviceOrientationManagerFlutterApiImpl(@NonNull BinaryMessenger binaryMessenger) { + super(binaryMessenger); + } + + public void sendDeviceOrientationChangedEvent( + @NonNull String orientation, @NonNull Reply reply) { + super.onDeviceOrientationChanged(orientation, reply); + } +} diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerHostApiImpl.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerHostApiImpl.java new file mode 100644 index 00000000000..4fbaa609b1b --- /dev/null +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerHostApiImpl.java @@ -0,0 +1,104 @@ +// 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.app.Activity; +import android.content.Context; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.VisibleForTesting; +import io.flutter.embedding.engine.systemchannels.PlatformChannel.DeviceOrientation; +import io.flutter.plugin.common.BinaryMessenger; +import io.flutter.plugins.camerax.CameraPermissionsManager.PermissionsRegistry; +import io.flutter.plugins.camerax.GeneratedCameraXLibrary.CameraPermissionsErrorData; +import io.flutter.plugins.camerax.GeneratedCameraXLibrary.Result; +import io.flutter.plugins.camerax.GeneratedCameraXLibrary.DeviceOrientationManagerFlutterApi; +import io.flutter.plugins.camerax.GeneratedCameraXLibrary.DeviceOrientationManagerHostApi; +import java.io.File; +import java.io.IOException; + +public class DeviceOrientationManagerHostApiImpl implements DeviceOrientationManagerHostApi { + private final BinaryMessenger binaryMessenger; + private final InstanceManager instanceManager; + + @VisibleForTesting public @NonNull CameraXProxy cameraXProxy = new CameraXProxy(); + @VisibleForTesting public @Nullable DeviceOrientationManager deviceOrientationManager; + @VisibleForTesting public @NonNull DeviceOrientationManagerFlutterApiImpl deviceOrientationManagerFlutterApiImpl; + + private Activity activity; + private PermissionsRegistry permissionsRegistry; + + public DeviceOrientationManagerHostApiImpl( + @NonNull BinaryMessenger binaryMessenger, + @NonNull InstanceManager instanceManager) { + this.binaryMessenger = binaryMessenger; + this.instanceManager = instanceManager; + this.deviceOrientationManagerFlutterApiImpl = new DeviceOrientationManagerFlutterApiImpl(binaryMessenger); + } + + public void setActivity(@NonNull Activity activity) { + this.activity = activity; + } + + /** + * Starts listening for device orientation changes using an instance of a {@link + * DeviceOrientationManager}. + * + *

Whenever a change in device orientation is detected by the {@code DeviceOrientationManager}, + * the {@link SystemServicesFlutterApi} will be used to notify the Dart side. + */ + @Override + public void startListeningForDeviceOrientationChange( + @NonNull Boolean isFrontFacing, @NonNull Long sensorOrientation) { + deviceOrientationManager = + cameraXProxy.createDeviceOrientationManager( + activity, + isFrontFacing, + sensorOrientation.intValue(), + (DeviceOrientation newOrientation) -> { + deviceOrientationManagerFlutterApiImpl.sendDeviceOrientationChangedEvent( + serializeDeviceOrientation(newOrientation), reply -> {}); + }); + deviceOrientationManager.start(); + } + + /** Serializes {@code DeviceOrientation} into a String that the Dart side is able to recognize. */ + String serializeDeviceOrientation(DeviceOrientation orientation) { + return orientation.toString(); + } + + /** + * Tells the {@code deviceOrientationManager} to stop listening for orientation updates. + * + *

Has no effect if the {@code deviceOrientationManager} was never created to listen for device + * orientation updates. + */ + @Override + public void stopListeningForDeviceOrientationChange() { + if (deviceOrientationManager != null) { + deviceOrientationManager.stop(); + } + } + +/** todo */ +@Override +public @NonNull Long getPhotoOrientation() { + if (deviceOrientationManager == null) { + // TODO: throw exception + } + + return Long.valueOf(deviceOrientationManager.getPhotoOrientation()); +} + +/** todo */ +@Override +public @NonNull Long getVideoOrientation() { + if (deviceOrientationManager == null) { + // TODO: throw exception + } + + return Long.valueOf(deviceOrientationManager.getVideoOrientation()); +} +} diff --git a/packages/camera/camera_android_camerax/lib/src/device_orientation_manager.dart b/packages/camera/camera_android_camerax/lib/src/device_orientation_manager.dart new file mode 100644 index 00000000000..38f240a5389 --- /dev/null +++ b/packages/camera/camera_android_camerax/lib/src/device_orientation_manager.dart @@ -0,0 +1,107 @@ +// 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:async'; + +import 'package:camera_platform_interface/camera_platform_interface.dart' + show DeviceOrientationChangedEvent; +import 'package:flutter/services.dart'; + +import 'android_camera_camerax_flutter_api_impls.dart'; +import 'camerax_library.g.dart'; + +// Ignoring lint indicating this class only contains static members +// as this class is a wrapper for various Android system services. +// ignore_for_file: avoid_classes_with_only_static_members + +/// Utility class that offers access to Android system services needed for +/// camera usage and other informational streams. +class DeviceOrientationManager { + /// Stream that emits the device orientation whenever it is changed. + /// + /// Values may start being added to the stream once + /// `startListeningForDeviceOrientationChange(...)` is called. + static final StreamController + deviceOrientationChangedStreamController = + StreamController.broadcast(); + + /// Requests that [deviceOrientationChangedStreamController] start + /// emitting values for any change in device orientation. + static void startListeningForDeviceOrientationChange( + bool isFrontFacing, int sensorOrientation, + {BinaryMessenger? binaryMessenger}) { + AndroidCameraXCameraFlutterApis.instance.ensureSetUp(); + final DeviceOrientationManagerHostApi api = + DeviceOrientationManagerHostApi(binaryMessenger: binaryMessenger); + + api.startListeningForDeviceOrientationChange( + isFrontFacing, sensorOrientation); + } + + /// Stops the [deviceOrientationChangedStreamController] from emitting values + /// for changes in device orientation. + static void stopListeningForDeviceOrientationChange( + {BinaryMessenger? binaryMessenger}) { + final DeviceOrientationManagerHostApi api = + DeviceOrientationManagerHostApi(binaryMessenger: binaryMessenger); + + api.stopListeningForDeviceOrientationChange(); + } + + /// Retrieves photo orientation. + static Future getPhotoOrientation( + {BinaryMessenger? binaryMessenger}) async { + final DeviceOrientationManagerHostApi api = + DeviceOrientationManagerHostApi(binaryMessenger: binaryMessenger); + + return api.getPhotoOrientation(); + } + + /// Retrieves video orientation. + static Future getVideoOrientation( + {BinaryMessenger? binaryMessenger}) async { + final DeviceOrientationManagerHostApi api = + DeviceOrientationManagerHostApi(binaryMessenger: binaryMessenger); + + return api.getPhotoOrientation(); + } +} + +/// Flutter API implementation of [DeviceOrientationManager]. +class DeviceOrientationManagerFlutterApiImpl + implements DeviceOrientationManagerFlutterApi { + /// Constructs an [DeviceOrientationManagerFlutterApiImpl]. + DeviceOrientationManagerFlutterApiImpl(); + + /// Callback method for any changes in device orientation. + /// + /// Will only be called if + /// `DeviceOrientationManager.startListeningForDeviceOrientationChange(...)` was called + /// to start listening for device orientation updates. + @override + void onDeviceOrientationChanged(String orientation) { + final DeviceOrientation deviceOrientation = + deserializeDeviceOrientation(orientation); + DeviceOrientationManager.deviceOrientationChangedStreamController + .add(DeviceOrientationChangedEvent(deviceOrientation)); + } + + /// Deserializes device orientation in [String] format into a + /// [DeviceOrientation]. + DeviceOrientation deserializeDeviceOrientation(String orientation) { + switch (orientation) { + case 'LANDSCAPE_LEFT': + return DeviceOrientation.landscapeLeft; + case 'LANDSCAPE_RIGHT': + return DeviceOrientation.landscapeRight; + case 'PORTRAIT_DOWN': + return DeviceOrientation.portraitDown; + case 'PORTRAIT_UP': + return DeviceOrientation.portraitUp; + default: + throw ArgumentError( + '"$orientation" is not a valid DeviceOrientation value'); + } + } +} From 03efa2f6c21d1777a2c57e138937e3458217b388 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Tue, 7 Nov 2023 15:51:34 -0800 Subject: [PATCH 07/29] Correct old dart tests --- .../test/android_camera_camerax_test.dart | 4 +- .../android_camera_camerax_test.mocks.dart | 59 +++++++----- .../test/device_orientation_manager_test.dart | 67 ++++++++++++++ ...device_orientation_manager_test.mocks.dart | 90 +++++++++++++++++++ .../test/image_analysis_test.dart | 21 +++++ .../test/image_analysis_test.mocks.dart | 17 ++++ .../test/image_capture_test.dart | 7 +- .../test/image_capture_test.mocks.dart | 17 ++++ .../test/preview_test.mocks.dart | 15 ++++ .../test/system_services_test.dart | 42 +-------- .../test/system_services_test.mocks.dart | 23 ----- .../test/video_capture_test.mocks.dart | 15 ++++ 12 files changed, 288 insertions(+), 89 deletions(-) create mode 100644 packages/camera/camera_android_camerax/test/device_orientation_manager_test.dart create mode 100644 packages/camera/camera_android_camerax/test/device_orientation_manager_test.mocks.dart 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 34e1c370b27..2a8ba8276d0 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_selector.dart'; 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/device_orientation_manager.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'; @@ -611,7 +612,8 @@ void main() { const DeviceOrientationChangedEvent testEvent = DeviceOrientationChangedEvent(DeviceOrientation.portraitDown); - SystemServices.deviceOrientationChangedStreamController.add(testEvent); + DeviceOrientationManager.deviceOrientationChangedStreamController + .add(testEvent); expect(await streamQueue.next, testEvent); await streamQueue.cancel(); 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 4fae31e0639..ea2f4450b6f 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 @@ -484,6 +484,15 @@ class MockImageAnalysis extends _i1.Mock implements _i19.ImageAnalysis { returnValue: _i15.Future.value(), returnValueForMissingStub: _i15.Future.value(), ) as _i15.Future); + @override + _i15.Future setTargetRotation(int? rotation) => (super.noSuchMethod( + Invocation.method( + #setTargetRotation, + [rotation], + ), + returnValue: _i15.Future.value(), + returnValueForMissingStub: _i15.Future.value(), + ) as _i15.Future); } /// A class which mocks [ImageCapture]. @@ -509,6 +518,15 @@ class MockImageCapture extends _i1.Mock implements _i21.ImageCapture { returnValue: _i15.Future.value(''), returnValueForMissingStub: _i15.Future.value(''), ) as _i15.Future); + @override + _i15.Future setTargetRotation(int? rotation) => (super.noSuchMethod( + Invocation.method( + #setTargetRotation, + [rotation], + ), + returnValue: _i15.Future.value(), + returnValueForMissingStub: _i15.Future.value(), + ) as _i15.Future); } /// A class which mocks [ImageProxy]. @@ -626,6 +644,15 @@ class MockPreview extends _i1.Mock implements _i25.Preview { ), )), ) as _i15.Future<_i7.ResolutionInfo>); + @override + _i15.Future setTargetRotation(int? rotation) => (super.noSuchMethod( + Invocation.method( + #setTargetRotation, + [rotation], + ), + returnValue: _i15.Future.value(), + returnValueForMissingStub: _i15.Future.value(), + ) as _i15.Future); } /// A class which mocks [ProcessCameraProvider]. @@ -837,6 +864,15 @@ class MockVideoCapture extends _i1.Mock implements _i28.VideoCapture { ), )), ) as _i15.Future<_i11.Recorder>); + @override + _i15.Future setTargetRotation(int? rotation) => (super.noSuchMethod( + Invocation.method( + #setTargetRotation, + [rotation], + ), + returnValue: _i15.Future.value(), + returnValueForMissingStub: _i15.Future.value(), + ) as _i15.Future); } /// A class which mocks [BuildContext]. @@ -1046,29 +1082,6 @@ class MockTestSystemServicesHostApi extends _i1.Mock _i15.Future<_i7.CameraPermissionsErrorData?>.value(), ) as _i15.Future<_i7.CameraPermissionsErrorData?>); @override - void startListeningForDeviceOrientationChange( - bool? isFrontFacing, - int? sensorOrientation, - ) => - super.noSuchMethod( - Invocation.method( - #startListeningForDeviceOrientationChange, - [ - isFrontFacing, - sensorOrientation, - ], - ), - returnValueForMissingStub: null, - ); - @override - void stopListeningForDeviceOrientationChange() => super.noSuchMethod( - Invocation.method( - #stopListeningForDeviceOrientationChange, - [], - ), - returnValueForMissingStub: null, - ); - @override String getTempFilePath( String? prefix, String? suffix, diff --git a/packages/camera/camera_android_camerax/test/device_orientation_manager_test.dart b/packages/camera/camera_android_camerax/test/device_orientation_manager_test.dart new file mode 100644 index 00000000000..57da80025e4 --- /dev/null +++ b/packages/camera/camera_android_camerax/test/device_orientation_manager_test.dart @@ -0,0 +1,67 @@ +// 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/device_orientation_manager.dart'; +import 'package:camera_platform_interface/camera_platform_interface.dart' + show DeviceOrientationChangedEvent; +import 'package:flutter/services.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:mockito/annotations.dart'; +import 'package:mockito/mockito.dart'; + +import 'device_orientation_manager_test.mocks.dart'; +import 'test_camerax_library.g.dart'; + +@GenerateMocks( + [TestInstanceManagerHostApi, TestDeviceOrientationManagerHostApi]) +void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + + // Mocks the call to clear the native InstanceManager. + TestInstanceManagerHostApi.setup(MockTestInstanceManagerHostApi()); + + group('DeviceOrientationManager', () { + tearDown(() => TestProcessCameraProviderHostApi.setup(null)); + + test('startListeningForDeviceOrientationChangeTest', () async { + final MockTestDeviceOrientationManagerHostApi mockApi = + MockTestDeviceOrientationManagerHostApi(); + TestDeviceOrientationManagerHostApi.setup(mockApi); + + DeviceOrientationManager.startListeningForDeviceOrientationChange( + true, 90); + verify(mockApi.startListeningForDeviceOrientationChange(true, 90)); + }); + + test('stopListeningForDeviceOrientationChangeTest', () async { + final MockTestDeviceOrientationManagerHostApi mockApi = + MockTestDeviceOrientationManagerHostApi(); + TestDeviceOrientationManagerHostApi.setup(mockApi); + + DeviceOrientationManager.stopListeningForDeviceOrientationChange(); + verify(mockApi.stopListeningForDeviceOrientationChange()); + }); + + test('onDeviceOrientationChanged adds new orientation to stream', () { + DeviceOrientationManager.deviceOrientationChangedStreamController.stream + .listen((DeviceOrientationChangedEvent event) { + expect(event.orientation, equals(DeviceOrientation.landscapeLeft)); + }); + DeviceOrientationManagerFlutterApiImpl() + .onDeviceOrientationChanged('LANDSCAPE_LEFT'); + }); + + test( + 'onDeviceOrientationChanged throws error if new orientation is invalid', + () { + expect( + () => DeviceOrientationManagerFlutterApiImpl() + .onDeviceOrientationChanged('FAKE_ORIENTATION'), + throwsA(isA().having( + (ArgumentError e) => e.message, + 'message', + '"FAKE_ORIENTATION" is not a valid DeviceOrientation value'))); + }); + }); +} diff --git a/packages/camera/camera_android_camerax/test/device_orientation_manager_test.mocks.dart b/packages/camera/camera_android_camerax/test/device_orientation_manager_test.mocks.dart new file mode 100644 index 00000000000..533d83e3685 --- /dev/null +++ b/packages/camera/camera_android_camerax/test/device_orientation_manager_test.mocks.dart @@ -0,0 +1,90 @@ +// Mocks generated by Mockito 5.4.1 from annotations +// in camera_android_camerax/test/device_orientation_manager_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; + +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 [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, + ); +} + +/// A class which mocks [TestDeviceOrientationManagerHostApi]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockTestDeviceOrientationManagerHostApi extends _i1.Mock + implements _i2.TestDeviceOrientationManagerHostApi { + MockTestDeviceOrientationManagerHostApi() { + _i1.throwOnMissingStub(this); + } + + @override + void startListeningForDeviceOrientationChange( + bool? isFrontFacing, + int? sensorOrientation, + ) => + super.noSuchMethod( + Invocation.method( + #startListeningForDeviceOrientationChange, + [ + isFrontFacing, + sensorOrientation, + ], + ), + returnValueForMissingStub: null, + ); + @override + void stopListeningForDeviceOrientationChange() => super.noSuchMethod( + Invocation.method( + #stopListeningForDeviceOrientationChange, + [], + ), + returnValueForMissingStub: null, + ); + @override + int getPhotoOrientation() => (super.noSuchMethod( + Invocation.method( + #getPhotoOrientation, + [], + ), + returnValue: 0, + ) as int); + @override + int getVideoOrientation() => (super.noSuchMethod( + Invocation.method( + #getVideoOrientation, + [], + ), + returnValue: 0, + ) as int); +} 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 80acd655982..6e0b99efa6d 100644 --- a/packages/camera/camera_android_camerax/test/image_analysis_test.dart +++ b/packages/camera/camera_android_camerax/test/image_analysis_test.dart @@ -30,6 +30,24 @@ void main() { TestImageAnalysisHostApi.setup(null); }); + test('detached create does not call create on the Java side', () { + final MockTestImageAnalysisHostApi mockApi = + MockTestImageAnalysisHostApi(); + TestImageAnalysisHostApi.setup(mockApi); + + final InstanceManager instanceManager = InstanceManager( + onWeakReferenceRemoved: (_) {}, + ); + + ImageAnalysis.detached( + targetRotation: 270, + resolutionSelector: MockResolutionSelector(), + instanceManager: instanceManager, + ); + + verifyNever(mockApi.create(argThat(isA()), argThat(isA()), + argThat(isA()))); + }); test('create calls create on the Java side', () { final MockTestImageAnalysisHostApi mockApi = MockTestImageAnalysisHostApi(); @@ -39,6 +57,7 @@ void main() { onWeakReferenceRemoved: (_) {}, ); + const int targetRotation = 90; final MockResolutionSelector mockResolutionSelector = MockResolutionSelector(); const int mockResolutionSelectorId = 24; @@ -50,12 +69,14 @@ void main() { }); final ImageAnalysis instance = ImageAnalysis( + targetRotation: targetRotation, resolutionSelector: mockResolutionSelector, instanceManager: instanceManager, ); verify(mockApi.create( argThat(equals(instanceManager.getIdentifier(instance))), + argThat(equals(targetRotation)), argThat(equals(mockResolutionSelectorId)))); }); 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 b0df5790b2c..f700a5b77c9 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 @@ -33,6 +33,7 @@ class MockTestImageAnalysisHostApi extends _i1.Mock @override void create( int? identifier, + int? targetRotation, int? resolutionSelectorId, ) => super.noSuchMethod( @@ -40,6 +41,7 @@ class MockTestImageAnalysisHostApi extends _i1.Mock #create, [ identifier, + targetRotation, resolutionSelectorId, ], ), @@ -68,6 +70,21 @@ class MockTestImageAnalysisHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override + void setTargetRotation( + int? identifier, + int? rotation, + ) => + super.noSuchMethod( + Invocation.method( + #setTargetRotation, + [ + identifier, + rotation, + ], + ), + returnValueForMissingStub: null, + ); } /// A class which mocks [TestInstanceManagerHostApi]. 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 c50314ed3cb..6760e4fee0e 100644 --- a/packages/camera/camera_android_camerax/test/image_capture_test.dart +++ b/packages/camera/camera_android_camerax/test/image_capture_test.dart @@ -35,12 +35,13 @@ void main() { ); ImageCapture.detached( instanceManager: instanceManager, + targetRotation: 180, targetFlashMode: ImageCapture.flashModeOn, resolutionSelector: MockResolutionSelector(), ); verifyNever(mockApi.create(argThat(isA()), argThat(isA()), - argThat(isA()))); + argThat(isA()), argThat(isA()))); }); test('create calls create on the Java side', () async { @@ -50,6 +51,8 @@ void main() { final InstanceManager instanceManager = InstanceManager( onWeakReferenceRemoved: (_) {}, ); + + const int targetRotation = 270; const int targetFlashMode = ImageCapture.flashModeAuto; final MockResolutionSelector mockResolutionSelector = MockResolutionSelector(); @@ -63,12 +66,14 @@ void main() { ImageCapture( instanceManager: instanceManager, + targetRotation: targetRotation, targetFlashMode: targetFlashMode, resolutionSelector: mockResolutionSelector, ); verify(mockApi.create( argThat(isA()), + argThat(equals(targetRotation)), argThat(equals(targetFlashMode)), argThat(equals(mockResolutionSelectorId)))); }); 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 44331c92cff..7ee2016f1f8 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 @@ -35,6 +35,7 @@ class MockTestImageCaptureHostApi extends _i1.Mock @override void create( int? identifier, + int? targetRotation, int? flashMode, int? resolutionSelectorId, ) => @@ -43,6 +44,7 @@ class MockTestImageCaptureHostApi extends _i1.Mock #create, [ identifier, + targetRotation, flashMode, resolutionSelectorId, ], @@ -72,6 +74,21 @@ class MockTestImageCaptureHostApi extends _i1.Mock ), returnValue: _i3.Future.value(''), ) as _i3.Future); + @override + void setTargetRotation( + int? identifier, + int? rotation, + ) => + super.noSuchMethod( + Invocation.method( + #setTargetRotation, + [ + identifier, + rotation, + ], + ), + returnValueForMissingStub: null, + ); } /// A class which mocks [TestInstanceManagerHostApi]. 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 d56e682ac68..1a735191aeb 100644 --- a/packages/camera/camera_android_camerax/test/preview_test.mocks.dart +++ b/packages/camera/camera_android_camerax/test/preview_test.mocks.dart @@ -108,6 +108,21 @@ class MockTestPreviewHostApi extends _i1.Mock ), ), ) as _i2.ResolutionInfo); + @override + void setTargetRotation( + int? identifier, + int? rotation, + ) => + super.noSuchMethod( + Invocation.method( + #setTargetRotation, + [ + identifier, + rotation, + ], + ), + returnValueForMissingStub: null, + ); } /// A class which mocks [ResolutionSelector]. diff --git a/packages/camera/camera_android_camerax/test/system_services_test.dart b/packages/camera/camera_android_camerax/test/system_services_test.dart index 414097b6015..030f9aee5b2 100644 --- a/packages/camera/camera_android_camerax/test/system_services_test.dart +++ b/packages/camera/camera_android_camerax/test/system_services_test.dart @@ -6,8 +6,7 @@ import 'package:camera_android_camerax/src/camerax_library.g.dart' show CameraPermissionsErrorData; import 'package:camera_android_camerax/src/system_services.dart'; import 'package:camera_platform_interface/camera_platform_interface.dart' - show CameraException, DeviceOrientationChangedEvent; -import 'package:flutter/services.dart'; + show CameraException; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; @@ -62,45 +61,6 @@ void main() { verify(mockApi.requestCameraPermissions(true)); }); - test('startListeningForDeviceOrientationChangeTest', () async { - final MockTestSystemServicesHostApi mockApi = - MockTestSystemServicesHostApi(); - TestSystemServicesHostApi.setup(mockApi); - - SystemServices.startListeningForDeviceOrientationChange(true, 90); - verify(mockApi.startListeningForDeviceOrientationChange(true, 90)); - }); - - test('stopListeningForDeviceOrientationChangeTest', () async { - final MockTestSystemServicesHostApi mockApi = - MockTestSystemServicesHostApi(); - TestSystemServicesHostApi.setup(mockApi); - - SystemServices.stopListeningForDeviceOrientationChange(); - verify(mockApi.stopListeningForDeviceOrientationChange()); - }); - - test('onDeviceOrientationChanged adds new orientation to stream', () { - SystemServices.deviceOrientationChangedStreamController.stream - .listen((DeviceOrientationChangedEvent event) { - expect(event.orientation, equals(DeviceOrientation.landscapeLeft)); - }); - SystemServicesFlutterApiImpl() - .onDeviceOrientationChanged('LANDSCAPE_LEFT'); - }); - - test( - 'onDeviceOrientationChanged throws error if new orientation is invalid', - () { - expect( - () => SystemServicesFlutterApiImpl() - .onDeviceOrientationChanged('FAKE_ORIENTATION'), - throwsA(isA().having( - (ArgumentError e) => e.message, - 'message', - '"FAKE_ORIENTATION" is not a valid DeviceOrientation value'))); - }); - test('onCameraError adds new error to stream', () { const String testErrorDescription = 'Test error description!'; SystemServices.cameraErrorStreamController.stream diff --git a/packages/camera/camera_android_camerax/test/system_services_test.mocks.dart b/packages/camera/camera_android_camerax/test/system_services_test.mocks.dart index 4955031de91..1aa4b738265 100644 --- a/packages/camera/camera_android_camerax/test/system_services_test.mocks.dart +++ b/packages/camera/camera_android_camerax/test/system_services_test.mocks.dart @@ -62,29 +62,6 @@ class MockTestSystemServicesHostApi extends _i1.Mock returnValue: _i3.Future<_i4.CameraPermissionsErrorData?>.value(), ) as _i3.Future<_i4.CameraPermissionsErrorData?>); @override - void startListeningForDeviceOrientationChange( - bool? isFrontFacing, - int? sensorOrientation, - ) => - super.noSuchMethod( - Invocation.method( - #startListeningForDeviceOrientationChange, - [ - isFrontFacing, - sensorOrientation, - ], - ), - returnValueForMissingStub: null, - ); - @override - void stopListeningForDeviceOrientationChange() => super.noSuchMethod( - Invocation.method( - #stopListeningForDeviceOrientationChange, - [], - ), - returnValueForMissingStub: null, - ); - @override String getTempFilePath( String? prefix, String? suffix, diff --git a/packages/camera/camera_android_camerax/test/video_capture_test.mocks.dart b/packages/camera/camera_android_camerax/test/video_capture_test.mocks.dart index 0a1034a62f9..6c4e1e8215f 100644 --- a/packages/camera/camera_android_camerax/test/video_capture_test.mocks.dart +++ b/packages/camera/camera_android_camerax/test/video_capture_test.mocks.dart @@ -60,6 +60,21 @@ class MockTestVideoCaptureHostApi extends _i1.Mock ), returnValue: 0, ) as int); + @override + void setTargetRotation( + int? identifier, + int? rotation, + ) => + super.noSuchMethod( + Invocation.method( + #setTargetRotation, + [ + identifier, + rotation, + ], + ), + returnValueForMissingStub: null, + ); } /// A class which mocks [TestInstanceManagerHostApi]. From b37dbbf08a9fa27e287160a72e765734271fc93b Mon Sep 17 00:00:00 2001 From: camsim99 Date: Tue, 7 Nov 2023 16:15:17 -0800 Subject: [PATCH 08/29] Add new wrapper tests --- .../lib/src/android_camera_camerax.dart | 11 ++---- .../lib/src/device_orientation_manager.dart | 2 +- .../lib/src/image_analysis.dart | 26 +++++++------- .../lib/src/image_capture.dart | 26 +++++++------- .../lib/src/preview.dart | 24 ++++++------- .../lib/src/video_capture.dart | 26 +++++++------- .../test/device_orientation_manager_test.dart | 34 +++++++++++++++++-- .../test/image_analysis_test.dart | 31 +++++++++++++++-- .../test/image_capture_test.dart | 30 ++++++++++++++-- .../test/preview_test.dart | 30 ++++++++++++++-- .../test/video_capture_test.dart | 26 ++++++++++++++ 11 files changed, 198 insertions(+), 68 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 7bb94e25059..1a3710f2dab 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 @@ -127,11 +127,6 @@ class AndroidCameraCameraX extends CameraPlatform { @visibleForTesting CameraSelector? cameraSelector; - /// The clockwise angle through which the output image needs to be rotated - /// to be upright on the device screen in its native orientation that is - /// initially set when [createCamera] is called. - int? initialSensorOrientation; - /// The controller we need to broadcast the different camera events. /// /// It is a `broadcast` because multiple controllers will connect to @@ -238,9 +233,8 @@ class AndroidCameraCameraX extends CameraPlatform { cameraSelectorLensDirection == CameraSelector.lensFacingFront; cameraSelector = createCameraSelector(cameraSelectorLensDirection); // Start listening for device orientation changes preceding camera creation. - initialSensorOrientation = cameraDescription.sensorOrientation; startListeningForDeviceOrientationChange( - cameraIsFrontFacing, initialSensorOrientation!); + cameraIsFrontFacing, cameraDescription.sensorOrientation!); // Determine ResolutionSelector and QualitySelector based on // resolutionPreset for camera UseCases. final ResolutionSelector? presetResolutionSelector = @@ -253,7 +247,8 @@ class AndroidCameraCameraX extends CameraPlatform { processCameraProvider!.unbindAll(); // Retrieve target rotation for UseCases. - final int targetRotation = _getTargetRotation(initialSensorOrientation!); + final int targetRotation = + _getTargetRotation(cameraDescription.sensorOrientation!); // Configure Preview instance. preview = createPreview( diff --git a/packages/camera/camera_android_camerax/lib/src/device_orientation_manager.dart b/packages/camera/camera_android_camerax/lib/src/device_orientation_manager.dart index 38f240a5389..3f2c5a21710 100644 --- a/packages/camera/camera_android_camerax/lib/src/device_orientation_manager.dart +++ b/packages/camera/camera_android_camerax/lib/src/device_orientation_manager.dart @@ -64,7 +64,7 @@ class DeviceOrientationManager { final DeviceOrientationManagerHostApi api = DeviceOrientationManagerHostApi(binaryMessenger: binaryMessenger); - return api.getPhotoOrientation(); + return api.getVideoOrientation(); } } 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 07d3abe3e98..5217ec65b5d 100644 --- a/packages/camera/camera_android_camerax/lib/src/image_analysis.dart +++ b/packages/camera/camera_android_camerax/lib/src/image_analysis.dart @@ -67,18 +67,18 @@ class ImageAnalysis extends UseCase { /// https://developer.android.com/reference/androidx/camera/core/ImageAnalysis.Builder#setResolutionSelector(androidx.camera.core.resolutionselector.ResolutionSelector). final ResolutionSelector? resolutionSelector; + /// Dynamically sets the target rotation of this instance. + /// + /// [rotation] should be one of the [Surface] rotation constants. + Future setTargetRotation(int rotation) => + _api.setTargetRotationFromInstances(this, rotation); + /// Sets an [Analyzer] to receive and analyze images. Future setAnalyzer(Analyzer analyzer) => _api.setAnalyzerFromInstances(this, analyzer); /// Removes a previously set [Analyzer]. Future clearAnalyzer() => _api.clearAnalyzerFromInstances(this); - - /// Dynamically sets the target rotation of this instance. - /// - /// [rotation] should be one of the [Surface] rotation constants. - Future setTargetRotation(int rotation) => - _api.setTargetRotationFromInstances(this, rotation); } /// Host API implementation of [ImageAnalysis]. @@ -125,6 +125,13 @@ class _ImageAnalysisHostApiImpl extends ImageAnalysisHostApi { ); } + /// Dynamically sets the target rotation of [instance] to [rotation]. + Future setTargetRotationFromInstances( + ImageAnalysis instance, int rotation) { + return setTargetRotation( + instanceManager.getIdentifier(instance)!, rotation); + } + /// Sets the [analyzer] to receive and analyze images on the [instance]. Future setAnalyzerFromInstances( ImageAnalysis instance, @@ -144,11 +151,4 @@ class _ImageAnalysisHostApiImpl extends ImageAnalysisHostApi { instanceManager.getIdentifier(instance)!, ); } - - /// Dynamically sets the target rotation of [instance] to [rotation]. - Future setTargetRotationFromInstances( - ImageAnalysis instance, int rotation) { - return setTargetRotation( - instanceManager.getIdentifier(instance)!, rotation); - } } 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 7498734fc81..17813da859d 100644 --- a/packages/camera/camera_android_camerax/lib/src/image_capture.dart +++ b/packages/camera/camera_android_camerax/lib/src/image_capture.dart @@ -84,6 +84,12 @@ class ImageCapture extends UseCase { /// See https://developer.android.com/reference/androidx/camera/core/ImageCapture#FLASH_MODE_OFF(). static const int flashModeOff = 2; + /// Dynamically sets the target rotation of this instance. + /// + /// [rotation] should be one of the [Surface] rotation constants. + Future setTargetRotation(int rotation) => + _api.setTargetRotationFromInstances(this, rotation); + /// Sets the flash mode to use for image capture. Future setFlashMode(int newFlashMode) async { return _api.setFlashModeFromInstance(this, newFlashMode); @@ -109,12 +115,6 @@ class ImageCapture extends UseCase { Future takePicture() async { return _api.takePictureFromInstance(this); } - - /// Dynamically sets the target rotation of this instance. - /// - /// [rotation] should be one of the [Surface] rotation constants. - Future setTargetRotation(int rotation) => - _api.setTargetRotationFromInstances(this, rotation); } /// Host API implementation of [ImageCapture]. @@ -163,6 +163,13 @@ class ImageCaptureHostApiImpl extends ImageCaptureHostApi { : instanceManager.getIdentifier(resolutionSelector)); } + /// Dynamically sets the target rotation of [instance] to [rotation]. + Future setTargetRotationFromInstances( + ImageCapture instance, int rotation) { + return setTargetRotation( + instanceManager.getIdentifier(instance)!, rotation); + } + /// Sets the flash mode for the specified [ImageCapture] instance to take /// a picture with. Future setFlashModeFromInstance( @@ -183,11 +190,4 @@ class ImageCaptureHostApiImpl extends ImageCaptureHostApi { final String picturePath = await takePicture(identifier!); return picturePath; } - - /// Dynamically sets the target rotation of [instance] to [rotation]. - Future setTargetRotationFromInstances( - ImageCapture instance, int rotation) { - return setTargetRotation( - instanceManager.getIdentifier(instance)!, rotation); - } } diff --git a/packages/camera/camera_android_camerax/lib/src/preview.dart b/packages/camera/camera_android_camerax/lib/src/preview.dart index 49bc8b8986b..d61203c6633 100644 --- a/packages/camera/camera_android_camerax/lib/src/preview.dart +++ b/packages/camera/camera_android_camerax/lib/src/preview.dart @@ -57,6 +57,12 @@ class Preview extends UseCase { /// https://developer.android.com/reference/androidx/camera/core/Preview.Builder#setResolutionSelector(androidx.camera.core.resolutionselector.ResolutionSelector). final ResolutionSelector? resolutionSelector; + /// Dynamically sets the target rotation of this instance. + /// + /// [rotation] should be one of the [Surface] rotation constants. + Future setTargetRotation(int rotation) => + _api.setTargetRotationFromInstances(this, rotation); + /// Sets the surface provider for the preview stream. /// /// Returns the ID of the FlutterSurfaceTextureEntry used on the native end @@ -75,12 +81,6 @@ class Preview extends UseCase { Future getResolutionInfo() { return _api.getResolutionInfoFromInstance(this); } - - /// Dynamically sets the target rotation of this instance. - /// - /// [rotation] should be one of the [Surface] rotation constants. - Future setTargetRotation(int rotation) => - _api.setTargetRotationFromInstances(this, rotation); } /// Host API implementation of [Preview]. @@ -123,6 +123,12 @@ class PreviewHostApiImpl extends PreviewHostApi { : instanceManager.getIdentifier(resolutionSelector)); } + /// Dynamically sets the target rotation of [instance] to [rotation]. + Future setTargetRotationFromInstances(Preview instance, int rotation) { + return setTargetRotation( + instanceManager.getIdentifier(instance)!, rotation); + } + /// Sets the surface provider of the specified [Preview] instance and returns /// the ID corresponding to the surface it will provide. Future setSurfaceProviderFromInstance(Preview instance) async { @@ -145,10 +151,4 @@ class PreviewHostApiImpl extends PreviewHostApi { return resolutionInfo; } - - /// Dynamically sets the target rotation of [instance] to [rotation]. - Future setTargetRotationFromInstances(Preview instance, int rotation) { - return setTargetRotation( - instanceManager.getIdentifier(instance)!, rotation); - } } diff --git a/packages/camera/camera_android_camerax/lib/src/video_capture.dart b/packages/camera/camera_android_camerax/lib/src/video_capture.dart index ae08da5d8d0..f87b80ba90b 100644 --- a/packages/camera/camera_android_camerax/lib/src/video_capture.dart +++ b/packages/camera/camera_android_camerax/lib/src/video_capture.dart @@ -28,6 +28,8 @@ class VideoCapture extends UseCase { AndroidCameraXCameraFlutterApis.instance.ensureSetUp(); } + late final VideoCaptureHostApiImpl _api; + /// Creates a [VideoCapture] associated with the given [Recorder]. static Future withOutput(Recorder recorder, {BinaryMessenger? binaryMessenger, InstanceManager? instanceManager}) { @@ -38,18 +40,16 @@ class VideoCapture extends UseCase { return api.withOutputFromInstance(recorder); } - /// Gets the [Recorder] associated with this VideoCapture. - Future getOutput() { - return _api.getOutputFromInstance(this); - } - /// Dynamically sets the target rotation of this instance. /// /// [rotation] should be one of the [Surface] rotation constants. Future setTargetRotation(int rotation) => _api.setTargetRotationFromInstances(this, rotation); - late final VideoCaptureHostApiImpl _api; + /// Gets the [Recorder] associated with this VideoCapture. + Future getOutput() { + return _api.getOutputFromInstance(this); + } } /// Host API implementation of [VideoCapture]. @@ -82,19 +82,19 @@ class VideoCaptureHostApiImpl extends VideoCaptureHostApi { .getInstanceWithWeakReference(videoCaptureId)!; } - /// Gets the [Recorder] associated with the provided [VideoCapture] instance. - Future getOutputFromInstance(VideoCapture instance) async { - final int? identifier = instanceManager.getIdentifier(instance); - final int recorderId = await getOutput(identifier!); - return instanceManager.getInstanceWithWeakReference(recorderId)!; - } - /// Dynamically sets the target rotation of [instance] to [rotation]. Future setTargetRotationFromInstances( VideoCapture instance, int rotation) { return setTargetRotation( instanceManager.getIdentifier(instance)!, rotation); } + + /// Gets the [Recorder] associated with the provided [VideoCapture] instance. + Future getOutputFromInstance(VideoCapture instance) async { + final int? identifier = instanceManager.getIdentifier(instance); + final int recorderId = await getOutput(identifier!); + return instanceManager.getInstanceWithWeakReference(recorderId)!; + } } /// Flutter API implementation of [VideoCapture]. diff --git a/packages/camera/camera_android_camerax/test/device_orientation_manager_test.dart b/packages/camera/camera_android_camerax/test/device_orientation_manager_test.dart index 57da80025e4..8ea4895cfc0 100644 --- a/packages/camera/camera_android_camerax/test/device_orientation_manager_test.dart +++ b/packages/camera/camera_android_camerax/test/device_orientation_manager_test.dart @@ -24,7 +24,9 @@ void main() { group('DeviceOrientationManager', () { tearDown(() => TestProcessCameraProviderHostApi.setup(null)); - test('startListeningForDeviceOrientationChangeTest', () async { + test( + 'startListeningForDeviceOrientationChange makes request to start listening for new device orientations', + () async { final MockTestDeviceOrientationManagerHostApi mockApi = MockTestDeviceOrientationManagerHostApi(); TestDeviceOrientationManagerHostApi.setup(mockApi); @@ -34,7 +36,9 @@ void main() { verify(mockApi.startListeningForDeviceOrientationChange(true, 90)); }); - test('stopListeningForDeviceOrientationChangeTest', () async { + test( + 'stopListeningForDeviceOrientationChange makes request to stop listening for new device orientations', + () async { final MockTestDeviceOrientationManagerHostApi mockApi = MockTestDeviceOrientationManagerHostApi(); TestDeviceOrientationManagerHostApi.setup(mockApi); @@ -43,6 +47,32 @@ void main() { verify(mockApi.stopListeningForDeviceOrientationChange()); }); + test('getPhotorientation retrieves expected orientation', () async { + final MockTestDeviceOrientationManagerHostApi mockApi = + MockTestDeviceOrientationManagerHostApi(); + TestDeviceOrientationManagerHostApi.setup(mockApi); + + const int photoOrientation = 270; + when(mockApi.getPhotoOrientation()).thenReturn(photoOrientation); + + expect(await DeviceOrientationManager.getPhotoOrientation(), + equals(photoOrientation)); + verify(mockApi.getPhotoOrientation()); + }); + + test('getVideoOrientation retrieves expected orientation', () async { + final MockTestDeviceOrientationManagerHostApi mockApi = + MockTestDeviceOrientationManagerHostApi(); + TestDeviceOrientationManagerHostApi.setup(mockApi); + + const int videoOrientation = 180; + when(mockApi.getVideoOrientation()).thenReturn(videoOrientation); + + expect(await DeviceOrientationManager.getVideoOrientation(), + equals(videoOrientation)); + verify(mockApi.getVideoOrientation()); + }); + test('onDeviceOrientationChanged adds new orientation to stream', () { DeviceOrientationManager.deviceOrientationChangedStreamController.stream .listen((DeviceOrientationChangedEvent event) { 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 6e0b99efa6d..89c6d44c74c 100644 --- a/packages/camera/camera_android_camerax/test/image_analysis_test.dart +++ b/packages/camera/camera_android_camerax/test/image_analysis_test.dart @@ -7,6 +7,7 @@ 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:camera_android_camerax/src/surface.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; @@ -40,7 +41,7 @@ void main() { ); ImageAnalysis.detached( - targetRotation: 270, + targetRotation: Surface.ROTATION_270, resolutionSelector: MockResolutionSelector(), instanceManager: instanceManager, ); @@ -57,7 +58,7 @@ void main() { onWeakReferenceRemoved: (_) {}, ); - const int targetRotation = 90; + const int targetRotation = Surface.ROTATION_90; final MockResolutionSelector mockResolutionSelector = MockResolutionSelector(); const int mockResolutionSelectorId = 24; @@ -80,6 +81,32 @@ void main() { argThat(equals(mockResolutionSelectorId)))); }); + test( + 'setTargetRotation makes call to set target rotation for ImageAnalysis instance', + () async { + final MockTestImageAnalysisHostApi mockApi = + MockTestImageAnalysisHostApi(); + TestImageAnalysisHostApi.setup(mockApi); + + final InstanceManager instanceManager = InstanceManager( + onWeakReferenceRemoved: (_) {}, + ); + const int targetRotation = Surface.ROTATION_180; + final ImageAnalysis imageAnalysis = ImageAnalysis.detached( + instanceManager: instanceManager, + ); + instanceManager.addHostCreatedInstance( + imageAnalysis, + 0, + onCopy: (_) => ImageAnalysis.detached(instanceManager: instanceManager), + ); + + await imageAnalysis.setTargetRotation(targetRotation); + + verify(mockApi.setTargetRotation( + instanceManager.getIdentifier(imageAnalysis), targetRotation)); + }); + test('setAnalyzer makes call to set analyzer on ImageAnalysis instance', () async { final MockTestImageAnalysisHostApi 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 6760e4fee0e..7402ed20174 100644 --- a/packages/camera/camera_android_camerax/test/image_capture_test.dart +++ b/packages/camera/camera_android_camerax/test/image_capture_test.dart @@ -5,6 +5,7 @@ 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:camera_android_camerax/src/surface.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; @@ -35,7 +36,7 @@ void main() { ); ImageCapture.detached( instanceManager: instanceManager, - targetRotation: 180, + targetRotation: Surface.ROTATION_180, targetFlashMode: ImageCapture.flashModeOn, resolutionSelector: MockResolutionSelector(), ); @@ -52,7 +53,7 @@ void main() { onWeakReferenceRemoved: (_) {}, ); - const int targetRotation = 270; + const int targetRotation = Surface.ROTATION_270; const int targetFlashMode = ImageCapture.flashModeAuto; final MockResolutionSelector mockResolutionSelector = MockResolutionSelector(); @@ -102,6 +103,31 @@ void main() { instanceManager.getIdentifier(imageCapture), flashMode)); }); + test( + 'setTargetRotation makes call to set target rotation for ImageCapture instance', + () async { + final MockTestImageCaptureHostApi mockApi = MockTestImageCaptureHostApi(); + TestImageCaptureHostApi.setup(mockApi); + + final InstanceManager instanceManager = InstanceManager( + onWeakReferenceRemoved: (_) {}, + ); + const int targetRotation = Surface.ROTATION_180; + final ImageCapture imageCapture = ImageCapture.detached( + instanceManager: instanceManager, + ); + instanceManager.addHostCreatedInstance( + imageCapture, + 0, + onCopy: (_) => ImageCapture.detached(instanceManager: instanceManager), + ); + + await imageCapture.setTargetRotation(targetRotation); + + verify(mockApi.setTargetRotation( + instanceManager.getIdentifier(imageCapture), targetRotation)); + }); + test('takePicture makes call to capture still image', () async { final MockTestImageCaptureHostApi mockApi = MockTestImageCaptureHostApi(); TestImageCaptureHostApi.setup(mockApi); diff --git a/packages/camera/camera_android_camerax/test/preview_test.dart b/packages/camera/camera_android_camerax/test/preview_test.dart index 29f862cda4c..a082b71d8ee 100644 --- a/packages/camera/camera_android_camerax/test/preview_test.dart +++ b/packages/camera/camera_android_camerax/test/preview_test.dart @@ -6,6 +6,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:camera_android_camerax/src/surface.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; @@ -33,7 +34,7 @@ void main() { ); Preview.detached( instanceManager: instanceManager, - targetRotation: 90, + targetRotation: Surface.ROTATION_90, resolutionSelector: MockResolutionSelector(), ); @@ -48,7 +49,7 @@ void main() { final InstanceManager instanceManager = InstanceManager( onWeakReferenceRemoved: (_) {}, ); - const int targetRotation = 90; + const int targetRotation = Surface.ROTATION_90; final MockResolutionSelector mockResolutionSelector = MockResolutionSelector(); const int mockResolutionSelectorId = 24; @@ -71,6 +72,31 @@ void main() { argThat(equals(mockResolutionSelectorId)))); }); + test( + 'setTargetRotation makes call to set target rotation for Preview instance', + () async { + final MockTestPreviewHostApi mockApi = MockTestPreviewHostApi(); + TestPreviewHostApi.setup(mockApi); + + final InstanceManager instanceManager = InstanceManager( + onWeakReferenceRemoved: (_) {}, + ); + const int targetRotation = Surface.ROTATION_180; + final Preview preview = Preview.detached( + instanceManager: instanceManager, + ); + instanceManager.addHostCreatedInstance( + preview, + 0, + onCopy: (_) => Preview.detached(instanceManager: instanceManager), + ); + + await preview.setTargetRotation(targetRotation); + + verify(mockApi.setTargetRotation( + instanceManager.getIdentifier(preview), targetRotation)); + }); + test( 'setSurfaceProvider makes call to set surface provider for preview instance', () async { diff --git a/packages/camera/camera_android_camerax/test/video_capture_test.dart b/packages/camera/camera_android_camerax/test/video_capture_test.dart index 560c48ffd59..6954b352ade 100644 --- a/packages/camera/camera_android_camerax/test/video_capture_test.dart +++ b/packages/camera/camera_android_camerax/test/video_capture_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/recorder.dart'; +import 'package:camera_android_camerax/src/surface.dart'; import 'package:camera_android_camerax/src/video_capture.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/annotations.dart'; @@ -50,6 +51,31 @@ void main() { verify(mockApi.withOutput(mockRecorderId)); }); + test( + 'setTargetRotation makes call to set target rotation for VideoCapture instance', + () async { + final MockTestVideoCaptureHostApi mockApi = MockTestVideoCaptureHostApi(); + TestVideoCaptureHostApi.setup(mockApi); + + final InstanceManager instanceManager = InstanceManager( + onWeakReferenceRemoved: (_) {}, + ); + const int targetRotation = Surface.ROTATION_180; + final VideoCapture videoCapture = VideoCapture.detached( + instanceManager: instanceManager, + ); + instanceManager.addHostCreatedInstance( + videoCapture, + 0, + onCopy: (_) => VideoCapture.detached(instanceManager: instanceManager), + ); + + await videoCapture.setTargetRotation(targetRotation); + + verify(mockApi.setTargetRotation( + instanceManager.getIdentifier(videoCapture), targetRotation)); + }); + test('getOutput calls the Java side and returns correct Recorder', () async { final MockTestVideoCaptureHostApi mockApi = MockTestVideoCaptureHostApi(); TestVideoCaptureHostApi.setup(mockApi); From 1307099b172f33c8abb15173b29450b2f56fd3e1 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Wed, 8 Nov 2023 09:10:07 -0800 Subject: [PATCH 09/29] Start attepmting plugin dart test code --- .../lib/src/android_camera_camerax.dart | 17 ++++--- .../test/android_camera_camerax_test.dart | 45 +++++++++++++++++++ 2 files changed, 55 insertions(+), 7 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 1a3710f2dab..ef1df7f5eba 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 @@ -234,7 +234,7 @@ class AndroidCameraCameraX extends CameraPlatform { cameraSelector = createCameraSelector(cameraSelectorLensDirection); // Start listening for device orientation changes preceding camera creation. startListeningForDeviceOrientationChange( - cameraIsFrontFacing, cameraDescription.sensorOrientation!); + cameraIsFrontFacing, cameraDescription.sensorOrientation); // Determine ResolutionSelector and QualitySelector based on // resolutionPreset for camera UseCases. final ResolutionSelector? presetResolutionSelector = @@ -248,7 +248,7 @@ class AndroidCameraCameraX extends CameraPlatform { // Retrieve target rotation for UseCases. final int targetRotation = - _getTargetRotation(cameraDescription.sensorOrientation!); + getTargetRotation(cameraDescription.sensorOrientation); // Configure Preview instance. preview = createPreview( @@ -403,10 +403,10 @@ class AndroidCameraCameraX extends CameraPlatform { /// Unlocks the capture orientation. @override Future unlockCaptureOrientation(int cameraId) async { - final int currentPhotoOrientation = _getTargetRotation( - await DeviceOrientationManager.getPhotoOrientation()); - final int currentVideoOrientation = _getTargetRotation( - await DeviceOrientationManager.getVideoOrientation()); + final int currentPhotoOrientation = + getTargetRotation(await DeviceOrientationManager.getPhotoOrientation()); + final int currentVideoOrientation = + getTargetRotation(await DeviceOrientationManager.getVideoOrientation()); /// Update UseCases to use current device orientation. await imageAnalysis!.setTargetRotation(currentPhotoOrientation); @@ -875,7 +875,8 @@ class AndroidCameraCameraX extends CameraPlatform { /// Returns [Surface] target rotation constant that maps to specified sensor /// orientation. - int _getTargetRotation(int sensorOrientation) { + @visibleForTesting + int getTargetRotation(int sensorOrientation) { switch (sensorOrientation) { case 90: return Surface.ROTATION_90; @@ -1028,6 +1029,8 @@ class AndroidCameraCameraX extends CameraPlatform { cameraIsFrontFacing, sensorOrientation); } + // TODO: start using _shouldCreateDetachedObjectForTesting + /// Returns a [CameraSelector] based on the specified camera lens direction. @visibleForTesting CameraSelector createCameraSelector(int cameraSelectorLensDirection) { 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 2a8ba8276d0..ab1310649da 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 @@ -452,6 +452,51 @@ void main() { expect(camera.recorder!.qualitySelector, isNull); }); + test( + 'createCamera properly sets target rotation from preset sensor orientation for all use cases', + () async { + final FakeAndroidCameraCameraX camera = + FakeAndroidCameraCameraX(shouldCreateDetachedObjectForTesting: true); + final MockProcessCameraProvider mockProcessCameraProvider = + MockProcessCameraProvider(); + const CameraLensDirection testLensDirection = CameraLensDirection.back; + const int testSensorOrientation = 270; + final int expectedTargetRotation = + camera.getTargetRotation(testSensorOrientation); + 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; + + await camera.createCamera(testCameraDescription, ResolutionPreset.low, + enableAudio: enableAudio); + + // Test non-video use cases. + expect(camera.preview!.targetRotation, equals(expectedTargetRotation)); + expect(camera.imageCapture!.targetRotation, equals(expectedTargetRotation)); + expect( + camera.imageAnalysis!.targetRotation, equals(expectedTargetRotation)); + + // Test video use case. + verify(camera.videoCapture!.setTargetRotation(expectedTargetRotation)); + }); + test( 'initializeCamera throws a CameraException when createCamera has not been called before initializedCamera', () async { From b4ad9c380be7eb7a959b17eecb10dd854e8b35e1 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Wed, 8 Nov 2023 10:21:32 -0800 Subject: [PATCH 10/29] Fix and add java tests --- .../camera/camera_android_camerax/README.md | 4 -- .../DeviceOrientationManagerHostApiImpl.java | 6 +-- .../CameraAndroidCameraxPluginTest.java | 2 + .../plugins/camerax/ImageAnalysisTest.java | 19 ++++++- .../plugins/camerax/ImageCaptureTest.java | 23 +++++++-- .../flutter/plugins/camerax/PreviewTest.java | 14 ++++++ .../plugins/camerax/SystemServicesTest.java | 49 ------------------- .../plugins/camerax/VideoCaptureTest.java | 15 ++++++ 8 files changed, 71 insertions(+), 61 deletions(-) diff --git a/packages/camera/camera_android_camerax/README.md b/packages/camera/camera_android_camerax/README.md index 073daa16d0e..3a2e49d7e60 100644 --- a/packages/camera/camera_android_camerax/README.md +++ b/packages/camera/camera_android_camerax/README.md @@ -31,10 +31,6 @@ dependencies: 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. - ### Exposure mode, point, & offset configuration \[[Issue #120468][120468]\] `setExposureMode`, `setExposurePoint`, & `setExposureOffset` are unimplemented. diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerHostApiImpl.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerHostApiImpl.java index 4fbaa609b1b..a7e9678485b 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerHostApiImpl.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerHostApiImpl.java @@ -86,9 +86,8 @@ public void stopListeningForDeviceOrientationChange() { @Override public @NonNull Long getPhotoOrientation() { if (deviceOrientationManager == null) { - // TODO: throw exception + throw new NullPointerException("startListeningForDeviceOrientationChange must first be called to subscribe to device orientation changes in order to retrieve the photo orientation."); } - return Long.valueOf(deviceOrientationManager.getPhotoOrientation()); } @@ -96,9 +95,8 @@ public void stopListeningForDeviceOrientationChange() { @Override public @NonNull Long getVideoOrientation() { if (deviceOrientationManager == null) { - // TODO: throw exception + throw new NullPointerException("startListeningForDeviceOrientationChange must first be called to subscribe to device orientation changes in order to retrieve the video orientation."); } - return Long.valueOf(deviceOrientationManager.getVideoOrientation()); } } diff --git a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/CameraAndroidCameraxPluginTest.java b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/CameraAndroidCameraxPluginTest.java index 4a2197624b6..58f517edc65 100644 --- a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/CameraAndroidCameraxPluginTest.java +++ b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/CameraAndroidCameraxPluginTest.java @@ -44,6 +44,7 @@ public void onAttachedToActivity_setsLifecycleOwnerAsActivityIfLifecycleOwner() plugin.processCameraProviderHostApiImpl = mockProcessCameraProviderHostApiImpl; plugin.liveDataHostApiImpl = mockLiveDataHostApiImpl; plugin.systemServicesHostApiImpl = mock(SystemServicesHostApiImpl.class); + plugin.deviceOrientationManagerHostApiImpl = mock(DeviceOrientationManagerHostApiImpl.class); plugin.onAttachedToEngine(flutterPluginBinding); plugin.onAttachedToActivity(activityPluginBinding); @@ -68,6 +69,7 @@ public void onAttachedToActivity_setsLifecycleOwnerAsActivityIfLifecycleOwner() plugin.processCameraProviderHostApiImpl = mockProcessCameraProviderHostApiImpl; plugin.liveDataHostApiImpl = mockLiveDataHostApiImpl; plugin.systemServicesHostApiImpl = mock(SystemServicesHostApiImpl.class); + plugin.deviceOrientationManagerHostApiImpl = mock(DeviceOrientationManagerHostApiImpl.class); plugin.onAttachedToEngine(flutterPluginBinding); plugin.onAttachedToActivity(activityPluginBinding); 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 08a9f80b637..5e4a729dbd2 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 @@ -12,6 +12,7 @@ import static org.mockito.Mockito.when; import android.content.Context; +import android.view.Surface; import androidx.camera.core.ImageAnalysis; import androidx.camera.core.resolutionselector.ResolutionSelector; import androidx.test.core.app.ApplicationProvider; @@ -56,6 +57,7 @@ public void hostApiCreate_createsExpectedImageAnalysisInstanceWithExpectedIdenti final ResolutionSelector mockResolutionSelector = mock(ResolutionSelector.class); final long instanceIdentifier = 0; final long mockResolutionSelectorId = 25; + final int targetRotation = Surface.ROTATION_90; hostApi.cameraXProxy = mockCameraXProxy; instanceManager.addDartCreatedInstance(mockResolutionSelector, mockResolutionSelectorId); @@ -63,8 +65,9 @@ public void hostApiCreate_createsExpectedImageAnalysisInstanceWithExpectedIdenti when(mockCameraXProxy.createImageAnalysisBuilder()).thenReturn(mockImageAnalysisBuilder); when(mockImageAnalysisBuilder.build()).thenReturn(mockImageAnalysis); - hostApi.create(instanceIdentifier, mockResolutionSelectorId); + hostApi.create(instanceIdentifier, Long.valueOf(targetRotation), mockResolutionSelectorId); + verify(mockImageAnalysisBuilder).setTargetRotation(targetRotation); verify(mockImageAnalysisBuilder).setResolutionSelector(mockResolutionSelector); assertEquals(instanceManager.getInstance(instanceIdentifier), mockImageAnalysis); } @@ -98,4 +101,18 @@ public void clearAnalyzer_makesCallToClearAnalyzerOnExpectedImageAnalysisInstanc verify(mockImageAnalysis).clearAnalyzer(); } + + @Test + public void setTargetRotation_makesCallToSetTargetRotation() { + final ImageAnalysisHostApiImpl hostApi = + new ImageAnalysisHostApiImpl(mockBinaryMessenger, instanceManager, context); + final long instanceIdentifier = 32; + final int targetRotation = Surface.ROTATION_180; + + instanceManager.addDartCreatedInstance(mockImageAnalysis, instanceIdentifier); + + hostApi.setTargetRotation(instanceIdentifier, Long.valueOf(targetRotation)); + + verify(mockImageAnalysis).setTargetRotation(targetRotation); + } } 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 df6c8ee74b7..0e80e581eba 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 @@ -14,6 +14,7 @@ import static org.mockito.Mockito.when; import android.content.Context; +import android.view.Surface; import androidx.camera.core.ImageCapture; import androidx.camera.core.ImageCaptureException; import androidx.camera.core.resolutionselector.ResolutionSelector; @@ -63,18 +64,20 @@ public void create_createsImageCaptureWithCorrectConfiguration() { new ImageCaptureHostApiImpl(mockBinaryMessenger, testInstanceManager, context); final ImageCapture.Builder mockImageCaptureBuilder = mock(ImageCapture.Builder.class); final Long imageCaptureIdentifier = 74L; - final Long flashMode = Long.valueOf(ImageCapture.FLASH_MODE_ON); + final int flashMode = ImageCapture.FLASH_MODE_ON; final ResolutionSelector mockResolutionSelector = mock(ResolutionSelector.class); final long mockResolutionSelectorId = 77; + final int targetRotation = Surface.ROTATION_270; imageCaptureHostApiImpl.cameraXProxy = mockCameraXProxy; testInstanceManager.addDartCreatedInstance(mockResolutionSelector, mockResolutionSelectorId); when(mockCameraXProxy.createImageCaptureBuilder()).thenReturn(mockImageCaptureBuilder); when(mockImageCaptureBuilder.build()).thenReturn(mockImageCapture); - imageCaptureHostApiImpl.create(imageCaptureIdentifier, flashMode, mockResolutionSelectorId); + imageCaptureHostApiImpl.create(imageCaptureIdentifier, Long.valueOf(targetRotation), Long.valueOf(flashMode), mockResolutionSelectorId); - verify(mockImageCaptureBuilder).setFlashMode(flashMode.intValue()); + verify(mockImageCaptureBuilder).setTargetRotation(targetRotation); + verify(mockImageCaptureBuilder).setFlashMode(flashMode); verify(mockImageCaptureBuilder).setResolutionSelector(mockResolutionSelector); verify(mockImageCaptureBuilder).build(); verify(testInstanceManager).addDartCreatedInstance(mockImageCapture, imageCaptureIdentifier); @@ -197,4 +200,18 @@ public void takePicture_usesExpectedOnImageSavedCallback() { verify(mockResult).error(mockException); } + + @Test + public void setTargetRotation_makesCallToSetTargetRotation() { + final ImageCaptureHostApiImpl hostApi = + new ImageCaptureHostApiImpl(mockBinaryMessenger, testInstanceManager, context); + final long instanceIdentifier = 42; + final int targetRotation = Surface.ROTATION_90; + + testInstanceManager.addDartCreatedInstance(mockImageCapture, instanceIdentifier); + + hostApi.setTargetRotation(instanceIdentifier, Long.valueOf(targetRotation)); + + verify(mockImageCapture).setTargetRotation(targetRotation); + } } 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 37a7c770413..81b455d7a86 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 @@ -217,4 +217,18 @@ public void getResolutionInfo_makesCallToRetrievePreviewResolutionInfo() { assertEquals(resolutionInfo.getWidth(), Long.valueOf(resolutionWidth)); assertEquals(resolutionInfo.getHeight(), Long.valueOf(resolutionHeight)); } + + @Test + public void setTargetRotation_makesCallToSetTargetRotation() { + final PreviewHostApiImpl hostApi = + new PreviewHostApiImpl(mockBinaryMessenger, testInstanceManager, mockTextureRegistry); + final long instanceIdentifier = 52; + final int targetRotation = Surface.ROTATION_180; + + testInstanceManager.addDartCreatedInstance(mockPreview, instanceIdentifier); + + hostApi.setTargetRotation(instanceIdentifier, Long.valueOf(targetRotation)); + + verify(mockPreview).setTargetRotation(targetRotation); + } } diff --git a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/SystemServicesTest.java b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/SystemServicesTest.java index f905704cbc1..98115f9c1c5 100644 --- a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/SystemServicesTest.java +++ b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/SystemServicesTest.java @@ -96,55 +96,6 @@ public void requestCameraPermissionsTest() { assertEquals(cameraPermissionsErrorData.getDescription(), testErrorDescription); } - @Test - public void deviceOrientationChangeTest() { - final SystemServicesHostApiImpl systemServicesHostApi = - new SystemServicesHostApiImpl(mockBinaryMessenger, mockInstanceManager, mockContext); - final CameraXProxy mockCameraXProxy = mock(CameraXProxy.class); - final Activity mockActivity = mock(Activity.class); - final DeviceOrientationManager mockDeviceOrientationManager = - mock(DeviceOrientationManager.class); - final Boolean isFrontFacing = true; - final int sensorOrientation = 90; - - SystemServicesFlutterApiImpl systemServicesFlutterApi = - mock(SystemServicesFlutterApiImpl.class); - systemServicesHostApi.systemServicesFlutterApi = systemServicesFlutterApi; - - systemServicesHostApi.cameraXProxy = mockCameraXProxy; - systemServicesHostApi.setActivity(mockActivity); - when(mockCameraXProxy.createDeviceOrientationManager( - eq(mockActivity), - eq(isFrontFacing), - eq(sensorOrientation), - any(DeviceOrientationChangeCallback.class))) - .thenReturn(mockDeviceOrientationManager); - - final ArgumentCaptor deviceOrientationChangeCallbackCaptor = - ArgumentCaptor.forClass(DeviceOrientationChangeCallback.class); - - systemServicesHostApi.startListeningForDeviceOrientationChange( - isFrontFacing, Long.valueOf(sensorOrientation)); - - // Test callback method defined in Flutter API is called when device orientation changes. - verify(mockCameraXProxy) - .createDeviceOrientationManager( - eq(mockActivity), - eq(isFrontFacing), - eq(sensorOrientation), - deviceOrientationChangeCallbackCaptor.capture()); - DeviceOrientationChangeCallback deviceOrientationChangeCallback = - deviceOrientationChangeCallbackCaptor.getValue(); - - deviceOrientationChangeCallback.onChange(DeviceOrientation.PORTRAIT_DOWN); - verify(systemServicesFlutterApi) - .sendDeviceOrientationChangedEvent( - eq(DeviceOrientation.PORTRAIT_DOWN.toString()), ArgumentMatchers.>any()); - - // Test that the DeviceOrientationManager starts listening for device orientation changes. - verify(mockDeviceOrientationManager).start(); - } - @Test public void getTempFilePath_returnsCorrectPath() { final SystemServicesHostApiImpl systemServicesHostApi = diff --git a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/VideoCaptureTest.java b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/VideoCaptureTest.java index 95794334c13..32627fbd624 100644 --- a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/VideoCaptureTest.java +++ b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/VideoCaptureTest.java @@ -10,6 +10,7 @@ import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; +import android.view.Surface; import androidx.camera.video.Recorder; import androidx.camera.video.VideoCapture; import io.flutter.plugin.common.BinaryMessenger; @@ -78,6 +79,20 @@ public void withOutput_returnsNewVideoCaptureWithAssociatedRecorder() { testInstanceManager.remove(videoCaptureId); } + @Test + public void setTargetRotation_makesCallToSetTargetRotation() { + final VideoCaptureHostApiImpl hostApi = + new VideoCaptureHostApiImpl(mockBinaryMessenger, testInstanceManager); + final long instanceIdentifier = 62; + final int targetRotation = Surface.ROTATION_270; + + testInstanceManager.addDartCreatedInstance(mockVideoCapture, instanceIdentifier); + + hostApi.setTargetRotation(instanceIdentifier, Long.valueOf(targetRotation)); + + verify(mockVideoCapture).setTargetRotation(targetRotation); + } + @Test public void flutterApiCreateTest() { final VideoCaptureFlutterApiImpl spyVideoCaptureFlutterApi = From 39ab5732c403afb2b3243cfb45efcdd5eb2d5909 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Thu, 9 Nov 2023 12:59:45 -0800 Subject: [PATCH 11/29] Debugging detached objects for testing --- .../DeviceOrientationManagerWrapperTest.java | 119 ++++++++++++++++++ .../lib/src/android_camera_camerax.dart | 2 - .../test/android_camera_camerax_test.dart | 36 ++++-- 3 files changed, 148 insertions(+), 9 deletions(-) create mode 100644 packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/DeviceOrientationManagerWrapperTest.java diff --git a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/DeviceOrientationManagerWrapperTest.java b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/DeviceOrientationManagerWrapperTest.java new file mode 100644 index 00000000000..9dbd09d8254 --- /dev/null +++ b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/DeviceOrientationManagerWrapperTest.java @@ -0,0 +1,119 @@ +// 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.junit.Assert.assertThrows; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.mockStatic; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import android.app.Activity; +import android.content.Context; +import io.flutter.embedding.engine.systemchannels.PlatformChannel.DeviceOrientation; +import io.flutter.plugin.common.BinaryMessenger; +import io.flutter.plugins.camerax.CameraPermissionsManager.PermissionsRegistry; +import io.flutter.plugins.camerax.CameraPermissionsManager.ResultCallback; +import io.flutter.plugins.camerax.DeviceOrientationManager.DeviceOrientationChangeCallback; +import io.flutter.plugins.camerax.GeneratedCameraXLibrary.CameraPermissionsErrorData; +import io.flutter.plugins.camerax.GeneratedCameraXLibrary.Result; +import io.flutter.plugins.camerax.GeneratedCameraXLibrary.DeviceOrientationManagerFlutterApi.Reply; +import java.io.File; +import java.io.IOException; +import org.junit.Rule; +import org.junit.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.ArgumentMatchers; +import org.mockito.Mock; +import org.mockito.MockedStatic; +import org.mockito.junit.MockitoJUnit; +import org.mockito.junit.MockitoRule; + +public class DeviceOrientationManagerWrapperTest { + @Rule public MockitoRule mockitoRule = MockitoJUnit.rule(); + + @Mock DeviceOrientationManager mockDeviceOrientationManager; + @Mock public BinaryMessenger mockBinaryMessenger; + @Mock public InstanceManager mockInstanceManager; + + @Test + public void deviceOrientationManagerWrapper_handlesDeviceOrientationChangesAsExpected() { + final DeviceOrientationManagerHostApiImpl hostApi = + new DeviceOrientationManagerHostApiImpl(mockBinaryMessenger, mockInstanceManager); + final CameraXProxy mockCameraXProxy = mock(CameraXProxy.class); + final Activity mockActivity = mock(Activity.class); + final Boolean isFrontFacing = true; + final int sensorOrientation = 90; + + DeviceOrientationManagerFlutterApiImpl flutterApi = + mock(DeviceOrientationManagerFlutterApiImpl.class); + hostApi.deviceOrientationManagerFlutterApiImpl = flutterApi; + + hostApi.cameraXProxy = mockCameraXProxy; + hostApi.setActivity(mockActivity); + when(mockCameraXProxy.createDeviceOrientationManager( + eq(mockActivity), + eq(isFrontFacing), + eq(sensorOrientation), + any(DeviceOrientationChangeCallback.class))) + .thenReturn(mockDeviceOrientationManager); + + final ArgumentCaptor deviceOrientationChangeCallbackCaptor = + ArgumentCaptor.forClass(DeviceOrientationChangeCallback.class); + + hostApi.startListeningForDeviceOrientationChange( + isFrontFacing, Long.valueOf(sensorOrientation)); + + // Test callback method defined in Flutter API is called when device orientation changes. + verify(mockCameraXProxy) + .createDeviceOrientationManager( + eq(mockActivity), + eq(isFrontFacing), + eq(sensorOrientation), + deviceOrientationChangeCallbackCaptor.capture()); + DeviceOrientationChangeCallback deviceOrientationChangeCallback = + deviceOrientationChangeCallbackCaptor.getValue(); + + deviceOrientationChangeCallback.onChange(DeviceOrientation.PORTRAIT_DOWN); + verify(flutterApi) + .sendDeviceOrientationChangedEvent( + eq(DeviceOrientation.PORTRAIT_DOWN.toString()), ArgumentMatchers.>any()); + + // Test that the DeviceOrientationManager starts listening for device orientation changes. + verify(mockDeviceOrientationManager).start(); + + // Test that the DevieOrientationManager can stop listening for device orientation changes. + hostApi.stopListeningForDeviceOrientationChange(); + verify(mockDeviceOrientationManager).stop(); + } + + @Test + public void getPhotoOrientation_returnsExpectedOrientation() { + final DeviceOrientationManagerHostApiImpl hostApi = + new DeviceOrientationManagerHostApiImpl(mockBinaryMessenger, mockInstanceManager); + final int photoOrientation = 90; + + hostApi.deviceOrientationManager = mockDeviceOrientationManager; + when(mockDeviceOrientationManager.getPhotoOrientation()).thenReturn(photoOrientation); + + assertEquals(hostApi.getPhotoOrientation(), Long.valueOf(photoOrientation)); + } + + @Test + public void getVideoOrientation_returnsExpectedOrientation() { + final DeviceOrientationManagerHostApiImpl hostApi = + new DeviceOrientationManagerHostApiImpl(mockBinaryMessenger, mockInstanceManager); + final int videoOrientation = 180; + + hostApi.deviceOrientationManager = mockDeviceOrientationManager; + when(mockDeviceOrientationManager.getVideoOrientation()).thenReturn(videoOrientation); + + assertEquals(hostApi.getVideoOrientation(), Long.valueOf(videoOrientation)); + } +} 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 ef1df7f5eba..bbb62658f44 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 @@ -1029,8 +1029,6 @@ class AndroidCameraCameraX extends CameraPlatform { cameraIsFrontFacing, sensorOrientation); } - // TODO: start using _shouldCreateDetachedObjectForTesting - /// Returns a [CameraSelector] based on the specified camera lens direction. @visibleForTesting CameraSelector createCameraSelector(int cameraSelectorLensDirection) { 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 ab1310649da..d846b12b438 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 @@ -168,8 +168,7 @@ void main() { test( 'createCamera requests permissions, starts listening for device orientation changes, updates camera state observers, and returns flutter surface texture ID', () async { - final FakeAndroidCameraCameraX camera = - FakeAndroidCameraCameraX(shouldCreateDetachedObjectForTesting: true); + final FakeAndroidCameraCameraX camera = FakeAndroidCameraCameraX(); final MockProcessCameraProvider mockProcessCameraProvider = MockProcessCameraProvider(); const CameraLensDirection testLensDirection = CameraLensDirection.back; @@ -236,8 +235,7 @@ void main() { test( 'createCamera binds Preview and ImageCapture use cases to ProcessCameraProvider instance', () async { - final FakeAndroidCameraCameraX camera = - FakeAndroidCameraCameraX(shouldCreateDetachedObjectForTesting: true); + final FakeAndroidCameraCameraX camera = FakeAndroidCameraCameraX(); final MockProcessCameraProvider mockProcessCameraProvider = MockProcessCameraProvider(); const CameraLensDirection testLensDirection = CameraLensDirection.back; @@ -283,7 +281,7 @@ void main() { 'createCamera properly sets preset resolution for non-video capture use cases', () async { final FakeAndroidCameraCameraX camera = - FakeAndroidCameraCameraX(shouldCreateDetachedObjectForTesting: true); + FakeAndroidCameraCameraX(); // TODO: this one has issues final MockProcessCameraProvider mockProcessCameraProvider = MockProcessCameraProvider(); const CameraLensDirection testLensDirection = CameraLensDirection.back; @@ -1458,10 +1456,19 @@ void main() { } /// Fake [AndroidCameraCameraX] that stubs behavior of some methods for testing. +/// +/// Note that this class depends on the `create...` methods diretly mirroring +/// the implementation for [AndroidCameraCameraX], and thus is only useful for +/// making sure the `create...` methods are called to create the relevant object. +/// This error-prone method should be fixed; see +/// https://github.com/flutter/flutter/issues/125926 for more details. class FakeAndroidCameraCameraX extends AndroidCameraCameraX { - FakeAndroidCameraCameraX({super.shouldCreateDetachedObjectForTesting}) - : super.forTesting(); + FakeAndroidCameraCameraX({this.shouldCreateDetachedObjectForTesting = false}) + : super.forTesting( + shouldCreateDetachedObjectForTesting: + shouldCreateDetachedObjectForTesting); + late bool shouldCreateDetachedObjectForTesting; bool cameraPermissionsRequested = false; bool startedListeningForDeviceOrientationChanges = false; @@ -1500,6 +1507,11 @@ class FakeAndroidCameraCameraX extends AndroidCameraCameraX { @override Preview createPreview( {required int targetRotation, ResolutionSelector? resolutionSelector}) { + if (shouldCreateDetachedObjectForTesting) { + return Preview.detached( + targetRotation: targetRotation, + resolutionSelector: resolutionSelector); + } when(testPreview.resolutionSelector).thenReturn(resolutionSelector); return testPreview; } @@ -1507,6 +1519,11 @@ class FakeAndroidCameraCameraX extends AndroidCameraCameraX { @override ImageCapture createImageCapture( {required int targetRotation, ResolutionSelector? resolutionSelector}) { + if (shouldCreateDetachedObjectForTesting) { + return ImageCapture.detached( + targetRotation: targetRotation, + resolutionSelector: resolutionSelector); + } when(testImageCapture.resolutionSelector).thenReturn(resolutionSelector); return testImageCapture; } @@ -1525,6 +1542,11 @@ class FakeAndroidCameraCameraX extends AndroidCameraCameraX { @override ImageAnalysis createImageAnalysis( {required int targetRotation, ResolutionSelector? resolutionSelector}) { + if (shouldCreateDetachedObjectForTesting) { + return ImageAnalysis.detached( + targetRotation: targetRotation, + resolutionSelector: resolutionSelector); + } when(testImageAnalysis.resolutionSelector).thenReturn(resolutionSelector); return testImageAnalysis; } From 2ecdcb0aa3df6add9c8619bb3eb085361c0e5e9c Mon Sep 17 00:00:00 2001 From: camsim99 Date: Sun, 26 Nov 2023 20:05:46 -0800 Subject: [PATCH 12/29] Make corrections from merge --- .../lib/src/android_camera_camerax.dart | 14 +-- .../lib/src/camerax_proxy.dart | 19 +-- .../test/android_camera_camerax_test.dart | 119 +++++++++--------- 3 files changed, 82 insertions(+), 70 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 8b652b3594d..8bd48d68445 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 @@ -243,7 +243,7 @@ class AndroidCameraCameraX extends CameraPlatform { // Retrieve target rotation for UseCases. final int targetRotation = - _getTargetRotation(cameraDescription.sensorOrientation); + getTargetRotation(cameraDescription.sensorOrientation); preview = proxy.createPreview( targetRotation: targetRotation, resolutionSelector: presetResolutionSelector); @@ -251,18 +251,18 @@ class AndroidCameraCameraX extends CameraPlatform { await proxy.setPreviewSurfaceProvider(preview!); // Configure ImageCapture instance. - imageCapture = proxy.createImageCapture( - presetResolutionSelector); // todo: add target rotation + imageCapture = + proxy.createImageCapture(presetResolutionSelector, targetRotation); // Configure ImageAnalysis instance. // Defaults to YUV_420_888 image format. - imageAnalysis = proxy.createImageAnalysis( - presetResolutionSelector); // todo: add target rotation + imageAnalysis = + proxy.createImageAnalysis(presetResolutionSelector, targetRotation); // Configure VideoCapture and Recorder instances. recorder = proxy.createRecorder(presetQualitySelector); - videoCapture = - await proxy.createVideoCapture(recorder!); // todo set target rotation + videoCapture = await proxy.createVideoCapture(recorder!); + await videoCapture!.setTargetRotation(targetRotation); // Bind configured UseCases to ProcessCameraProvider instance & mark Preview // instance as bound but not paused. Video capture is bound at first use diff --git a/packages/camera/camera_android_camerax/lib/src/camerax_proxy.dart b/packages/camera/camera_android_camerax/lib/src/camerax_proxy.dart index 133d84544d9..c4824347495 100644 --- a/packages/camera/camera_android_camerax/lib/src/camerax_proxy.dart +++ b/packages/camera/camera_android_camerax/lib/src/camerax_proxy.dart @@ -8,6 +8,7 @@ import 'analyzer.dart'; import 'camera_selector.dart'; import 'camera_state.dart'; import 'camerax_library.g.dart'; +import 'device_orientation_manager.dart'; import 'fallback_strategy.dart'; import 'image_analysis.dart'; import 'image_capture.dart'; @@ -63,7 +64,8 @@ class CameraXProxy { /// Returns an [ImageCapture] configured with specified flash mode and /// the specified [ResolutionSelector]. - ImageCapture Function(ResolutionSelector? resolutionSelector) + ImageCapture Function( + ResolutionSelector? resolutionSelector, int? targetRotation) createImageCapture; /// Returns a [Recorder] for use in video capture configured with the @@ -75,7 +77,8 @@ class CameraXProxy { /// Returns an [ImageAnalysis] configured with the specified /// [ResolutionSelector]. - ImageAnalysis Function(ResolutionSelector? resolutionSelector) + ImageAnalysis Function( + ResolutionSelector? resolutionSelector, int? targetRotation) createImageAnalysis; /// Returns an [Analyzer] configured with the specified callback for @@ -151,8 +154,9 @@ class CameraXProxy { } static ImageCapture _createAttachedImageCapture( - ResolutionSelector? resolutionSelector) { - return ImageCapture(resolutionSelector: resolutionSelector); + ResolutionSelector? resolutionSelector, int? targetRotation) { + return ImageCapture( + resolutionSelector: resolutionSelector, targetRotation: targetRotation); } static Recorder _createAttachedRecorder(QualitySelector? qualitySelector) { @@ -165,8 +169,9 @@ class CameraXProxy { } static ImageAnalysis _createAttachedImageAnalysis( - ResolutionSelector? resolutionSelector) { - return ImageAnalysis(resolutionSelector: resolutionSelector); + ResolutionSelector? resolutionSelector, int? targetRotation) { + return ImageAnalysis( + resolutionSelector: resolutionSelector, targetRotation: targetRotation); } static Analyzer _createAttachedAnalyzer( @@ -214,7 +219,7 @@ class CameraXProxy { static void _startListeningForDeviceOrientationChange( bool cameraIsFrontFacing, int sensorOrientation) { - SystemServices.startListeningForDeviceOrientationChange( + DeviceOrientationManager.startListeningForDeviceOrientationChange( cameraIsFrontFacing, sensorOrientation); } 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 cc4cf5e3055..c105ab1ec16 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 @@ -234,10 +234,10 @@ void main() { {required int targetRotation, ResolutionSelector? resolutionSelector}) => mockPreview, - createImageCapture: (_) => mockImageCapture, + createImageCapture: (_, __) => mockImageCapture, createRecorder: (_) => mockRecorder, createVideoCapture: (_) => Future.value(mockVideoCapture), - createImageAnalysis: (_) => mockImageAnalysis, + createImageAnalysis: (_, __) => mockImageAnalysis, createResolutionStrategy: ( {bool highestAvailable = false, Size? boundSize, @@ -352,10 +352,10 @@ void main() { {required int targetRotation, ResolutionSelector? resolutionSelector}) => mockPreview, - createImageCapture: (_) => mockImageCapture, + createImageCapture: (_, __) => mockImageCapture, createRecorder: (_) => mockRecorder, createVideoCapture: (_) => Future.value(mockVideoCapture), - createImageAnalysis: (_) => mockImageAnalysis, + createImageAnalysis: (_, __) => mockImageAnalysis, createResolutionStrategy: ( {bool highestAvailable = false, Size? boundSize, @@ -438,12 +438,18 @@ void main() { Preview.detached( targetRotation: targetRotation, resolutionSelector: resolutionSelector), - createImageCapture: (ResolutionSelector? resolutionSelector) => - ImageCapture.detached(resolutionSelector: resolutionSelector), + createImageCapture: + (ResolutionSelector? resolutionSelector, int? targetRotation) => + ImageCapture.detached( + resolutionSelector: resolutionSelector, + targetRotation: targetRotation), createRecorder: (_) => mockRecorder, createVideoCapture: (_) => Future.value(mockVideoCapture), - createImageAnalysis: (ResolutionSelector? resolutionSelector) => - ImageAnalysis.detached(resolutionSelector: resolutionSelector), + createImageAnalysis: + (ResolutionSelector? resolutionSelector, int? targetRotation) => + ImageAnalysis.detached( + resolutionSelector: resolutionSelector, + targetRotation: targetRotation), createResolutionStrategy: ( {bool highestAvailable = false, Size? boundSize, int? fallbackRule}) { if (highestAvailable) { @@ -586,11 +592,11 @@ void main() { {required int targetRotation, ResolutionSelector? resolutionSelector}) => mockPreview, - createImageCapture: (_) => mockImageCapture, + createImageCapture: (_, __) => mockImageCapture, createRecorder: (QualitySelector? qualitySelector) => Recorder.detached(qualitySelector: qualitySelector), createVideoCapture: (_) => Future.value(mockVideoCapture), - createImageAnalysis: (_) => mockImageAnalysis, + createImageAnalysis: (_, __) => mockImageAnalysis, createResolutionStrategy: ( {bool highestAvailable = false, Size? boundSize, @@ -668,50 +674,51 @@ void main() { expect(camera.recorder!.qualitySelector, isNull); }); - test( - 'createCamera properly sets target rotation from preset sensor orientation for all use cases', - () async { - final FakeAndroidCameraCameraX camera = - FakeAndroidCameraCameraX(shouldCreateDetachedObjectForTesting: true); - final MockProcessCameraProvider mockProcessCameraProvider = - MockProcessCameraProvider(); - const CameraLensDirection testLensDirection = CameraLensDirection.back; - const int testSensorOrientation = 270; - final int expectedTargetRotation = - camera.getTargetRotation(testSensorOrientation); - 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; - - await camera.createCamera(testCameraDescription, ResolutionPreset.low, - enableAudio: enableAudio); - - // Test non-video use cases. - expect(camera.preview!.targetRotation, equals(expectedTargetRotation)); - expect(camera.imageCapture!.targetRotation, equals(expectedTargetRotation)); - expect( - camera.imageAnalysis!.targetRotation, equals(expectedTargetRotation)); - - // Test video use case. - verify(camera.videoCapture!.setTargetRotation(expectedTargetRotation)); - }); +// tODO: fix + // test( + // 'createCamera properly sets target rotation from preset sensor orientation for all use cases', + // () async { + // final FakeAndroidCameraCameraX camera = + // FakeAndroidCameraCameraX(shouldCreateDetachedObjectForTesting: true); + // final MockProcessCameraProvider mockProcessCameraProvider = + // MockProcessCameraProvider(); + // const CameraLensDirection testLensDirection = CameraLensDirection.back; + // const int testSensorOrientation = 270; + // final int expectedTargetRotation = + // camera.getTargetRotation(testSensorOrientation); + // 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; + + // await camera.createCamera(testCameraDescription, ResolutionPreset.low, + // enableAudio: enableAudio); + + // // Test non-video use cases. + // expect(camera.preview!.targetRotation, equals(expectedTargetRotation)); + // expect(camera.imageCapture!.targetRotation, equals(expectedTargetRotation)); + // expect( + // camera.imageAnalysis!.targetRotation, equals(expectedTargetRotation)); + + // // Test video use case. + // verify(camera.videoCapture!.setTargetRotation(expectedTargetRotation)); + // }); test( 'initializeCamera throws a CameraException when createCamera has not been called before initializedCamera', @@ -766,10 +773,10 @@ void main() { {required int targetRotation, ResolutionSelector? resolutionSelector}) => mockPreview, - createImageCapture: (_) => mockImageCapture, + createImageCapture: (_, __) => mockImageCapture, createRecorder: (QualitySelector? qualitySelector) => MockRecorder(), createVideoCapture: (_) => Future.value(MockVideoCapture()), - createImageAnalysis: (_) => mockImageAnalysis, + createImageAnalysis: (_, __) => mockImageAnalysis, createResolutionStrategy: ( {bool highestAvailable = false, Size? boundSize, From e7fa2c21bfc8e7fe487950bf01efc39aca7259b2 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Mon, 27 Nov 2023 15:49:22 -0800 Subject: [PATCH 13/29] Fix plugin dart tests --- .../lib/src/android_camera_camerax.dart | 9 +- .../lib/src/camerax_proxy.dart | 16 ++ .../test/android_camera_camerax_test.dart | 226 ++++++++++++++---- 3 files changed, 201 insertions(+), 50 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 8bd48d68445..45c8276c888 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 @@ -243,7 +243,7 @@ class AndroidCameraCameraX extends CameraPlatform { // Retrieve target rotation for UseCases. final int targetRotation = - getTargetRotation(cameraDescription.sensorOrientation); + _getTargetRotation(cameraDescription.sensorOrientation); preview = proxy.createPreview( targetRotation: targetRotation, resolutionSelector: presetResolutionSelector); @@ -394,9 +394,9 @@ class AndroidCameraCameraX extends CameraPlatform { @override Future unlockCaptureOrientation(int cameraId) async { final int currentPhotoOrientation = - getTargetRotation(await DeviceOrientationManager.getPhotoOrientation()); + _getTargetRotation(await proxy.getPhotoOrientation()); final int currentVideoOrientation = - getTargetRotation(await DeviceOrientationManager.getVideoOrientation()); + _getTargetRotation(await proxy.getVideoOrientation()); /// Update UseCases to use current device orientation. await imageAnalysis!.setTargetRotation(currentPhotoOrientation); @@ -853,8 +853,7 @@ class AndroidCameraCameraX extends CameraPlatform { /// Returns [Surface] target rotation constant that maps to specified sensor /// orientation. - @visibleForTesting - int getTargetRotation(int sensorOrientation) { + int _getTargetRotation(int sensorOrientation) { switch (sensorOrientation) { case 90: return Surface.ROTATION_90; diff --git a/packages/camera/camera_android_camerax/lib/src/camerax_proxy.dart b/packages/camera/camera_android_camerax/lib/src/camerax_proxy.dart index c4824347495..517ceb1d110 100644 --- a/packages/camera/camera_android_camerax/lib/src/camerax_proxy.dart +++ b/packages/camera/camera_android_camerax/lib/src/camerax_proxy.dart @@ -48,6 +48,8 @@ class CameraXProxy { this.startListeningForDeviceOrientationChange = _startListeningForDeviceOrientationChange, this.setPreviewSurfaceProvider = _setPreviewSurfaceProvider, + this.getPhotoOrientation = _getPhotoOrientation, + this.getVideoOrientation = _getVideoOrientation, }); /// Returns a [ProcessCameraProvider] instance. @@ -131,6 +133,12 @@ class CameraXProxy { /// the ID corresponding to the surface it will provide. Future Function(Preview preview) setPreviewSurfaceProvider; + /// Retrieves current photo orientation. + Future Function() getPhotoOrientation; + + /// Retrieves current video orientation. + Future Function() getVideoOrientation; + static Future _getProcessCameraProvider() { return ProcessCameraProvider.getInstance(); } @@ -226,4 +234,12 @@ class CameraXProxy { static Future _setPreviewSurfaceProvider(Preview preview) async { return preview.setSurfaceProvider(); } + + static Future _getPhotoOrientation() async { + return DeviceOrientationManager.getPhotoOrientation(); + } + + static Future _getVideoOrientation() async { + return DeviceOrientationManager.getVideoOrientation(); + } } 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 c105ab1ec16..b413790a74e 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 @@ -32,6 +32,7 @@ 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/surface.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'; @@ -674,51 +675,105 @@ void main() { expect(camera.recorder!.qualitySelector, isNull); }); -// tODO: fix - // test( - // 'createCamera properly sets target rotation from preset sensor orientation for all use cases', - // () async { - // final FakeAndroidCameraCameraX camera = - // FakeAndroidCameraCameraX(shouldCreateDetachedObjectForTesting: true); - // final MockProcessCameraProvider mockProcessCameraProvider = - // MockProcessCameraProvider(); - // const CameraLensDirection testLensDirection = CameraLensDirection.back; - // const int testSensorOrientation = 270; - // final int expectedTargetRotation = - // camera.getTargetRotation(testSensorOrientation); - // 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; - - // await camera.createCamera(testCameraDescription, ResolutionPreset.low, - // enableAudio: enableAudio); - - // // Test non-video use cases. - // expect(camera.preview!.targetRotation, equals(expectedTargetRotation)); - // expect(camera.imageCapture!.targetRotation, equals(expectedTargetRotation)); - // expect( - // camera.imageAnalysis!.targetRotation, equals(expectedTargetRotation)); - - // // Test video use case. - // verify(camera.videoCapture!.setTargetRotation(expectedTargetRotation)); - // }); + test( + 'createCamera properly sets target rotation from preset sensor orientation for all use cases', + () async { + final AndroidCameraCameraX camera = AndroidCameraCameraX(); + const CameraLensDirection testLensDirection = CameraLensDirection.back; + const bool enableAudio = true; + final List validSensorOrientations = [90, 180, 270, 0]; + + final MockProcessCameraProvider mockProcessCameraProvider = + MockProcessCameraProvider(); + final MockCamera mockCamera = MockCamera(); + final MockCameraInfo mockCameraInfo = MockCameraInfo(); + final MockCameraSelector mockCameraSelector = MockCameraSelector(); + final MockVideoCapture mockVideoCapture = MockVideoCapture(); + + // Tell plugin to create mock/detached objects for testing createCamera + // as needed. + camera.proxy = CameraXProxy( + getProcessCameraProvider: () => + Future.value(mockProcessCameraProvider), + createPreview: ( + {required int targetRotation, + ResolutionSelector? resolutionSelector}) => + Preview.detached( + targetRotation: targetRotation, + resolutionSelector: resolutionSelector), + createImageCapture: + (ResolutionSelector? resolutionSelector, int? targetRotation) => + ImageCapture.detached( + resolutionSelector: resolutionSelector, + targetRotation: targetRotation), + createImageAnalysis: + (ResolutionSelector? resolutionSelector, int? targetRotation) => + ImageAnalysis.detached( + resolutionSelector: resolutionSelector, + targetRotation: targetRotation), + requestCameraPermissions: (_) => Future.value(), + createCameraStateObserver: (void Function(Object) onChanged) => + Observer.detached(onChanged: onChanged), + createResolutionSelector: (_) => MockResolutionSelector(), + createCameraSelector: (_) => mockCameraSelector, + createRecorder: (_) => MockRecorder(), + createVideoCapture: (_) => Future.value(mockVideoCapture), + createQualitySelector: ( + {required VideoQuality videoQuality, + required FallbackStrategy fallbackStrategy}) => + MockQualitySelector(), + startListeningForDeviceOrientationChange: (_, __) {}, + createResolutionStrategy: ( + {bool highestAvailable = false, + Size? boundSize, + int? fallbackRule}) => + MockResolutionStrategy(), + createFallbackStrategy: ( + {required VideoQuality quality, + required VideoResolutionFallbackRule fallbackRule}) => + MockFallbackStrategy(), + setPreviewSurfaceProvider: (_) => Future.value( + 5), // 5 is a random Flutter SurfaceTexture ID for testing}, + ); + + when(mockProcessCameraProvider.bindToLifecycle(mockCameraSelector, any)) + .thenAnswer((_) async => mockCamera); + when(mockCamera.getCameraInfo()).thenAnswer((_) async => mockCameraInfo); + when(mockCameraInfo.getCameraState()) + .thenAnswer((_) async => MockLiveCameraState()); + camera.processCameraProvider = mockProcessCameraProvider; + + for (final int sensorOrientation in validSensorOrientations) { + int? expectedTargetRotation; + switch (sensorOrientation) { + case 90: + expectedTargetRotation = Surface.ROTATION_90; + case 180: + expectedTargetRotation = Surface.ROTATION_180; + case 270: + expectedTargetRotation = Surface.ROTATION_270; + case 0: + expectedTargetRotation = Surface.ROTATION_0; + } + final CameraDescription testCameraDescription = CameraDescription( + name: 'cameraName', + lensDirection: testLensDirection, + sensorOrientation: sensorOrientation); + + await camera.createCamera(testCameraDescription, ResolutionPreset.low, + enableAudio: enableAudio); + + // Test non-video use cases. + expect(camera.preview!.targetRotation, equals(expectedTargetRotation)); + expect( + camera.imageCapture!.targetRotation, equals(expectedTargetRotation)); + expect( + camera.imageAnalysis!.targetRotation, equals(expectedTargetRotation)); + + // Test video use case. + verify(camera.videoCapture!.setTargetRotation(expectedTargetRotation!)); + } + }); test( 'initializeCamera throws a CameraException when createCamera has not been called before initializedCamera', @@ -1779,6 +1834,9 @@ void main() { // Set directly for test versus calling createCamera. camera.imageAnalysis = mockImageAnalysis; + // Tell plugin to create a detached analyzer for testing purposes. + camera.proxy = CameraXProxy(createAnalyzer: (_) => MockAnalyzer()); + final StreamSubscription imageStreamSubscription = camera .onStreamedFrameAvailable(cameraId) .listen((CameraImageData data) {}); @@ -1787,4 +1845,82 @@ void main() { verify(mockImageAnalysis.clearAnalyzer()); }); + + test( + 'lockCaptureOrientation sets capture-related use case target rotations to correct orientation', + () async { + final AndroidCameraCameraX camera = AndroidCameraCameraX(); + const int cameraId = 44; + + final MockImageAnalysis mockImageAnalysis = MockImageAnalysis(); + final MockImageCapture mockImageCapture = MockImageCapture(); + final MockVideoCapture mockVideoCapture = MockVideoCapture(); + + // Set directly for test versus calling createCamera. + camera.imageAnalysis = mockImageAnalysis; + camera.imageCapture = mockImageCapture; + camera.videoCapture = mockVideoCapture; + + for (final DeviceOrientation orientation in DeviceOrientation.values) { + int? targetRotation; + switch (orientation) { + case DeviceOrientation.portraitUp: + targetRotation = Surface.ROTATION_0; + case DeviceOrientation.landscapeLeft: + targetRotation = Surface.ROTATION_90; + case DeviceOrientation.portraitDown: + targetRotation = Surface.ROTATION_180; + case DeviceOrientation.landscapeRight: + targetRotation = Surface.ROTATION_270; + } + + await camera.lockCaptureOrientation(cameraId, orientation); + + verify(mockImageAnalysis.setTargetRotation(targetRotation)); + verify(mockImageCapture.setTargetRotation(targetRotation)); + verify(mockVideoCapture.setTargetRotation(targetRotation)); + } + }); + + test( + 'unlockCaptureOrientation sets capture-related use case target rotations to current photo/video orientation', + () async { + final AndroidCameraCameraX camera = AndroidCameraCameraX(); + const int cameraId = 57; + final List validSensorOrientations = [90, 180, 270, 0]; + + final MockImageAnalysis mockImageAnalysis = MockImageAnalysis(); + final MockImageCapture mockImageCapture = MockImageCapture(); + final MockVideoCapture mockVideoCapture = MockVideoCapture(); + + // Set directly for test versus calling createCamera. + camera.imageAnalysis = mockImageAnalysis; + camera.imageCapture = mockImageCapture; + camera.videoCapture = mockVideoCapture; + + for (final int sensorOrientation in validSensorOrientations) { + int? targetRotation; + switch (sensorOrientation) { + case 90: + targetRotation = Surface.ROTATION_90; + case 180: + targetRotation = Surface.ROTATION_180; + case 270: + targetRotation = Surface.ROTATION_270; + case 0: + targetRotation = Surface.ROTATION_0; + } + + // Tell plugin to mock current photo & video orientations. + camera.proxy = CameraXProxy( + getPhotoOrientation: () => Future.value(sensorOrientation), + getVideoOrientation: () => Future.value(sensorOrientation)); + + await camera.unlockCaptureOrientation(cameraId); + + verify(mockImageAnalysis.setTargetRotation(targetRotation)); + verify(mockImageCapture.setTargetRotation(targetRotation)); + verify(mockVideoCapture.setTargetRotation(targetRotation)); + } + }); } From 64e07dea9e30fa284055403dc6987efb3231871d Mon Sep 17 00:00:00 2001 From: camsim99 Date: Mon, 27 Nov 2023 16:22:49 -0800 Subject: [PATCH 14/29] Bump version --- packages/camera/camera_android_camerax/CHANGELOG.md | 4 ++++ packages/camera/camera_android_camerax/pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/camera/camera_android_camerax/CHANGELOG.md b/packages/camera/camera_android_camerax/CHANGELOG.md index 53f295252d5..4354c9cb4cc 100644 --- a/packages/camera/camera_android_camerax/CHANGELOG.md +++ b/packages/camera/camera_android_camerax/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.5.0+24 +* Implements `lockCaptureOrientation` and `unlockCaptureOrientation`. +* Sets the initial target rotation of `UseCase`s to that specified by the `CameraDescription` passed to `createCamera`. + ## 0.5.0+23 * Updates minimum supported SDK version to Flutter 3.10/Dart 3.0. diff --git a/packages/camera/camera_android_camerax/pubspec.yaml b/packages/camera/camera_android_camerax/pubspec.yaml index 07be8469a85..ef29dae798e 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+23 +version: 0.5.0+24 environment: sdk: ">=3.0.0 <4.0.0" From 0e614aa7e93febaf6cad51321c584935afece364 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Mon, 27 Nov 2023 16:30:37 -0800 Subject: [PATCH 15/29] Formatting --- .../camerax/CameraAndroidCameraxPlugin.java | 6 +- .../DeviceOrientationManagerHostApiImpl.java | 38 +- .../camerax/GeneratedCameraXLibrary.java | 948 ++++++++++++------ .../camerax/SystemServicesHostApiImpl.java | 2 - .../DeviceOrientationManagerWrapperTest.java | 11 - .../plugins/camerax/ImageCaptureTest.java | 6 +- .../plugins/camerax/SystemServicesTest.java | 5 - ...roid_camera_camerax_flutter_api_impls.dart | 3 +- .../lib/src/camerax_library.g.dart | 369 ++++--- .../test/test_camerax_library.g.dart | 829 ++++++++++----- 10 files changed, 1427 insertions(+), 790 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 13626070d51..c8046db5af6 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 @@ -72,8 +72,10 @@ public void setUp( systemServicesHostApiImpl = new SystemServicesHostApiImpl(binaryMessenger, instanceManager, context); GeneratedCameraXLibrary.SystemServicesHostApi.setup(binaryMessenger, systemServicesHostApiImpl); - deviceOrientationManagerHostApiImpl = new DeviceOrientationManagerHostApiImpl(binaryMessenger, instanceManager); - GeneratedCameraXLibrary.DeviceOrientationManagerHostApi.setup(binaryMessenger, deviceOrientationManagerHostApiImpl); + deviceOrientationManagerHostApiImpl = + new DeviceOrientationManagerHostApiImpl(binaryMessenger, instanceManager); + GeneratedCameraXLibrary.DeviceOrientationManagerHostApi.setup( + binaryMessenger, deviceOrientationManagerHostApiImpl); GeneratedCameraXLibrary.PreviewHostApi.setup( binaryMessenger, new PreviewHostApiImpl(binaryMessenger, instanceManager, textureRegistry)); imageCaptureHostApiImpl = diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerHostApiImpl.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerHostApiImpl.java index a7e9678485b..21c4288ce45 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerHostApiImpl.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerHostApiImpl.java @@ -5,19 +5,13 @@ package io.flutter.plugins.camerax; import android.app.Activity; -import android.content.Context; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import io.flutter.embedding.engine.systemchannels.PlatformChannel.DeviceOrientation; import io.flutter.plugin.common.BinaryMessenger; import io.flutter.plugins.camerax.CameraPermissionsManager.PermissionsRegistry; -import io.flutter.plugins.camerax.GeneratedCameraXLibrary.CameraPermissionsErrorData; -import io.flutter.plugins.camerax.GeneratedCameraXLibrary.Result; -import io.flutter.plugins.camerax.GeneratedCameraXLibrary.DeviceOrientationManagerFlutterApi; import io.flutter.plugins.camerax.GeneratedCameraXLibrary.DeviceOrientationManagerHostApi; -import java.io.File; -import java.io.IOException; public class DeviceOrientationManagerHostApiImpl implements DeviceOrientationManagerHostApi { private final BinaryMessenger binaryMessenger; @@ -25,17 +19,19 @@ public class DeviceOrientationManagerHostApiImpl implements DeviceOrientationMan @VisibleForTesting public @NonNull CameraXProxy cameraXProxy = new CameraXProxy(); @VisibleForTesting public @Nullable DeviceOrientationManager deviceOrientationManager; - @VisibleForTesting public @NonNull DeviceOrientationManagerFlutterApiImpl deviceOrientationManagerFlutterApiImpl; + + @VisibleForTesting + public @NonNull DeviceOrientationManagerFlutterApiImpl deviceOrientationManagerFlutterApiImpl; private Activity activity; private PermissionsRegistry permissionsRegistry; public DeviceOrientationManagerHostApiImpl( - @NonNull BinaryMessenger binaryMessenger, - @NonNull InstanceManager instanceManager) { + @NonNull BinaryMessenger binaryMessenger, @NonNull InstanceManager instanceManager) { this.binaryMessenger = binaryMessenger; this.instanceManager = instanceManager; - this.deviceOrientationManagerFlutterApiImpl = new DeviceOrientationManagerFlutterApiImpl(binaryMessenger); + this.deviceOrientationManagerFlutterApiImpl = + new DeviceOrientationManagerFlutterApiImpl(binaryMessenger); } public void setActivity(@NonNull Activity activity) { @@ -82,21 +78,23 @@ public void stopListeningForDeviceOrientationChange() { } } -/** todo */ -@Override -public @NonNull Long getPhotoOrientation() { + /** todo */ + @Override + public @NonNull Long getPhotoOrientation() { if (deviceOrientationManager == null) { - throw new NullPointerException("startListeningForDeviceOrientationChange must first be called to subscribe to device orientation changes in order to retrieve the photo orientation."); + throw new NullPointerException( + "startListeningForDeviceOrientationChange must first be called to subscribe to device orientation changes in order to retrieve the photo orientation."); } return Long.valueOf(deviceOrientationManager.getPhotoOrientation()); -} + } -/** todo */ -@Override -public @NonNull Long getVideoOrientation() { + /** todo */ + @Override + public @NonNull Long getVideoOrientation() { if (deviceOrientationManager == null) { - throw new NullPointerException("startListeningForDeviceOrientationChange must first be called to subscribe to device orientation changes in order to retrieve the video orientation."); + throw new NullPointerException( + "startListeningForDeviceOrientationChange must first be called to subscribe to device orientation changes in order to retrieve the video orientation."); } return Long.valueOf(deviceOrientationManager.getVideoOrientation()); -} + } } 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 dbf1ac731a2..acbde9de321 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,17 +1133,17 @@ 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); - @NonNull + @NonNull Long getCameraControl(@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 = @@ -1093,10 +1156,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; } @@ -1117,10 +1180,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraHost ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - Long output = api.getCameraControl((identifierArg == null) ? null : identifierArg.longValue()); + Long output = + api.getCameraControl( + (identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1140,7 +1204,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); @@ -1149,6 +1213,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1188,21 +1253,28 @@ 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); - @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) -> { @@ -1231,7 +1303,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) -> { @@ -1242,8 +1316,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; } @@ -1263,7 +1336,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); @@ -1272,10 +1345,13 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + 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)); @@ -1284,26 +1360,33 @@ public void onCameraError(@NonNull String errorDescriptionArg, @NonNull Reply getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `DeviceOrientationManagerHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable DeviceOrientationManagerHostApi api) { + /** + * Sets up an instance of `DeviceOrientationManagerHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable DeviceOrientationManagerHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.DeviceOrientationManagerHostApi.startListeningForDeviceOrientationChange", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.DeviceOrientationManagerHostApi.startListeningForDeviceOrientationChange", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1312,10 +1395,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable DeviceOrie 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; } @@ -1328,7 +1412,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable DeviceOrie { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.DeviceOrientationManagerHostApi.stopListeningForDeviceOrientationChange", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.DeviceOrientationManagerHostApi.stopListeningForDeviceOrientationChange", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1336,8 +1422,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable DeviceOrie try { api.stopListeningForDeviceOrientationChange(); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1350,7 +1435,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable DeviceOrie { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.DeviceOrientationManagerHostApi.getPhotoOrientation", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.DeviceOrientationManagerHostApi.getPhotoOrientation", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1358,8 +1445,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable DeviceOrie try { Long output = api.getPhotoOrientation(); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1372,7 +1458,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable DeviceOrie { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.DeviceOrientationManagerHostApi.getVideoOrientation", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.DeviceOrientationManagerHostApi.getVideoOrientation", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1380,8 +1468,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable DeviceOrie try { Long output = api.getVideoOrientation(); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1401,7 +1488,7 @@ public DeviceOrientationManagerFlutterApi(@NonNull BinaryMessenger argBinaryMess this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -1410,10 +1497,14 @@ 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.DeviceOrientationManagerFlutterApi.onDeviceOrientationChanged", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.DeviceOrientationManagerFlutterApi.onDeviceOrientationChanged", + getCodec()); channel.send( new ArrayList(Collections.singletonList(orientationArg)), channelReply -> callback.reply(null)); @@ -1449,14 +1540,15 @@ 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); void setTargetRotation(@NonNull Long identifier, @NonNull Long rotation); @@ -1465,7 +1557,7 @@ public interface 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 = @@ -1480,10 +1572,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; } @@ -1496,7 +1592,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) -> { @@ -1504,10 +1602,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; } @@ -1520,7 +1619,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) -> { @@ -1528,8 +1629,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; } @@ -1550,10 +1650,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; } @@ -1575,10 +1676,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PreviewHos Number identifierArg = (Number) args.get(0); Number rotationArg = (Number) args.get(1); try { - api.setTargetRotation((identifierArg == null) ? null : identifierArg.longValue(), (rotationArg == null) ? null : rotationArg.longValue()); + api.setTargetRotation( + (identifierArg == null) ? null : identifierArg.longValue(), + (rotationArg == null) ? null : rotationArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1593,10 +1695,10 @@ 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); void setTargetRotation(@NonNull Long identifier, @NonNull Long rotation); @@ -1605,7 +1707,10 @@ public interface 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 = @@ -1618,10 +1723,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; } @@ -1642,10 +1748,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; } @@ -1658,7 +1764,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable VideoCaptu { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.VideoCaptureHostApi.setTargetRotation", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.VideoCaptureHostApi.setTargetRotation", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1667,10 +1775,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable VideoCaptu Number identifierArg = (Number) args.get(0); Number rotationArg = (Number) args.get(1); try { - api.setTargetRotation((identifierArg == null) ? null : identifierArg.longValue(), (rotationArg == null) ? null : rotationArg.longValue()); + api.setTargetRotation( + (identifierArg == null) ? null : identifierArg.longValue(), + (rotationArg == null) ? null : rotationArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1690,7 +1799,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); @@ -1699,6 +1808,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1711,22 +1821,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 = @@ -1742,10 +1858,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; } @@ -1766,10 +1885,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; } @@ -1782,7 +1902,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) -> { @@ -1790,10 +1912,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; } @@ -1815,10 +1938,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; } @@ -1838,7 +1962,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); @@ -1847,7 +1971,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()); @@ -1859,15 +1988,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<>( @@ -1879,10 +2012,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; } @@ -1902,7 +2035,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); @@ -1911,6 +2044,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1935,7 +2069,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 = @@ -1950,8 +2086,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; } @@ -1974,8 +2109,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; } @@ -1998,8 +2132,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; } @@ -2022,8 +2155,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; } @@ -2043,7 +2175,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); @@ -2052,6 +2184,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2064,7 +2197,11 @@ 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 targetRotation, @Nullable Long flashMode, @Nullable Long resolutionSelectorId); + void create( + @NonNull Long identifier, + @Nullable Long targetRotation, + @Nullable Long flashMode, + @Nullable Long resolutionSelectorId); void setFlashMode(@NonNull Long identifier, @NonNull Long flashMode); @@ -2076,7 +2213,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 = @@ -2092,10 +2232,15 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageCaptu Number flashModeArg = (Number) args.get(2); Number resolutionSelectorIdArg = (Number) args.get(3); try { - api.create((identifierArg == null) ? null : identifierArg.longValue(), (targetRotationArg == null) ? null : targetRotationArg.longValue(), (flashModeArg == null) ? null : flashModeArg.longValue(), (resolutionSelectorIdArg == null) ? null : resolutionSelectorIdArg.longValue()); + api.create( + (identifierArg == null) ? null : identifierArg.longValue(), + (targetRotationArg == null) ? null : targetRotationArg.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; } @@ -2117,10 +2262,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; } @@ -2153,7 +2299,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); @@ -2162,7 +2309,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.ImageCaptureHostApi.setTargetRotation", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.ImageCaptureHostApi.setTargetRotation", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2171,10 +2320,11 @@ public void error(Throwable error) { Number identifierArg = (Number) args.get(0); Number rotationArg = (Number) args.get(1); try { - api.setTargetRotation((identifierArg == null) ? null : identifierArg.longValue(), (rotationArg == null) ? null : rotationArg.longValue()); + api.setTargetRotation( + (identifierArg == null) ? null : identifierArg.longValue(), + (rotationArg == null) ? null : rotationArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2188,7 +2338,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() {} @@ -2216,14 +2367,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<>( @@ -2237,10 +2393,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; } @@ -2255,14 +2413,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<>( @@ -2276,10 +2441,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; } @@ -2294,18 +2465,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) -> { @@ -2315,10 +2493,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; } @@ -2365,7 +2547,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); @@ -2374,7 +2556,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()); @@ -2418,7 +2605,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); @@ -2427,12 +2614,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)); } } @@ -2444,7 +2638,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); @@ -2453,7 +2647,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()); @@ -2465,7 +2664,10 @@ public void create(@NonNull Long identifierArg, @NonNull Double minZoomRatioArg, /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface ImageAnalysisHostApi { - void create(@NonNull Long identifier, @Nullable Long targetRotation, @Nullable Long resolutionSelectorId); + void create( + @NonNull Long identifier, + @Nullable Long targetRotation, + @Nullable Long resolutionSelectorId); void setAnalyzer(@NonNull Long identifier, @NonNull Long analyzerIdentifier); @@ -2477,8 +2679,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<>( @@ -2492,10 +2698,14 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageAnaly Number targetRotationArg = (Number) args.get(1); Number resolutionSelectorIdArg = (Number) args.get(2); try { - api.create((identifierArg == null) ? null : identifierArg.longValue(), (targetRotationArg == null) ? null : targetRotationArg.longValue(), (resolutionSelectorIdArg == null) ? null : resolutionSelectorIdArg.longValue()); + api.create( + (identifierArg == null) ? null : identifierArg.longValue(), + (targetRotationArg == null) ? null : targetRotationArg.longValue(), + (resolutionSelectorIdArg == null) + ? null + : resolutionSelectorIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2517,10 +2727,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; } @@ -2533,7 +2744,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) -> { @@ -2543,8 +2756,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; } @@ -2557,7 +2769,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageAnaly { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.ImageAnalysisHostApi.setTargetRotation", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.ImageAnalysisHostApi.setTargetRotation", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2566,10 +2780,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageAnaly Number identifierArg = (Number) args.get(0); Number rotationArg = (Number) args.get(1); try { - api.setTargetRotation((identifierArg == null) ? null : identifierArg.longValue(), (rotationArg == null) ? null : rotationArg.longValue()); + api.setTargetRotation( + (identifierArg == null) ? null : identifierArg.longValue(), + (rotationArg == null) ? null : rotationArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2590,7 +2805,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 = @@ -2605,8 +2822,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; } @@ -2627,7 +2843,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 = @@ -2642,8 +2860,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; } @@ -2663,7 +2880,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); @@ -2672,7 +2889,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()); @@ -2689,7 +2910,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); @@ -2698,7 +2919,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()); @@ -2741,14 +2964,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 = @@ -2762,10 +2987,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; } @@ -2788,8 +3014,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; } @@ -2811,10 +3036,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; } @@ -2861,7 +3087,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); @@ -2870,7 +3096,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()); @@ -2887,7 +3117,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); @@ -2896,6 +3126,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2904,7 +3135,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()); @@ -2916,7 +3151,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); @@ -2925,7 +3160,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 = @@ -2938,10 +3175,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; } @@ -2964,8 +3201,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; } @@ -2985,7 +3221,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); @@ -2994,7 +3230,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()); @@ -3011,7 +3253,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); @@ -3020,12 +3262,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)); } } @@ -3064,17 +3313,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<>( @@ -3085,13 +3341,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; } @@ -3104,19 +3363,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; } @@ -3131,14 +3395,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<>( @@ -3149,13 +3420,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; } @@ -3170,16 +3447,22 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable FallbackSt /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface CameraControlHostApi { - void enableTorch(@NonNull Long identifier, @NonNull Boolean torch, @NonNull Result result); + void enableTorch( + @NonNull Long identifier, @NonNull Boolean torch, @NonNull Result result); - void setZoomRatio(@NonNull Long identifier, @NonNull Double ratio, @NonNull Result result); + void setZoomRatio( + @NonNull Long identifier, @NonNull Double ratio, @NonNull Result result); /** The codec used by CameraControlHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `CameraControlHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraControlHostApi api) { + /** + * Sets up an instance of `CameraControlHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable CameraControlHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -3204,7 +3487,10 @@ public void error(Throwable error) { } }; - api.enableTorch((identifierArg == null) ? null : identifierArg.longValue(), torchArg, resultCallback); + api.enableTorch( + (identifierArg == null) ? null : identifierArg.longValue(), + torchArg, + resultCallback); }); } else { channel.setMessageHandler(null); @@ -3213,7 +3499,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.CameraControlHostApi.setZoomRatio", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.CameraControlHostApi.setZoomRatio", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3234,7 +3522,10 @@ public void error(Throwable error) { } }; - api.setZoomRatio((identifierArg == null) ? null : identifierArg.longValue(), ratioArg, resultCallback); + api.setZoomRatio( + (identifierArg == null) ? null : identifierArg.longValue(), + ratioArg, + resultCallback); }); } else { channel.setMessageHandler(null); @@ -3250,7 +3541,7 @@ public CameraControlFlutterApi(@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); @@ -3259,6 +3550,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/SystemServicesHostApiImpl.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/SystemServicesHostApiImpl.java index f9ac1f0a0cf..4e0b18069ff 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/SystemServicesHostApiImpl.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/SystemServicesHostApiImpl.java @@ -7,13 +7,11 @@ import android.app.Activity; import android.content.Context; import androidx.annotation.NonNull; -import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import io.flutter.plugin.common.BinaryMessenger; import io.flutter.plugins.camerax.CameraPermissionsManager.PermissionsRegistry; import io.flutter.plugins.camerax.GeneratedCameraXLibrary.CameraPermissionsErrorData; import io.flutter.plugins.camerax.GeneratedCameraXLibrary.Result; -import io.flutter.plugins.camerax.GeneratedCameraXLibrary.SystemServicesFlutterApi; import io.flutter.plugins.camerax.GeneratedCameraXLibrary.SystemServicesHostApi; import java.io.File; import java.io.IOException; diff --git a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/DeviceOrientationManagerWrapperTest.java b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/DeviceOrientationManagerWrapperTest.java index 9dbd09d8254..3fcc3ccb94f 100644 --- a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/DeviceOrientationManagerWrapperTest.java +++ b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/DeviceOrientationManagerWrapperTest.java @@ -5,33 +5,22 @@ 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.mock; -import static org.mockito.Mockito.mockStatic; -import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import android.app.Activity; -import android.content.Context; import io.flutter.embedding.engine.systemchannels.PlatformChannel.DeviceOrientation; import io.flutter.plugin.common.BinaryMessenger; -import io.flutter.plugins.camerax.CameraPermissionsManager.PermissionsRegistry; -import io.flutter.plugins.camerax.CameraPermissionsManager.ResultCallback; import io.flutter.plugins.camerax.DeviceOrientationManager.DeviceOrientationChangeCallback; -import io.flutter.plugins.camerax.GeneratedCameraXLibrary.CameraPermissionsErrorData; -import io.flutter.plugins.camerax.GeneratedCameraXLibrary.Result; import io.flutter.plugins.camerax.GeneratedCameraXLibrary.DeviceOrientationManagerFlutterApi.Reply; -import java.io.File; -import java.io.IOException; import org.junit.Rule; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.mockito.ArgumentMatchers; import org.mockito.Mock; -import org.mockito.MockedStatic; import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; 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 0e80e581eba..591037fd97c 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 @@ -74,7 +74,11 @@ public void create_createsImageCaptureWithCorrectConfiguration() { when(mockCameraXProxy.createImageCaptureBuilder()).thenReturn(mockImageCaptureBuilder); when(mockImageCaptureBuilder.build()).thenReturn(mockImageCapture); - imageCaptureHostApiImpl.create(imageCaptureIdentifier, Long.valueOf(targetRotation), Long.valueOf(flashMode), mockResolutionSelectorId); + imageCaptureHostApiImpl.create( + imageCaptureIdentifier, + Long.valueOf(targetRotation), + Long.valueOf(flashMode), + mockResolutionSelectorId); verify(mockImageCaptureBuilder).setTargetRotation(targetRotation); verify(mockImageCaptureBuilder).setFlashMode(flashMode); diff --git a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/SystemServicesTest.java b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/SystemServicesTest.java index 98115f9c1c5..3636629e75f 100644 --- a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/SystemServicesTest.java +++ b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/SystemServicesTest.java @@ -6,7 +6,6 @@ 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.mock; import static org.mockito.Mockito.mockStatic; @@ -16,20 +15,16 @@ import android.app.Activity; import android.content.Context; -import io.flutter.embedding.engine.systemchannels.PlatformChannel.DeviceOrientation; import io.flutter.plugin.common.BinaryMessenger; import io.flutter.plugins.camerax.CameraPermissionsManager.PermissionsRegistry; import io.flutter.plugins.camerax.CameraPermissionsManager.ResultCallback; -import io.flutter.plugins.camerax.DeviceOrientationManager.DeviceOrientationChangeCallback; import io.flutter.plugins.camerax.GeneratedCameraXLibrary.CameraPermissionsErrorData; import io.flutter.plugins.camerax.GeneratedCameraXLibrary.Result; -import io.flutter.plugins.camerax.GeneratedCameraXLibrary.SystemServicesFlutterApi.Reply; import java.io.File; import java.io.IOException; import org.junit.Rule; import org.junit.Test; import org.mockito.ArgumentCaptor; -import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.MockedStatic; import org.mockito.junit.MockitoJUnit; diff --git a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax_flutter_api_impls.dart b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax_flutter_api_impls.dart index 59838e62549..24f159a1eab 100644 --- a/packages/camera/camera_android_camerax/lib/src/android_camera_camerax_flutter_api_impls.dart +++ b/packages/camera/camera_android_camerax/lib/src/android_camera_camerax_flutter_api_impls.dart @@ -179,7 +179,8 @@ class AndroidCameraXCameraFlutterApis { processCameraProviderFlutterApiImpl); CameraFlutterApi.setup(cameraFlutterApiImpl); SystemServicesFlutterApi.setup(systemServicesFlutterApiImpl); - DeviceOrientationManagerFlutterApi.setup(deviceOrientationManagerFlutterApiImpl); + DeviceOrientationManagerFlutterApi.setup( + deviceOrientationManagerFlutterApiImpl); CameraStateErrorFlutterApi.setup(cameraStateErrorFlutterApiImpl); CameraStateFlutterApi.setup(cameraStateFlutterApiImpl); PendingRecordingFlutterApi.setup(pendingRecordingFlutterApiImpl); 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 156b84290ed..20c69080bd6 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, @@ -814,7 +824,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, @@ -842,7 +852,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); @@ -860,9 +870,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?; @@ -915,7 +927,8 @@ 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.onCameraError', codec, @@ -925,7 +938,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, @@ -948,12 +961,15 @@ class DeviceOrientationManagerHostApi { static const MessageCodec codec = StandardMessageCodec(); - 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.DeviceOrientationManagerHostApi.startListeningForDeviceOrientationChange', codec, + 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.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', @@ -972,10 +988,10 @@ class DeviceOrientationManagerHostApi { Future stopListeningForDeviceOrientationChange() async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.stopListeningForDeviceOrientationChange', codec, + 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.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', @@ -994,10 +1010,10 @@ class DeviceOrientationManagerHostApi { Future getPhotoOrientation() async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.getPhotoOrientation', codec, + 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.getPhotoOrientation', + 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', @@ -1021,10 +1037,10 @@ class DeviceOrientationManagerHostApi { Future getVideoOrientation() async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.getVideoOrientation', codec, + 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.getVideoOrientation', + 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', @@ -1052,17 +1068,19 @@ abstract class DeviceOrientationManagerFlutterApi { void onDeviceOrientationChanged(String orientation); - static void setup(DeviceOrientationManagerFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(DeviceOrientationManagerFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.DeviceOrientationManagerFlutterApi.onDeviceOrientationChanged', codec, + 'dev.flutter.pigeon.DeviceOrientationManagerFlutterApi.onDeviceOrientationChanged', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.DeviceOrientationManagerFlutterApi.onDeviceOrientationChanged was null.'); + 'Argument for dev.flutter.pigeon.DeviceOrientationManagerFlutterApi.onDeviceOrientationChanged was null.'); final List args = (message as List?)!; final String? arg_orientation = (args[0] as String?); assert(arg_orientation != null, @@ -1090,7 +1108,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); @@ -1108,12 +1126,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', @@ -1161,8 +1181,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', @@ -1210,8 +1229,8 @@ class PreviewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PreviewHostApi.setTargetRotation', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_rotation]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_rotation]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1297,8 +1316,8 @@ class VideoCaptureHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.VideoCaptureHostApi.setTargetRotation', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_rotation]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_rotation]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1321,7 +1340,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, @@ -1331,7 +1351,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, @@ -1354,12 +1374,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', @@ -1405,7 +1430,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?; @@ -1434,8 +1460,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', @@ -1463,7 +1489,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, @@ -1473,7 +1500,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, @@ -1531,7 +1558,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, @@ -1541,7 +1569,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, @@ -1658,7 +1686,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, @@ -1668,7 +1697,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, @@ -1691,12 +1720,17 @@ class ImageCaptureHostApi { static const MessageCodec codec = StandardMessageCodec(); - Future create(int arg_identifier, int? arg_targetRotation, int? arg_flashMode, int? arg_resolutionSelectorId) async { + Future create(int arg_identifier, int? arg_targetRotation, + 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_targetRotation, arg_flashMode, arg_resolutionSelectorId]) as List?; + final List? replyList = await channel.send([ + arg_identifier, + arg_targetRotation, + arg_flashMode, + arg_resolutionSelectorId + ]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1717,8 +1751,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', @@ -1766,8 +1800,8 @@ class ImageCaptureHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ImageCaptureHostApi.setTargetRotation', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_rotation]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_rotation]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1800,7 +1834,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); @@ -1818,12 +1852,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', @@ -1851,12 +1887,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', @@ -1884,12 +1924,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', @@ -1922,7 +1966,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); @@ -1935,7 +1979,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, @@ -1945,12 +1990,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?); @@ -1977,7 +2023,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); @@ -1988,9 +2034,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, @@ -2000,18 +2050,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; }); } @@ -2024,7 +2076,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, @@ -2034,7 +2087,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, @@ -2063,12 +2116,16 @@ class ImageAnalysisHostApi { static const MessageCodec codec = StandardMessageCodec(); - Future create(int arg_identifier, int? arg_targetRotation, int? arg_resolutionSelectorId) async { + Future create(int arg_identifier, int? arg_targetRotation, + 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_targetRotation, arg_resolutionSelectorId]) as List?; + final List? replyList = await channel.send([ + arg_identifier, + arg_targetRotation, + arg_resolutionSelectorId + ]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2085,12 +2142,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', @@ -2133,8 +2192,8 @@ class ImageAnalysisHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ImageAnalysisHostApi.setTargetRotation', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_rotation]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_rotation]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2223,7 +2282,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, @@ -2233,7 +2293,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, @@ -2254,7 +2314,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, @@ -2264,7 +2325,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, @@ -2295,7 +2356,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); @@ -2318,7 +2379,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', @@ -2357,12 +2419,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', @@ -2395,7 +2458,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); @@ -2408,7 +2471,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, @@ -2418,12 +2482,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!); @@ -2441,7 +2506,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, @@ -2451,7 +2517,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, @@ -2470,7 +2536,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, @@ -2551,7 +2617,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, @@ -2561,7 +2628,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, @@ -2588,7 +2655,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, @@ -2598,7 +2666,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, @@ -2612,7 +2680,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; }); } @@ -2638,9 +2707,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); @@ -2658,12 +2727,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', @@ -2680,12 +2755,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', @@ -2718,12 +2794,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', @@ -2755,8 +2835,8 @@ class CameraControlHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraControlHostApi.enableTorch', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_torch]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_torch]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2777,8 +2857,8 @@ class CameraControlHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraControlHostApi.setZoomRatio', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_ratio]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_ratio]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2801,7 +2881,8 @@ abstract class CameraControlFlutterApi { void create(int identifier); - static void setup(CameraControlFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(CameraControlFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraControlFlutterApi.create', codec, @@ -2811,7 +2892,7 @@ abstract class CameraControlFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraControlFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.CameraControlFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != 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 b9989b256b9..b895baab13c 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,24 +420,29 @@ 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); int getCameraControl(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, @@ -389,11 +457,14 @@ abstract class TestCameraHostApi { 'dev.flutter.pigeon.CameraHostApi.getCameraControl', 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.getCameraControl was null.'); + 'Argument for dev.flutter.pigeon.CameraHostApi.getCameraControl was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -421,7 +492,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); @@ -430,29 +501,37 @@ 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); 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]; }); } @@ -462,11 +541,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, @@ -483,10 +565,12 @@ abstract class TestSystemServicesHostApi { } abstract class TestDeviceOrientationManagerHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); - void startListeningForDeviceOrientationChange(bool isFrontFacing, int sensorOrientation); + void startListeningForDeviceOrientationChange( + bool isFrontFacing, int sensorOrientation); void stopListeningForDeviceOrientationChange(); @@ -494,17 +578,22 @@ abstract class TestDeviceOrientationManagerHostApi { int getVideoOrientation(); - static void setup(TestDeviceOrientationManagerHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestDeviceOrientationManagerHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.startListeningForDeviceOrientationChange', codec, + 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.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.DeviceOrientationManagerHostApi.startListeningForDeviceOrientationChange was null.'); + 'Argument for dev.flutter.pigeon.DeviceOrientationManagerHostApi.startListeningForDeviceOrientationChange was null.'); final List args = (message as List?)!; final bool? arg_isFrontFacing = (args[0] as bool?); assert(arg_isFrontFacing != null, @@ -512,19 +601,24 @@ abstract class TestDeviceOrientationManagerHostApi { final int? arg_sensorOrientation = (args[1] as int?); assert(arg_sensorOrientation != null, 'Argument for dev.flutter.pigeon.DeviceOrientationManagerHostApi.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.DeviceOrientationManagerHostApi.stopListeningForDeviceOrientationChange', codec, + 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.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 []; @@ -533,12 +627,16 @@ abstract class TestDeviceOrientationManagerHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.getPhotoOrientation', codec, + 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.getPhotoOrientation', + 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 = api.getPhotoOrientation(); return [output]; @@ -547,12 +645,16 @@ abstract class TestDeviceOrientationManagerHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.getVideoOrientation', codec, + 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.getVideoOrientation', + 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 = api.getVideoOrientation(); return [output]; @@ -577,7 +679,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); @@ -586,7 +688,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); @@ -599,17 +702,21 @@ abstract class TestPreviewHostApi { void setTargetRotation(int identifier, int rotation); - 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, @@ -626,11 +733,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, @@ -642,12 +752,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 []; @@ -659,11 +773,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, @@ -678,11 +795,14 @@ abstract class TestPreviewHostApi { 'dev.flutter.pigeon.PreviewHostApi.setTargetRotation', 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.setTargetRotation was null.'); + 'Argument for dev.flutter.pigeon.PreviewHostApi.setTargetRotation was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -699,7 +819,8 @@ 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); @@ -708,17 +829,21 @@ abstract class TestVideoCaptureHostApi { void setTargetRotation(int identifier, int rotation); - 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, @@ -733,11 +858,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, @@ -752,11 +880,14 @@ abstract class TestVideoCaptureHostApi { 'dev.flutter.pigeon.VideoCaptureHostApi.setTargetRotation', 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.setTargetRotation was null.'); + 'Argument for dev.flutter.pigeon.VideoCaptureHostApi.setTargetRotation was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -773,10 +904,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); @@ -784,17 +917,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, @@ -802,7 +939,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 []; }); } @@ -812,11 +950,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, @@ -828,14 +969,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, @@ -850,11 +995,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, @@ -871,22 +1019,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, @@ -900,7 +1053,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); @@ -911,17 +1065,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, @@ -936,11 +1094,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, @@ -955,11 +1116,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, @@ -974,11 +1138,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, @@ -992,10 +1159,12 @@ 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? targetRotation, int? flashMode, int? resolutionSelectorId); + void create(int identifier, int? targetRotation, int? flashMode, + int? resolutionSelectorId); void setFlashMode(int identifier, int flashMode); @@ -1003,17 +1172,21 @@ abstract class TestImageCaptureHostApi { void setTargetRotation(int identifier, int rotation); - 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, @@ -1021,7 +1194,8 @@ abstract class TestImageCaptureHostApi { final int? arg_targetRotation = (args[1] as int?); final int? arg_flashMode = (args[2] as int?); final int? arg_resolutionSelectorId = (args[3] as int?); - api.create(arg_identifier!, arg_targetRotation, arg_flashMode, arg_resolutionSelectorId); + api.create(arg_identifier!, arg_targetRotation, arg_flashMode, + arg_resolutionSelectorId); return []; }); } @@ -1031,11 +1205,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, @@ -1053,11 +1230,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, @@ -1072,11 +1252,14 @@ abstract class TestImageCaptureHostApi { 'dev.flutter.pigeon.ImageCaptureHostApi.setTargetRotation', 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.setTargetRotation was null.'); + 'Argument for dev.flutter.pigeon.ImageCaptureHostApi.setTargetRotation was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1107,7 +1290,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); @@ -1116,22 +1299,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, @@ -1147,29 +1336,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 []; }); } @@ -1178,22 +1374,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, @@ -1204,7 +1405,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 []; }); } @@ -1213,7 +1415,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? targetRotation, int? resolutionSelectorId); @@ -1224,24 +1427,29 @@ abstract class TestImageAnalysisHostApi { void setTargetRotation(int identifier, int rotation); - 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, 'Argument for dev.flutter.pigeon.ImageAnalysisHostApi.create was null, expected non-null int.'); final int? arg_targetRotation = (args[1] as int?); final int? arg_resolutionSelectorId = (args[2] as int?); - api.create(arg_identifier!, arg_targetRotation, arg_resolutionSelectorId); + api.create( + arg_identifier!, arg_targetRotation, arg_resolutionSelectorId); return []; }); } @@ -1251,11 +1459,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, @@ -1273,11 +1484,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, @@ -1292,11 +1506,14 @@ abstract class TestImageAnalysisHostApi { 'dev.flutter.pigeon.ImageAnalysisHostApi.setTargetRotation', 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.setTargetRotation was null.'); + 'Argument for dev.flutter.pigeon.ImageAnalysisHostApi.setTargetRotation was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1313,22 +1530,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, @@ -1342,22 +1564,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, @@ -1385,7 +1612,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); @@ -1394,7 +1621,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); @@ -1403,17 +1631,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, @@ -1431,11 +1663,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, @@ -1450,16 +1685,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!); @@ -1471,24 +1710,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, @@ -1503,11 +1747,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, @@ -1538,9 +1785,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); @@ -1549,33 +1796,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 []; }); } @@ -1585,19 +1840,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]; }); } @@ -1606,30 +1866,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!); @@ -1641,24 +1910,29 @@ abstract class TestFallbackStrategyHostApi { } abstract class TestCameraControlHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); Future enableTorch(int identifier, bool torch); Future setZoomRatio(int identifier, double ratio); - static void setup(TestCameraControlHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestCameraControlHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraControlHostApi.enableTorch', 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.CameraControlHostApi.enableTorch was null.'); + 'Argument for dev.flutter.pigeon.CameraControlHostApi.enableTorch was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1676,11 +1950,14 @@ abstract class TestCameraControlHostApi { 'dev.flutter.pigeon.CameraControlHostApi.setZoomRatio', 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.CameraControlHostApi.setZoomRatio was null.'); + 'Argument for dev.flutter.pigeon.CameraControlHostApi.setZoomRatio was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, From 00879d2298b9d17b22edd542da03e8cddbb82ab9 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Tue, 5 Dec 2023 16:41:22 -0800 Subject: [PATCH 16/29] 1: debugging orientation and doing some wrapping --- .../camerax/DeviceOrientationManager.java | 26 +- .../DeviceOrientationManagerHostApiImpl.java | 46 +- .../camerax/GeneratedCameraXLibrary.java | 960 ++++++------------ .../lib/src/android_camera_camerax.dart | 108 +- .../lib/src/camerax_library.g.dart | 373 +++---- .../lib/src/camerax_proxy.dart | 27 +- .../lib/src/device_orientation_manager.dart | 38 +- .../pigeons/camerax_library.dart | 5 +- .../test/android_camera_camerax_test.dart | 367 ++++--- .../test/device_orientation_manager_test.dart | 60 +- ...device_orientation_manager_test.mocks.dart | 8 +- .../test/test_camerax_library.g.dart | 847 ++++++--------- 12 files changed, 1204 insertions(+), 1661 deletions(-) diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManager.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManager.java index 67cac560db4..7158e177703 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManager.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManager.java @@ -19,6 +19,8 @@ import io.flutter.embedding.engine.systemchannels.PlatformChannel; import io.flutter.embedding.engine.systemchannels.PlatformChannel.DeviceOrientation; +import android.util.Log; + /** * Support class to help to determine the media orientation based on the orientation of the device. */ @@ -114,26 +116,40 @@ public int getPhotoOrientation(@Nullable PlatformChannel.DeviceOrientation orien orientation = getUIOrientation(); } + Log.e("CAMILLE", "----------------------------------------------------------"); + + Log.e("CAMILLE SENSOR ORIENTATION", Integer.toString(sensorOrientation)); + Log.e("CAMILLE ORIENTATION", orientation.toString()); + Log.e("CAMILLE ISFRONTFACING", isFrontFacing ? "true":"false"); + switch (orientation) { case PORTRAIT_UP: - angle = 90; + angle = isFrontFacing ? 180 : 0; break; case PORTRAIT_DOWN: - angle = 270; + angle = isFrontFacing ? 0 : 180; break; case LANDSCAPE_LEFT: - angle = isFrontFacing ? 180 : 0; + angle = isFrontFacing ? 90 : 270; // isFrontFacing ? 270 : 90; break; case LANDSCAPE_RIGHT: - angle = isFrontFacing ? 0 : 180; + angle = isFrontFacing ? 270 : 90; // isFrontFacing ? 90 : 270; break; } + Log.e("CAMILLE ANGLE", Integer.toString(angle)); + + int ans = (angle + sensorOrientation + 270) % 360; + + Log.e("CAMILLE ANS", Integer.toString(ans)); + Log.e("CAMILLE", "----------------------------------------------------------"); + // Sensor orientation is 90 for most devices, or 270 for some devices (eg. Nexus 5X). // This has to be taken into account so the JPEG is rotated properly. // For devices with orientation of 90, this simply returns the mapping from ORIENTATIONS. // For devices with orientation of 270, the JPEG is rotated 180 degrees instead. - return (angle + sensorOrientation + 270) % 360; + // return ans; + return 180; } /** diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerHostApiImpl.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerHostApiImpl.java index 21c4288ce45..ea4b69af0fd 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerHostApiImpl.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerHostApiImpl.java @@ -13,6 +13,8 @@ import io.flutter.plugins.camerax.CameraPermissionsManager.PermissionsRegistry; import io.flutter.plugins.camerax.GeneratedCameraXLibrary.DeviceOrientationManagerHostApi; +import android.util.Log; + public class DeviceOrientationManagerHostApiImpl implements DeviceOrientationManagerHostApi { private final BinaryMessenger binaryMessenger; private final InstanceManager instanceManager; @@ -54,6 +56,7 @@ public void startListeningForDeviceOrientationChange( isFrontFacing, sensorOrientation.intValue(), (DeviceOrientation newOrientation) -> { + Log.e("CAMILLE HI", serializeDeviceOrientation(newOrientation)); deviceOrientationManagerFlutterApiImpl.sendDeviceOrientationChangedEvent( serializeDeviceOrientation(newOrientation), reply -> {}); }); @@ -65,6 +68,25 @@ String serializeDeviceOrientation(DeviceOrientation orientation) { return orientation.toString(); } + DeviceOrientation deserializeDeviceOrientationString(@Nullable String orientation) { + if (orientation == null) { + return null; + } + switch(orientation) { + case "LANDSCAPE_LEFT": + return DeviceOrientation.LANDSCAPE_LEFT; + case "LANDSCAPE_RIGHT": + return DeviceOrientation.LANDSCAPE_RIGHT; + case "PORTRAIT_DOWN": + return DeviceOrientation.PORTRAIT_DOWN; + case "PORTRAIT_UP": + return DeviceOrientation.PORTRAIT_UP; + default: + throw new IllegalArgumentException( + "Specified device orientation is unspecified."); + } + } + /** * Tells the {@code deviceOrientationManager} to stop listening for orientation updates. * @@ -78,23 +100,35 @@ public void stopListeningForDeviceOrientationChange() { } } - /** todo */ + /** + * Returns device's photo orientation in degrees based on the sensor orientation and + * last known UI orientation. + */ @Override - public @NonNull Long getPhotoOrientation() { + public @NonNull Long getPhotoOrientation(@Nullable String orientation) { if (deviceOrientationManager == null) { throw new NullPointerException( "startListeningForDeviceOrientationChange must first be called to subscribe to device orientation changes in order to retrieve the photo orientation."); } - return Long.valueOf(deviceOrientationManager.getPhotoOrientation()); + if (orientation == null) { + return Long.valueOf(deviceOrientationManager.getPhotoOrientation()); + } + return Long.valueOf(deviceOrientationManager.getPhotoOrientation(deserializeDeviceOrientationString(orientation))); } - /** todo */ + /** + * Returns device's video orientation in clockwise degrees based on the sensor orientation + * and last known UI orientation. + */ @Override - public @NonNull Long getVideoOrientation() { + public @NonNull Long getVideoOrientation(@Nullable String orientation) { if (deviceOrientationManager == null) { throw new NullPointerException( "startListeningForDeviceOrientationChange must first be called to subscribe to device orientation changes in order to retrieve the video orientation."); } - return Long.valueOf(deviceOrientationManager.getVideoOrientation()); + if (orientation == null) { + return Long.valueOf(deviceOrientationManager.getVideoOrientation()); + } + return Long.valueOf(deviceOrientationManager.getVideoOrientation(deserializeDeviceOrientationString(orientation))); } } 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 acbde9de321..9d1ccccac22 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,12 +109,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), @@ -130,7 +134,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), @@ -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,9 @@ 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; } } @@ -479,7 +469,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; @@ -540,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(); @@ -548,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<>( @@ -565,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; } @@ -586,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 = @@ -603,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; } @@ -623,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); @@ -632,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<>( @@ -645,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) -> { @@ -678,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; } @@ -703,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; } @@ -720,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) -> { @@ -730,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; } @@ -755,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; } @@ -778,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); @@ -787,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<>( @@ -802,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<>( @@ -827,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; } @@ -853,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; } @@ -878,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); @@ -887,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()); @@ -903,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); @@ -923,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) -> { @@ -961,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) -> { @@ -971,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; } @@ -988,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) -> { @@ -1000,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; } @@ -1021,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) -> { @@ -1032,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; } @@ -1050,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) -> { @@ -1061,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; } @@ -1077,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) -> { @@ -1089,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; } @@ -1109,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); @@ -1118,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)); @@ -1133,17 +1070,17 @@ 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); - @NonNull + @NonNull Long getCameraControl(@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 = @@ -1156,10 +1093,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; } @@ -1180,11 +1117,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraHost ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - Long output = - api.getCameraControl( - (identifierArg == null) ? null : identifierArg.longValue()); + Long output = api.getCameraControl((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1204,7 +1140,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); @@ -1213,7 +1149,6 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1253,28 +1188,21 @@ 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); - @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) -> { @@ -1303,9 +1231,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) -> { @@ -1316,7 +1242,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; } @@ -1336,7 +1263,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); @@ -1345,13 +1272,10 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - 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)); @@ -1360,33 +1284,26 @@ public void onCameraError(@NonNull String errorDescriptionArg, @NonNull Reply getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `DeviceOrientationManagerHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable DeviceOrientationManagerHostApi api) { + /**Sets up an instance of `DeviceOrientationManagerHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable DeviceOrientationManagerHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.DeviceOrientationManagerHostApi.startListeningForDeviceOrientationChange", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.DeviceOrientationManagerHostApi.startListeningForDeviceOrientationChange", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1395,11 +1312,10 @@ static void setup( 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; } @@ -1412,9 +1328,7 @@ static void setup( { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.DeviceOrientationManagerHostApi.stopListeningForDeviceOrientationChange", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.DeviceOrientationManagerHostApi.stopListeningForDeviceOrientationChange", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1422,7 +1336,8 @@ static void setup( try { api.stopListeningForDeviceOrientationChange(); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1435,17 +1350,18 @@ static void setup( { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.DeviceOrientationManagerHostApi.getPhotoOrientation", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.DeviceOrientationManagerHostApi.getPhotoOrientation", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { ArrayList wrapped = new ArrayList(); + ArrayList args = (ArrayList) message; + String orientationArg = (String) args.get(0); try { - Long output = api.getPhotoOrientation(); + Long output = api.getPhotoOrientation(orientationArg); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1458,17 +1374,18 @@ static void setup( { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.DeviceOrientationManagerHostApi.getVideoOrientation", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.DeviceOrientationManagerHostApi.getVideoOrientation", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { ArrayList wrapped = new ArrayList(); + ArrayList args = (ArrayList) message; + String orientationArg = (String) args.get(0); try { - Long output = api.getVideoOrientation(); + Long output = api.getVideoOrientation(orientationArg); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1488,7 +1405,7 @@ public DeviceOrientationManagerFlutterApi(@NonNull BinaryMessenger argBinaryMess this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -1497,14 +1414,10 @@ 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.DeviceOrientationManagerFlutterApi.onDeviceOrientationChanged", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.DeviceOrientationManagerFlutterApi.onDeviceOrientationChanged", getCodec()); channel.send( new ArrayList(Collections.singletonList(orientationArg)), channelReply -> callback.reply(null)); @@ -1540,15 +1453,14 @@ 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); void setTargetRotation(@NonNull Long identifier, @NonNull Long rotation); @@ -1557,7 +1469,7 @@ void create( 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 = @@ -1572,14 +1484,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; } @@ -1592,9 +1500,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) -> { @@ -1602,11 +1508,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; } @@ -1619,9 +1524,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) -> { @@ -1629,7 +1532,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; } @@ -1650,11 +1554,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; } @@ -1676,11 +1579,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PreviewHos Number identifierArg = (Number) args.get(0); Number rotationArg = (Number) args.get(1); try { - api.setTargetRotation( - (identifierArg == null) ? null : identifierArg.longValue(), - (rotationArg == null) ? null : rotationArg.longValue()); + api.setTargetRotation((identifierArg == null) ? null : identifierArg.longValue(), (rotationArg == null) ? null : rotationArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1695,10 +1597,10 @@ 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); void setTargetRotation(@NonNull Long identifier, @NonNull Long rotation); @@ -1707,10 +1609,7 @@ public interface 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 = @@ -1723,11 +1622,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; } @@ -1748,10 +1646,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; } @@ -1764,9 +1662,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable VideoCaptu { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.VideoCaptureHostApi.setTargetRotation", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.VideoCaptureHostApi.setTargetRotation", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1775,11 +1671,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable VideoCaptu Number identifierArg = (Number) args.get(0); Number rotationArg = (Number) args.get(1); try { - api.setTargetRotation( - (identifierArg == null) ? null : identifierArg.longValue(), - (rotationArg == null) ? null : rotationArg.longValue()); + api.setTargetRotation((identifierArg == null) ? null : identifierArg.longValue(), (rotationArg == null) ? null : rotationArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1799,7 +1694,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); @@ -1808,7 +1703,6 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1821,28 +1715,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 = @@ -1858,13 +1746,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; } @@ -1885,11 +1770,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; } @@ -1902,9 +1786,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) -> { @@ -1912,11 +1794,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; } @@ -1938,11 +1819,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; } @@ -1962,7 +1842,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); @@ -1971,12 +1851,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()); @@ -1988,19 +1863,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<>( @@ -2012,10 +1883,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; } @@ -2035,7 +1906,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); @@ -2044,7 +1915,6 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2069,9 +1939,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 = @@ -2086,7 +1954,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; } @@ -2109,7 +1978,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; } @@ -2132,7 +2002,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; } @@ -2155,7 +2026,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; } @@ -2175,7 +2047,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); @@ -2184,7 +2056,6 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2197,11 +2068,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 targetRotation, - @Nullable Long flashMode, - @Nullable Long resolutionSelectorId); + void create(@NonNull Long identifier, @Nullable Long targetRotation, @Nullable Long flashMode, @Nullable Long resolutionSelectorId); void setFlashMode(@NonNull Long identifier, @NonNull Long flashMode); @@ -2213,10 +2080,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 = @@ -2232,15 +2096,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageCaptu Number flashModeArg = (Number) args.get(2); Number resolutionSelectorIdArg = (Number) args.get(3); try { - api.create( - (identifierArg == null) ? null : identifierArg.longValue(), - (targetRotationArg == null) ? null : targetRotationArg.longValue(), - (flashModeArg == null) ? null : flashModeArg.longValue(), - (resolutionSelectorIdArg == null) - ? null - : resolutionSelectorIdArg.longValue()); + api.create((identifierArg == null) ? null : identifierArg.longValue(), (targetRotationArg == null) ? null : targetRotationArg.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; } @@ -2262,11 +2121,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; } @@ -2299,8 +2157,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); @@ -2309,9 +2166,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.ImageCaptureHostApi.setTargetRotation", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.ImageCaptureHostApi.setTargetRotation", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2320,11 +2175,10 @@ public void error(Throwable error) { Number identifierArg = (Number) args.get(0); Number rotationArg = (Number) args.get(1); try { - api.setTargetRotation( - (identifierArg == null) ? null : identifierArg.longValue(), - (rotationArg == null) ? null : rotationArg.longValue()); + api.setTargetRotation((identifierArg == null) ? null : identifierArg.longValue(), (rotationArg == null) ? null : rotationArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2338,8 +2192,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() {} @@ -2367,19 +2220,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<>( @@ -2393,12 +2241,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; } @@ -2413,21 +2259,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<>( @@ -2441,16 +2280,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; } @@ -2465,25 +2298,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) -> { @@ -2493,14 +2319,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; } @@ -2547,7 +2369,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); @@ -2556,12 +2378,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()); @@ -2605,7 +2422,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); @@ -2614,19 +2431,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)); } } @@ -2638,7 +2448,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); @@ -2647,12 +2457,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()); @@ -2664,10 +2469,7 @@ public void create( /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface ImageAnalysisHostApi { - void create( - @NonNull Long identifier, - @Nullable Long targetRotation, - @Nullable Long resolutionSelectorId); + void create(@NonNull Long identifier, @Nullable Long targetRotation, @Nullable Long resolutionSelectorId); void setAnalyzer(@NonNull Long identifier, @NonNull Long analyzerIdentifier); @@ -2679,12 +2481,8 @@ void create( 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<>( @@ -2698,14 +2496,10 @@ static void setup( Number targetRotationArg = (Number) args.get(1); Number resolutionSelectorIdArg = (Number) args.get(2); try { - api.create( - (identifierArg == null) ? null : identifierArg.longValue(), - (targetRotationArg == null) ? null : targetRotationArg.longValue(), - (resolutionSelectorIdArg == null) - ? null - : resolutionSelectorIdArg.longValue()); + api.create((identifierArg == null) ? null : identifierArg.longValue(), (targetRotationArg == null) ? null : targetRotationArg.longValue(), (resolutionSelectorIdArg == null) ? null : resolutionSelectorIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2727,11 +2521,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; } @@ -2744,9 +2537,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) -> { @@ -2756,7 +2547,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; } @@ -2769,9 +2561,7 @@ static void setup( { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.ImageAnalysisHostApi.setTargetRotation", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.ImageAnalysisHostApi.setTargetRotation", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2780,11 +2570,10 @@ static void setup( Number identifierArg = (Number) args.get(0); Number rotationArg = (Number) args.get(1); try { - api.setTargetRotation( - (identifierArg == null) ? null : identifierArg.longValue(), - (rotationArg == null) ? null : rotationArg.longValue()); + api.setTargetRotation((identifierArg == null) ? null : identifierArg.longValue(), (rotationArg == null) ? null : rotationArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2805,9 +2594,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 = @@ -2822,7 +2609,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; } @@ -2843,9 +2631,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 = @@ -2860,7 +2646,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; } @@ -2880,7 +2667,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); @@ -2889,11 +2676,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()); @@ -2910,7 +2693,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); @@ -2919,9 +2702,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()); @@ -2964,16 +2745,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 = @@ -2987,11 +2766,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; } @@ -3014,7 +2792,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; } @@ -3036,11 +2815,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; } @@ -3087,7 +2865,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); @@ -3096,11 +2874,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()); @@ -3117,7 +2891,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); @@ -3126,7 +2900,6 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -3135,11 +2908,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()); @@ -3151,7 +2920,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); @@ -3160,9 +2929,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 = @@ -3175,10 +2942,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; } @@ -3201,7 +2968,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; } @@ -3221,7 +2989,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); @@ -3230,13 +2998,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()); @@ -3253,7 +3015,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); @@ -3262,19 +3024,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)); } } @@ -3313,24 +3068,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 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<>( @@ -3341,16 +3089,13 @@ static void setup( 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; } @@ -3363,24 +3108,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); - 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; } @@ -3395,21 +3135,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 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<>( @@ -3420,19 +3153,13 @@ static void setup( 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; } @@ -3447,22 +3174,16 @@ static void setup( /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface CameraControlHostApi { - void enableTorch( - @NonNull Long identifier, @NonNull Boolean torch, @NonNull Result result); + void enableTorch(@NonNull Long identifier, @NonNull Boolean torch, @NonNull Result result); - void setZoomRatio( - @NonNull Long identifier, @NonNull Double ratio, @NonNull Result result); + void setZoomRatio(@NonNull Long identifier, @NonNull Double ratio, @NonNull Result result); /** The codec used by CameraControlHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `CameraControlHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable CameraControlHostApi api) { + /**Sets up an instance of `CameraControlHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraControlHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -3487,10 +3208,7 @@ public void error(Throwable error) { } }; - api.enableTorch( - (identifierArg == null) ? null : identifierArg.longValue(), - torchArg, - resultCallback); + api.enableTorch((identifierArg == null) ? null : identifierArg.longValue(), torchArg, resultCallback); }); } else { channel.setMessageHandler(null); @@ -3499,9 +3217,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.CameraControlHostApi.setZoomRatio", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.CameraControlHostApi.setZoomRatio", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3522,10 +3238,7 @@ public void error(Throwable error) { } }; - api.setZoomRatio( - (identifierArg == null) ? null : identifierArg.longValue(), - ratioArg, - resultCallback); + api.setZoomRatio((identifierArg == null) ? null : identifierArg.longValue(), ratioArg, resultCallback); }); } else { channel.setMessageHandler(null); @@ -3541,7 +3254,7 @@ public CameraControlFlutterApi(@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); @@ -3550,7 +3263,6 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( 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 45c8276c888..c95a12ac255 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 @@ -157,6 +157,15 @@ class AndroidCameraCameraX extends CameraPlatform { /// set for the camera in use. static const String zoomStateNotSetErrorCode = 'zoomStateNotSet'; + /// Whether or not the capture orientation is locked. + /// + /// Indicates a new target rotation should not be set as it has been locked by + /// [lockCaptureOrientation]. + @visibleForTesting + bool captureOrientationLocked = false; + + DeviceOrientation? lockedOrientation; + /// Returns list of all available cameras and their descriptions. @override Future> availableCameras() async { @@ -241,28 +250,24 @@ class AndroidCameraCameraX extends CameraPlatform { processCameraProvider ??= await proxy.getProcessCameraProvider(); processCameraProvider!.unbindAll(); - // Retrieve target rotation for UseCases. - final int targetRotation = - _getTargetRotation(cameraDescription.sensorOrientation); + // Configure Preview instance. preview = proxy.createPreview( - targetRotation: targetRotation, - resolutionSelector: presetResolutionSelector); + presetResolutionSelector, /* use default target rotation */ null); final int flutterSurfaceTextureId = await proxy.setPreviewSurfaceProvider(preview!); // Configure ImageCapture instance. - imageCapture = - proxy.createImageCapture(presetResolutionSelector, targetRotation); + imageCapture = proxy.createImageCapture( + presetResolutionSelector, /* use default target rotation */ null); // Configure ImageAnalysis instance. // Defaults to YUV_420_888 image format. - imageAnalysis = - proxy.createImageAnalysis(presetResolutionSelector, targetRotation); + imageAnalysis = proxy.createImageAnalysis( + presetResolutionSelector, /* use default target rotation */ null); // Configure VideoCapture and Recorder instances. recorder = proxy.createRecorder(presetQualitySelector); videoCapture = await proxy.createVideoCapture(recorder!); - await videoCapture!.setTargetRotation(targetRotation); // Bind configured UseCases to ProcessCameraProvider instance & mark Preview // instance as bound but not paused. Video capture is bound at first use @@ -381,26 +386,38 @@ class AndroidCameraCameraX extends CameraPlatform { int cameraId, DeviceOrientation orientation, ) async { - final int targetRotation = - _getTargetRotationFromDeviceOrientation(orientation); + captureOrientationLocked = true; + lockedOrientation = orientation; + + // Get rotation for photos and vi + //deos based on orientation. + final int targetPhotoRotation = + _getTargetRotation(await proxy.getPhotoOrientation(orientation)); + + final int targetVideoRotation = + _getTargetRotation(await proxy.getVideoOrientation(orientation)); /// Update UseCases to use target device orientation. - await imageAnalysis!.setTargetRotation(targetRotation); - await imageCapture!.setTargetRotation(targetRotation); - await videoCapture!.setTargetRotation(targetRotation); + await imageCapture!.setTargetRotation(targetPhotoRotation); + await imageAnalysis!.setTargetRotation(targetPhotoRotation); + await videoCapture!.setTargetRotation(targetVideoRotation); } /// Unlocks the capture orientation. @override Future unlockCaptureOrientation(int cameraId) async { + captureOrientationLocked = false; + lockedOrientation = null; + + // Get current orientation for photos and videos. final int currentPhotoOrientation = - _getTargetRotation(await proxy.getPhotoOrientation()); + _getTargetRotation(await proxy.getPhotoOrientation(null)); final int currentVideoOrientation = - _getTargetRotation(await proxy.getVideoOrientation()); + _getTargetRotation(await proxy.getVideoOrientation(null)); /// Update UseCases to use current device orientation. - await imageAnalysis!.setTargetRotation(currentPhotoOrientation); await imageCapture!.setTargetRotation(currentPhotoOrientation); + await imageAnalysis!.setTargetRotation(currentPhotoOrientation); await videoCapture!.setTargetRotation(currentVideoOrientation); } @@ -528,6 +545,7 @@ class AndroidCameraCameraX extends CameraPlatform { /// [cameraId] is not used. @override Future takePicture(int cameraId) async { + // Set flash mode. if (_currentFlashMode != null) { await imageCapture!.setFlashMode(_currentFlashMode!); } else if (torchEnabled) { @@ -535,6 +553,18 @@ class AndroidCameraCameraX extends CameraPlatform { // been enabled. await imageCapture!.setFlashMode(ImageCapture.flashModeOff); } + // Set target rotation to current photo orientation only if capture + // orientation not locked. + if (!captureOrientationLocked) { + // print(await proxy.getPhotoOrientation(null)); + // print(await prox) + await imageCapture!.setTargetRotation( + _getTargetRotation(await proxy.getPhotoOrientation(null))); + } else { + await imageCapture!.setTargetRotation(_getTargetRotation( + await proxy.getPhotoOrientation(lockedOrientation))); + } + final String picturePath = await imageCapture!.takePicture(); return XFile(picturePath); } @@ -617,6 +647,13 @@ class AndroidCameraCameraX extends CameraPlatform { .bindToLifecycle(cameraSelector!, [videoCapture!]); } + // Set target rotation to current video orientation only if capture + // orientation not locked. + if (!captureOrientationLocked) { + await videoCapture!.setTargetRotation( + _getTargetRotation(await proxy.getVideoOrientation(null))); + } + videoOutputPath = await SystemServices.getTempFilePath(videoPrefix, '.temp'); pendingRecording = await recorder!.prepareRecording(videoOutputPath!); @@ -689,7 +726,7 @@ class AndroidCameraCameraX extends CameraPlatform { Stream onStreamedFrameAvailable(int cameraId, {CameraImageStreamOptions? options}) { cameraImageDataStreamController = StreamController( - onListen: () => _onFrameStreamListen(cameraId), + onListen: () => _configureImageAnalysis(cameraId), onCancel: _onFrameStreamCancel, ); return cameraImageDataStreamController!.stream; @@ -718,7 +755,14 @@ class AndroidCameraCameraX extends CameraPlatform { /// Configures the [imageAnalysis] instance for image streaming. Future _configureImageAnalysis(int cameraId) async { - // Create Analyzer that can read image data for image streaming. + // Set target rotation to current photo orientation only if capture + // orientation not locked. + if (!captureOrientationLocked) { + await imageAnalysis!.setTargetRotation( + _getTargetRotation(await proxy.getPhotoOrientation(null))); + } + + // Create and set Analyzer that can read image data for image streaming. final WeakReference weakThis = WeakReference(this); Future analyze(ImageProxy imageProxy) async { @@ -743,7 +787,7 @@ class AndroidCameraCameraX extends CameraPlatform { width: imageProxy.width); weakThis.target!.cameraImageDataStreamController!.add(cameraImageData); - unawaited(imageProxy.close()); + await imageProxy.close(); } final Analyzer analyzer = proxy.createAnalyzer(analyze); @@ -763,12 +807,6 @@ class AndroidCameraCameraX extends CameraPlatform { // Methods for configuring image streaming: - /// The [onListen] callback for the stream controller used for image - /// streaming. - Future _onFrameStreamListen(int cameraId) async { - await _configureImageAnalysis(cameraId); - } - /// The [onCancel] callback for the stream controller used for image /// streaming. /// @@ -869,22 +907,6 @@ class AndroidCameraCameraX extends CameraPlatform { } } - /// Returns [Surface] target rotation constant that maps to specified - /// [DeviceOrientation]. - int _getTargetRotationFromDeviceOrientation( - DeviceOrientation deviceOrientation) { - switch (deviceOrientation) { - case DeviceOrientation.portraitUp: - return Surface.ROTATION_0; - case DeviceOrientation.landscapeLeft: - return Surface.ROTATION_90; - case DeviceOrientation.portraitDown: - return Surface.ROTATION_180; - case DeviceOrientation.landscapeRight: - return Surface.ROTATION_270; - } - } - /// Returns the [ResolutionSelector] that maps to the specified resolution /// preset for camera [UseCase]s. /// 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 20c69080bd6..5e3f2d2ff67 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,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', @@ -283,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, @@ -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,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, @@ -442,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, @@ -469,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', @@ -487,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', @@ -521,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, @@ -532,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, @@ -560,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', @@ -584,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?; @@ -610,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', @@ -647,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', @@ -674,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', @@ -720,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, @@ -731,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, @@ -824,7 +814,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, @@ -852,7 +842,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); @@ -870,11 +860,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?; @@ -927,8 +915,7 @@ 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.onCameraError', codec, @@ -938,7 +925,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, @@ -961,15 +948,12 @@ class DeviceOrientationManagerHostApi { static const MessageCodec codec = StandardMessageCodec(); - 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.DeviceOrientationManagerHostApi.startListeningForDeviceOrientationChange', - codec, + 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.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', @@ -988,10 +972,10 @@ class DeviceOrientationManagerHostApi { Future stopListeningForDeviceOrientationChange() async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.stopListeningForDeviceOrientationChange', - codec, + 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.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', @@ -1008,12 +992,12 @@ class DeviceOrientationManagerHostApi { } } - Future getPhotoOrientation() async { + Future getPhotoOrientation(String? arg_orientation) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.getPhotoOrientation', - codec, + 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.getPhotoOrientation', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send(null) as List?; + final List? replyList = + await channel.send([arg_orientation]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1035,12 +1019,12 @@ class DeviceOrientationManagerHostApi { } } - Future getVideoOrientation() async { + Future getVideoOrientation(String? arg_orientation) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.getVideoOrientation', - codec, + 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.getVideoOrientation', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send(null) as List?; + final List? replyList = + await channel.send([arg_orientation]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1068,19 +1052,17 @@ abstract class DeviceOrientationManagerFlutterApi { void onDeviceOrientationChanged(String orientation); - static void setup(DeviceOrientationManagerFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(DeviceOrientationManagerFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.DeviceOrientationManagerFlutterApi.onDeviceOrientationChanged', - codec, + 'dev.flutter.pigeon.DeviceOrientationManagerFlutterApi.onDeviceOrientationChanged', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.DeviceOrientationManagerFlutterApi.onDeviceOrientationChanged was null.'); + 'Argument for dev.flutter.pigeon.DeviceOrientationManagerFlutterApi.onDeviceOrientationChanged was null.'); final List args = (message as List?)!; final String? arg_orientation = (args[0] as String?); assert(arg_orientation != null, @@ -1108,7 +1090,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); @@ -1126,14 +1108,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', @@ -1181,7 +1161,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', @@ -1229,8 +1210,8 @@ class PreviewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PreviewHostApi.setTargetRotation', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_rotation]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_rotation]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1316,8 +1297,8 @@ class VideoCaptureHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.VideoCaptureHostApi.setTargetRotation', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_rotation]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_rotation]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1340,8 +1321,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, @@ -1351,7 +1331,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, @@ -1374,17 +1354,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', @@ -1430,8 +1405,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?; @@ -1460,8 +1434,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', @@ -1489,8 +1463,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, @@ -1500,7 +1473,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, @@ -1558,8 +1531,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, @@ -1569,7 +1541,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, @@ -1686,8 +1658,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, @@ -1697,7 +1668,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, @@ -1720,17 +1691,12 @@ class ImageCaptureHostApi { static const MessageCodec codec = StandardMessageCodec(); - Future create(int arg_identifier, int? arg_targetRotation, - int? arg_flashMode, int? arg_resolutionSelectorId) async { + Future create(int arg_identifier, int? arg_targetRotation, 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_targetRotation, - arg_flashMode, - arg_resolutionSelectorId - ]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_targetRotation, arg_flashMode, arg_resolutionSelectorId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1751,8 +1717,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', @@ -1800,8 +1766,8 @@ class ImageCaptureHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ImageCaptureHostApi.setTargetRotation', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_rotation]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_rotation]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1834,7 +1800,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); @@ -1852,14 +1818,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', @@ -1887,16 +1851,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', @@ -1924,16 +1884,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', @@ -1966,7 +1922,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); @@ -1979,8 +1935,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, @@ -1990,13 +1945,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?); @@ -2023,7 +1977,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); @@ -2034,13 +1988,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, @@ -2050,20 +2000,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; }); } @@ -2076,8 +2024,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, @@ -2087,7 +2034,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, @@ -2116,16 +2063,12 @@ class ImageAnalysisHostApi { static const MessageCodec codec = StandardMessageCodec(); - Future create(int arg_identifier, int? arg_targetRotation, - int? arg_resolutionSelectorId) async { + Future create(int arg_identifier, int? arg_targetRotation, 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_targetRotation, - arg_resolutionSelectorId - ]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_targetRotation, arg_resolutionSelectorId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2142,14 +2085,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', @@ -2192,8 +2133,8 @@ class ImageAnalysisHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ImageAnalysisHostApi.setTargetRotation', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_rotation]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_rotation]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2282,8 +2223,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, @@ -2293,7 +2233,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, @@ -2314,8 +2254,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, @@ -2325,7 +2264,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, @@ -2356,7 +2295,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); @@ -2379,8 +2318,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', @@ -2419,13 +2357,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', @@ -2458,7 +2395,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); @@ -2471,8 +2408,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, @@ -2482,13 +2418,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!); @@ -2506,8 +2441,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, @@ -2517,7 +2451,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, @@ -2536,7 +2470,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, @@ -2617,8 +2551,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, @@ -2628,7 +2561,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, @@ -2655,8 +2588,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, @@ -2666,7 +2598,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, @@ -2680,8 +2612,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; }); } @@ -2707,9 +2638,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); @@ -2727,18 +2658,12 @@ 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', @@ -2755,13 +2680,12 @@ 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', @@ -2794,16 +2718,12 @@ 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', @@ -2835,8 +2755,8 @@ class CameraControlHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraControlHostApi.enableTorch', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_torch]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_torch]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2857,8 +2777,8 @@ class CameraControlHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraControlHostApi.setZoomRatio', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_ratio]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_ratio]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2881,8 +2801,7 @@ abstract class CameraControlFlutterApi { void create(int identifier); - static void setup(CameraControlFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(CameraControlFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraControlFlutterApi.create', codec, @@ -2892,7 +2811,7 @@ abstract class CameraControlFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraControlFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.CameraControlFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, diff --git a/packages/camera/camera_android_camerax/lib/src/camerax_proxy.dart b/packages/camera/camera_android_camerax/lib/src/camerax_proxy.dart index 517ceb1d110..bf4236ceb26 100644 --- a/packages/camera/camera_android_camerax/lib/src/camerax_proxy.dart +++ b/packages/camera/camera_android_camerax/lib/src/camerax_proxy.dart @@ -4,6 +4,8 @@ import 'dart:ui' show Size; +import 'package:flutter/services.dart' show DeviceOrientation; + import 'analyzer.dart'; import 'camera_selector.dart'; import 'camera_state.dart'; @@ -61,8 +63,9 @@ class CameraXProxy { /// Returns a [Preview] configured with the specified target rotation and /// specified [ResolutionSelector]. Preview Function( - {required int targetRotation, - ResolutionSelector? resolutionSelector}) createPreview; + ResolutionSelector? resolutionSelector, + int? targetRotation, + ) createPreview; /// Returns an [ImageCapture] configured with specified flash mode and /// the specified [ResolutionSelector]. @@ -133,11 +136,11 @@ class CameraXProxy { /// the ID corresponding to the surface it will provide. Future Function(Preview preview) setPreviewSurfaceProvider; - /// Retrieves current photo orientation. - Future Function() getPhotoOrientation; + /// Retrieves current photo orientation in degrees. + Future Function(DeviceOrientation? orientation) getPhotoOrientation; - /// Retrieves current video orientation. - Future Function() getVideoOrientation; + /// Retrieves current video orientation in degrees. + Future Function(DeviceOrientation? orientation) getVideoOrientation; static Future _getProcessCameraProvider() { return ProcessCameraProvider.getInstance(); @@ -156,7 +159,7 @@ class CameraXProxy { } static Preview _createAttachedPreview( - {required int targetRotation, ResolutionSelector? resolutionSelector}) { + ResolutionSelector? resolutionSelector, int? targetRotation) { return Preview( targetRotation: targetRotation, resolutionSelector: resolutionSelector); } @@ -235,11 +238,13 @@ class CameraXProxy { return preview.setSurfaceProvider(); } - static Future _getPhotoOrientation() async { - return DeviceOrientationManager.getPhotoOrientation(); + static Future _getPhotoOrientation( + DeviceOrientation? orientation) async { + return DeviceOrientationManager.getPhotoOrientation(orientation); } - static Future _getVideoOrientation() async { - return DeviceOrientationManager.getVideoOrientation(); + static Future _getVideoOrientation( + DeviceOrientation? orientation) async { + return DeviceOrientationManager.getVideoOrientation(orientation); } } diff --git a/packages/camera/camera_android_camerax/lib/src/device_orientation_manager.dart b/packages/camera/camera_android_camerax/lib/src/device_orientation_manager.dart index 3f2c5a21710..0cd6a961dd7 100644 --- a/packages/camera/camera_android_camerax/lib/src/device_orientation_manager.dart +++ b/packages/camera/camera_android_camerax/lib/src/device_orientation_manager.dart @@ -49,22 +49,48 @@ class DeviceOrientationManager { api.stopListeningForDeviceOrientationChange(); } - /// Retrieves photo orientation. - static Future getPhotoOrientation( + /// Retrieves photo orientation in degrees based on the sensor orientation + /// and the last known UI orientation. + /// + /// [startListeningForDeviceOrientationChange] must be called before calling + /// this method. + static Future getPhotoOrientation(DeviceOrientation? sensorOrientation, {BinaryMessenger? binaryMessenger}) async { final DeviceOrientationManagerHostApi api = DeviceOrientationManagerHostApi(binaryMessenger: binaryMessenger); - return api.getPhotoOrientation(); + return api.getPhotoOrientation(sensorOrientation == null + ? null + : serializeDeviceOrientation(sensorOrientation)); } - /// Retrieves video orientation. - static Future getVideoOrientation( + /// Retrieves video orientation in degrees based on the sensor + /// [DeviceOrientation] and the last known UI orientation. + /// + /// [startListeningForDeviceOrientationChange] must be called before calling + /// this method. + static Future getVideoOrientation(DeviceOrientation? sensorOrientation, {BinaryMessenger? binaryMessenger}) async { final DeviceOrientationManagerHostApi api = DeviceOrientationManagerHostApi(binaryMessenger: binaryMessenger); - return api.getVideoOrientation(); + return api.getVideoOrientation(sensorOrientation == null + ? null + : serializeDeviceOrientation(sensorOrientation)); + } + + /// Serializes[DeviceOrientation] into a [String]. + static String serializeDeviceOrientation(DeviceOrientation orientation) { + switch (orientation) { + case DeviceOrientation.landscapeLeft: + return 'LANDSCAPE_LEFT'; + case DeviceOrientation.landscapeRight: + return 'LANDSCAPE_RIGHT'; + case DeviceOrientation.portraitDown: + return 'PORTRAIT_DOWN'; + case DeviceOrientation.portraitUp: + return 'PORTRAIT_UP'; + } } } diff --git a/packages/camera/camera_android_camerax/pigeons/camerax_library.dart b/packages/camera/camera_android_camerax/pigeons/camerax_library.dart index ff2ad45ee52..69cc96a0899 100644 --- a/packages/camera/camera_android_camerax/pigeons/camerax_library.dart +++ b/packages/camera/camera_android_camerax/pigeons/camerax_library.dart @@ -226,9 +226,10 @@ abstract class DeviceOrientationManagerHostApi { void stopListeningForDeviceOrientationChange(); - int getPhotoOrientation(); + // TODO(camsim99): Change String orientations to enum for readability. + int getPhotoOrientation(String? orientation); - int getVideoOrientation(); + int getVideoOrientation(String? orientation); } @FlutterApi() 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 b413790a74e..585d79ea51d 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 @@ -231,10 +231,7 @@ void main() { return mockBackCameraSelector; } }, - createPreview: ( - {required int targetRotation, - ResolutionSelector? resolutionSelector}) => - mockPreview, + createPreview: (_, __) => mockPreview, createImageCapture: (_, __) => mockImageCapture, createRecorder: (_) => mockRecorder, createVideoCapture: (_) => Future.value(mockVideoCapture), @@ -349,10 +346,7 @@ void main() { return mockBackCameraSelector; } }, - createPreview: ( - {required int targetRotation, - ResolutionSelector? resolutionSelector}) => - mockPreview, + createPreview: (_, __) => mockPreview, createImageCapture: (_, __) => mockImageCapture, createRecorder: (_) => mockRecorder, createVideoCapture: (_) => Future.value(mockVideoCapture), @@ -433,12 +427,11 @@ void main() { return mockBackCameraSelector; } }, - createPreview: ( - {required int targetRotation, - ResolutionSelector? resolutionSelector}) => - Preview.detached( - targetRotation: targetRotation, - resolutionSelector: resolutionSelector), + createPreview: + (ResolutionSelector? resolutionSelector, int? targetRotation) => + Preview.detached( + targetRotation: targetRotation, + resolutionSelector: resolutionSelector), createImageCapture: (ResolutionSelector? resolutionSelector, int? targetRotation) => ImageCapture.detached( @@ -589,10 +582,7 @@ void main() { return mockBackCameraSelector; } }, - createPreview: ( - {required int targetRotation, - ResolutionSelector? resolutionSelector}) => - mockPreview, + createPreview: (_, __) => mockPreview, createImageCapture: (_, __) => mockImageCapture, createRecorder: (QualitySelector? qualitySelector) => Recorder.detached(qualitySelector: qualitySelector), @@ -675,106 +665,6 @@ void main() { expect(camera.recorder!.qualitySelector, isNull); }); - test( - 'createCamera properly sets target rotation from preset sensor orientation for all use cases', - () async { - final AndroidCameraCameraX camera = AndroidCameraCameraX(); - const CameraLensDirection testLensDirection = CameraLensDirection.back; - const bool enableAudio = true; - final List validSensorOrientations = [90, 180, 270, 0]; - - final MockProcessCameraProvider mockProcessCameraProvider = - MockProcessCameraProvider(); - final MockCamera mockCamera = MockCamera(); - final MockCameraInfo mockCameraInfo = MockCameraInfo(); - final MockCameraSelector mockCameraSelector = MockCameraSelector(); - final MockVideoCapture mockVideoCapture = MockVideoCapture(); - - // Tell plugin to create mock/detached objects for testing createCamera - // as needed. - camera.proxy = CameraXProxy( - getProcessCameraProvider: () => - Future.value(mockProcessCameraProvider), - createPreview: ( - {required int targetRotation, - ResolutionSelector? resolutionSelector}) => - Preview.detached( - targetRotation: targetRotation, - resolutionSelector: resolutionSelector), - createImageCapture: - (ResolutionSelector? resolutionSelector, int? targetRotation) => - ImageCapture.detached( - resolutionSelector: resolutionSelector, - targetRotation: targetRotation), - createImageAnalysis: - (ResolutionSelector? resolutionSelector, int? targetRotation) => - ImageAnalysis.detached( - resolutionSelector: resolutionSelector, - targetRotation: targetRotation), - requestCameraPermissions: (_) => Future.value(), - createCameraStateObserver: (void Function(Object) onChanged) => - Observer.detached(onChanged: onChanged), - createResolutionSelector: (_) => MockResolutionSelector(), - createCameraSelector: (_) => mockCameraSelector, - createRecorder: (_) => MockRecorder(), - createVideoCapture: (_) => Future.value(mockVideoCapture), - createQualitySelector: ( - {required VideoQuality videoQuality, - required FallbackStrategy fallbackStrategy}) => - MockQualitySelector(), - startListeningForDeviceOrientationChange: (_, __) {}, - createResolutionStrategy: ( - {bool highestAvailable = false, - Size? boundSize, - int? fallbackRule}) => - MockResolutionStrategy(), - createFallbackStrategy: ( - {required VideoQuality quality, - required VideoResolutionFallbackRule fallbackRule}) => - MockFallbackStrategy(), - setPreviewSurfaceProvider: (_) => Future.value( - 5), // 5 is a random Flutter SurfaceTexture ID for testing}, - ); - - when(mockProcessCameraProvider.bindToLifecycle(mockCameraSelector, any)) - .thenAnswer((_) async => mockCamera); - when(mockCamera.getCameraInfo()).thenAnswer((_) async => mockCameraInfo); - when(mockCameraInfo.getCameraState()) - .thenAnswer((_) async => MockLiveCameraState()); - camera.processCameraProvider = mockProcessCameraProvider; - - for (final int sensorOrientation in validSensorOrientations) { - int? expectedTargetRotation; - switch (sensorOrientation) { - case 90: - expectedTargetRotation = Surface.ROTATION_90; - case 180: - expectedTargetRotation = Surface.ROTATION_180; - case 270: - expectedTargetRotation = Surface.ROTATION_270; - case 0: - expectedTargetRotation = Surface.ROTATION_0; - } - final CameraDescription testCameraDescription = CameraDescription( - name: 'cameraName', - lensDirection: testLensDirection, - sensorOrientation: sensorOrientation); - - await camera.createCamera(testCameraDescription, ResolutionPreset.low, - enableAudio: enableAudio); - - // Test non-video use cases. - expect(camera.preview!.targetRotation, equals(expectedTargetRotation)); - expect( - camera.imageCapture!.targetRotation, equals(expectedTargetRotation)); - expect( - camera.imageAnalysis!.targetRotation, equals(expectedTargetRotation)); - - // Test video use case. - verify(camera.videoCapture!.setTargetRotation(expectedTargetRotation!)); - } - }); - test( 'initializeCamera throws a CameraException when createCamera has not been called before initializedCamera', () async { @@ -824,10 +714,7 @@ void main() { return mockBackCameraSelector; } }, - createPreview: ( - {required int targetRotation, - ResolutionSelector? resolutionSelector}) => - mockPreview, + createPreview: (_, __) => mockPreview, createImageCapture: (_, __) => mockImageCapture, createRecorder: (QualitySelector? qualitySelector) => MockRecorder(), createVideoCapture: (_) => Future.value(MockVideoCapture()), @@ -1193,6 +1080,9 @@ void main() { camera.videoCapture = MockVideoCapture(); camera.cameraSelector = MockCameraSelector(); + // Ignore setting target rotation for this test; tested seprately. + camera.captureOrientationLocked = true; + const int cameraId = 17; const String outputPath = '/temp/MOV123.temp'; @@ -1233,6 +1123,9 @@ void main() { camera.videoCapture = MockVideoCapture(); camera.cameraSelector = MockCameraSelector(); + // Ignore setting target rotation for this test; tested seprately. + camera.captureOrientationLocked = true; + const int cameraId = 17; const String outputPath = '/temp/MOV123.temp'; @@ -1287,6 +1180,9 @@ void main() { MockTestSystemServicesHostApi(); TestSystemServicesHostApi.setup(mockSystemServicesApi); + // Ignore setting target rotation for this test; tested seprately. + camera.captureOrientationLocked = true; + // Tell plugin to create detached Analyzer for testing. camera.proxy = CameraXProxy( createAnalyzer: @@ -1323,6 +1219,53 @@ void main() { await camera.cameraImageDataStreamController!.close(); }); + test( + 'startVideoCapturing sets VideoCapture target rotation to current video orientation if orientation unlocked', + () async { + // Set up mocks and constants. + final AndroidCameraCameraX camera = AndroidCameraCameraX(); + final MockPendingRecording mockPendingRecording = MockPendingRecording(); + final MockRecording mockRecording = MockRecording(); + final MockVideoCapture mockVideoCapture = MockVideoCapture(); + final TestSystemServicesHostApi mockSystemServicesApi = + MockTestSystemServicesHostApi(); + TestSystemServicesHostApi.setup(mockSystemServicesApi); + + // Set directly for test versus calling createCamera. + camera.processCameraProvider = MockProcessCameraProvider(); + camera.camera = MockCamera(); + camera.recorder = MockRecorder(); + camera.videoCapture = mockVideoCapture; + camera.cameraSelector = MockCameraSelector(); + + // Tell plugin to mock call to get current video orientation. + camera.proxy = + CameraXProxy(getVideoOrientation: (_) => Future.value(270)); + + const int cameraId = 87; + const String outputPath = '/temp/MOV123.temp'; + + // Mock method calls. + when(mockSystemServicesApi.getTempFilePath(camera.videoPrefix, '.temp')) + .thenReturn(outputPath); + when(camera.recorder!.prepareRecording(outputPath)) + .thenAnswer((_) async => mockPendingRecording); + when(mockPendingRecording.start()).thenAnswer((_) async => mockRecording); + when(camera.processCameraProvider!.isBound(camera.videoCapture!)) + .thenAnswer((_) async => true); + + // Test when orientation is unlocked. + await camera.startVideoCapturing(const VideoCaptureOptions(cameraId)); + verify(mockVideoCapture.setTargetRotation(Surface.ROTATION_270)); + + // Test when orientation is locked. + camera.captureOrientationLocked = true; + clearInteractions(mockVideoCapture); + + await camera.startVideoCapturing(const VideoCaptureOptions(cameraId)); + verifyNever(mockVideoCapture.setTargetRotation(any)); + }); + test('pauseVideoRecording pauses the recording', () async { final AndroidCameraCameraX camera = AndroidCameraCameraX(); final MockRecording recording = MockRecording(); @@ -1430,6 +1373,9 @@ void main() { // Set directly for test versus calling createCamera. camera.imageCapture = MockImageCapture(); + // Ignore setting target rotation for this test; tested seprately. + camera.captureOrientationLocked = true; + when(camera.imageCapture!.takePicture()) .thenAnswer((_) async => testPicturePath); @@ -1438,6 +1384,34 @@ void main() { expect(imageFile.path, equals(testPicturePath)); }); + test( + 'takePicture sets ImageCapture target rotation to currrent photo rotation when orientation unlocked', + () async { + final AndroidCameraCameraX camera = AndroidCameraCameraX(); + final MockImageCapture mockImageCapture = MockImageCapture(); + + // Set directly for test versus calling createCamera. + camera.imageCapture = mockImageCapture; + + // Tell plugin to mock call to get current photo orientation. + camera.proxy = + CameraXProxy(getPhotoOrientation: (_) => Future.value(180)); + + when(camera.imageCapture!.takePicture()) + .thenAnswer((_) async => 'test/absolute/path/to/picture'); + + // Test when orientation is unlocked. + await camera.takePicture(3); + verify(mockImageCapture.setTargetRotation(Surface.ROTATION_180)); + + // Test when orientation is locked. + camera.captureOrientationLocked = true; + clearInteractions(mockImageCapture); + + await camera.takePicture(3); + verifyNever(mockImageCapture.setTargetRotation(any)); + }); + test('takePicture turns non-torch flash mode off when torch mode enabled', () async { final AndroidCameraCameraX camera = AndroidCameraCameraX(); @@ -1448,6 +1422,9 @@ void main() { camera.imageCapture = MockImageCapture(); camera.camera = MockCamera(); + // Ignore setting target rotation for this test; tested seprately. + camera.captureOrientationLocked = true; + when(camera.camera!.getCameraControl()) .thenAnswer((_) async => mockCameraControl); @@ -1467,6 +1444,9 @@ void main() { camera.imageCapture = MockImageCapture(); camera.camera = MockCamera(); + // Ignore setting target rotation for this test; tested seprately. + camera.captureOrientationLocked = true; + when(camera.camera!.getCameraControl()) .thenAnswer((_) async => mockCameraControl); @@ -1677,6 +1657,9 @@ void main() { camera.cameraSelector = MockCameraSelector(); camera.imageAnalysis = MockImageAnalysis(); + // Ignore setting target rotation for this test; tested seprately. + camera.captureOrientationLocked = true; + when(mockProcessCameraProvider.bindToLifecycle(any, any)) .thenAnswer((_) => Future.value(mockCamera)); when(mockCamera.getCameraInfo()) @@ -1717,6 +1700,9 @@ void main() { camera.cameraSelector = MockCameraSelector(); camera.imageAnalysis = MockImageAnalysis(); + // Ignore setting target rotation for this test; tested seprately. + camera.captureOrientationLocked = true; + when(mockProcessCameraProvider.bindToLifecycle(any, any)) .thenAnswer((_) => Future.value(mockCamera)); when(mockCamera.getCameraInfo()) @@ -1778,6 +1764,9 @@ void main() { camera.cameraSelector = mockCameraSelector; camera.imageAnalysis = mockImageAnalysis; + // Ignore setting target rotation for this test; tested seprately. + camera.captureOrientationLocked = true; + when(mockProcessCameraProvider.isBound(mockImageAnalysis)) .thenAnswer((_) async => Future.value(false)); when(mockProcessCameraProvider @@ -1834,6 +1823,9 @@ void main() { // Set directly for test versus calling createCamera. camera.imageAnalysis = mockImageAnalysis; + // Ignore setting target rotation for this test; tested seprately. + camera.captureOrientationLocked = true; + // Tell plugin to create a detached analyzer for testing purposes. camera.proxy = CameraXProxy(createAnalyzer: (_) => MockAnalyzer()); @@ -1846,11 +1838,48 @@ void main() { verify(mockImageAnalysis.clearAnalyzer()); }); + test( + 'onStreamedFrameAvailable sets ImageAnalysis target rotation to current photo orientation when orientation unlocked', + () async { + final AndroidCameraCameraX camera = AndroidCameraCameraX(); + const int cameraId = 35; + final MockImageAnalysis mockImageAnalysis = MockImageAnalysis(); + + // Set directly for test versus calling createCamera. + camera.imageAnalysis = mockImageAnalysis; + + // Tell plugin to create a detached analyzer for testing purposes and mock + // call to get current photo orientation. + camera.proxy = CameraXProxy( + createAnalyzer: (_) => MockAnalyzer(), + getPhotoOrientation: (_) => Future.value(90)); + + // Test when orientation is unlocked. + StreamSubscription imageStreamSubscription = camera + .onStreamedFrameAvailable(cameraId) + .listen((CameraImageData imageData) {}); + + await untilCalled(mockImageAnalysis.setTargetRotation(Surface.ROTATION_90)); + await imageStreamSubscription.cancel(); + + // Wait until onListen completes and then test when orientation is locked. + camera.captureOrientationLocked = true; + clearInteractions(mockImageAnalysis); + imageStreamSubscription = camera + .onStreamedFrameAvailable(cameraId) + .listen((CameraImageData data) {}); + + await untilCalled(mockImageAnalysis.setAnalyzer(any)); + verifyNever(mockImageAnalysis.setTargetRotation(Surface.ROTATION_90)); + await imageStreamSubscription.cancel(); + }); + test( 'lockCaptureOrientation sets capture-related use case target rotations to correct orientation', () async { final AndroidCameraCameraX camera = AndroidCameraCameraX(); const int cameraId = 44; + const DeviceOrientation testOrientation = DeviceOrientation.landscapeLeft; final MockImageAnalysis mockImageAnalysis = MockImageAnalysis(); final MockImageCapture mockImageCapture = MockImageCapture(); @@ -1861,25 +1890,34 @@ void main() { camera.imageCapture = mockImageCapture; camera.videoCapture = mockVideoCapture; - for (final DeviceOrientation orientation in DeviceOrientation.values) { - int? targetRotation; - switch (orientation) { - case DeviceOrientation.portraitUp: - targetRotation = Surface.ROTATION_0; - case DeviceOrientation.landscapeLeft: - targetRotation = Surface.ROTATION_90; - case DeviceOrientation.portraitDown: - targetRotation = Surface.ROTATION_180; - case DeviceOrientation.landscapeRight: - targetRotation = Surface.ROTATION_270; - } + // Tell plugin to mock calls to retrieve photo and video orientations. + const int targetPhotoOrientation = 90; + const int targetPhotoOrientationConstant = Surface.ROTATION_90; + const int targetVideoOrientation = 270; + const int targetVideoOrientationConstant = Surface.ROTATION_270; + camera.proxy = CameraXProxy( + getPhotoOrientation: (DeviceOrientation? orientation) { + if (orientation == testOrientation) { + return Future.value(targetPhotoOrientation); + } else { + return Future.value(0); + } + }, + getVideoOrientation: (DeviceOrientation? orientation) { + if (orientation == testOrientation) { + return Future.value(targetVideoOrientation); + } else { + return Future.value(0); + } + }, + ); - await camera.lockCaptureOrientation(cameraId, orientation); + await camera.lockCaptureOrientation(cameraId, testOrientation); - verify(mockImageAnalysis.setTargetRotation(targetRotation)); - verify(mockImageCapture.setTargetRotation(targetRotation)); - verify(mockVideoCapture.setTargetRotation(targetRotation)); - } + verify(mockImageAnalysis.setTargetRotation(targetPhotoOrientationConstant)); + verify(mockImageCapture.setTargetRotation(targetPhotoOrientationConstant)); + verify(mockVideoCapture.setTargetRotation(targetVideoOrientationConstant)); + expect(camera.captureOrientationLocked, isTrue); }); test( @@ -1887,7 +1925,6 @@ void main() { () async { final AndroidCameraCameraX camera = AndroidCameraCameraX(); const int cameraId = 57; - final List validSensorOrientations = [90, 180, 270, 0]; final MockImageAnalysis mockImageAnalysis = MockImageAnalysis(); final MockImageCapture mockImageCapture = MockImageCapture(); @@ -1898,29 +1935,37 @@ void main() { camera.imageCapture = mockImageCapture; camera.videoCapture = mockVideoCapture; - for (final int sensorOrientation in validSensorOrientations) { - int? targetRotation; - switch (sensorOrientation) { - case 90: - targetRotation = Surface.ROTATION_90; - case 180: - targetRotation = Surface.ROTATION_180; - case 270: - targetRotation = Surface.ROTATION_270; - case 0: - targetRotation = Surface.ROTATION_0; - } + // Set flag to test it is properly changed. + camera.captureOrientationLocked = true; - // Tell plugin to mock current photo & video orientations. - camera.proxy = CameraXProxy( - getPhotoOrientation: () => Future.value(sensorOrientation), - getVideoOrientation: () => Future.value(sensorOrientation)); + // Tell plugin to mock current photo & video orientations. + const int targetPhotoOrientation = 270; + const int targetPhotoOrientationConstant = Surface.ROTATION_270; + const int targetVideoOrientation = 180; + const int targetVideoOrientationConstant = Surface.ROTATION_180; + + camera.proxy = CameraXProxy( + getPhotoOrientation: (DeviceOrientation? orientation) { + if (orientation == null) { + return Future.value(targetPhotoOrientation); + } else { + return Future.value(0); + } + }, + getVideoOrientation: (DeviceOrientation? orientation) { + if (orientation == null) { + return Future.value(targetVideoOrientation); + } else { + return Future.value(0); + } + }, + ); - await camera.unlockCaptureOrientation(cameraId); + await camera.unlockCaptureOrientation(cameraId); - verify(mockImageAnalysis.setTargetRotation(targetRotation)); - verify(mockImageCapture.setTargetRotation(targetRotation)); - verify(mockVideoCapture.setTargetRotation(targetRotation)); - } + verify(mockImageAnalysis.setTargetRotation(targetPhotoOrientationConstant)); + verify(mockImageCapture.setTargetRotation(targetPhotoOrientationConstant)); + verify(mockVideoCapture.setTargetRotation(targetVideoOrientationConstant)); + expect(camera.captureOrientationLocked, isFalse); }); } diff --git a/packages/camera/camera_android_camerax/test/device_orientation_manager_test.dart b/packages/camera/camera_android_camerax/test/device_orientation_manager_test.dart index 8ea4895cfc0..98456c93253 100644 --- a/packages/camera/camera_android_camerax/test/device_orientation_manager_test.dart +++ b/packages/camera/camera_android_camerax/test/device_orientation_manager_test.dart @@ -47,17 +47,34 @@ void main() { verify(mockApi.stopListeningForDeviceOrientationChange()); }); - test('getPhotorientation retrieves expected orientation', () async { + test('getPhotoOrientation retrieves expected orientation', () async { final MockTestDeviceOrientationManagerHostApi mockApi = MockTestDeviceOrientationManagerHostApi(); TestDeviceOrientationManagerHostApi.setup(mockApi); - const int photoOrientation = 270; - when(mockApi.getPhotoOrientation()).thenReturn(photoOrientation); - - expect(await DeviceOrientationManager.getPhotoOrientation(), - equals(photoOrientation)); - verify(mockApi.getPhotoOrientation()); + int offsetForTesting = 1; + for (final DeviceOrientation orientation in DeviceOrientation.values) { + String? serializedDeviceOrientation; + switch (orientation) { + case DeviceOrientation.landscapeLeft: + serializedDeviceOrientation = 'LANDSCAPE_LEFT'; + case DeviceOrientation.landscapeRight: + serializedDeviceOrientation = 'LANDSCAPE_RIGHT'; + case DeviceOrientation.portraitDown: + serializedDeviceOrientation = 'PORTRAIT_DOWN'; + case DeviceOrientation.portraitUp: + serializedDeviceOrientation = 'PORTRAIT_UP'; + } + final int photoOrientation = 270 + offsetForTesting; + offsetForTesting += 1; + + when(mockApi.getPhotoOrientation(serializedDeviceOrientation)) + .thenReturn(photoOrientation); + + expect(await DeviceOrientationManager.getPhotoOrientation(orientation), + equals(photoOrientation)); + verify(mockApi.getPhotoOrientation(serializedDeviceOrientation)); + } }); test('getVideoOrientation retrieves expected orientation', () async { @@ -65,12 +82,29 @@ void main() { MockTestDeviceOrientationManagerHostApi(); TestDeviceOrientationManagerHostApi.setup(mockApi); - const int videoOrientation = 180; - when(mockApi.getVideoOrientation()).thenReturn(videoOrientation); - - expect(await DeviceOrientationManager.getVideoOrientation(), - equals(videoOrientation)); - verify(mockApi.getVideoOrientation()); + int offsetForTesting = 1; + for (final DeviceOrientation orientation in DeviceOrientation.values) { + String? serializedDeviceOrientation; + switch (orientation) { + case DeviceOrientation.landscapeLeft: + serializedDeviceOrientation = 'LANDSCAPE_LEFT'; + case DeviceOrientation.landscapeRight: + serializedDeviceOrientation = 'LANDSCAPE_RIGHT'; + case DeviceOrientation.portraitDown: + serializedDeviceOrientation = 'PORTRAIT_DOWN'; + case DeviceOrientation.portraitUp: + serializedDeviceOrientation = 'PORTRAIT_UP'; + } + final int videoOrientation = 270 + offsetForTesting; + offsetForTesting += 1; + + when(mockApi.getVideoOrientation(serializedDeviceOrientation)) + .thenReturn(videoOrientation); + + expect(await DeviceOrientationManager.getVideoOrientation(orientation), + equals(videoOrientation)); + verify(mockApi.getVideoOrientation(serializedDeviceOrientation)); + } }); test('onDeviceOrientationChanged adds new orientation to stream', () { diff --git a/packages/camera/camera_android_camerax/test/device_orientation_manager_test.mocks.dart b/packages/camera/camera_android_camerax/test/device_orientation_manager_test.mocks.dart index 533d83e3685..9152aa95750 100644 --- a/packages/camera/camera_android_camerax/test/device_orientation_manager_test.mocks.dart +++ b/packages/camera/camera_android_camerax/test/device_orientation_manager_test.mocks.dart @@ -72,18 +72,18 @@ class MockTestDeviceOrientationManagerHostApi extends _i1.Mock returnValueForMissingStub: null, ); @override - int getPhotoOrientation() => (super.noSuchMethod( + int getPhotoOrientation(String? orientation) => (super.noSuchMethod( Invocation.method( #getPhotoOrientation, - [], + [orientation], ), returnValue: 0, ) as int); @override - int getVideoOrientation() => (super.noSuchMethod( + int getVideoOrientation(String? orientation) => (super.noSuchMethod( Invocation.method( #getVideoOrientation, - [], + [orientation], ), returnValue: 0, ) as int); 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 b895baab13c..71ae481b956 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,29 +357,24 @@ 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); int getCameraControl(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, @@ -457,14 +389,11 @@ abstract class TestCameraHostApi { 'dev.flutter.pigeon.CameraHostApi.getCameraControl', 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.getCameraControl was null.'); + 'Argument for dev.flutter.pigeon.CameraHostApi.getCameraControl was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -492,7 +421,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); @@ -501,37 +430,29 @@ 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); 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]; }); } @@ -541,14 +462,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, @@ -565,35 +483,28 @@ abstract class TestSystemServicesHostApi { } abstract class TestDeviceOrientationManagerHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); - void startListeningForDeviceOrientationChange( - bool isFrontFacing, int sensorOrientation); + void startListeningForDeviceOrientationChange(bool isFrontFacing, int sensorOrientation); void stopListeningForDeviceOrientationChange(); - int getPhotoOrientation(); + int getPhotoOrientation(String? orientation); - int getVideoOrientation(); + int getVideoOrientation(String? orientation); - static void setup(TestDeviceOrientationManagerHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestDeviceOrientationManagerHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.startListeningForDeviceOrientationChange', - codec, + 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.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.DeviceOrientationManagerHostApi.startListeningForDeviceOrientationChange was null.'); + 'Argument for dev.flutter.pigeon.DeviceOrientationManagerHostApi.startListeningForDeviceOrientationChange was null.'); final List args = (message as List?)!; final bool? arg_isFrontFacing = (args[0] as bool?); assert(arg_isFrontFacing != null, @@ -601,24 +512,19 @@ abstract class TestDeviceOrientationManagerHostApi { final int? arg_sensorOrientation = (args[1] as int?); assert(arg_sensorOrientation != null, 'Argument for dev.flutter.pigeon.DeviceOrientationManagerHostApi.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.DeviceOrientationManagerHostApi.stopListeningForDeviceOrientationChange', - codec, + 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.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 []; @@ -627,36 +533,34 @@ abstract class TestDeviceOrientationManagerHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.getPhotoOrientation', - codec, + 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.getPhotoOrientation', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { - // ignore message - final int output = api.getPhotoOrientation(); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.DeviceOrientationManagerHostApi.getPhotoOrientation was null.'); + final List args = (message as List?)!; + final String? arg_orientation = (args[0] as String?); + final int output = api.getPhotoOrientation(arg_orientation); return [output]; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.getVideoOrientation', - codec, + 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.getVideoOrientation', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { - // ignore message - final int output = api.getVideoOrientation(); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.DeviceOrientationManagerHostApi.getVideoOrientation was null.'); + final List args = (message as List?)!; + final String? arg_orientation = (args[0] as String?); + final int output = api.getVideoOrientation(arg_orientation); return [output]; }); } @@ -679,7 +583,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); @@ -688,8 +592,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); @@ -702,21 +605,17 @@ abstract class TestPreviewHostApi { void setTargetRotation(int identifier, int rotation); - 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, @@ -733,14 +632,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, @@ -752,16 +648,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 []; @@ -773,14 +665,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, @@ -795,14 +684,11 @@ abstract class TestPreviewHostApi { 'dev.flutter.pigeon.PreviewHostApi.setTargetRotation', 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.setTargetRotation was null.'); + 'Argument for dev.flutter.pigeon.PreviewHostApi.setTargetRotation was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -819,8 +705,7 @@ 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); @@ -829,21 +714,17 @@ abstract class TestVideoCaptureHostApi { void setTargetRotation(int identifier, int rotation); - 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, @@ -858,14 +739,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, @@ -880,14 +758,11 @@ abstract class TestVideoCaptureHostApi { 'dev.flutter.pigeon.VideoCaptureHostApi.setTargetRotation', 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.setTargetRotation was null.'); + 'Argument for dev.flutter.pigeon.VideoCaptureHostApi.setTargetRotation was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -904,12 +779,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); @@ -917,21 +790,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, @@ -939,8 +808,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 []; }); } @@ -950,14 +818,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, @@ -969,18 +834,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, @@ -995,14 +856,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, @@ -1019,27 +877,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, @@ -1053,8 +906,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); @@ -1065,21 +917,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, @@ -1094,14 +942,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, @@ -1116,14 +961,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, @@ -1138,14 +980,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, @@ -1159,12 +998,10 @@ 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? targetRotation, int? flashMode, - int? resolutionSelectorId); + void create(int identifier, int? targetRotation, int? flashMode, int? resolutionSelectorId); void setFlashMode(int identifier, int flashMode); @@ -1172,21 +1009,17 @@ abstract class TestImageCaptureHostApi { void setTargetRotation(int identifier, int rotation); - 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, @@ -1194,8 +1027,7 @@ abstract class TestImageCaptureHostApi { final int? arg_targetRotation = (args[1] as int?); final int? arg_flashMode = (args[2] as int?); final int? arg_resolutionSelectorId = (args[3] as int?); - api.create(arg_identifier!, arg_targetRotation, arg_flashMode, - arg_resolutionSelectorId); + api.create(arg_identifier!, arg_targetRotation, arg_flashMode, arg_resolutionSelectorId); return []; }); } @@ -1205,14 +1037,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, @@ -1230,14 +1059,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, @@ -1252,14 +1078,11 @@ abstract class TestImageCaptureHostApi { 'dev.flutter.pigeon.ImageCaptureHostApi.setTargetRotation', 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.setTargetRotation was null.'); + 'Argument for dev.flutter.pigeon.ImageCaptureHostApi.setTargetRotation was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1290,7 +1113,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); @@ -1299,28 +1122,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, @@ -1336,36 +1153,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 []; }); } @@ -1374,27 +1184,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, @@ -1405,8 +1210,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 []; }); } @@ -1415,8 +1219,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? targetRotation, int? resolutionSelectorId); @@ -1427,29 +1230,24 @@ abstract class TestImageAnalysisHostApi { void setTargetRotation(int identifier, int rotation); - 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, 'Argument for dev.flutter.pigeon.ImageAnalysisHostApi.create was null, expected non-null int.'); final int? arg_targetRotation = (args[1] as int?); final int? arg_resolutionSelectorId = (args[2] as int?); - api.create( - arg_identifier!, arg_targetRotation, arg_resolutionSelectorId); + api.create(arg_identifier!, arg_targetRotation, arg_resolutionSelectorId); return []; }); } @@ -1459,14 +1257,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, @@ -1484,14 +1279,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, @@ -1506,14 +1298,11 @@ abstract class TestImageAnalysisHostApi { 'dev.flutter.pigeon.ImageAnalysisHostApi.setTargetRotation', 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.setTargetRotation was null.'); + 'Argument for dev.flutter.pigeon.ImageAnalysisHostApi.setTargetRotation was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1530,27 +1319,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, @@ -1564,27 +1348,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, @@ -1612,7 +1391,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); @@ -1621,8 +1400,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); @@ -1631,21 +1409,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, @@ -1663,14 +1437,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, @@ -1685,20 +1456,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!); @@ -1710,29 +1477,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, @@ -1747,14 +1509,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, @@ -1785,9 +1544,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); @@ -1796,41 +1555,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 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 []; }); } @@ -1840,24 +1591,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 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]; }); } @@ -1866,39 +1612,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, 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!); @@ -1910,29 +1647,24 @@ abstract class TestFallbackStrategyHostApi { } abstract class TestCameraControlHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); Future enableTorch(int identifier, bool torch); Future setZoomRatio(int identifier, double ratio); - static void setup(TestCameraControlHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestCameraControlHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraControlHostApi.enableTorch', 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.CameraControlHostApi.enableTorch was null.'); + 'Argument for dev.flutter.pigeon.CameraControlHostApi.enableTorch was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1950,14 +1682,11 @@ abstract class TestCameraControlHostApi { 'dev.flutter.pigeon.CameraControlHostApi.setZoomRatio', 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.CameraControlHostApi.setZoomRatio was null.'); + 'Argument for dev.flutter.pigeon.CameraControlHostApi.setZoomRatio was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, From 95daaf63f6c872d103351010af3202967e766168 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Wed, 6 Dec 2023 15:34:10 -0800 Subject: [PATCH 17/29] add potential fix --- .../camerax/DeviceOrientationManager.java | 76 ++++++++++--------- 1 file changed, 42 insertions(+), 34 deletions(-) diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManager.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManager.java index 7158e177703..e599801a592 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManager.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManager.java @@ -19,8 +19,6 @@ import io.flutter.embedding.engine.systemchannels.PlatformChannel; import io.flutter.embedding.engine.systemchannels.PlatformChannel.DeviceOrientation; -import android.util.Log; - /** * Support class to help to determine the media orientation based on the orientation of the device. */ @@ -109,49 +107,59 @@ public int getPhotoOrientation() { * into degrees. * @return The device's photo orientation in degrees. */ - public int getPhotoOrientation(@Nullable PlatformChannel.DeviceOrientation orientation) { - int angle = 0; - // Fallback to device orientation when the orientation value is null. - if (orientation == null) { - orientation = getUIOrientation(); + // public int getPhotoOrientation(@Nullable PlatformChannel.DeviceOrientation orientation) { + // int angle = 0; + // // Fallback to device orientation when the orientation value is null. + // if (orientation == null) { + // orientation = getUIOrientation(); + // } + + // switch (orientation) { + // case PORTRAIT_UP: + // angle = 90; + // break; + // case PORTRAIT_DOWN: + // angle = 270; + // break; + // case LANDSCAPE_LEFT: + // angle = isFrontFacing ? 180 : 0; + // break; + // case LANDSCAPE_RIGHT: + // angle = isFrontFacing ? 0 : 180; + // break; + // } + + // // Sensor orientation is 90 for most devices, or 270 for some devices (eg. Nexus 5X). + // // This has to be taken into account so the JPEG is rotated properly. + // // For devices with orientation of 90, this simply returns the mapping from ORIENTATIONS. + // // For devices with orientation of 270, the JPEG is rotated 180 degrees instead. + // return (angle + sensorOrientation + 270) % 360; + // } + + public int getPhotoOrientation(@Nullable PlatformChannel.DeviceOrientation lockedOrientation) { + PlatformChannel.DeviceOrientation currentOrientation = this.lastOrientation; + if (currentOrientation == null) { + currentOrientation = getUIOrientation(); } - Log.e("CAMILLE", "----------------------------------------------------------"); + return (decodeOrientation(currentOrientation, !isFrontFacing) + decodeOrientation(lockedOrientation, true) + 360) % 360; + } - Log.e("CAMILLE SENSOR ORIENTATION", Integer.toString(sensorOrientation)); - Log.e("CAMILLE ORIENTATION", orientation.toString()); - Log.e("CAMILLE ISFRONTFACING", isFrontFacing ? "true":"false"); + public int decodeOrientation(@NonNull PlatformChannel.DeviceOrientation orientation, bool clockwise) { switch (orientation) { case PORTRAIT_UP: - angle = isFrontFacing ? 180 : 0; - break; + return 0; + case LANDSCAPE_RIGHT: + return clockwise ? 90: 270; case PORTRAIT_DOWN: - angle = isFrontFacing ? 0 : 180; - break; + return 180; case LANDSCAPE_LEFT: - angle = isFrontFacing ? 90 : 270; // isFrontFacing ? 270 : 90; - break; - case LANDSCAPE_RIGHT: - angle = isFrontFacing ? 270 : 90; // isFrontFacing ? 90 : 270; - break; + return clockwise ? 270 : 90; } - - Log.e("CAMILLE ANGLE", Integer.toString(angle)); - - int ans = (angle + sensorOrientation + 270) % 360; - - Log.e("CAMILLE ANS", Integer.toString(ans)); - Log.e("CAMILLE", "----------------------------------------------------------"); - - // Sensor orientation is 90 for most devices, or 270 for some devices (eg. Nexus 5X). - // This has to be taken into account so the JPEG is rotated properly. - // For devices with orientation of 90, this simply returns the mapping from ORIENTATIONS. - // For devices with orientation of 270, the JPEG is rotated 180 degrees instead. - // return ans; - return 180; } + /** * Returns the device's video orientation in clockwise degrees based on the sensor orientation and * the last known UI orientation. From b5acca597a7f2f651c77d9b96b6fb3f1e78c8b8b Mon Sep 17 00:00:00 2001 From: camsim99 Date: Fri, 8 Dec 2023 08:22:58 -0800 Subject: [PATCH 18/29] Add correct solution --- .../camerax/DeviceOrientationManager.java | 20 +++++++++++--- .../DeviceOrientationManagerHostApiImpl.java | 9 +++++++ .../camerax/GeneratedCameraXLibrary.java | 25 +++++++++++++++++ .../lib/src/android_camera_camerax.dart | 20 ++++++++------ .../lib/src/camerax_library.g.dart | 27 +++++++++++++++++++ .../lib/src/camerax_proxy.dart | 7 +++++ .../lib/src/device_orientation_manager.dart | 8 ++++++ .../pigeons/camerax_library.dart | 2 ++ .../test/test_camerax_library.g.dart | 16 +++++++++++ 9 files changed, 122 insertions(+), 12 deletions(-) diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManager.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManager.java index e599801a592..948b35a76b6 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManager.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManager.java @@ -19,6 +19,8 @@ import io.flutter.embedding.engine.systemchannels.PlatformChannel; import io.flutter.embedding.engine.systemchannels.PlatformChannel.DeviceOrientation; +import android.util.Log; + /** * Support class to help to determine the media orientation based on the orientation of the device. */ @@ -142,21 +144,26 @@ public int getPhotoOrientation(@Nullable PlatformChannel.DeviceOrientation locke currentOrientation = getUIOrientation(); } - return (decodeOrientation(currentOrientation, !isFrontFacing) + decodeOrientation(lockedOrientation, true) + 360) % 360; + Log.e("CAMILLE", Integer.toString(decodeOrientation(lockedOrientation))); + Log.e("CAMILLE", Integer.toString(decodeOrientation(currentOrientation))); + // return (decodeOrientation(lockedOrientation) - decodeOrientation(currentOrientation) + 360) % 360; + return ((360 - decodeOrientation(lockedOrientation)) + 360) % 360; + } - public int decodeOrientation(@NonNull PlatformChannel.DeviceOrientation orientation, bool clockwise) { + public int decodeOrientation(@NonNull PlatformChannel.DeviceOrientation orientation) { switch (orientation) { case PORTRAIT_UP: return 0; case LANDSCAPE_RIGHT: - return clockwise ? 90: 270; + return 90; case PORTRAIT_DOWN: return 180; case LANDSCAPE_LEFT: - return clockwise ? 270 : 90; + return 270; } + throw new IllegalArgumentException("um no"); } @@ -342,6 +349,11 @@ int getDeviceDefaultOrientation() { } } + /** Gets default capture rotation for CameraX {@code UseCase}s. */ + Long getDefaultRotation() { + return Long.valueOf(getDisplay().getRotation()); // todo: consider saving this value (display) since we could be calling this a lot. also makes this an int and the host api Long + } + /** * Gets an instance of the Android {@link android.view.Display}. * diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerHostApiImpl.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerHostApiImpl.java index ea4b69af0fd..ce189aa8bba 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerHostApiImpl.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerHostApiImpl.java @@ -131,4 +131,13 @@ public void stopListeningForDeviceOrientationChange() { } return Long.valueOf(deviceOrientationManager.getVideoOrientation(deserializeDeviceOrientationString(orientation))); } + + @Override + public @NonNull Long getDefaultRotation() { + if (deviceOrientationManager == null) { + throw new NullPointerException( + "startListeningForDeviceOrientationChange must first be called to subscribe to device orientation changes in order to retrieve the video orientation."); + } + return deviceOrientationManager.getDefaultRotation(); + } } 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 9d1ccccac22..4ccc6ad56bd 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 @@ -1294,6 +1294,9 @@ public interface DeviceOrientationManagerHostApi { @NonNull Long getVideoOrientation(@Nullable String orientation); + @NonNull + Long getDefaultRotation(); + /** The codec used by DeviceOrientationManagerHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); @@ -1385,6 +1388,28 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable DeviceOrie Long output = api.getVideoOrientation(orientationArg); wrapped.add(0, output); } + catch (Throwable exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.DeviceOrientationManagerHostApi.getDefaultRotation", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + Long output = api.getDefaultRotation(); + wrapped.add(0, output); + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; 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 c95a12ac255..777a67affe7 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 @@ -164,6 +164,8 @@ class AndroidCameraCameraX extends CameraPlatform { @visibleForTesting bool captureOrientationLocked = false; + bool shouldSetDefaultRotation = false; + DeviceOrientation? lockedOrientation; /// Returns list of all available cameras and their descriptions. @@ -386,6 +388,7 @@ class AndroidCameraCameraX extends CameraPlatform { int cameraId, DeviceOrientation orientation, ) async { + shouldSetDefaultRotation = true; captureOrientationLocked = true; lockedOrientation = orientation; @@ -555,14 +558,11 @@ class AndroidCameraCameraX extends CameraPlatform { } // Set target rotation to current photo orientation only if capture // orientation not locked. - if (!captureOrientationLocked) { - // print(await proxy.getPhotoOrientation(null)); - // print(await prox) - await imageCapture!.setTargetRotation( - _getTargetRotation(await proxy.getPhotoOrientation(null))); - } else { - await imageCapture!.setTargetRotation(_getTargetRotation( - await proxy.getPhotoOrientation(lockedOrientation))); + if (!captureOrientationLocked && shouldSetDefaultRotation) { + // TESTER: use for testing not other use cases + print("SETTING DEFAULT ROTATION!"); + print(await proxy.getDefaultRotation()); + await imageCapture!.setTargetRotation(await proxy.getDefaultRotation()); } final String picturePath = await imageCapture!.takePicture(); @@ -652,6 +652,8 @@ class AndroidCameraCameraX extends CameraPlatform { if (!captureOrientationLocked) { await videoCapture!.setTargetRotation( _getTargetRotation(await proxy.getVideoOrientation(null))); + } else if (shouldSetDefaultRotation) { + await imageCapture!.setTargetRotation(await proxy.getDefaultRotation()); } videoOutputPath = @@ -760,6 +762,8 @@ class AndroidCameraCameraX extends CameraPlatform { if (!captureOrientationLocked) { await imageAnalysis!.setTargetRotation( _getTargetRotation(await proxy.getPhotoOrientation(null))); + } else if (shouldSetDefaultRotation) { + await imageCapture!.setTargetRotation(await proxy.getDefaultRotation()); } // Create and set Analyzer that can read image data for image streaming. 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 5e3f2d2ff67..0aac178c7f9 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 @@ -1045,6 +1045,33 @@ class DeviceOrientationManagerHostApi { return (replyList[0] as int?)!; } } + + Future getDefaultRotation() async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.getDefaultRotation', codec, + binaryMessenger: _binaryMessenger); + final List? replyList = + await channel.send(null) 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 if (replyList[0] == null) { + throw PlatformException( + code: 'null-error', + message: 'Host platform returned null value for non-null return value.', + ); + } else { + return (replyList[0] as int?)!; + } + } } abstract class DeviceOrientationManagerFlutterApi { diff --git a/packages/camera/camera_android_camerax/lib/src/camerax_proxy.dart b/packages/camera/camera_android_camerax/lib/src/camerax_proxy.dart index bf4236ceb26..0d02488edc7 100644 --- a/packages/camera/camera_android_camerax/lib/src/camerax_proxy.dart +++ b/packages/camera/camera_android_camerax/lib/src/camerax_proxy.dart @@ -52,6 +52,7 @@ class CameraXProxy { this.setPreviewSurfaceProvider = _setPreviewSurfaceProvider, this.getPhotoOrientation = _getPhotoOrientation, this.getVideoOrientation = _getVideoOrientation, + this.getDefaultRotation = _getDefaultRotation, }); /// Returns a [ProcessCameraProvider] instance. @@ -142,6 +143,8 @@ class CameraXProxy { /// Retrieves current video orientation in degrees. Future Function(DeviceOrientation? orientation) getVideoOrientation; + Future Function() getDefaultRotation; + static Future _getProcessCameraProvider() { return ProcessCameraProvider.getInstance(); } @@ -247,4 +250,8 @@ class CameraXProxy { DeviceOrientation? orientation) async { return DeviceOrientationManager.getVideoOrientation(orientation); } + + static Future _getDefaultRotation() async { + return DeviceOrientationManager.getDefaultRotation(); + } } diff --git a/packages/camera/camera_android_camerax/lib/src/device_orientation_manager.dart b/packages/camera/camera_android_camerax/lib/src/device_orientation_manager.dart index 0cd6a961dd7..0f81f410b22 100644 --- a/packages/camera/camera_android_camerax/lib/src/device_orientation_manager.dart +++ b/packages/camera/camera_android_camerax/lib/src/device_orientation_manager.dart @@ -79,6 +79,14 @@ class DeviceOrientationManager { : serializeDeviceOrientation(sensorOrientation)); } + static Future getDefaultRotation( + {BinaryMessenger? binaryMessenger}) async { + final DeviceOrientationManagerHostApi api = + DeviceOrientationManagerHostApi(binaryMessenger: binaryMessenger); + + return api.getDefaultRotation(); + } + /// Serializes[DeviceOrientation] into a [String]. static String serializeDeviceOrientation(DeviceOrientation orientation) { switch (orientation) { diff --git a/packages/camera/camera_android_camerax/pigeons/camerax_library.dart b/packages/camera/camera_android_camerax/pigeons/camerax_library.dart index 69cc96a0899..7a9ea14b71d 100644 --- a/packages/camera/camera_android_camerax/pigeons/camerax_library.dart +++ b/packages/camera/camera_android_camerax/pigeons/camerax_library.dart @@ -230,6 +230,8 @@ abstract class DeviceOrientationManagerHostApi { int getPhotoOrientation(String? orientation); int getVideoOrientation(String? orientation); + + int getDefaultRotation(); } @FlutterApi() 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 71ae481b956..0a7048939ad 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 @@ -494,6 +494,8 @@ abstract class TestDeviceOrientationManagerHostApi { int getVideoOrientation(String? orientation); + int getDefaultRotation(); + static void setup(TestDeviceOrientationManagerHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( @@ -565,6 +567,20 @@ abstract class TestDeviceOrientationManagerHostApi { }); } } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.getDefaultRotation', codec, + binaryMessenger: binaryMessenger); + if (api == null) { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + } else { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + // ignore message + final int output = api.getDefaultRotation(); + return [output]; + }); + } + } } } From a410de1564a9a8e93ae642260586576249a2bf3b Mon Sep 17 00:00:00 2001 From: camsim99 Date: Fri, 8 Dec 2023 17:24:12 -0800 Subject: [PATCH 19/29] Add theoretical fix --- .../camerax/DeviceOrientationManager.java | 207 +--- .../DeviceOrientationManagerHostApiImpl.java | 58 +- .../camerax/GeneratedCameraXLibrary.java | 993 +++++++++++------- .../lib/src/android_camera_camerax.dart | 69 +- .../lib/src/camerax_library.g.dart | 417 ++++---- .../lib/src/camerax_proxy.dart | 18 - .../lib/src/device_orientation_manager.dart | 29 +- .../pigeons/camerax_library.dart | 5 - .../android_camera_camerax_test.mocks.dart | 46 + .../test/camera_control_test.mocks.dart | 1 + .../test/camera_info_test.mocks.dart | 5 + .../test/camera_selector_test.mocks.dart | 1 + .../test/camera_test.mocks.dart | 1 + ...device_orientation_manager_test.mocks.dart | 16 +- .../test/image_analysis_test.mocks.dart | 3 + .../test/image_capture_test.mocks.dart | 3 + .../test/image_proxy_test.mocks.dart | 1 + .../test/live_data_test.mocks.dart | 2 + .../test/pending_recording_test.mocks.dart | 3 + .../test/preview_test.mocks.dart | 4 + .../process_camera_provider_test.mocks.dart | 5 + .../test/quality_selector_test.mocks.dart | 5 + .../test/recorder_test.mocks.dart | 4 + .../test/recording_test.mocks.dart | 3 + .../test/resolution_selector_test.mocks.dart | 1 + .../test/system_services_test.mocks.dart | 1 + .../test/test_camerax_library.g.dart | 857 +++++++++------ .../test/video_capture_test.mocks.dart | 2 + 28 files changed, 1523 insertions(+), 1237 deletions(-) diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManager.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManager.java index 948b35a76b6..4dce8c0c67f 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManager.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManager.java @@ -14,12 +14,10 @@ import android.view.Surface; import android.view.WindowManager; import androidx.annotation.NonNull; -import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import io.flutter.embedding.engine.systemchannels.PlatformChannel; import io.flutter.embedding.engine.systemchannels.PlatformChannel.DeviceOrientation; -import android.util.Log; /** * Support class to help to determine the media orientation based on the orientation of the device. @@ -87,149 +85,6 @@ public void stop() { broadcastReceiver = null; } - /** - * Returns the device's photo orientation in degrees based on the sensor orientation and the last - * known UI orientation. - * - *

Returns one of 0, 90, 180 or 270. - * - * @return The device's photo orientation in degrees. - */ - public int getPhotoOrientation() { - return this.getPhotoOrientation(this.lastOrientation); - } - - /** - * Returns the device's photo orientation in degrees based on the sensor orientation and the - * supplied {@link PlatformChannel.DeviceOrientation} value. - * - *

Returns one of 0, 90, 180 or 270. - * - * @param orientation The {@link PlatformChannel.DeviceOrientation} value that is to be converted - * into degrees. - * @return The device's photo orientation in degrees. - */ - // public int getPhotoOrientation(@Nullable PlatformChannel.DeviceOrientation orientation) { - // int angle = 0; - // // Fallback to device orientation when the orientation value is null. - // if (orientation == null) { - // orientation = getUIOrientation(); - // } - - // switch (orientation) { - // case PORTRAIT_UP: - // angle = 90; - // break; - // case PORTRAIT_DOWN: - // angle = 270; - // break; - // case LANDSCAPE_LEFT: - // angle = isFrontFacing ? 180 : 0; - // break; - // case LANDSCAPE_RIGHT: - // angle = isFrontFacing ? 0 : 180; - // break; - // } - - // // Sensor orientation is 90 for most devices, or 270 for some devices (eg. Nexus 5X). - // // This has to be taken into account so the JPEG is rotated properly. - // // For devices with orientation of 90, this simply returns the mapping from ORIENTATIONS. - // // For devices with orientation of 270, the JPEG is rotated 180 degrees instead. - // return (angle + sensorOrientation + 270) % 360; - // } - - public int getPhotoOrientation(@Nullable PlatformChannel.DeviceOrientation lockedOrientation) { - PlatformChannel.DeviceOrientation currentOrientation = this.lastOrientation; - if (currentOrientation == null) { - currentOrientation = getUIOrientation(); - } - - Log.e("CAMILLE", Integer.toString(decodeOrientation(lockedOrientation))); - Log.e("CAMILLE", Integer.toString(decodeOrientation(currentOrientation))); - // return (decodeOrientation(lockedOrientation) - decodeOrientation(currentOrientation) + 360) % 360; - return ((360 - decodeOrientation(lockedOrientation)) + 360) % 360; - - } - - - public int decodeOrientation(@NonNull PlatformChannel.DeviceOrientation orientation) { - switch (orientation) { - case PORTRAIT_UP: - return 0; - case LANDSCAPE_RIGHT: - return 90; - case PORTRAIT_DOWN: - return 180; - case LANDSCAPE_LEFT: - return 270; - } - throw new IllegalArgumentException("um no"); - } - - - /** - * Returns the device's video orientation in clockwise degrees based on the sensor orientation and - * the last known UI orientation. - * - *

Returns one of 0, 90, 180 or 270. - * - * @return The device's video orientation in clockwise degrees. - */ - public int getVideoOrientation() { - return this.getVideoOrientation(this.lastOrientation); - } - - /** - * Returns the device's video orientation in clockwise degrees based on the sensor orientation and - * the supplied {@link PlatformChannel.DeviceOrientation} value. - * - *

Returns one of 0, 90, 180 or 270. - * - *

More details can be found in the official Android documentation: - * https://developer.android.com/reference/android/media/MediaRecorder#setOrientationHint(int) - * - *

See also: - * https://developer.android.com/training/camera2/camera-preview-large-screens#orientation_calculation - * - * @param orientation The {@link PlatformChannel.DeviceOrientation} value that is to be converted - * into degrees. - * @return The device's video orientation in clockwise degrees. - */ - public int getVideoOrientation(@Nullable PlatformChannel.DeviceOrientation orientation) { - int angle = 0; - - // Fallback to device orientation when the orientation value is null. - if (orientation == null) { - orientation = getUIOrientation(); - } - - switch (orientation) { - case PORTRAIT_UP: - angle = 0; - break; - case PORTRAIT_DOWN: - angle = 180; - break; - case LANDSCAPE_LEFT: - angle = 270; - break; - case LANDSCAPE_RIGHT: - angle = 90; - break; - } - - if (isFrontFacing) { - angle *= -1; - } - - return (angle + sensorOrientation + 360) % 360; - } - - /** @return the last received UI orientation. */ - public @Nullable PlatformChannel.DeviceOrientation getLastUIOrientation() { - return this.lastOrientation; - } - /** * Handles orientation changes based on change events triggered by the OrientationIntentFilter. * @@ -296,62 +151,18 @@ PlatformChannel.DeviceOrientation getUIOrientation() { } /** - * Calculates the sensor orientation based on the supplied angle. + * Gets default capture rotation for CameraX {@code UseCase}s. * - *

This method is visible for testing purposes only and should never be used outside this - * class. + *

See + * https://developer.android.com/reference/androidx/camera/core/ImageCapture#setTargetRotation(int), + * for instance. * - * @param angle Orientation angle. - * @return The sensor orientation based on the supplied angle. + * @return The rotation of the screen from its "natural" orientation; one of {@code + * Surface.ROTATION_0}, {@code Surface.ROTATION_90}, {@code Surface.ROTATION_180}, {@code + * Surface.ROTATION_270} */ - @VisibleForTesting - PlatformChannel.DeviceOrientation calculateSensorOrientation(int angle) { - final int tolerance = 45; - angle += tolerance; - - // Orientation is 0 in the default orientation mode. This is portrait-mode for phones - // and landscape for tablets. We have to compensate for this by calculating the default - // orientation, and apply an offset accordingly. - int defaultDeviceOrientation = getDeviceDefaultOrientation(); - if (defaultDeviceOrientation == Configuration.ORIENTATION_LANDSCAPE) { - angle += 90; - } - // Determine the orientation - angle = angle % 360; - return new PlatformChannel.DeviceOrientation[] { - PlatformChannel.DeviceOrientation.PORTRAIT_UP, - PlatformChannel.DeviceOrientation.LANDSCAPE_LEFT, - PlatformChannel.DeviceOrientation.PORTRAIT_DOWN, - PlatformChannel.DeviceOrientation.LANDSCAPE_RIGHT, - } - [angle / 90]; - } - - /** - * Gets the default orientation of the device. - * - *

This method is visible for testing purposes only and should never be used outside this - * class. - * - * @return The default orientation of the device. - */ - @VisibleForTesting - int getDeviceDefaultOrientation() { - Configuration config = activity.getResources().getConfiguration(); - int rotation = getDisplay().getRotation(); - if (((rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_180) - && config.orientation == Configuration.ORIENTATION_LANDSCAPE) - || ((rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270) - && config.orientation == Configuration.ORIENTATION_PORTRAIT)) { - return Configuration.ORIENTATION_LANDSCAPE; - } else { - return Configuration.ORIENTATION_PORTRAIT; - } - } - - /** Gets default capture rotation for CameraX {@code UseCase}s. */ - Long getDefaultRotation() { - return Long.valueOf(getDisplay().getRotation()); // todo: consider saving this value (display) since we could be calling this a lot. also makes this an int and the host api Long + int getDefaultRotation() { + return getDisplay().getRotation(); } /** diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerHostApiImpl.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerHostApiImpl.java index ce189aa8bba..dccf517030e 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerHostApiImpl.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerHostApiImpl.java @@ -13,7 +13,6 @@ import io.flutter.plugins.camerax.CameraPermissionsManager.PermissionsRegistry; import io.flutter.plugins.camerax.GeneratedCameraXLibrary.DeviceOrientationManagerHostApi; -import android.util.Log; public class DeviceOrientationManagerHostApiImpl implements DeviceOrientationManagerHostApi { private final BinaryMessenger binaryMessenger; @@ -56,7 +55,6 @@ public void startListeningForDeviceOrientationChange( isFrontFacing, sensorOrientation.intValue(), (DeviceOrientation newOrientation) -> { - Log.e("CAMILLE HI", serializeDeviceOrientation(newOrientation)); deviceOrientationManagerFlutterApiImpl.sendDeviceOrientationChangedEvent( serializeDeviceOrientation(newOrientation), reply -> {}); }); @@ -68,25 +66,6 @@ String serializeDeviceOrientation(DeviceOrientation orientation) { return orientation.toString(); } - DeviceOrientation deserializeDeviceOrientationString(@Nullable String orientation) { - if (orientation == null) { - return null; - } - switch(orientation) { - case "LANDSCAPE_LEFT": - return DeviceOrientation.LANDSCAPE_LEFT; - case "LANDSCAPE_RIGHT": - return DeviceOrientation.LANDSCAPE_RIGHT; - case "PORTRAIT_DOWN": - return DeviceOrientation.PORTRAIT_DOWN; - case "PORTRAIT_UP": - return DeviceOrientation.PORTRAIT_UP; - default: - throw new IllegalArgumentException( - "Specified device orientation is unspecified."); - } - } - /** * Tells the {@code deviceOrientationManager} to stop listening for orientation updates. * @@ -100,44 +79,13 @@ public void stopListeningForDeviceOrientationChange() { } } - /** - * Returns device's photo orientation in degrees based on the sensor orientation and - * last known UI orientation. - */ - @Override - public @NonNull Long getPhotoOrientation(@Nullable String orientation) { - if (deviceOrientationManager == null) { - throw new NullPointerException( - "startListeningForDeviceOrientationChange must first be called to subscribe to device orientation changes in order to retrieve the photo orientation."); - } - if (orientation == null) { - return Long.valueOf(deviceOrientationManager.getPhotoOrientation()); - } - return Long.valueOf(deviceOrientationManager.getPhotoOrientation(deserializeDeviceOrientationString(orientation))); - } - - /** - * Returns device's video orientation in clockwise degrees based on the sensor orientation - * and last known UI orientation. - */ + /** Gets default capture rotation for CameraX {@code UseCase}s. */ @Override - public @NonNull Long getVideoOrientation(@Nullable String orientation) { - if (deviceOrientationManager == null) { - throw new NullPointerException( - "startListeningForDeviceOrientationChange must first be called to subscribe to device orientation changes in order to retrieve the video orientation."); - } - if (orientation == null) { - return Long.valueOf(deviceOrientationManager.getVideoOrientation()); - } - return Long.valueOf(deviceOrientationManager.getVideoOrientation(deserializeDeviceOrientationString(orientation))); - } - - @Override public @NonNull Long getDefaultRotation() { - if (deviceOrientationManager == null) { + if (deviceOrientationManager == null) { throw new NullPointerException( "startListeningForDeviceOrientationChange must first be called to subscribe to device orientation changes in order to retrieve the video orientation."); } - return deviceOrientationManager.getDefaultRotation(); + return Long.valueOf(deviceOrientationManager.getDefaultRotation()); } } 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 4ccc6ad56bd..6cdd8b5f27b 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,17 +1133,17 @@ 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); - @NonNull + @NonNull Long getCameraControl(@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 = @@ -1093,10 +1156,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; } @@ -1117,10 +1180,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraHost ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - Long output = api.getCameraControl((identifierArg == null) ? null : identifierArg.longValue()); + Long output = + api.getCameraControl( + (identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1140,7 +1204,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); @@ -1149,6 +1213,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1188,21 +1253,28 @@ 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); - @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) -> { @@ -1231,7 +1303,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) -> { @@ -1242,8 +1316,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; } @@ -1263,7 +1336,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); @@ -1272,10 +1345,13 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + 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)); @@ -1284,29 +1360,30 @@ public void onCameraError(@NonNull String errorDescriptionArg, @NonNull Reply getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `DeviceOrientationManagerHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable DeviceOrientationManagerHostApi api) { + /** + * Sets up an instance of `DeviceOrientationManagerHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable DeviceOrientationManagerHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.DeviceOrientationManagerHostApi.startListeningForDeviceOrientationChange", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.DeviceOrientationManagerHostApi.startListeningForDeviceOrientationChange", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1315,10 +1392,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable DeviceOrie 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; } @@ -1331,7 +1409,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable DeviceOrie { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.DeviceOrientationManagerHostApi.stopListeningForDeviceOrientationChange", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.DeviceOrientationManagerHostApi.stopListeningForDeviceOrientationChange", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1339,8 +1419,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable DeviceOrie try { api.stopListeningForDeviceOrientationChange(); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1353,55 +1432,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable DeviceOrie { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.DeviceOrientationManagerHostApi.getPhotoOrientation", getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList(); - ArrayList args = (ArrayList) message; - String orientationArg = (String) args.get(0); - try { - Long output = api.getPhotoOrientation(orientationArg); - wrapped.add(0, output); - } - catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.DeviceOrientationManagerHostApi.getVideoOrientation", getCodec()); - if (api != null) { - channel.setMessageHandler( - (message, reply) -> { - ArrayList wrapped = new ArrayList(); - ArrayList args = (ArrayList) message; - String orientationArg = (String) args.get(0); - try { - Long output = api.getVideoOrientation(orientationArg); - wrapped.add(0, output); - } - catch (Throwable exception) { - ArrayList wrappedError = wrapError(exception); - wrapped = wrappedError; - } - reply.reply(wrapped); - }); - } else { - channel.setMessageHandler(null); - } - } - { - BasicMessageChannel channel = - new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.DeviceOrientationManagerHostApi.getDefaultRotation", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.DeviceOrientationManagerHostApi.getDefaultRotation", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1409,8 +1442,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable DeviceOrie try { Long output = api.getDefaultRotation(); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1430,7 +1462,7 @@ public DeviceOrientationManagerFlutterApi(@NonNull BinaryMessenger argBinaryMess this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -1439,10 +1471,14 @@ 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.DeviceOrientationManagerFlutterApi.onDeviceOrientationChanged", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.DeviceOrientationManagerFlutterApi.onDeviceOrientationChanged", + getCodec()); channel.send( new ArrayList(Collections.singletonList(orientationArg)), channelReply -> callback.reply(null)); @@ -1478,14 +1514,15 @@ 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); void setTargetRotation(@NonNull Long identifier, @NonNull Long rotation); @@ -1494,7 +1531,7 @@ public interface 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 = @@ -1509,10 +1546,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; } @@ -1525,7 +1566,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) -> { @@ -1533,10 +1576,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; } @@ -1549,7 +1593,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) -> { @@ -1557,8 +1603,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; } @@ -1579,10 +1624,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; } @@ -1604,10 +1650,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PreviewHos Number identifierArg = (Number) args.get(0); Number rotationArg = (Number) args.get(1); try { - api.setTargetRotation((identifierArg == null) ? null : identifierArg.longValue(), (rotationArg == null) ? null : rotationArg.longValue()); + api.setTargetRotation( + (identifierArg == null) ? null : identifierArg.longValue(), + (rotationArg == null) ? null : rotationArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1622,10 +1669,10 @@ 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); void setTargetRotation(@NonNull Long identifier, @NonNull Long rotation); @@ -1634,7 +1681,10 @@ public interface 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 = @@ -1647,10 +1697,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; } @@ -1671,10 +1722,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; } @@ -1687,7 +1738,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable VideoCaptu { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.VideoCaptureHostApi.setTargetRotation", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.VideoCaptureHostApi.setTargetRotation", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1696,10 +1749,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable VideoCaptu Number identifierArg = (Number) args.get(0); Number rotationArg = (Number) args.get(1); try { - api.setTargetRotation((identifierArg == null) ? null : identifierArg.longValue(), (rotationArg == null) ? null : rotationArg.longValue()); + api.setTargetRotation( + (identifierArg == null) ? null : identifierArg.longValue(), + (rotationArg == null) ? null : rotationArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1719,7 +1773,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); @@ -1728,6 +1782,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1740,22 +1795,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 = @@ -1771,10 +1832,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; } @@ -1795,10 +1859,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; } @@ -1811,7 +1876,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) -> { @@ -1819,10 +1886,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; } @@ -1844,10 +1912,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; } @@ -1867,7 +1936,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); @@ -1876,7 +1945,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()); @@ -1888,15 +1962,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<>( @@ -1908,10 +1986,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; } @@ -1931,7 +2009,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); @@ -1940,6 +2018,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1964,7 +2043,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 = @@ -1979,8 +2060,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; } @@ -2003,8 +2083,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; } @@ -2027,8 +2106,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; } @@ -2051,8 +2129,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; } @@ -2072,7 +2149,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); @@ -2081,6 +2158,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2093,7 +2171,11 @@ 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 targetRotation, @Nullable Long flashMode, @Nullable Long resolutionSelectorId); + void create( + @NonNull Long identifier, + @Nullable Long targetRotation, + @Nullable Long flashMode, + @Nullable Long resolutionSelectorId); void setFlashMode(@NonNull Long identifier, @NonNull Long flashMode); @@ -2105,7 +2187,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 = @@ -2121,10 +2206,15 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageCaptu Number flashModeArg = (Number) args.get(2); Number resolutionSelectorIdArg = (Number) args.get(3); try { - api.create((identifierArg == null) ? null : identifierArg.longValue(), (targetRotationArg == null) ? null : targetRotationArg.longValue(), (flashModeArg == null) ? null : flashModeArg.longValue(), (resolutionSelectorIdArg == null) ? null : resolutionSelectorIdArg.longValue()); + api.create( + (identifierArg == null) ? null : identifierArg.longValue(), + (targetRotationArg == null) ? null : targetRotationArg.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; } @@ -2146,10 +2236,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; } @@ -2182,7 +2273,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); @@ -2191,7 +2283,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.ImageCaptureHostApi.setTargetRotation", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.ImageCaptureHostApi.setTargetRotation", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2200,10 +2294,11 @@ public void error(Throwable error) { Number identifierArg = (Number) args.get(0); Number rotationArg = (Number) args.get(1); try { - api.setTargetRotation((identifierArg == null) ? null : identifierArg.longValue(), (rotationArg == null) ? null : rotationArg.longValue()); + api.setTargetRotation( + (identifierArg == null) ? null : identifierArg.longValue(), + (rotationArg == null) ? null : rotationArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2217,7 +2312,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() {} @@ -2245,14 +2341,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<>( @@ -2266,10 +2367,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; } @@ -2284,14 +2387,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<>( @@ -2305,10 +2415,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; } @@ -2323,18 +2439,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) -> { @@ -2344,10 +2467,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; } @@ -2394,7 +2521,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); @@ -2403,7 +2530,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()); @@ -2447,7 +2579,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); @@ -2456,12 +2588,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)); } } @@ -2473,7 +2612,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); @@ -2482,7 +2621,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()); @@ -2494,7 +2638,10 @@ public void create(@NonNull Long identifierArg, @NonNull Double minZoomRatioArg, /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface ImageAnalysisHostApi { - void create(@NonNull Long identifier, @Nullable Long targetRotation, @Nullable Long resolutionSelectorId); + void create( + @NonNull Long identifier, + @Nullable Long targetRotation, + @Nullable Long resolutionSelectorId); void setAnalyzer(@NonNull Long identifier, @NonNull Long analyzerIdentifier); @@ -2506,8 +2653,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<>( @@ -2521,10 +2672,14 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageAnaly Number targetRotationArg = (Number) args.get(1); Number resolutionSelectorIdArg = (Number) args.get(2); try { - api.create((identifierArg == null) ? null : identifierArg.longValue(), (targetRotationArg == null) ? null : targetRotationArg.longValue(), (resolutionSelectorIdArg == null) ? null : resolutionSelectorIdArg.longValue()); + api.create( + (identifierArg == null) ? null : identifierArg.longValue(), + (targetRotationArg == null) ? null : targetRotationArg.longValue(), + (resolutionSelectorIdArg == null) + ? null + : resolutionSelectorIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2546,10 +2701,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; } @@ -2562,7 +2718,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) -> { @@ -2572,8 +2730,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; } @@ -2586,7 +2743,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageAnaly { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.ImageAnalysisHostApi.setTargetRotation", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.ImageAnalysisHostApi.setTargetRotation", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2595,10 +2754,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable ImageAnaly Number identifierArg = (Number) args.get(0); Number rotationArg = (Number) args.get(1); try { - api.setTargetRotation((identifierArg == null) ? null : identifierArg.longValue(), (rotationArg == null) ? null : rotationArg.longValue()); + api.setTargetRotation( + (identifierArg == null) ? null : identifierArg.longValue(), + (rotationArg == null) ? null : rotationArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2619,7 +2779,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 = @@ -2634,8 +2796,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; } @@ -2656,7 +2817,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 = @@ -2671,8 +2834,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; } @@ -2692,7 +2854,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); @@ -2701,7 +2863,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()); @@ -2718,7 +2884,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); @@ -2727,7 +2893,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()); @@ -2770,14 +2938,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 = @@ -2791,10 +2961,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; } @@ -2817,8 +2988,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; } @@ -2840,10 +3010,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; } @@ -2890,7 +3061,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); @@ -2899,7 +3070,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()); @@ -2916,7 +3091,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); @@ -2925,6 +3100,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2933,7 +3109,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()); @@ -2945,7 +3125,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); @@ -2954,7 +3134,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 = @@ -2967,10 +3149,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; } @@ -2993,8 +3175,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; } @@ -3014,7 +3195,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); @@ -3023,7 +3204,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()); @@ -3040,7 +3227,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); @@ -3049,12 +3236,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)); } } @@ -3093,17 +3287,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<>( @@ -3114,13 +3315,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; } @@ -3133,19 +3337,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; } @@ -3160,14 +3369,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<>( @@ -3178,13 +3394,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; } @@ -3199,16 +3421,22 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable FallbackSt /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface CameraControlHostApi { - void enableTorch(@NonNull Long identifier, @NonNull Boolean torch, @NonNull Result result); + void enableTorch( + @NonNull Long identifier, @NonNull Boolean torch, @NonNull Result result); - void setZoomRatio(@NonNull Long identifier, @NonNull Double ratio, @NonNull Result result); + void setZoomRatio( + @NonNull Long identifier, @NonNull Double ratio, @NonNull Result result); /** The codec used by CameraControlHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `CameraControlHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CameraControlHostApi api) { + /** + * Sets up an instance of `CameraControlHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable CameraControlHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -3233,7 +3461,10 @@ public void error(Throwable error) { } }; - api.enableTorch((identifierArg == null) ? null : identifierArg.longValue(), torchArg, resultCallback); + api.enableTorch( + (identifierArg == null) ? null : identifierArg.longValue(), + torchArg, + resultCallback); }); } else { channel.setMessageHandler(null); @@ -3242,7 +3473,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.CameraControlHostApi.setZoomRatio", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.CameraControlHostApi.setZoomRatio", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -3263,7 +3496,10 @@ public void error(Throwable error) { } }; - api.setZoomRatio((identifierArg == null) ? null : identifierArg.longValue(), ratioArg, resultCallback); + api.setZoomRatio( + (identifierArg == null) ? null : identifierArg.longValue(), + ratioArg, + resultCallback); }); } else { channel.setMessageHandler(null); @@ -3279,7 +3515,7 @@ public CameraControlFlutterApi(@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); @@ -3288,6 +3524,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( 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 777a67affe7..0268c609c6c 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 @@ -166,8 +166,6 @@ class AndroidCameraCameraX extends CameraPlatform { bool shouldSetDefaultRotation = false; - DeviceOrientation? lockedOrientation; - /// Returns list of all available cameras and their descriptions. @override Future> availableCameras() async { @@ -390,38 +388,23 @@ class AndroidCameraCameraX extends CameraPlatform { ) async { shouldSetDefaultRotation = true; captureOrientationLocked = true; - lockedOrientation = orientation; - - // Get rotation for photos and vi - //deos based on orientation. - final int targetPhotoRotation = - _getTargetRotation(await proxy.getPhotoOrientation(orientation)); - final int targetVideoRotation = - _getTargetRotation(await proxy.getVideoOrientation(orientation)); + // Get target rotation based on locked orientation + final int targetLockedRotation = + (_getRotationFromDeviceOrientation(orientation) + 360) % 360; /// Update UseCases to use target device orientation. - await imageCapture!.setTargetRotation(targetPhotoRotation); - await imageAnalysis!.setTargetRotation(targetPhotoRotation); - await videoCapture!.setTargetRotation(targetVideoRotation); + await imageCapture!.setTargetRotation(targetLockedRotation); + await imageAnalysis!.setTargetRotation(targetLockedRotation); + await videoCapture!.setTargetRotation(targetLockedRotation); } /// Unlocks the capture orientation. @override Future unlockCaptureOrientation(int cameraId) async { + // Flag that default rotation should be set for UseCases + // as needed. captureOrientationLocked = false; - lockedOrientation = null; - - // Get current orientation for photos and videos. - final int currentPhotoOrientation = - _getTargetRotation(await proxy.getPhotoOrientation(null)); - final int currentVideoOrientation = - _getTargetRotation(await proxy.getVideoOrientation(null)); - - /// Update UseCases to use current device orientation. - await imageCapture!.setTargetRotation(currentPhotoOrientation); - await imageAnalysis!.setTargetRotation(currentPhotoOrientation); - await videoCapture!.setTargetRotation(currentVideoOrientation); } /// Gets the minimum supported exposure offset for the selected camera in EV units. @@ -556,12 +539,10 @@ class AndroidCameraCameraX extends CameraPlatform { // been enabled. await imageCapture!.setFlashMode(ImageCapture.flashModeOff); } + // Set target rotation to current photo orientation only if capture // orientation not locked. if (!captureOrientationLocked && shouldSetDefaultRotation) { - // TESTER: use for testing not other use cases - print("SETTING DEFAULT ROTATION!"); - print(await proxy.getDefaultRotation()); await imageCapture!.setTargetRotation(await proxy.getDefaultRotation()); } @@ -647,13 +628,10 @@ class AndroidCameraCameraX extends CameraPlatform { .bindToLifecycle(cameraSelector!, [videoCapture!]); } - // Set target rotation to current video orientation only if capture + // Set target rotation to current photo orientation only if capture // orientation not locked. - if (!captureOrientationLocked) { - await videoCapture!.setTargetRotation( - _getTargetRotation(await proxy.getVideoOrientation(null))); - } else if (shouldSetDefaultRotation) { - await imageCapture!.setTargetRotation(await proxy.getDefaultRotation()); + if (!captureOrientationLocked && shouldSetDefaultRotation) { + await videoCapture!.setTargetRotation(await proxy.getDefaultRotation()); } videoOutputPath = @@ -759,11 +737,8 @@ class AndroidCameraCameraX extends CameraPlatform { Future _configureImageAnalysis(int cameraId) async { // Set target rotation to current photo orientation only if capture // orientation not locked. - if (!captureOrientationLocked) { - await imageAnalysis!.setTargetRotation( - _getTargetRotation(await proxy.getPhotoOrientation(null))); - } else if (shouldSetDefaultRotation) { - await imageCapture!.setTargetRotation(await proxy.getDefaultRotation()); + if (!captureOrientationLocked && shouldSetDefaultRotation) { + await imageAnalysis!.setTargetRotation(await proxy.getDefaultRotation()); } // Create and set Analyzer that can read image data for image streaming. @@ -911,6 +886,22 @@ class AndroidCameraCameraX extends CameraPlatform { } } + /// Returns counter-clockwise degrees of rotation from + /// [DeviceOrientation.portraitUp] required to reach the specified + /// [DeviceOrientation]. + int _getRotationFromDeviceOrientation(DeviceOrientation orientation) { + switch (orientation) { + case DeviceOrientation.portraitUp: + return 0; + case DeviceOrientation.landscapeLeft: + return 90; + case DeviceOrientation.portraitDown: + return 180; + case DeviceOrientation.landscapeRight: + return 270; + } + } + /// Returns the [ResolutionSelector] that maps to the specified resolution /// preset for camera [UseCase]s. /// 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 0aac178c7f9..ebbd30fbfd9 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, @@ -814,7 +824,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, @@ -842,7 +852,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); @@ -860,9 +870,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?; @@ -915,7 +927,8 @@ 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.onCameraError', codec, @@ -925,7 +938,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, @@ -948,12 +961,15 @@ class DeviceOrientationManagerHostApi { static const MessageCodec codec = StandardMessageCodec(); - 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.DeviceOrientationManagerHostApi.startListeningForDeviceOrientationChange', codec, + 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.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', @@ -972,10 +988,10 @@ class DeviceOrientationManagerHostApi { Future stopListeningForDeviceOrientationChange() async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.stopListeningForDeviceOrientationChange', codec, + 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.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', @@ -992,66 +1008,12 @@ class DeviceOrientationManagerHostApi { } } - Future getPhotoOrientation(String? arg_orientation) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.getPhotoOrientation', codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_orientation]) 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 if (replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (replyList[0] as int?)!; - } - } - - Future getVideoOrientation(String? arg_orientation) async { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.getVideoOrientation', codec, - binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_orientation]) 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 if (replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (replyList[0] as int?)!; - } - } - Future getDefaultRotation() async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.getDefaultRotation', codec, + 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.getDefaultRotation', + 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', @@ -1079,17 +1041,19 @@ abstract class DeviceOrientationManagerFlutterApi { void onDeviceOrientationChanged(String orientation); - static void setup(DeviceOrientationManagerFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(DeviceOrientationManagerFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.DeviceOrientationManagerFlutterApi.onDeviceOrientationChanged', codec, + 'dev.flutter.pigeon.DeviceOrientationManagerFlutterApi.onDeviceOrientationChanged', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.DeviceOrientationManagerFlutterApi.onDeviceOrientationChanged was null.'); + 'Argument for dev.flutter.pigeon.DeviceOrientationManagerFlutterApi.onDeviceOrientationChanged was null.'); final List args = (message as List?)!; final String? arg_orientation = (args[0] as String?); assert(arg_orientation != null, @@ -1117,7 +1081,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); @@ -1135,12 +1099,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', @@ -1188,8 +1154,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', @@ -1237,8 +1202,8 @@ class PreviewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PreviewHostApi.setTargetRotation', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_rotation]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_rotation]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1324,8 +1289,8 @@ class VideoCaptureHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.VideoCaptureHostApi.setTargetRotation', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_rotation]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_rotation]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1348,7 +1313,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, @@ -1358,7 +1324,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, @@ -1381,12 +1347,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', @@ -1432,7 +1403,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?; @@ -1461,8 +1433,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', @@ -1490,7 +1462,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, @@ -1500,7 +1473,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, @@ -1558,7 +1531,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, @@ -1568,7 +1542,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, @@ -1685,7 +1659,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, @@ -1695,7 +1670,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, @@ -1718,12 +1693,17 @@ class ImageCaptureHostApi { static const MessageCodec codec = StandardMessageCodec(); - Future create(int arg_identifier, int? arg_targetRotation, int? arg_flashMode, int? arg_resolutionSelectorId) async { + Future create(int arg_identifier, int? arg_targetRotation, + 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_targetRotation, arg_flashMode, arg_resolutionSelectorId]) as List?; + final List? replyList = await channel.send([ + arg_identifier, + arg_targetRotation, + arg_flashMode, + arg_resolutionSelectorId + ]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1744,8 +1724,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', @@ -1793,8 +1773,8 @@ class ImageCaptureHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ImageCaptureHostApi.setTargetRotation', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_rotation]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_rotation]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1827,7 +1807,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); @@ -1845,12 +1825,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', @@ -1878,12 +1860,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', @@ -1911,12 +1897,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', @@ -1949,7 +1939,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); @@ -1962,7 +1952,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, @@ -1972,12 +1963,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?); @@ -2004,7 +1996,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); @@ -2015,9 +2007,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, @@ -2027,18 +2023,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; }); } @@ -2051,7 +2049,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, @@ -2061,7 +2060,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, @@ -2090,12 +2089,16 @@ class ImageAnalysisHostApi { static const MessageCodec codec = StandardMessageCodec(); - Future create(int arg_identifier, int? arg_targetRotation, int? arg_resolutionSelectorId) async { + Future create(int arg_identifier, int? arg_targetRotation, + 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_targetRotation, arg_resolutionSelectorId]) as List?; + final List? replyList = await channel.send([ + arg_identifier, + arg_targetRotation, + arg_resolutionSelectorId + ]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2112,12 +2115,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', @@ -2160,8 +2165,8 @@ class ImageAnalysisHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.ImageAnalysisHostApi.setTargetRotation', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_rotation]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_rotation]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2250,7 +2255,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, @@ -2260,7 +2266,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, @@ -2281,7 +2287,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, @@ -2291,7 +2298,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, @@ -2322,7 +2329,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); @@ -2345,7 +2352,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', @@ -2384,12 +2392,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', @@ -2422,7 +2431,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); @@ -2435,7 +2444,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, @@ -2445,12 +2455,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!); @@ -2468,7 +2479,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, @@ -2478,7 +2490,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, @@ -2497,7 +2509,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, @@ -2578,7 +2590,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, @@ -2588,7 +2601,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, @@ -2615,7 +2628,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, @@ -2625,7 +2639,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, @@ -2639,7 +2653,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; }); } @@ -2665,9 +2680,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); @@ -2685,12 +2700,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', @@ -2707,12 +2728,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', @@ -2745,12 +2767,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', @@ -2782,8 +2808,8 @@ class CameraControlHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraControlHostApi.enableTorch', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_torch]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_torch]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2804,8 +2830,8 @@ class CameraControlHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraControlHostApi.setZoomRatio', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_ratio]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_ratio]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2828,7 +2854,8 @@ abstract class CameraControlFlutterApi { void create(int identifier); - static void setup(CameraControlFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(CameraControlFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraControlFlutterApi.create', codec, @@ -2838,7 +2865,7 @@ abstract class CameraControlFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CameraControlFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.CameraControlFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, diff --git a/packages/camera/camera_android_camerax/lib/src/camerax_proxy.dart b/packages/camera/camera_android_camerax/lib/src/camerax_proxy.dart index 0d02488edc7..105048fc77a 100644 --- a/packages/camera/camera_android_camerax/lib/src/camerax_proxy.dart +++ b/packages/camera/camera_android_camerax/lib/src/camerax_proxy.dart @@ -50,8 +50,6 @@ class CameraXProxy { this.startListeningForDeviceOrientationChange = _startListeningForDeviceOrientationChange, this.setPreviewSurfaceProvider = _setPreviewSurfaceProvider, - this.getPhotoOrientation = _getPhotoOrientation, - this.getVideoOrientation = _getVideoOrientation, this.getDefaultRotation = _getDefaultRotation, }); @@ -137,12 +135,6 @@ class CameraXProxy { /// the ID corresponding to the surface it will provide. Future Function(Preview preview) setPreviewSurfaceProvider; - /// Retrieves current photo orientation in degrees. - Future Function(DeviceOrientation? orientation) getPhotoOrientation; - - /// Retrieves current video orientation in degrees. - Future Function(DeviceOrientation? orientation) getVideoOrientation; - Future Function() getDefaultRotation; static Future _getProcessCameraProvider() { @@ -241,16 +233,6 @@ class CameraXProxy { return preview.setSurfaceProvider(); } - static Future _getPhotoOrientation( - DeviceOrientation? orientation) async { - return DeviceOrientationManager.getPhotoOrientation(orientation); - } - - static Future _getVideoOrientation( - DeviceOrientation? orientation) async { - return DeviceOrientationManager.getVideoOrientation(orientation); - } - static Future _getDefaultRotation() async { return DeviceOrientationManager.getDefaultRotation(); } diff --git a/packages/camera/camera_android_camerax/lib/src/device_orientation_manager.dart b/packages/camera/camera_android_camerax/lib/src/device_orientation_manager.dart index 0f81f410b22..7eea44ce826 100644 --- a/packages/camera/camera_android_camerax/lib/src/device_orientation_manager.dart +++ b/packages/camera/camera_android_camerax/lib/src/device_orientation_manager.dart @@ -49,36 +49,11 @@ class DeviceOrientationManager { api.stopListeningForDeviceOrientationChange(); } - /// Retrieves photo orientation in degrees based on the sensor orientation - /// and the last known UI orientation. + /// Retrieves the default rotation that CameraX uses for [UseCase]s in terms + /// of one of the [Surface] rotation constants. /// /// [startListeningForDeviceOrientationChange] must be called before calling /// this method. - static Future getPhotoOrientation(DeviceOrientation? sensorOrientation, - {BinaryMessenger? binaryMessenger}) async { - final DeviceOrientationManagerHostApi api = - DeviceOrientationManagerHostApi(binaryMessenger: binaryMessenger); - - return api.getPhotoOrientation(sensorOrientation == null - ? null - : serializeDeviceOrientation(sensorOrientation)); - } - - /// Retrieves video orientation in degrees based on the sensor - /// [DeviceOrientation] and the last known UI orientation. - /// - /// [startListeningForDeviceOrientationChange] must be called before calling - /// this method. - static Future getVideoOrientation(DeviceOrientation? sensorOrientation, - {BinaryMessenger? binaryMessenger}) async { - final DeviceOrientationManagerHostApi api = - DeviceOrientationManagerHostApi(binaryMessenger: binaryMessenger); - - return api.getVideoOrientation(sensorOrientation == null - ? null - : serializeDeviceOrientation(sensorOrientation)); - } - static Future getDefaultRotation( {BinaryMessenger? binaryMessenger}) async { final DeviceOrientationManagerHostApi api = diff --git a/packages/camera/camera_android_camerax/pigeons/camerax_library.dart b/packages/camera/camera_android_camerax/pigeons/camerax_library.dart index 7a9ea14b71d..7a2422e17df 100644 --- a/packages/camera/camera_android_camerax/pigeons/camerax_library.dart +++ b/packages/camera/camera_android_camerax/pigeons/camerax_library.dart @@ -226,11 +226,6 @@ abstract class DeviceOrientationManagerHostApi { void stopListeningForDeviceOrientationChange(); - // TODO(camsim99): Change String orientations to enum for readability. - int getPhotoOrientation(String? orientation); - - int getVideoOrientation(String? orientation); - int getDefaultRotation(); } 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 536392443ae..981ac4cc4f4 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 @@ -261,6 +261,7 @@ class MockCamera extends _i1.Mock implements _i9.Camera { ), )), ) as _i16.Future<_i2.CameraInfo>); + @override _i16.Future<_i3.CameraControl> getCameraControl() => (super.noSuchMethod( Invocation.method( @@ -299,6 +300,7 @@ class MockCameraInfo extends _i1.Mock implements _i2.CameraInfo { returnValue: _i16.Future.value(0), returnValueForMissingStub: _i16.Future.value(0), ) as _i16.Future); + @override _i16.Future<_i4.LiveData<_i18.CameraState>> getCameraState() => (super.noSuchMethod( @@ -324,6 +326,7 @@ class MockCameraInfo extends _i1.Mock implements _i2.CameraInfo { ), )), ) as _i16.Future<_i4.LiveData<_i18.CameraState>>); + @override _i16.Future<_i5.ExposureState> getExposureState() => (super.noSuchMethod( Invocation.method( @@ -346,6 +349,7 @@ class MockCameraInfo extends _i1.Mock implements _i2.CameraInfo { ), )), ) as _i16.Future<_i5.ExposureState>); + @override _i16.Future<_i4.LiveData<_i19.ZoomState>> getZoomState() => (super.noSuchMethod( @@ -387,6 +391,7 @@ class MockCameraControl extends _i1.Mock implements _i3.CameraControl { returnValue: _i16.Future.value(), returnValueForMissingStub: _i16.Future.value(), ) as _i16.Future); + @override _i16.Future setZoomRatio(double? ratio) => (super.noSuchMethod( Invocation.method( @@ -415,18 +420,21 @@ class MockCameraImageData extends _i1.Mock implements _i6.CameraImageData { Invocation.getter(#format), ), ) as _i6.CameraImageFormat); + @override int get height => (super.noSuchMethod( Invocation.getter(#height), returnValue: 0, returnValueForMissingStub: 0, ) as int); + @override int get width => (super.noSuchMethod( Invocation.getter(#width), returnValue: 0, returnValueForMissingStub: 0, ) as int); + @override List<_i6.CameraImagePlane> get planes => (super.noSuchMethod( Invocation.getter(#planes), @@ -472,6 +480,7 @@ class MockExposureState extends _i1.Mock implements _i5.ExposureState { Invocation.getter(#exposureCompensationRange), ), ) as _i7.ExposureCompensationRange); + @override double get exposureCompensationStep => (super.noSuchMethod( Invocation.getter(#exposureCompensationStep), @@ -491,6 +500,7 @@ class MockFallbackStrategy extends _i1.Mock implements _i21.FallbackStrategy { returnValue: _i7.VideoQuality.SD, returnValueForMissingStub: _i7.VideoQuality.SD, ) as _i7.VideoQuality); + @override _i7.VideoResolutionFallbackRule get fallbackRule => (super.noSuchMethod( Invocation.getter(#fallbackRule), @@ -514,6 +524,7 @@ class MockImageAnalysis extends _i1.Mock implements _i22.ImageAnalysis { returnValue: _i16.Future.value(), returnValueForMissingStub: _i16.Future.value(), ) as _i16.Future); + @override _i16.Future setAnalyzer(_i15.Analyzer? analyzer) => (super.noSuchMethod( Invocation.method( @@ -523,6 +534,7 @@ class MockImageAnalysis extends _i1.Mock implements _i22.ImageAnalysis { returnValue: _i16.Future.value(), returnValueForMissingStub: _i16.Future.value(), ) as _i16.Future); + @override _i16.Future clearAnalyzer() => (super.noSuchMethod( Invocation.method( @@ -548,6 +560,7 @@ class MockImageCapture extends _i1.Mock implements _i23.ImageCapture { returnValue: _i16.Future.value(), returnValueForMissingStub: _i16.Future.value(), ) as _i16.Future); + @override _i16.Future setFlashMode(int? newFlashMode) => (super.noSuchMethod( Invocation.method( @@ -557,6 +570,7 @@ class MockImageCapture extends _i1.Mock implements _i23.ImageCapture { returnValue: _i16.Future.value(), returnValueForMissingStub: _i16.Future.value(), ) as _i16.Future); + @override _i16.Future takePicture() => (super.noSuchMethod( Invocation.method( @@ -579,18 +593,21 @@ class MockImageProxy extends _i1.Mock implements _i17.ImageProxy { returnValue: 0, returnValueForMissingStub: 0, ) as int); + @override int get height => (super.noSuchMethod( Invocation.getter(#height), returnValue: 0, returnValueForMissingStub: 0, ) as int); + @override int get width => (super.noSuchMethod( Invocation.getter(#width), returnValue: 0, returnValueForMissingStub: 0, ) as int); + @override _i16.Future> getPlanes() => (super.noSuchMethod( Invocation.method( @@ -602,6 +619,7 @@ class MockImageProxy extends _i1.Mock implements _i17.ImageProxy { returnValueForMissingStub: _i16.Future>.value(<_i24.PlaneProxy>[]), ) as _i16.Future>); + @override _i16.Future close() => (super.noSuchMethod( Invocation.method( @@ -624,6 +642,7 @@ class MockObserver extends _i1.Mock implements _i25.Observer<_i18.CameraState> { returnValue: (Object value) {}, returnValueForMissingStub: (Object value) {}, ) as void Function(Object)); + @override set onChanged(void Function(Object)? _onChanged) => super.noSuchMethod( Invocation.setter( @@ -674,12 +693,14 @@ class MockPlaneProxy extends _i1.Mock implements _i24.PlaneProxy { returnValue: _i26.Uint8List(0), returnValueForMissingStub: _i26.Uint8List(0), ) as _i26.Uint8List); + @override int get pixelStride => (super.noSuchMethod( Invocation.getter(#pixelStride), returnValue: 0, returnValueForMissingStub: 0, ) as int); + @override int get rowStride => (super.noSuchMethod( Invocation.getter(#rowStride), @@ -702,6 +723,7 @@ class MockPreview extends _i1.Mock implements _i27.Preview { returnValue: _i16.Future.value(), returnValueForMissingStub: _i16.Future.value(), ) as _i16.Future); + @override _i16.Future setSurfaceProvider() => (super.noSuchMethod( Invocation.method( @@ -711,6 +733,7 @@ class MockPreview extends _i1.Mock implements _i27.Preview { returnValue: _i16.Future.value(0), returnValueForMissingStub: _i16.Future.value(0), ) as _i16.Future); + @override void releaseFlutterSurfaceTexture() => super.noSuchMethod( Invocation.method( @@ -719,6 +742,7 @@ class MockPreview extends _i1.Mock implements _i27.Preview { ), returnValueForMissingStub: null, ); + @override _i16.Future<_i7.ResolutionInfo> getResolutionInfo() => (super.noSuchMethod( Invocation.method( @@ -762,6 +786,7 @@ class MockProcessCameraProvider extends _i1.Mock returnValueForMissingStub: _i16.Future>.value(<_i2.CameraInfo>[]), ) as _i16.Future>); + @override _i16.Future<_i9.Camera> bindToLifecycle( _i20.CameraSelector? cameraSelector, @@ -796,6 +821,7 @@ class MockProcessCameraProvider extends _i1.Mock ), )), ) as _i16.Future<_i9.Camera>); + @override _i16.Future isBound(_i29.UseCase? useCase) => (super.noSuchMethod( Invocation.method( @@ -805,6 +831,7 @@ class MockProcessCameraProvider extends _i1.Mock returnValue: _i16.Future.value(false), returnValueForMissingStub: _i16.Future.value(false), ) as _i16.Future); + @override void unbind(List<_i29.UseCase>? useCases) => super.noSuchMethod( Invocation.method( @@ -813,6 +840,7 @@ class MockProcessCameraProvider extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void unbindAll() => super.noSuchMethod( Invocation.method( @@ -895,6 +923,7 @@ class MockRecording extends _i1.Mock implements _i8.Recording { returnValue: _i16.Future.value(), returnValueForMissingStub: _i16.Future.value(), ) as _i16.Future); + @override _i16.Future pause() => (super.noSuchMethod( Invocation.method( @@ -904,6 +933,7 @@ class MockRecording extends _i1.Mock implements _i8.Recording { returnValue: _i16.Future.value(), returnValueForMissingStub: _i16.Future.value(), ) as _i16.Future); + @override _i16.Future resume() => (super.noSuchMethod( Invocation.method( @@ -913,6 +943,7 @@ class MockRecording extends _i1.Mock implements _i8.Recording { returnValue: _i16.Future.value(), returnValueForMissingStub: _i16.Future.value(), ) as _i16.Future); + @override _i16.Future stop() => (super.noSuchMethod( Invocation.method( @@ -938,6 +969,7 @@ class MockVideoCapture extends _i1.Mock implements _i33.VideoCapture { returnValue: _i16.Future.value(), returnValueForMissingStub: _i16.Future.value(), ) as _i16.Future); + @override _i16.Future<_i11.Recorder> getOutput() => (super.noSuchMethod( Invocation.method( @@ -978,18 +1010,21 @@ class MockBuildContext extends _i1.Mock implements _i12.BuildContext { Invocation.getter(#widget), ), ) as _i12.Widget); + @override bool get mounted => (super.noSuchMethod( Invocation.getter(#mounted), returnValue: false, returnValueForMissingStub: false, ) as bool); + @override bool get debugDoingBuild => (super.noSuchMethod( Invocation.getter(#debugDoingBuild), returnValue: false, returnValueForMissingStub: false, ) as bool); + @override _i12.InheritedWidget dependOnInheritedElement( _i12.InheritedElement? ancestor, { @@ -1018,6 +1053,7 @@ class MockBuildContext extends _i1.Mock implements _i12.BuildContext { ), ), ) as _i12.InheritedWidget); + @override void visitAncestorElements(_i12.ConditionalElementVisitor? visitor) => super.noSuchMethod( @@ -1027,6 +1063,7 @@ class MockBuildContext extends _i1.Mock implements _i12.BuildContext { ), returnValueForMissingStub: null, ); + @override void visitChildElements(_i12.ElementVisitor? visitor) => super.noSuchMethod( Invocation.method( @@ -1035,6 +1072,7 @@ class MockBuildContext extends _i1.Mock implements _i12.BuildContext { ), returnValueForMissingStub: null, ); + @override void dispatchNotification(_i12.Notification? notification) => super.noSuchMethod( @@ -1044,6 +1082,7 @@ class MockBuildContext extends _i1.Mock implements _i12.BuildContext { ), returnValueForMissingStub: null, ); + @override _i14.DiagnosticsNode describeElement( String? name, { @@ -1072,6 +1111,7 @@ class MockBuildContext extends _i1.Mock implements _i12.BuildContext { ), ), ) as _i14.DiagnosticsNode); + @override _i14.DiagnosticsNode describeWidget( String? name, { @@ -1100,6 +1140,7 @@ class MockBuildContext extends _i1.Mock implements _i12.BuildContext { ), ), ) as _i14.DiagnosticsNode); + @override List<_i14.DiagnosticsNode> describeMissingAncestor( {required Type? expectedAncestorType}) => @@ -1112,6 +1153,7 @@ class MockBuildContext extends _i1.Mock implements _i12.BuildContext { returnValue: <_i14.DiagnosticsNode>[], returnValueForMissingStub: <_i14.DiagnosticsNode>[], ) as List<_i14.DiagnosticsNode>); + @override _i14.DiagnosticsNode describeOwnershipChain(String? name) => (super.noSuchMethod( @@ -1168,6 +1210,7 @@ class MockTestSystemServicesHostApi extends _i1.Mock returnValueForMissingStub: _i16.Future<_i7.CameraPermissionsErrorData?>.value(), ) as _i16.Future<_i7.CameraPermissionsErrorData?>); + @override String getTempFilePath( String? prefix, @@ -1197,6 +1240,7 @@ class MockZoomState extends _i1.Mock implements _i19.ZoomState { returnValue: 0.0, returnValueForMissingStub: 0.0, ) as double); + @override double get maxZoomRatio => (super.noSuchMethod( Invocation.getter(#maxZoomRatio), @@ -1225,6 +1269,7 @@ class MockLiveCameraState extends _i1.Mock returnValue: _i16.Future.value(), returnValueForMissingStub: _i16.Future.value(), ) as _i16.Future); + @override _i16.Future removeObservers() => (super.noSuchMethod( Invocation.method( @@ -1256,6 +1301,7 @@ class MockLiveZoomState extends _i1.Mock returnValue: _i16.Future.value(), returnValueForMissingStub: _i16.Future.value(), ) as _i16.Future); + @override _i16.Future removeObservers() => (super.noSuchMethod( Invocation.method( diff --git a/packages/camera/camera_android_camerax/test/camera_control_test.mocks.dart b/packages/camera/camera_android_camerax/test/camera_control_test.mocks.dart index 519fc623669..34b8c890823 100644 --- a/packages/camera/camera_android_camerax/test/camera_control_test.mocks.dart +++ b/packages/camera/camera_android_camerax/test/camera_control_test.mocks.dart @@ -47,6 +47,7 @@ class MockTestCameraControlHostApi extends _i1.Mock returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); + @override _i3.Future setZoomRatio( int? identifier, diff --git a/packages/camera/camera_android_camerax/test/camera_info_test.mocks.dart b/packages/camera/camera_android_camerax/test/camera_info_test.mocks.dart index 8de0b8dfc69..3ab98a01cb0 100644 --- a/packages/camera/camera_android_camerax/test/camera_info_test.mocks.dart +++ b/packages/camera/camera_android_camerax/test/camera_info_test.mocks.dart @@ -43,6 +43,7 @@ class MockTestCameraInfoHostApi extends _i1.Mock ), returnValue: 0, ) as int); + @override int getCameraState(int? identifier) => (super.noSuchMethod( Invocation.method( @@ -51,6 +52,7 @@ class MockTestCameraInfoHostApi extends _i1.Mock ), returnValue: 0, ) as int); + @override int getExposureState(int? identifier) => (super.noSuchMethod( Invocation.method( @@ -59,6 +61,7 @@ class MockTestCameraInfoHostApi extends _i1.Mock ), returnValue: 0, ) as int); + @override int getZoomState(int? identifier) => (super.noSuchMethod( Invocation.method( @@ -108,6 +111,7 @@ class MockLiveCameraState extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future removeObservers() => (super.noSuchMethod( Invocation.method( @@ -139,6 +143,7 @@ class MockLiveZoomState extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future removeObservers() => (super.noSuchMethod( Invocation.method( diff --git a/packages/camera/camera_android_camerax/test/camera_selector_test.mocks.dart b/packages/camera/camera_android_camerax/test/camera_selector_test.mocks.dart index ec127753790..a60dc8c4ffe 100644 --- a/packages/camera/camera_android_camerax/test/camera_selector_test.mocks.dart +++ b/packages/camera/camera_android_camerax/test/camera_selector_test.mocks.dart @@ -44,6 +44,7 @@ class MockTestCameraSelectorHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override List filter( int? identifier, diff --git a/packages/camera/camera_android_camerax/test/camera_test.mocks.dart b/packages/camera/camera_android_camerax/test/camera_test.mocks.dart index 7bae8650bd0..e5b9582ef18 100644 --- a/packages/camera/camera_android_camerax/test/camera_test.mocks.dart +++ b/packages/camera/camera_android_camerax/test/camera_test.mocks.dart @@ -36,6 +36,7 @@ class MockTestCameraHostApi extends _i1.Mock implements _i2.TestCameraHostApi { ), returnValue: 0, ) as int); + @override int getCameraControl(int? identifier) => (super.noSuchMethod( Invocation.method( diff --git a/packages/camera/camera_android_camerax/test/device_orientation_manager_test.mocks.dart b/packages/camera/camera_android_camerax/test/device_orientation_manager_test.mocks.dart index 9152aa95750..b673c0f7a34 100644 --- a/packages/camera/camera_android_camerax/test/device_orientation_manager_test.mocks.dart +++ b/packages/camera/camera_android_camerax/test/device_orientation_manager_test.mocks.dart @@ -63,6 +63,7 @@ class MockTestDeviceOrientationManagerHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void stopListeningForDeviceOrientationChange() => super.noSuchMethod( Invocation.method( @@ -71,19 +72,12 @@ class MockTestDeviceOrientationManagerHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override - int getPhotoOrientation(String? orientation) => (super.noSuchMethod( - Invocation.method( - #getPhotoOrientation, - [orientation], - ), - returnValue: 0, - ) as int); - @override - int getVideoOrientation(String? orientation) => (super.noSuchMethod( + int getDefaultRotation() => (super.noSuchMethod( Invocation.method( - #getVideoOrientation, - [orientation], + #getDefaultRotation, + [], ), returnValue: 0, ) as int); 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 f700a5b77c9..22c903321bd 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 @@ -47,6 +47,7 @@ class MockTestImageAnalysisHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void setAnalyzer( int? identifier, @@ -62,6 +63,7 @@ class MockTestImageAnalysisHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void clearAnalyzer(int? identifier) => super.noSuchMethod( Invocation.method( @@ -70,6 +72,7 @@ class MockTestImageAnalysisHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void setTargetRotation( int? identifier, 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 7ee2016f1f8..fe41083caa5 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 @@ -51,6 +51,7 @@ class MockTestImageCaptureHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void setFlashMode( int? identifier, @@ -66,6 +67,7 @@ class MockTestImageCaptureHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override _i3.Future takePicture(int? identifier) => (super.noSuchMethod( Invocation.method( @@ -74,6 +76,7 @@ class MockTestImageCaptureHostApi extends _i1.Mock ), returnValue: _i3.Future.value(''), ) as _i3.Future); + @override void setTargetRotation( int? identifier, diff --git a/packages/camera/camera_android_camerax/test/image_proxy_test.mocks.dart b/packages/camera/camera_android_camerax/test/image_proxy_test.mocks.dart index cc9700c815d..5c47ff3425e 100644 --- a/packages/camera/camera_android_camerax/test/image_proxy_test.mocks.dart +++ b/packages/camera/camera_android_camerax/test/image_proxy_test.mocks.dart @@ -37,6 +37,7 @@ class MockTestImageProxyHostApi extends _i1.Mock ), returnValue: [], ) as List); + @override void close(int? identifier) => super.noSuchMethod( Invocation.method( diff --git a/packages/camera/camera_android_camerax/test/live_data_test.mocks.dart b/packages/camera/camera_android_camerax/test/live_data_test.mocks.dart index 9ec79e910e2..970c051d46c 100644 --- a/packages/camera/camera_android_camerax/test/live_data_test.mocks.dart +++ b/packages/camera/camera_android_camerax/test/live_data_test.mocks.dart @@ -45,6 +45,7 @@ class MockTestLiveDataHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void removeObservers(int? identifier) => super.noSuchMethod( Invocation.method( @@ -53,6 +54,7 @@ class MockTestLiveDataHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override int? getValue( int? identifier, diff --git a/packages/camera/camera_android_camerax/test/pending_recording_test.mocks.dart b/packages/camera/camera_android_camerax/test/pending_recording_test.mocks.dart index 6b706ae2448..a7342b867ae 100644 --- a/packages/camera/camera_android_camerax/test/pending_recording_test.mocks.dart +++ b/packages/camera/camera_android_camerax/test/pending_recording_test.mocks.dart @@ -79,6 +79,7 @@ class MockRecording extends _i1.Mock implements _i3.Recording { returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); + @override _i4.Future pause() => (super.noSuchMethod( Invocation.method( @@ -88,6 +89,7 @@ class MockRecording extends _i1.Mock implements _i3.Recording { returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); + @override _i4.Future resume() => (super.noSuchMethod( Invocation.method( @@ -97,6 +99,7 @@ class MockRecording extends _i1.Mock implements _i3.Recording { returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); + @override _i4.Future stop() => (super.noSuchMethod( Invocation.method( 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 1a735191aeb..ef76e1b7079 100644 --- a/packages/camera/camera_android_camerax/test/preview_test.mocks.dart +++ b/packages/camera/camera_android_camerax/test/preview_test.mocks.dart @@ -78,6 +78,7 @@ class MockTestPreviewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override int setSurfaceProvider(int? identifier) => (super.noSuchMethod( Invocation.method( @@ -86,6 +87,7 @@ class MockTestPreviewHostApi extends _i1.Mock ), returnValue: 0, ) as int); + @override void releaseFlutterSurfaceTexture() => super.noSuchMethod( Invocation.method( @@ -94,6 +96,7 @@ class MockTestPreviewHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override _i2.ResolutionInfo getResolutionInfo(int? identifier) => (super.noSuchMethod( Invocation.method( @@ -108,6 +111,7 @@ class MockTestPreviewHostApi extends _i1.Mock ), ), ) as _i2.ResolutionInfo); + @override void setTargetRotation( int? identifier, diff --git a/packages/camera/camera_android_camerax/test/process_camera_provider_test.mocks.dart b/packages/camera/camera_android_camerax/test/process_camera_provider_test.mocks.dart index 194ad0008fb..dcc6b1298af 100644 --- a/packages/camera/camera_android_camerax/test/process_camera_provider_test.mocks.dart +++ b/packages/camera/camera_android_camerax/test/process_camera_provider_test.mocks.dart @@ -58,6 +58,7 @@ class MockTestProcessCameraProviderHostApi extends _i1.Mock ), returnValue: _i3.Future.value(0), ) as _i3.Future); + @override List getAvailableCameraInfos(int? identifier) => (super.noSuchMethod( Invocation.method( @@ -66,6 +67,7 @@ class MockTestProcessCameraProviderHostApi extends _i1.Mock ), returnValue: [], ) as List); + @override int bindToLifecycle( int? identifier, @@ -83,6 +85,7 @@ class MockTestProcessCameraProviderHostApi extends _i1.Mock ), returnValue: 0, ) as int); + @override bool isBound( int? identifier, @@ -98,6 +101,7 @@ class MockTestProcessCameraProviderHostApi extends _i1.Mock ), returnValue: false, ) as bool); + @override void unbind( int? identifier, @@ -113,6 +117,7 @@ class MockTestProcessCameraProviderHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void unbindAll(int? identifier) => super.noSuchMethod( Invocation.method( 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 65741af996a..b7afe91ed96 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 @@ -78,6 +78,7 @@ class MockCameraInfo extends _i1.Mock implements _i5.CameraInfo { ), returnValue: _i6.Future.value(0), ) as _i6.Future); + @override _i6.Future<_i2.LiveData<_i7.CameraState>> getCameraState() => (super.noSuchMethod( @@ -94,6 +95,7 @@ class MockCameraInfo extends _i1.Mock implements _i5.CameraInfo { ), )), ) as _i6.Future<_i2.LiveData<_i7.CameraState>>); + @override _i6.Future<_i3.ExposureState> getExposureState() => (super.noSuchMethod( Invocation.method( @@ -108,6 +110,7 @@ class MockCameraInfo extends _i1.Mock implements _i5.CameraInfo { ), )), ) as _i6.Future<_i3.ExposureState>); + @override _i6.Future<_i2.LiveData<_i8.ZoomState>> getZoomState() => (super.noSuchMethod( Invocation.method( @@ -139,6 +142,7 @@ class MockFallbackStrategy extends _i1.Mock implements _i9.FallbackStrategy { Invocation.getter(#quality), returnValue: _i4.VideoQuality.SD, ) as _i4.VideoQuality); + @override _i4.VideoResolutionFallbackRule get fallbackRule => (super.noSuchMethod( Invocation.getter(#fallbackRule), @@ -172,6 +176,7 @@ class MockTestQualitySelectorHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override _i4.ResolutionInfo getResolution( int? cameraInfoId, 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 7a678e28645..4209db35875 100644 --- a/packages/camera/camera_android_camerax/test/recorder_test.mocks.dart +++ b/packages/camera/camera_android_camerax/test/recorder_test.mocks.dart @@ -138,6 +138,7 @@ class MockTestRecorderHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override int getAspectRatio(int? identifier) => (super.noSuchMethod( Invocation.method( @@ -146,6 +147,7 @@ class MockTestRecorderHostApi extends _i1.Mock ), returnValue: 0, ) as int); + @override int getTargetVideoEncodingBitRate(int? identifier) => (super.noSuchMethod( Invocation.method( @@ -154,6 +156,7 @@ class MockTestRecorderHostApi extends _i1.Mock ), returnValue: 0, ) as int); + @override int prepareRecording( int? identifier, @@ -197,6 +200,7 @@ class MockTestQualitySelectorHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override _i2.ResolutionInfo getResolution( int? cameraInfoId, diff --git a/packages/camera/camera_android_camerax/test/recording_test.mocks.dart b/packages/camera/camera_android_camerax/test/recording_test.mocks.dart index 91362b6bcde..e27159612d1 100644 --- a/packages/camera/camera_android_camerax/test/recording_test.mocks.dart +++ b/packages/camera/camera_android_camerax/test/recording_test.mocks.dart @@ -37,6 +37,7 @@ class MockTestRecordingHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void pause(int? identifier) => super.noSuchMethod( Invocation.method( @@ -45,6 +46,7 @@ class MockTestRecordingHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void resume(int? identifier) => super.noSuchMethod( Invocation.method( @@ -53,6 +55,7 @@ class MockTestRecordingHostApi extends _i1.Mock ), returnValueForMissingStub: null, ); + @override void stop(int? identifier) => super.noSuchMethod( Invocation.method( 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 6ab8de8316d..28d9ca058bf 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 @@ -37,6 +37,7 @@ class MockAspectRatioStrategy extends _i1.Mock Invocation.getter(#preferredAspectRatio), returnValue: 0, ) as int); + @override int get fallbackRule => (super.noSuchMethod( Invocation.getter(#fallbackRule), diff --git a/packages/camera/camera_android_camerax/test/system_services_test.mocks.dart b/packages/camera/camera_android_camerax/test/system_services_test.mocks.dart index 1aa4b738265..7d97b2424ab 100644 --- a/packages/camera/camera_android_camerax/test/system_services_test.mocks.dart +++ b/packages/camera/camera_android_camerax/test/system_services_test.mocks.dart @@ -61,6 +61,7 @@ class MockTestSystemServicesHostApi extends _i1.Mock ), returnValue: _i3.Future<_i4.CameraPermissionsErrorData?>.value(), ) as _i3.Future<_i4.CameraPermissionsErrorData?>); + @override String getTempFilePath( String? prefix, 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 0a7048939ad..b32133cb690 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,24 +420,29 @@ 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); int getCameraControl(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, @@ -389,11 +457,14 @@ abstract class TestCameraHostApi { 'dev.flutter.pigeon.CameraHostApi.getCameraControl', 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.getCameraControl was null.'); + 'Argument for dev.flutter.pigeon.CameraHostApi.getCameraControl was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -421,7 +492,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); @@ -430,29 +501,37 @@ 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); 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]; }); } @@ -462,11 +541,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, @@ -483,30 +565,33 @@ abstract class TestSystemServicesHostApi { } abstract class TestDeviceOrientationManagerHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); - void startListeningForDeviceOrientationChange(bool isFrontFacing, int sensorOrientation); + void startListeningForDeviceOrientationChange( + bool isFrontFacing, int sensorOrientation); void stopListeningForDeviceOrientationChange(); - int getPhotoOrientation(String? orientation); - - int getVideoOrientation(String? orientation); - int getDefaultRotation(); - static void setup(TestDeviceOrientationManagerHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestDeviceOrientationManagerHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.startListeningForDeviceOrientationChange', codec, + 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.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.DeviceOrientationManagerHostApi.startListeningForDeviceOrientationChange was null.'); + 'Argument for dev.flutter.pigeon.DeviceOrientationManagerHostApi.startListeningForDeviceOrientationChange was null.'); final List args = (message as List?)!; final bool? arg_isFrontFacing = (args[0] as bool?); assert(arg_isFrontFacing != null, @@ -514,19 +599,24 @@ abstract class TestDeviceOrientationManagerHostApi { final int? arg_sensorOrientation = (args[1] as int?); assert(arg_sensorOrientation != null, 'Argument for dev.flutter.pigeon.DeviceOrientationManagerHostApi.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.DeviceOrientationManagerHostApi.stopListeningForDeviceOrientationChange', codec, + 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.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 []; @@ -535,46 +625,16 @@ abstract class TestDeviceOrientationManagerHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.getPhotoOrientation', 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.DeviceOrientationManagerHostApi.getPhotoOrientation was null.'); - final List args = (message as List?)!; - final String? arg_orientation = (args[0] as String?); - final int output = api.getPhotoOrientation(arg_orientation); - return [output]; - }); - } - } - { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.getVideoOrientation', 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.DeviceOrientationManagerHostApi.getVideoOrientation was null.'); - final List args = (message as List?)!; - final String? arg_orientation = (args[0] as String?); - final int output = api.getVideoOrientation(arg_orientation); - return [output]; - }); - } - } - { - final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.getDefaultRotation', codec, + 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.getDefaultRotation', + 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 = api.getDefaultRotation(); return [output]; @@ -599,7 +659,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); @@ -608,7 +668,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); @@ -621,17 +682,21 @@ abstract class TestPreviewHostApi { void setTargetRotation(int identifier, int rotation); - 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, @@ -648,11 +713,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, @@ -664,12 +732,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 []; @@ -681,11 +753,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, @@ -700,11 +775,14 @@ abstract class TestPreviewHostApi { 'dev.flutter.pigeon.PreviewHostApi.setTargetRotation', 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.setTargetRotation was null.'); + 'Argument for dev.flutter.pigeon.PreviewHostApi.setTargetRotation was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -721,7 +799,8 @@ 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); @@ -730,17 +809,21 @@ abstract class TestVideoCaptureHostApi { void setTargetRotation(int identifier, int rotation); - 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,11 +838,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, @@ -774,11 +860,14 @@ abstract class TestVideoCaptureHostApi { 'dev.flutter.pigeon.VideoCaptureHostApi.setTargetRotation', 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.setTargetRotation was null.'); + 'Argument for dev.flutter.pigeon.VideoCaptureHostApi.setTargetRotation was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -795,10 +884,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); @@ -806,17 +897,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, @@ -824,7 +919,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 []; }); } @@ -834,11 +930,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, @@ -850,14 +949,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, @@ -872,11 +975,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, @@ -893,22 +999,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, @@ -922,7 +1033,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); @@ -933,17 +1045,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, @@ -958,11 +1074,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, @@ -977,11 +1096,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, @@ -996,11 +1118,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, @@ -1014,10 +1139,12 @@ 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? targetRotation, int? flashMode, int? resolutionSelectorId); + void create(int identifier, int? targetRotation, int? flashMode, + int? resolutionSelectorId); void setFlashMode(int identifier, int flashMode); @@ -1025,17 +1152,21 @@ abstract class TestImageCaptureHostApi { void setTargetRotation(int identifier, int rotation); - 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, @@ -1043,7 +1174,8 @@ abstract class TestImageCaptureHostApi { final int? arg_targetRotation = (args[1] as int?); final int? arg_flashMode = (args[2] as int?); final int? arg_resolutionSelectorId = (args[3] as int?); - api.create(arg_identifier!, arg_targetRotation, arg_flashMode, arg_resolutionSelectorId); + api.create(arg_identifier!, arg_targetRotation, arg_flashMode, + arg_resolutionSelectorId); return []; }); } @@ -1053,11 +1185,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, @@ -1075,11 +1210,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, @@ -1094,11 +1232,14 @@ abstract class TestImageCaptureHostApi { 'dev.flutter.pigeon.ImageCaptureHostApi.setTargetRotation', 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.setTargetRotation was null.'); + 'Argument for dev.flutter.pigeon.ImageCaptureHostApi.setTargetRotation was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1129,7 +1270,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); @@ -1138,22 +1279,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, @@ -1169,29 +1316,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 []; }); } @@ -1200,22 +1354,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, @@ -1226,7 +1385,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 []; }); } @@ -1235,7 +1395,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? targetRotation, int? resolutionSelectorId); @@ -1246,24 +1407,29 @@ abstract class TestImageAnalysisHostApi { void setTargetRotation(int identifier, int rotation); - 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, 'Argument for dev.flutter.pigeon.ImageAnalysisHostApi.create was null, expected non-null int.'); final int? arg_targetRotation = (args[1] as int?); final int? arg_resolutionSelectorId = (args[2] as int?); - api.create(arg_identifier!, arg_targetRotation, arg_resolutionSelectorId); + api.create( + arg_identifier!, arg_targetRotation, arg_resolutionSelectorId); return []; }); } @@ -1273,11 +1439,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, @@ -1295,11 +1464,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, @@ -1314,11 +1486,14 @@ abstract class TestImageAnalysisHostApi { 'dev.flutter.pigeon.ImageAnalysisHostApi.setTargetRotation', 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.setTargetRotation was null.'); + 'Argument for dev.flutter.pigeon.ImageAnalysisHostApi.setTargetRotation was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1335,22 +1510,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, @@ -1364,22 +1544,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, @@ -1407,7 +1592,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); @@ -1416,7 +1601,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); @@ -1425,17 +1611,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, @@ -1453,11 +1643,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, @@ -1472,16 +1665,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!); @@ -1493,24 +1690,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, @@ -1525,11 +1727,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, @@ -1560,9 +1765,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); @@ -1571,33 +1776,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 []; }); } @@ -1607,19 +1820,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]; }); } @@ -1628,30 +1846,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!); @@ -1663,24 +1890,29 @@ abstract class TestFallbackStrategyHostApi { } abstract class TestCameraControlHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); Future enableTorch(int identifier, bool torch); Future setZoomRatio(int identifier, double ratio); - static void setup(TestCameraControlHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestCameraControlHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CameraControlHostApi.enableTorch', 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.CameraControlHostApi.enableTorch was null.'); + 'Argument for dev.flutter.pigeon.CameraControlHostApi.enableTorch was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1698,11 +1930,14 @@ abstract class TestCameraControlHostApi { 'dev.flutter.pigeon.CameraControlHostApi.setZoomRatio', 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.CameraControlHostApi.setZoomRatio was null.'); + 'Argument for dev.flutter.pigeon.CameraControlHostApi.setZoomRatio was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, diff --git a/packages/camera/camera_android_camerax/test/video_capture_test.mocks.dart b/packages/camera/camera_android_camerax/test/video_capture_test.mocks.dart index 6c4e1e8215f..f48641d8155 100644 --- a/packages/camera/camera_android_camerax/test/video_capture_test.mocks.dart +++ b/packages/camera/camera_android_camerax/test/video_capture_test.mocks.dart @@ -52,6 +52,7 @@ class MockTestVideoCaptureHostApi extends _i1.Mock ), returnValue: 0, ) as int); + @override int getOutput(int? identifier) => (super.noSuchMethod( Invocation.method( @@ -60,6 +61,7 @@ class MockTestVideoCaptureHostApi extends _i1.Mock ), returnValue: 0, ) as int); + @override void setTargetRotation( int? identifier, From f1d21e2ead8af45854c69de4946f87d686fe6049 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Mon, 11 Dec 2023 09:35:34 -0800 Subject: [PATCH 20/29] Fix tests --- .../camerax/DeviceOrientationManager.java | 1 - .../camerax/DeviceOrientationManagerTest.java | 166 +-------------- .../DeviceOrientationManagerWrapperTest.java | 20 +- .../lib/src/android_camera_camerax.dart | 39 ++-- .../lib/src/camerax_proxy.dart | 4 +- .../lib/src/image_analysis.dart | 3 + .../lib/src/image_capture.dart | 3 + .../lib/src/preview.dart | 3 + .../lib/src/video_capture.dart | 3 + .../test/android_camera_camerax_test.dart | 190 ++++++++++-------- .../test/device_orientation_manager_test.dart | 60 +----- 11 files changed, 164 insertions(+), 328 deletions(-) diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManager.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManager.java index 4dce8c0c67f..d4a98acf782 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManager.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManager.java @@ -18,7 +18,6 @@ import io.flutter.embedding.engine.systemchannels.PlatformChannel; import io.flutter.embedding.engine.systemchannels.PlatformChannel.DeviceOrientation; - /** * Support class to help to determine the media orientation based on the orientation of the device. */ diff --git a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/DeviceOrientationManagerTest.java b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/DeviceOrientationManagerTest.java index 1e2bfba714c..1bb4077fb6d 100644 --- a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/DeviceOrientationManagerTest.java +++ b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/DeviceOrientationManagerTest.java @@ -50,108 +50,6 @@ public void before() { new DeviceOrientationManager(mockActivity, false, 0, mockDeviceOrientationChangeCallback); } - @Test - public void getVideoOrientation_whenNaturalScreenOrientationEqualsPortraitUp() { - int degreesPortraitUp = - deviceOrientationManager.getVideoOrientation(DeviceOrientation.PORTRAIT_UP); - int degreesPortraitDown = - deviceOrientationManager.getVideoOrientation(DeviceOrientation.PORTRAIT_DOWN); - int degreesLandscapeLeft = - deviceOrientationManager.getVideoOrientation(DeviceOrientation.LANDSCAPE_LEFT); - int degreesLandscapeRight = - deviceOrientationManager.getVideoOrientation(DeviceOrientation.LANDSCAPE_RIGHT); - - assertEquals(0, degreesPortraitUp); - assertEquals(270, degreesLandscapeLeft); - assertEquals(180, degreesPortraitDown); - assertEquals(90, degreesLandscapeRight); - } - - @Test - public void getVideoOrientation_whenNaturalScreenOrientationEqualsLandscapeLeft() { - DeviceOrientationManager orientationManager = - new DeviceOrientationManager(mockActivity, false, 90, mockDeviceOrientationChangeCallback); - - int degreesPortraitUp = orientationManager.getVideoOrientation(DeviceOrientation.PORTRAIT_UP); - int degreesPortraitDown = - orientationManager.getVideoOrientation(DeviceOrientation.PORTRAIT_DOWN); - int degreesLandscapeLeft = - orientationManager.getVideoOrientation(DeviceOrientation.LANDSCAPE_LEFT); - int degreesLandscapeRight = - orientationManager.getVideoOrientation(DeviceOrientation.LANDSCAPE_RIGHT); - - assertEquals(90, degreesPortraitUp); - assertEquals(0, degreesLandscapeLeft); - assertEquals(270, degreesPortraitDown); - assertEquals(180, degreesLandscapeRight); - } - - @Test - public void getVideoOrientation_fallbackToPortraitSensorOrientationWhenOrientationIsNull() { - setUpUIOrientationMocks(Configuration.ORIENTATION_PORTRAIT, Surface.ROTATION_0); - - int degrees = deviceOrientationManager.getVideoOrientation(null); - - assertEquals(0, degrees); - } - - @Test - public void getVideoOrientation_fallbackToLandscapeSensorOrientationWhenOrientationIsNull() { - setUpUIOrientationMocks(Configuration.ORIENTATION_LANDSCAPE, Surface.ROTATION_0); - - DeviceOrientationManager orientationManager = - new DeviceOrientationManager(mockActivity, false, 90, mockDeviceOrientationChangeCallback); - - int degrees = orientationManager.getVideoOrientation(null); - - assertEquals(0, degrees); - } - - @Test - public void getPhotoOrientation_whenNaturalScreenOrientationEqualsPortraitUp() { - int degreesPortraitUp = - deviceOrientationManager.getPhotoOrientation(DeviceOrientation.PORTRAIT_UP); - int degreesPortraitDown = - deviceOrientationManager.getPhotoOrientation(DeviceOrientation.PORTRAIT_DOWN); - int degreesLandscapeLeft = - deviceOrientationManager.getPhotoOrientation(DeviceOrientation.LANDSCAPE_LEFT); - int degreesLandscapeRight = - deviceOrientationManager.getPhotoOrientation(DeviceOrientation.LANDSCAPE_RIGHT); - - assertEquals(0, degreesPortraitUp); - assertEquals(90, degreesLandscapeRight); - assertEquals(180, degreesPortraitDown); - assertEquals(270, degreesLandscapeLeft); - } - - @Test - public void getPhotoOrientation_whenNaturalScreenOrientationEqualsLandscapeLeft() { - DeviceOrientationManager orientationManager = - new DeviceOrientationManager(mockActivity, false, 90, mockDeviceOrientationChangeCallback); - - int degreesPortraitUp = orientationManager.getPhotoOrientation(DeviceOrientation.PORTRAIT_UP); - int degreesPortraitDown = - orientationManager.getPhotoOrientation(DeviceOrientation.PORTRAIT_DOWN); - int degreesLandscapeLeft = - orientationManager.getPhotoOrientation(DeviceOrientation.LANDSCAPE_LEFT); - int degreesLandscapeRight = - orientationManager.getPhotoOrientation(DeviceOrientation.LANDSCAPE_RIGHT); - - assertEquals(90, degreesPortraitUp); - assertEquals(180, degreesLandscapeRight); - assertEquals(270, degreesPortraitDown); - assertEquals(0, degreesLandscapeLeft); - } - - @Test - public void getPhotoOrientation_shouldFallbackToCurrentOrientationWhenOrientationIsNull() { - setUpUIOrientationMocks(Configuration.ORIENTATION_LANDSCAPE, Surface.ROTATION_0); - - int degrees = deviceOrientationManager.getPhotoOrientation(null); - - assertEquals(270, degrees); - } - @Test public void handleUIOrientationChange_shouldSendMessageWhenSensorAccessIsAllowed() { try (MockedStatic mockedSystem = mockStatic(Settings.System.class)) { @@ -239,60 +137,6 @@ public void getUIOrientation() { assertEquals(DeviceOrientation.PORTRAIT_UP, uiOrientation); } - @Test - public void getDeviceDefaultOrientation() { - setUpUIOrientationMocks(Configuration.ORIENTATION_PORTRAIT, Surface.ROTATION_0); - int orientation = deviceOrientationManager.getDeviceDefaultOrientation(); - assertEquals(Configuration.ORIENTATION_PORTRAIT, orientation); - - setUpUIOrientationMocks(Configuration.ORIENTATION_PORTRAIT, Surface.ROTATION_180); - orientation = deviceOrientationManager.getDeviceDefaultOrientation(); - assertEquals(Configuration.ORIENTATION_PORTRAIT, orientation); - - setUpUIOrientationMocks(Configuration.ORIENTATION_PORTRAIT, Surface.ROTATION_90); - orientation = deviceOrientationManager.getDeviceDefaultOrientation(); - assertEquals(Configuration.ORIENTATION_LANDSCAPE, orientation); - - setUpUIOrientationMocks(Configuration.ORIENTATION_PORTRAIT, Surface.ROTATION_270); - orientation = deviceOrientationManager.getDeviceDefaultOrientation(); - assertEquals(Configuration.ORIENTATION_LANDSCAPE, orientation); - - setUpUIOrientationMocks(Configuration.ORIENTATION_LANDSCAPE, Surface.ROTATION_0); - orientation = deviceOrientationManager.getDeviceDefaultOrientation(); - assertEquals(Configuration.ORIENTATION_LANDSCAPE, orientation); - - setUpUIOrientationMocks(Configuration.ORIENTATION_LANDSCAPE, Surface.ROTATION_180); - orientation = deviceOrientationManager.getDeviceDefaultOrientation(); - assertEquals(Configuration.ORIENTATION_LANDSCAPE, orientation); - - setUpUIOrientationMocks(Configuration.ORIENTATION_LANDSCAPE, Surface.ROTATION_90); - orientation = deviceOrientationManager.getDeviceDefaultOrientation(); - assertEquals(Configuration.ORIENTATION_PORTRAIT, orientation); - - setUpUIOrientationMocks(Configuration.ORIENTATION_LANDSCAPE, Surface.ROTATION_270); - orientation = deviceOrientationManager.getDeviceDefaultOrientation(); - assertEquals(Configuration.ORIENTATION_PORTRAIT, orientation); - } - - @Test - public void calculateSensorOrientation() { - setUpUIOrientationMocks(Configuration.ORIENTATION_PORTRAIT, Surface.ROTATION_0); - DeviceOrientation orientation = deviceOrientationManager.calculateSensorOrientation(0); - assertEquals(DeviceOrientation.PORTRAIT_UP, orientation); - - setUpUIOrientationMocks(Configuration.ORIENTATION_PORTRAIT, Surface.ROTATION_0); - orientation = deviceOrientationManager.calculateSensorOrientation(90); - assertEquals(DeviceOrientation.LANDSCAPE_LEFT, orientation); - - setUpUIOrientationMocks(Configuration.ORIENTATION_PORTRAIT, Surface.ROTATION_0); - orientation = deviceOrientationManager.calculateSensorOrientation(180); - assertEquals(DeviceOrientation.PORTRAIT_DOWN, orientation); - - setUpUIOrientationMocks(Configuration.ORIENTATION_PORTRAIT, Surface.ROTATION_0); - orientation = deviceOrientationManager.calculateSensorOrientation(270); - assertEquals(DeviceOrientation.LANDSCAPE_RIGHT, orientation); - } - private void setUpUIOrientationMocks(int orientation, int rotation) { Resources mockResources = mock(Resources.class); Configuration mockConfiguration = mock(Configuration.class); @@ -304,6 +148,16 @@ private void setUpUIOrientationMocks(int orientation, int rotation) { when(mockResources.getConfiguration()).thenReturn(mockConfiguration); } + @Test + public void getDefaultRotation_returnsExpectedValue() { + final int expectedRotation = 90; + when(mockDisplay.getRotation()).thenReturn(expectedRotation); + + final int defaultRotation = deviceOrientationManager.getDefaultRotation(); + + assertEquals(defaultRotation, expectedRotation); + } + @Test public void getDisplayTest() { Display display = deviceOrientationManager.getDisplay(); diff --git a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/DeviceOrientationManagerWrapperTest.java b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/DeviceOrientationManagerWrapperTest.java index 3fcc3ccb94f..5ff0585222f 100644 --- a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/DeviceOrientationManagerWrapperTest.java +++ b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/DeviceOrientationManagerWrapperTest.java @@ -83,26 +83,14 @@ public void deviceOrientationManagerWrapper_handlesDeviceOrientationChangesAsExp } @Test - public void getPhotoOrientation_returnsExpectedOrientation() { + public void getDefaultRotation_returnsExpectedRotation() { final DeviceOrientationManagerHostApiImpl hostApi = new DeviceOrientationManagerHostApiImpl(mockBinaryMessenger, mockInstanceManager); - final int photoOrientation = 90; + final int defaultRotation = 180; hostApi.deviceOrientationManager = mockDeviceOrientationManager; - when(mockDeviceOrientationManager.getPhotoOrientation()).thenReturn(photoOrientation); + when(mockDeviceOrientationManager.getDefaultRotation()).thenReturn(defaultRotation); - assertEquals(hostApi.getPhotoOrientation(), Long.valueOf(photoOrientation)); - } - - @Test - public void getVideoOrientation_returnsExpectedOrientation() { - final DeviceOrientationManagerHostApiImpl hostApi = - new DeviceOrientationManagerHostApiImpl(mockBinaryMessenger, mockInstanceManager); - final int videoOrientation = 180; - - hostApi.deviceOrientationManager = mockDeviceOrientationManager; - when(mockDeviceOrientationManager.getVideoOrientation()).thenReturn(videoOrientation); - - assertEquals(hostApi.getVideoOrientation(), Long.valueOf(videoOrientation)); + assertEquals(hostApi.getDefaultRotation(), Long.valueOf(defaultRotation)); } } 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 0268c609c6c..3363339770e 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 @@ -164,6 +164,15 @@ class AndroidCameraCameraX extends CameraPlatform { @visibleForTesting bool captureOrientationLocked = false; + /// Whether or not the default rotation for [UseCase]s needs to be set + /// manually because the capture orientation was previously locked. + /// + /// Currently, CameraX provides no way to unset target rotations for + /// [UseCase]s, so once they are set and unset, this plugin must start setting + /// the default orientation manually. + /// + /// See https://developer.android.com/reference/androidx/camera/core/ImageCapture#setTargetRotation(int) + /// for an example on how setting target rotations for [UseCase]s work. bool shouldSetDefaultRotation = false; /// Returns list of all available cameras and their descriptions. @@ -386,14 +395,19 @@ class AndroidCameraCameraX extends CameraPlatform { int cameraId, DeviceOrientation orientation, ) async { - shouldSetDefaultRotation = true; + // Flag that (1) default rotation for UseCases will need to be set manually + // if orientation ever unlocked and (2) the capture orientation is locked + // and should not be changed. + if (!shouldSetDefaultRotation) { + shouldSetDefaultRotation = true; + } captureOrientationLocked = true; - // Get target rotation based on locked orientation + // Get target rotation based on locked orientation. final int targetLockedRotation = - (_getRotationFromDeviceOrientation(orientation) + 360) % 360; + _getRotationConstantFromDeviceOrientation(orientation); - /// Update UseCases to use target device orientation. + // Update UseCases to use target device orientation. await imageCapture!.setTargetRotation(targetLockedRotation); await imageAnalysis!.setTargetRotation(targetLockedRotation); await videoCapture!.setTargetRotation(targetLockedRotation); @@ -402,8 +416,7 @@ class AndroidCameraCameraX extends CameraPlatform { /// Unlocks the capture orientation. @override Future unlockCaptureOrientation(int cameraId) async { - // Flag that default rotation should be set for UseCases - // as needed. + // Flag that default rotation should be set for UseCases as needed. captureOrientationLocked = false; } @@ -870,7 +883,7 @@ class AndroidCameraCameraX extends CameraPlatform { /// Returns [Surface] target rotation constant that maps to specified sensor /// orientation. - int _getTargetRotation(int sensorOrientation) { + int _getTargetRotationConstant(int sensorOrientation) { switch (sensorOrientation) { case 90: return Surface.ROTATION_90; @@ -886,19 +899,19 @@ class AndroidCameraCameraX extends CameraPlatform { } } - /// Returns counter-clockwise degrees of rotation from + /// Returns [Surface] constant for counter-clockwise degrees of rotation from /// [DeviceOrientation.portraitUp] required to reach the specified /// [DeviceOrientation]. - int _getRotationFromDeviceOrientation(DeviceOrientation orientation) { + int _getRotationConstantFromDeviceOrientation(DeviceOrientation orientation) { switch (orientation) { case DeviceOrientation.portraitUp: - return 0; + return Surface.ROTATION_0; case DeviceOrientation.landscapeLeft: - return 90; + return Surface.ROTATION_90; case DeviceOrientation.portraitDown: - return 180; + return Surface.ROTATION_180; case DeviceOrientation.landscapeRight: - return 270; + return Surface.ROTATION_270; } } diff --git a/packages/camera/camera_android_camerax/lib/src/camerax_proxy.dart b/packages/camera/camera_android_camerax/lib/src/camerax_proxy.dart index 105048fc77a..96183aa95b5 100644 --- a/packages/camera/camera_android_camerax/lib/src/camerax_proxy.dart +++ b/packages/camera/camera_android_camerax/lib/src/camerax_proxy.dart @@ -4,8 +4,6 @@ import 'dart:ui' show Size; -import 'package:flutter/services.dart' show DeviceOrientation; - import 'analyzer.dart'; import 'camera_selector.dart'; import 'camera_state.dart'; @@ -135,6 +133,8 @@ class CameraXProxy { /// the ID corresponding to the surface it will provide. Future Function(Preview preview) setPreviewSurfaceProvider; + /// Returns default rotation for [UseCase]s in terms of one of the [Surface] + /// rotation constants. Future Function() getDefaultRotation; static Future _getProcessCameraProvider() { 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 5217ec65b5d..567d38d1fbe 100644 --- a/packages/camera/camera_android_camerax/lib/src/image_analysis.dart +++ b/packages/camera/camera_android_camerax/lib/src/image_analysis.dart @@ -69,6 +69,9 @@ class ImageAnalysis extends UseCase { /// Dynamically sets the target rotation of this instance. /// + /// The target rotations should be expressed in the counter-clockwise + /// direction and relative to [DeviceOrientation.portraitUp]. + /// /// [rotation] should be one of the [Surface] rotation constants. Future setTargetRotation(int rotation) => _api.setTargetRotationFromInstances(this, rotation); 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 17813da859d..8da22ab6f09 100644 --- a/packages/camera/camera_android_camerax/lib/src/image_capture.dart +++ b/packages/camera/camera_android_camerax/lib/src/image_capture.dart @@ -86,6 +86,9 @@ class ImageCapture extends UseCase { /// Dynamically sets the target rotation of this instance. /// + /// The target rotations should be expressed in the counter-clockwise + /// direction and relative to [DeviceOrientation.portraitUp]. + /// /// [rotation] should be one of the [Surface] rotation constants. Future setTargetRotation(int rotation) => _api.setTargetRotationFromInstances(this, rotation); diff --git a/packages/camera/camera_android_camerax/lib/src/preview.dart b/packages/camera/camera_android_camerax/lib/src/preview.dart index d61203c6633..9b91f2993bc 100644 --- a/packages/camera/camera_android_camerax/lib/src/preview.dart +++ b/packages/camera/camera_android_camerax/lib/src/preview.dart @@ -59,6 +59,9 @@ class Preview extends UseCase { /// Dynamically sets the target rotation of this instance. /// + /// The target rotations should be expressed in the counter-clockwise + /// direction and relative to [DeviceOrientation.portraitUp]. + /// /// [rotation] should be one of the [Surface] rotation constants. Future setTargetRotation(int rotation) => _api.setTargetRotationFromInstances(this, rotation); diff --git a/packages/camera/camera_android_camerax/lib/src/video_capture.dart b/packages/camera/camera_android_camerax/lib/src/video_capture.dart index f87b80ba90b..865670ddef6 100644 --- a/packages/camera/camera_android_camerax/lib/src/video_capture.dart +++ b/packages/camera/camera_android_camerax/lib/src/video_capture.dart @@ -42,6 +42,9 @@ class VideoCapture extends UseCase { /// Dynamically sets the target rotation of this instance. /// + /// The target rotations should be expressed in the counter-clockwise + /// direction and relative to [DeviceOrientation.portraitUp]. + /// /// [rotation] should be one of the [Surface] rotation constants. Future setTargetRotation(int rotation) => _api.setTargetRotationFromInstances(this, rotation); 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 585d79ea51d..b682110c192 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 @@ -1230,6 +1230,7 @@ void main() { final TestSystemServicesHostApi mockSystemServicesApi = MockTestSystemServicesHostApi(); TestSystemServicesHostApi.setup(mockSystemServicesApi); + const int defaultTargetRotation = Surface.ROTATION_270; // Set directly for test versus calling createCamera. camera.processCameraProvider = MockProcessCameraProvider(); @@ -1239,8 +1240,8 @@ void main() { camera.cameraSelector = MockCameraSelector(); // Tell plugin to mock call to get current video orientation. - camera.proxy = - CameraXProxy(getVideoOrientation: (_) => Future.value(270)); + camera.proxy = CameraXProxy( + getDefaultRotation: () => Future.value(defaultTargetRotation)); const int cameraId = 87; const String outputPath = '/temp/MOV123.temp'; @@ -1254,16 +1255,34 @@ void main() { when(camera.processCameraProvider!.isBound(camera.videoCapture!)) .thenAnswer((_) async => true); - // Test when orientation is unlocked. + // Orientation is unlocked and plugin does not need to set default target + // rotation manually. + camera.recording = null; await camera.startVideoCapturing(const VideoCaptureOptions(cameraId)); - verify(mockVideoCapture.setTargetRotation(Surface.ROTATION_270)); + verifyNever(mockVideoCapture.setTargetRotation(any)); - // Test when orientation is locked. + // Orientation is locked and plugin does not need to set default target + // rotation manually. + camera.recording = null; camera.captureOrientationLocked = true; - clearInteractions(mockVideoCapture); + await camera.startVideoCapturing(const VideoCaptureOptions(cameraId)); + verifyNever(mockVideoCapture.setTargetRotation(any)); + // Orientation is locked and plugin does need to set default target + // rotation manually. + camera.recording = null; + camera.captureOrientationLocked = true; + camera.shouldSetDefaultRotation = true; await camera.startVideoCapturing(const VideoCaptureOptions(cameraId)); verifyNever(mockVideoCapture.setTargetRotation(any)); + + // Orientation is unlocked and plugin does need to set default target + // rotation manually. + camera.recording = null; + camera.captureOrientationLocked = false; + camera.shouldSetDefaultRotation = true; + await camera.startVideoCapturing(const VideoCaptureOptions(cameraId)); + verify(mockVideoCapture.setTargetRotation(defaultTargetRotation)); }); test('pauseVideoRecording pauses the recording', () async { @@ -1389,27 +1408,43 @@ void main() { () async { final AndroidCameraCameraX camera = AndroidCameraCameraX(); final MockImageCapture mockImageCapture = MockImageCapture(); + const int cameraId = 3; + const int defaultTargetRotation = Surface.ROTATION_180; // Set directly for test versus calling createCamera. camera.imageCapture = mockImageCapture; // Tell plugin to mock call to get current photo orientation. - camera.proxy = - CameraXProxy(getPhotoOrientation: (_) => Future.value(180)); + camera.proxy = CameraXProxy( + getDefaultRotation: () => Future.value(defaultTargetRotation)); when(camera.imageCapture!.takePicture()) .thenAnswer((_) async => 'test/absolute/path/to/picture'); - // Test when orientation is unlocked. - await camera.takePicture(3); - verify(mockImageCapture.setTargetRotation(Surface.ROTATION_180)); + // Orientation is unlocked and plugin does not need to set default target + // rotation manually. + await camera.takePicture(cameraId); + verifyNever(mockImageCapture.setTargetRotation(any)); - // Test when orientation is locked. + // Orientation is locked and plugin does not need to set default target + // rotation manually. camera.captureOrientationLocked = true; - clearInteractions(mockImageCapture); + await camera.takePicture(cameraId); + verifyNever(mockImageCapture.setTargetRotation(any)); - await camera.takePicture(3); + // Orientation is locked and plugin does need to set default target + // rotation manually. + camera.captureOrientationLocked = true; + camera.shouldSetDefaultRotation = true; + await camera.takePicture(cameraId); verifyNever(mockImageCapture.setTargetRotation(any)); + + // Orientation is unlocked and plugin does need to set default target + // rotation manually. + camera.captureOrientationLocked = false; + camera.shouldSetDefaultRotation = true; + await camera.takePicture(cameraId); + verify(mockImageCapture.setTargetRotation(defaultTargetRotation)); }); test('takePicture turns non-torch flash mode off when torch mode enabled', @@ -1843,6 +1878,7 @@ void main() { () async { final AndroidCameraCameraX camera = AndroidCameraCameraX(); const int cameraId = 35; + const int defaultTargetRotation = Surface.ROTATION_90; final MockImageAnalysis mockImageAnalysis = MockImageAnalysis(); // Set directly for test versus calling createCamera. @@ -1852,25 +1888,47 @@ void main() { // call to get current photo orientation. camera.proxy = CameraXProxy( createAnalyzer: (_) => MockAnalyzer(), - getPhotoOrientation: (_) => Future.value(90)); + getDefaultRotation: () => Future.value(defaultTargetRotation)); - // Test when orientation is unlocked. + // Orientation is unlocked and plugin does not need to set default target + // rotation manually. StreamSubscription imageStreamSubscription = camera .onStreamedFrameAvailable(cameraId) - .listen((CameraImageData imageData) {}); - - await untilCalled(mockImageAnalysis.setTargetRotation(Surface.ROTATION_90)); + .listen((CameraImageData data) {}); + await untilCalled(mockImageAnalysis.setAnalyzer(any)); + verifyNever(mockImageAnalysis.setTargetRotation(any)); await imageStreamSubscription.cancel(); - // Wait until onListen completes and then test when orientation is locked. + // Orientation is locked and plugin does not need to set default target + // rotation manually. camera.captureOrientationLocked = true; - clearInteractions(mockImageAnalysis); imageStreamSubscription = camera .onStreamedFrameAvailable(cameraId) .listen((CameraImageData data) {}); + await untilCalled(mockImageAnalysis.setAnalyzer(any)); + verifyNever(mockImageAnalysis.setTargetRotation(any)); + await imageStreamSubscription.cancel(); + // Orientation is locked and plugin does need to set default target + // rotation manually. + camera.captureOrientationLocked = true; + camera.shouldSetDefaultRotation = true; + imageStreamSubscription = camera + .onStreamedFrameAvailable(cameraId) + .listen((CameraImageData data) {}); await untilCalled(mockImageAnalysis.setAnalyzer(any)); - verifyNever(mockImageAnalysis.setTargetRotation(Surface.ROTATION_90)); + verifyNever(mockImageAnalysis.setTargetRotation(any)); + await imageStreamSubscription.cancel(); + + // Orientation is unlocked and plugin does need to set default target + // rotation manually. + camera.captureOrientationLocked = false; + camera.shouldSetDefaultRotation = true; + imageStreamSubscription = camera + .onStreamedFrameAvailable(cameraId) + .listen((CameraImageData data) {}); + await untilCalled( + mockImageAnalysis.setTargetRotation(defaultTargetRotation)); await imageStreamSubscription.cancel(); }); @@ -1879,7 +1937,6 @@ void main() { () async { final AndroidCameraCameraX camera = AndroidCameraCameraX(); const int cameraId = 44; - const DeviceOrientation testOrientation = DeviceOrientation.landscapeLeft; final MockImageAnalysis mockImageAnalysis = MockImageAnalysis(); final MockImageCapture mockImageCapture = MockImageCapture(); @@ -1890,34 +1947,31 @@ void main() { camera.imageCapture = mockImageCapture; camera.videoCapture = mockVideoCapture; - // Tell plugin to mock calls to retrieve photo and video orientations. - const int targetPhotoOrientation = 90; - const int targetPhotoOrientationConstant = Surface.ROTATION_90; - const int targetVideoOrientation = 270; - const int targetVideoOrientationConstant = Surface.ROTATION_270; - camera.proxy = CameraXProxy( - getPhotoOrientation: (DeviceOrientation? orientation) { - if (orientation == testOrientation) { - return Future.value(targetPhotoOrientation); - } else { - return Future.value(0); - } - }, - getVideoOrientation: (DeviceOrientation? orientation) { - if (orientation == testOrientation) { - return Future.value(targetVideoOrientation); - } else { - return Future.value(0); - } - }, - ); + for (final DeviceOrientation orientation in DeviceOrientation.values) { + int? expectedTargetRotation; + switch (orientation) { + case DeviceOrientation.portraitUp: + expectedTargetRotation = Surface.ROTATION_0; + case DeviceOrientation.landscapeLeft: + expectedTargetRotation = Surface.ROTATION_90; + case DeviceOrientation.portraitDown: + expectedTargetRotation = Surface.ROTATION_180; + case DeviceOrientation.landscapeRight: + expectedTargetRotation = Surface.ROTATION_270; + } - await camera.lockCaptureOrientation(cameraId, testOrientation); + await camera.lockCaptureOrientation(cameraId, orientation); - verify(mockImageAnalysis.setTargetRotation(targetPhotoOrientationConstant)); - verify(mockImageCapture.setTargetRotation(targetPhotoOrientationConstant)); - verify(mockVideoCapture.setTargetRotation(targetVideoOrientationConstant)); - expect(camera.captureOrientationLocked, isTrue); + verify(mockImageAnalysis.setTargetRotation(expectedTargetRotation)); + verify(mockImageCapture.setTargetRotation(expectedTargetRotation)); + verify(mockVideoCapture.setTargetRotation(expectedTargetRotation)); + expect(camera.captureOrientationLocked, isTrue); + expect(camera.shouldSetDefaultRotation, isTrue); + + // Reset flags for testing. + camera.captureOrientationLocked = false; + camera.shouldSetDefaultRotation = false; + } }); test( @@ -1926,46 +1980,8 @@ void main() { final AndroidCameraCameraX camera = AndroidCameraCameraX(); const int cameraId = 57; - final MockImageAnalysis mockImageAnalysis = MockImageAnalysis(); - final MockImageCapture mockImageCapture = MockImageCapture(); - final MockVideoCapture mockVideoCapture = MockVideoCapture(); - - // Set directly for test versus calling createCamera. - camera.imageAnalysis = mockImageAnalysis; - camera.imageCapture = mockImageCapture; - camera.videoCapture = mockVideoCapture; - - // Set flag to test it is properly changed. camera.captureOrientationLocked = true; - - // Tell plugin to mock current photo & video orientations. - const int targetPhotoOrientation = 270; - const int targetPhotoOrientationConstant = Surface.ROTATION_270; - const int targetVideoOrientation = 180; - const int targetVideoOrientationConstant = Surface.ROTATION_180; - - camera.proxy = CameraXProxy( - getPhotoOrientation: (DeviceOrientation? orientation) { - if (orientation == null) { - return Future.value(targetPhotoOrientation); - } else { - return Future.value(0); - } - }, - getVideoOrientation: (DeviceOrientation? orientation) { - if (orientation == null) { - return Future.value(targetVideoOrientation); - } else { - return Future.value(0); - } - }, - ); - await camera.unlockCaptureOrientation(cameraId); - - verify(mockImageAnalysis.setTargetRotation(targetPhotoOrientationConstant)); - verify(mockImageCapture.setTargetRotation(targetPhotoOrientationConstant)); - verify(mockVideoCapture.setTargetRotation(targetVideoOrientationConstant)); expect(camera.captureOrientationLocked, isFalse); }); } diff --git a/packages/camera/camera_android_camerax/test/device_orientation_manager_test.dart b/packages/camera/camera_android_camerax/test/device_orientation_manager_test.dart index 98456c93253..69c8d20e3fd 100644 --- a/packages/camera/camera_android_camerax/test/device_orientation_manager_test.dart +++ b/packages/camera/camera_android_camerax/test/device_orientation_manager_test.dart @@ -3,6 +3,7 @@ // found in the LICENSE file. import 'package:camera_android_camerax/src/device_orientation_manager.dart'; +import 'package:camera_android_camerax/src/surface.dart'; import 'package:camera_platform_interface/camera_platform_interface.dart' show DeviceOrientationChangedEvent; import 'package:flutter/services.dart'; @@ -47,64 +48,17 @@ void main() { verify(mockApi.stopListeningForDeviceOrientationChange()); }); - test('getPhotoOrientation retrieves expected orientation', () async { + test('getDefaultRotation retrieves expected rotation', () async { final MockTestDeviceOrientationManagerHostApi mockApi = MockTestDeviceOrientationManagerHostApi(); TestDeviceOrientationManagerHostApi.setup(mockApi); + const int expectedRotation = Surface.ROTATION_180; - int offsetForTesting = 1; - for (final DeviceOrientation orientation in DeviceOrientation.values) { - String? serializedDeviceOrientation; - switch (orientation) { - case DeviceOrientation.landscapeLeft: - serializedDeviceOrientation = 'LANDSCAPE_LEFT'; - case DeviceOrientation.landscapeRight: - serializedDeviceOrientation = 'LANDSCAPE_RIGHT'; - case DeviceOrientation.portraitDown: - serializedDeviceOrientation = 'PORTRAIT_DOWN'; - case DeviceOrientation.portraitUp: - serializedDeviceOrientation = 'PORTRAIT_UP'; - } - final int photoOrientation = 270 + offsetForTesting; - offsetForTesting += 1; + when(mockApi.getDefaultRotation()).thenReturn(expectedRotation); - when(mockApi.getPhotoOrientation(serializedDeviceOrientation)) - .thenReturn(photoOrientation); - - expect(await DeviceOrientationManager.getPhotoOrientation(orientation), - equals(photoOrientation)); - verify(mockApi.getPhotoOrientation(serializedDeviceOrientation)); - } - }); - - test('getVideoOrientation retrieves expected orientation', () async { - final MockTestDeviceOrientationManagerHostApi mockApi = - MockTestDeviceOrientationManagerHostApi(); - TestDeviceOrientationManagerHostApi.setup(mockApi); - - int offsetForTesting = 1; - for (final DeviceOrientation orientation in DeviceOrientation.values) { - String? serializedDeviceOrientation; - switch (orientation) { - case DeviceOrientation.landscapeLeft: - serializedDeviceOrientation = 'LANDSCAPE_LEFT'; - case DeviceOrientation.landscapeRight: - serializedDeviceOrientation = 'LANDSCAPE_RIGHT'; - case DeviceOrientation.portraitDown: - serializedDeviceOrientation = 'PORTRAIT_DOWN'; - case DeviceOrientation.portraitUp: - serializedDeviceOrientation = 'PORTRAIT_UP'; - } - final int videoOrientation = 270 + offsetForTesting; - offsetForTesting += 1; - - when(mockApi.getVideoOrientation(serializedDeviceOrientation)) - .thenReturn(videoOrientation); - - expect(await DeviceOrientationManager.getVideoOrientation(orientation), - equals(videoOrientation)); - verify(mockApi.getVideoOrientation(serializedDeviceOrientation)); - } + expect(await DeviceOrientationManager.getDefaultRotation(), + equals(expectedRotation)); + verify(mockApi.getDefaultRotation()); }); test('onDeviceOrientationChanged adds new orientation to stream', () { From 2be21dacb97d11b4596ced5bd893406c95064055 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Mon, 11 Dec 2023 09:52:04 -0800 Subject: [PATCH 21/29] Add branching for potential Camx error --- .../plugins/camerax/PendingRecordingHostApiImpl.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/PendingRecordingHostApiImpl.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/PendingRecordingHostApiImpl.java index 70119fac5d4..32577c0e6f6 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/PendingRecordingHostApiImpl.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/PendingRecordingHostApiImpl.java @@ -75,7 +75,13 @@ public void handleVideoRecordEvent(@NonNull VideoRecordEvent event) { if (event instanceof VideoRecordEvent.Finalize) { VideoRecordEvent.Finalize castedEvent = (VideoRecordEvent.Finalize) event; if (castedEvent.hasError()) { - systemServicesFlutterApi.sendCameraError(castedEvent.getCause().toString(), reply -> {}); + String cameraErrorMessage; + if (castedEvent.getCause() != null) { + cameraErrorMessage = castedEvent.getCause().toString(); + } else { + cameraErrorMessage = "Error code " + castedEvent.getError() + ": An error occurred while recording video."; + } + systemServicesFlutterApi.sendCameraError(cameraErrorMessage, reply -> {}); } } } From b28ad129d12bdb3ed23da03a4aafe7c66970c922 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Mon, 11 Dec 2023 11:41:54 -0800 Subject: [PATCH 22/29] Address Gray review --- .../DeviceOrientationManagerHostApiImpl.java | 11 +++++++---- .../camerax/VideoCaptureHostApiImpl.java | 2 +- .../DeviceOrientationManagerWrapperTest.java | 2 +- .../lib/src/android_camera_camerax.dart | 18 ------------------ .../lib/src/image_capture.dart | 8 ++++---- 5 files changed, 13 insertions(+), 28 deletions(-) diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerHostApiImpl.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerHostApiImpl.java index dccf517030e..86a91a2849a 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerHostApiImpl.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerHostApiImpl.java @@ -82,10 +82,13 @@ public void stopListeningForDeviceOrientationChange() { /** Gets default capture rotation for CameraX {@code UseCase}s. */ @Override public @NonNull Long getDefaultRotation() { - if (deviceOrientationManager == null) { - throw new NullPointerException( - "startListeningForDeviceOrientationChange must first be called to subscribe to device orientation changes in order to retrieve the video orientation."); + int defaultRotation; + try { + defaultRotation = deviceOrientationManager.getDefaultRotation(); + } catch (NullPointerException e) { + throw new IllegalStateException("startListeningForDeviceOrientationChange must first be called to subscribe to device orientation changes in order to retrieve the video orientation."); } - return Long.valueOf(deviceOrientationManager.getDefaultRotation()); + + return Long.valueOf(defaultRotation); } } diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/VideoCaptureHostApiImpl.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/VideoCaptureHostApiImpl.java index ba6b9678b6f..1c849ee0937 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/VideoCaptureHostApiImpl.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/VideoCaptureHostApiImpl.java @@ -57,7 +57,7 @@ public void setTargetRotation(@NonNull Long identifier, @NonNull Long rotation) } /** - * Retrieives the {@link VideoCapture} instance associated with the specified {@code identifier}. + * Retrieves the {@link VideoCapture} instance associated with the specified {@code identifier}. */ private VideoCapture getVideoCaptureInstance(@NonNull Long identifier) { return Objects.requireNonNull(instanceManager.getInstance(identifier)); diff --git a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/DeviceOrientationManagerWrapperTest.java b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/DeviceOrientationManagerWrapperTest.java index 5ff0585222f..c151ac5aa48 100644 --- a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/DeviceOrientationManagerWrapperTest.java +++ b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/DeviceOrientationManagerWrapperTest.java @@ -77,7 +77,7 @@ public void deviceOrientationManagerWrapper_handlesDeviceOrientationChangesAsExp // Test that the DeviceOrientationManager starts listening for device orientation changes. verify(mockDeviceOrientationManager).start(); - // Test that the DevieOrientationManager can stop listening for device orientation changes. + // Test that the DeviceOrientationManager can stop listening for device orientation changes. hostApi.stopListeningForDeviceOrientationChange(); verify(mockDeviceOrientationManager).stop(); } 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 3363339770e..ed8112bd86c 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 @@ -881,24 +881,6 @@ class AndroidCameraCameraX extends CameraPlatform { } } - /// Returns [Surface] target rotation constant that maps to specified sensor - /// orientation. - int _getTargetRotationConstant(int sensorOrientation) { - switch (sensorOrientation) { - case 90: - return Surface.ROTATION_90; - case 180: - return Surface.ROTATION_180; - case 270: - return Surface.ROTATION_270; - case 0: - return Surface.ROTATION_0; - default: - throw ArgumentError( - '"$sensorOrientation" is not a valid sensor orientation value'); - } - } - /// Returns [Surface] constant for counter-clockwise degrees of rotation from /// [DeviceOrientation.portraitUp] required to reach the specified /// [DeviceOrientation]. 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 8da22ab6f09..2142240acea 100644 --- a/packages/camera/camera_android_camerax/lib/src/image_capture.dart +++ b/packages/camera/camera_android_camerax/lib/src/image_capture.dart @@ -95,7 +95,7 @@ class ImageCapture extends UseCase { /// Sets the flash mode to use for image capture. Future setFlashMode(int newFlashMode) async { - return _api.setFlashModeFromInstance(this, newFlashMode); + return _api.setFlashModeFromInstances(this, newFlashMode); } /// Takes a picture and returns the absolute path of where the capture image @@ -116,7 +116,7 @@ class ImageCapture extends UseCase { /// See https://developer.android.com/reference/androidx/camera/core/ImageCapture /// for more information. Future takePicture() async { - return _api.takePictureFromInstance(this); + return _api.takePictureFromInstances(this); } } @@ -175,7 +175,7 @@ class ImageCaptureHostApiImpl extends ImageCaptureHostApi { /// Sets the flash mode for the specified [ImageCapture] instance to take /// a picture with. - Future setFlashModeFromInstance( + Future setFlashModeFromInstances( ImageCapture instance, int flashMode) async { final int? identifier = instanceManager.getIdentifier(instance); assert(identifier != null, @@ -185,7 +185,7 @@ class ImageCaptureHostApiImpl extends ImageCaptureHostApi { } /// Takes a picture with the specified [ImageCapture] instance. - Future takePictureFromInstance(ImageCapture instance) async { + Future takePictureFromInstances(ImageCapture instance) async { final int? identifier = instanceManager.getIdentifier(instance); assert(identifier != null, 'No ImageCapture has the identifer of that requested to get the resolution information for.'); From 0e01e432d16febd75862b7a4d4933c5fcb9e0c4d Mon Sep 17 00:00:00 2001 From: camsim99 Date: Mon, 11 Dec 2023 14:02:15 -0800 Subject: [PATCH 23/29] Self review --- .../camera_android_camerax/CHANGELOG.md | 2 +- .../camerax/DeviceOrientationManager.java | 2 +- .../DeviceOrientationManagerHostApiImpl.java | 4 +-- .../camerax/PendingRecordingHostApiImpl.java | 3 +- .../lib/src/android_camera_camerax.dart | 18 ++++++------ .../lib/src/camerax_proxy.dart | 9 ++++-- .../lib/src/image_analysis.dart | 29 +++++++++---------- .../lib/src/image_capture.dart | 29 +++++++++---------- .../lib/src/preview.dart | 24 +++++++-------- .../lib/src/video_capture.dart | 10 +++---- .../test/android_camera_camerax_test.dart | 6 ++-- .../test/image_analysis_test.dart | 4 +-- .../test/image_capture_test.dart | 4 +-- .../test/preview_test.dart | 4 +-- 14 files changed, 73 insertions(+), 75 deletions(-) diff --git a/packages/camera/camera_android_camerax/CHANGELOG.md b/packages/camera/camera_android_camerax/CHANGELOG.md index 4354c9cb4cc..ea414bc489f 100644 --- a/packages/camera/camera_android_camerax/CHANGELOG.md +++ b/packages/camera/camera_android_camerax/CHANGELOG.md @@ -1,6 +1,6 @@ ## 0.5.0+24 + * Implements `lockCaptureOrientation` and `unlockCaptureOrientation`. -* Sets the initial target rotation of `UseCase`s to that specified by the `CameraDescription` passed to `createCamera`. ## 0.5.0+23 diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManager.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManager.java index d4a98acf782..b5281179d72 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManager.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManager.java @@ -126,7 +126,7 @@ static void handleOrientationChange( @SuppressWarnings("deprecation") @VisibleForTesting PlatformChannel.DeviceOrientation getUIOrientation() { - final int rotation = getDisplay().getRotation(); + final int rotation = getDefaultRotation(); final int orientation = activity.getResources().getConfiguration().orientation; switch (orientation) { diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerHostApiImpl.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerHostApiImpl.java index 86a91a2849a..1e9267486aa 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerHostApiImpl.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerHostApiImpl.java @@ -13,7 +13,6 @@ import io.flutter.plugins.camerax.CameraPermissionsManager.PermissionsRegistry; import io.flutter.plugins.camerax.GeneratedCameraXLibrary.DeviceOrientationManagerHostApi; - public class DeviceOrientationManagerHostApiImpl implements DeviceOrientationManagerHostApi { private final BinaryMessenger binaryMessenger; private final InstanceManager instanceManager; @@ -86,7 +85,8 @@ public void stopListeningForDeviceOrientationChange() { try { defaultRotation = deviceOrientationManager.getDefaultRotation(); } catch (NullPointerException e) { - throw new IllegalStateException("startListeningForDeviceOrientationChange must first be called to subscribe to device orientation changes in order to retrieve the video orientation."); + throw new IllegalStateException( + "startListeningForDeviceOrientationChange must first be called to subscribe to device orientation changes in order to retrieve default rotation."); } return Long.valueOf(defaultRotation); diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/PendingRecordingHostApiImpl.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/PendingRecordingHostApiImpl.java index 32577c0e6f6..d4acebefbff 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/PendingRecordingHostApiImpl.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/PendingRecordingHostApiImpl.java @@ -79,7 +79,8 @@ public void handleVideoRecordEvent(@NonNull VideoRecordEvent event) { if (castedEvent.getCause() != null) { cameraErrorMessage = castedEvent.getCause().toString(); } else { - cameraErrorMessage = "Error code " + castedEvent.getError() + ": An error occurred while recording video."; + cameraErrorMessage = + "Error code " + castedEvent.getError() + ": An error occurred while recording video."; } systemServicesFlutterApi.sendCameraError(cameraErrorMessage, reply -> {}); } 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 ed8112bd86c..5fbbc23f1a6 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 @@ -172,7 +172,7 @@ class AndroidCameraCameraX extends CameraPlatform { /// the default orientation manually. /// /// See https://developer.android.com/reference/androidx/camera/core/ImageCapture#setTargetRotation(int) - /// for an example on how setting target rotations for [UseCase]s work. + /// for an example on how setting target rotations for [UseCase]s works. bool shouldSetDefaultRotation = false; /// Returns list of all available cameras and their descriptions. @@ -260,19 +260,19 @@ class AndroidCameraCameraX extends CameraPlatform { processCameraProvider!.unbindAll(); // Configure Preview instance. - preview = proxy.createPreview( - presetResolutionSelector, /* use default target rotation */ null); + preview = proxy.createPreview(presetResolutionSelector, + /* use CameraX default target rotation */ null); final int flutterSurfaceTextureId = await proxy.setPreviewSurfaceProvider(preview!); // Configure ImageCapture instance. - imageCapture = proxy.createImageCapture( - presetResolutionSelector, /* use default target rotation */ null); + imageCapture = proxy.createImageCapture(presetResolutionSelector, + /* use CameraX default target rotation */ null); // Configure ImageAnalysis instance. // Defaults to YUV_420_888 image format. - imageAnalysis = proxy.createImageAnalysis( - presetResolutionSelector, /* use default target rotation */ null); + imageAnalysis = proxy.createImageAnalysis(presetResolutionSelector, + /* use CameraX default target rotation */ null); // Configure VideoCapture and Recorder instances. recorder = proxy.createRecorder(presetQualitySelector); @@ -396,8 +396,8 @@ class AndroidCameraCameraX extends CameraPlatform { DeviceOrientation orientation, ) async { // Flag that (1) default rotation for UseCases will need to be set manually - // if orientation ever unlocked and (2) the capture orientation is locked - // and should not be changed. + // if orientation is ever unlocked and (2) the capture orientation is locked + // and should not be changed until unlocked. if (!shouldSetDefaultRotation) { shouldSetDefaultRotation = true; } diff --git a/packages/camera/camera_android_camerax/lib/src/camerax_proxy.dart b/packages/camera/camera_android_camerax/lib/src/camerax_proxy.dart index 96183aa95b5..4b52b075f57 100644 --- a/packages/camera/camera_android_camerax/lib/src/camerax_proxy.dart +++ b/packages/camera/camera_android_camerax/lib/src/camerax_proxy.dart @@ -156,13 +156,15 @@ class CameraXProxy { static Preview _createAttachedPreview( ResolutionSelector? resolutionSelector, int? targetRotation) { return Preview( - targetRotation: targetRotation, resolutionSelector: resolutionSelector); + initialTargetRotation: targetRotation, + resolutionSelector: resolutionSelector); } static ImageCapture _createAttachedImageCapture( ResolutionSelector? resolutionSelector, int? targetRotation) { return ImageCapture( - resolutionSelector: resolutionSelector, targetRotation: targetRotation); + resolutionSelector: resolutionSelector, + initialTargetRotation: targetRotation); } static Recorder _createAttachedRecorder(QualitySelector? qualitySelector) { @@ -177,7 +179,8 @@ class CameraXProxy { static ImageAnalysis _createAttachedImageAnalysis( ResolutionSelector? resolutionSelector, int? targetRotation) { return ImageAnalysis( - resolutionSelector: resolutionSelector, targetRotation: targetRotation); + resolutionSelector: resolutionSelector, + initialTargetRotation: targetRotation); } static Analyzer _createAttachedAnalyzer( 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 567d38d1fbe..c4fcdd1ed8b 100644 --- a/packages/camera/camera_android_camerax/lib/src/image_analysis.dart +++ b/packages/camera/camera_android_camerax/lib/src/image_analysis.dart @@ -21,32 +21,26 @@ import 'use_case.dart'; @immutable class ImageAnalysis extends UseCase { /// Creates an [ImageAnalysis]. - /// - /// [targetRotation] should be specified in terms of one of the [Surface] - /// rotation constants. ImageAnalysis( {BinaryMessenger? binaryMessenger, InstanceManager? instanceManager, - this.targetRotation, + this.initialTargetRotation, this.resolutionSelector}) : super.detached( binaryMessenger: binaryMessenger, instanceManager: instanceManager) { _api = _ImageAnalysisHostApiImpl( binaryMessenger: binaryMessenger, instanceManager: instanceManager); - _api.createFromInstances(this, targetRotation, resolutionSelector); + _api.createFromInstances(this, initialTargetRotation, resolutionSelector); AndroidCameraXCameraFlutterApis.instance.ensureSetUp(); } /// Constructs an [ImageAnalysis] that is not automatically attached to a /// native object. - /// - /// [targetRotation] should be specified in terms of one of the [Surface] - /// rotation constants. ImageAnalysis.detached( {BinaryMessenger? binaryMessenger, InstanceManager? instanceManager, - this.targetRotation, + this.initialTargetRotation, this.resolutionSelector}) : super.detached( binaryMessenger: binaryMessenger, @@ -58,8 +52,12 @@ class ImageAnalysis extends UseCase { late final _ImageAnalysisHostApiImpl _api; - /// Target rotation of the camera used for the preview stream. - final int? targetRotation; + /// Initial target rotation of the camera used for the preview stream. + /// + /// Should be specified in terms of one of the [Surface] + /// rotation constants that represents the counter-clockwise degrees of + /// rotation relative to [DeviceOrientation.portraitUp]. + final int? initialTargetRotation; /// Target resolution of the camera preview stream. /// @@ -69,10 +67,9 @@ class ImageAnalysis extends UseCase { /// Dynamically sets the target rotation of this instance. /// - /// The target rotations should be expressed in the counter-clockwise - /// direction and relative to [DeviceOrientation.portraitUp]. - /// - /// [rotation] should be one of the [Surface] rotation constants. + /// [rotation] should be specified in terms of one of the [Surface] + /// rotation constants that represents the counter-clockwise degrees of + /// rotation relative to [DeviceOrientation.portraitUp]. Future setTargetRotation(int rotation) => _api.setTargetRotationFromInstances(this, rotation); @@ -115,7 +112,7 @@ class _ImageAnalysisHostApiImpl extends ImageAnalysisHostApi { instanceManager.addDartCreatedInstance( instance, onCopy: (ImageAnalysis original) => ImageAnalysis.detached( - targetRotation: original.targetRotation, + initialTargetRotation: original.initialTargetRotation, resolutionSelector: original.resolutionSelector, binaryMessenger: binaryMessenger, instanceManager: instanceManager, 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 2142240acea..b0f5eb2d52e 100644 --- a/packages/camera/camera_android_camerax/lib/src/image_capture.dart +++ b/packages/camera/camera_android_camerax/lib/src/image_capture.dart @@ -17,13 +17,10 @@ import 'use_case.dart'; @immutable class ImageCapture extends UseCase { /// Creates an [ImageCapture]. - /// - /// [targetRotation] should be specified in terms of one of the [Surface] - /// rotation constants. ImageCapture({ BinaryMessenger? binaryMessenger, InstanceManager? instanceManager, - this.targetRotation, + this.initialTargetRotation, this.targetFlashMode, this.resolutionSelector, }) : super.detached( @@ -33,18 +30,15 @@ class ImageCapture extends UseCase { _api = ImageCaptureHostApiImpl( binaryMessenger: binaryMessenger, instanceManager: instanceManager); _api.createFromInstance( - this, targetRotation, targetFlashMode, resolutionSelector); + this, initialTargetRotation, targetFlashMode, resolutionSelector); } /// Constructs a [ImageCapture] that is not automatically attached to a /// native object. - /// - /// [targetRotation] should be specified in terms of one of the [Surface] - /// rotation constants. ImageCapture.detached({ BinaryMessenger? binaryMessenger, InstanceManager? instanceManager, - this.targetRotation, + this.initialTargetRotation, this.targetFlashMode, this.resolutionSelector, }) : super.detached( @@ -57,8 +51,12 @@ class ImageCapture extends UseCase { late final ImageCaptureHostApiImpl _api; - /// Target rotation of the camera used for the preview stream. - final int? targetRotation; + /// Initial target rotation of the camera used for the preview stream. + /// + /// Should be specified in terms of one of the [Surface] + /// rotation constants that represents the counter-clockwise degrees of + /// rotation relative to [DeviceOrientation.portraitUp]. + final int? initialTargetRotation; /// Flash mode used to take a picture. final int? targetFlashMode; @@ -86,10 +84,9 @@ class ImageCapture extends UseCase { /// Dynamically sets the target rotation of this instance. /// - /// The target rotations should be expressed in the counter-clockwise - /// direction and relative to [DeviceOrientation.portraitUp]. - /// - /// [rotation] should be one of the [Surface] rotation constants. + /// [rotation] should be specified in terms of one of the [Surface] + /// rotation constants that represents the counter-clockwise degrees of + /// rotation relative to [DeviceOrientation.portraitUp]. Future setTargetRotation(int rotation) => _api.setTargetRotationFromInstances(this, rotation); @@ -153,7 +150,7 @@ class ImageCaptureHostApiImpl extends ImageCaptureHostApi { return ImageCapture.detached( binaryMessenger: binaryMessenger, instanceManager: instanceManager, - targetRotation: original.targetRotation, + initialTargetRotation: original.initialTargetRotation, targetFlashMode: original.targetFlashMode, resolutionSelector: original.resolutionSelector); }); diff --git a/packages/camera/camera_android_camerax/lib/src/preview.dart b/packages/camera/camera_android_camerax/lib/src/preview.dart index 9b91f2993bc..c46a646e7d0 100644 --- a/packages/camera/camera_android_camerax/lib/src/preview.dart +++ b/packages/camera/camera_android_camerax/lib/src/preview.dart @@ -17,27 +17,24 @@ import 'use_case.dart'; @immutable class Preview extends UseCase { /// Creates a [Preview]. - /// - /// [targetRotation] should be specified in terms of one of the [Surface] - /// rotation constants. Preview( {BinaryMessenger? binaryMessenger, InstanceManager? instanceManager, - this.targetRotation, + this.initialTargetRotation, this.resolutionSelector}) : super.detached( binaryMessenger: binaryMessenger, instanceManager: instanceManager) { _api = PreviewHostApiImpl( binaryMessenger: binaryMessenger, instanceManager: instanceManager); - _api.createFromInstance(this, targetRotation, resolutionSelector); + _api.createFromInstance(this, initialTargetRotation, resolutionSelector); } /// Constructs a [Preview] that is not automatically attached to a native object. Preview.detached( {BinaryMessenger? binaryMessenger, InstanceManager? instanceManager, - this.targetRotation, + this.initialTargetRotation, this.resolutionSelector}) : super.detached( binaryMessenger: binaryMessenger, @@ -49,7 +46,11 @@ class Preview extends UseCase { late final PreviewHostApiImpl _api; /// Target rotation of the camera used for the preview stream. - final int? targetRotation; + /// + /// Should be specified in terms of one of the [Surface] + /// rotation constants that represents the counter-clockwise degrees of + /// rotation relative to [DeviceOrientation.portraitUp]. + final int? initialTargetRotation; /// Target resolution of the camera preview stream. /// @@ -59,10 +60,9 @@ class Preview extends UseCase { /// Dynamically sets the target rotation of this instance. /// - /// The target rotations should be expressed in the counter-clockwise - /// direction and relative to [DeviceOrientation.portraitUp]. - /// - /// [rotation] should be one of the [Surface] rotation constants. + /// [rotation] should be specified in terms of one of the [Surface] + /// rotation constants that represents the counter-clockwise degrees of + /// rotation relative to [DeviceOrientation.portraitUp]. Future setTargetRotation(int rotation) => _api.setTargetRotationFromInstances(this, rotation); @@ -115,7 +115,7 @@ class PreviewHostApiImpl extends PreviewHostApi { return Preview.detached( binaryMessenger: binaryMessenger, instanceManager: instanceManager, - targetRotation: original.targetRotation, + initialTargetRotation: original.initialTargetRotation, resolutionSelector: original.resolutionSelector); }); create( diff --git a/packages/camera/camera_android_camerax/lib/src/video_capture.dart b/packages/camera/camera_android_camerax/lib/src/video_capture.dart index 865670ddef6..c3d4403a6ca 100644 --- a/packages/camera/camera_android_camerax/lib/src/video_capture.dart +++ b/packages/camera/camera_android_camerax/lib/src/video_capture.dart @@ -17,7 +17,8 @@ import 'use_case.dart'; /// See https://developer.android.com/reference/androidx/camera/video/VideoCapture. @immutable class VideoCapture extends UseCase { - /// Creates a VideoCapture that is not automatically attached to a native object. + /// Creates a [VideoCapture] that is not automatically attached to a native + /// object. VideoCapture.detached( {BinaryMessenger? binaryMessenger, InstanceManager? instanceManager}) : super.detached( @@ -42,10 +43,9 @@ class VideoCapture extends UseCase { /// Dynamically sets the target rotation of this instance. /// - /// The target rotations should be expressed in the counter-clockwise - /// direction and relative to [DeviceOrientation.portraitUp]. - /// - /// [rotation] should be one of the [Surface] rotation constants. + /// [rotation] should be specified in terms of one of the [Surface] + /// rotation constants that represents the counter-clockwise degrees of + /// rotation relative to [DeviceOrientation.portraitUp]. Future setTargetRotation(int rotation) => _api.setTargetRotationFromInstances(this, rotation); 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 b682110c192..25ff3222cd4 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 @@ -430,20 +430,20 @@ void main() { createPreview: (ResolutionSelector? resolutionSelector, int? targetRotation) => Preview.detached( - targetRotation: targetRotation, + initialTargetRotation: targetRotation, resolutionSelector: resolutionSelector), createImageCapture: (ResolutionSelector? resolutionSelector, int? targetRotation) => ImageCapture.detached( resolutionSelector: resolutionSelector, - targetRotation: targetRotation), + initialTargetRotation: targetRotation), createRecorder: (_) => mockRecorder, createVideoCapture: (_) => Future.value(mockVideoCapture), createImageAnalysis: (ResolutionSelector? resolutionSelector, int? targetRotation) => ImageAnalysis.detached( resolutionSelector: resolutionSelector, - targetRotation: targetRotation), + initialTargetRotation: targetRotation), createResolutionStrategy: ( {bool highestAvailable = false, Size? boundSize, int? fallbackRule}) { if (highestAvailable) { 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 89c6d44c74c..1db792cf6d3 100644 --- a/packages/camera/camera_android_camerax/test/image_analysis_test.dart +++ b/packages/camera/camera_android_camerax/test/image_analysis_test.dart @@ -41,7 +41,7 @@ void main() { ); ImageAnalysis.detached( - targetRotation: Surface.ROTATION_270, + initialTargetRotation: Surface.ROTATION_270, resolutionSelector: MockResolutionSelector(), instanceManager: instanceManager, ); @@ -70,7 +70,7 @@ void main() { }); final ImageAnalysis instance = ImageAnalysis( - targetRotation: targetRotation, + initialTargetRotation: targetRotation, resolutionSelector: mockResolutionSelector, instanceManager: instanceManager, ); 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 7402ed20174..e9e9f0c1855 100644 --- a/packages/camera/camera_android_camerax/test/image_capture_test.dart +++ b/packages/camera/camera_android_camerax/test/image_capture_test.dart @@ -36,7 +36,7 @@ void main() { ); ImageCapture.detached( instanceManager: instanceManager, - targetRotation: Surface.ROTATION_180, + initialTargetRotation: Surface.ROTATION_180, targetFlashMode: ImageCapture.flashModeOn, resolutionSelector: MockResolutionSelector(), ); @@ -67,7 +67,7 @@ void main() { ImageCapture( instanceManager: instanceManager, - targetRotation: targetRotation, + initialTargetRotation: targetRotation, targetFlashMode: targetFlashMode, resolutionSelector: mockResolutionSelector, ); diff --git a/packages/camera/camera_android_camerax/test/preview_test.dart b/packages/camera/camera_android_camerax/test/preview_test.dart index a082b71d8ee..cda1252d538 100644 --- a/packages/camera/camera_android_camerax/test/preview_test.dart +++ b/packages/camera/camera_android_camerax/test/preview_test.dart @@ -34,7 +34,7 @@ void main() { ); Preview.detached( instanceManager: instanceManager, - targetRotation: Surface.ROTATION_90, + initialTargetRotation: Surface.ROTATION_90, resolutionSelector: MockResolutionSelector(), ); @@ -62,7 +62,7 @@ void main() { Preview( instanceManager: instanceManager, - targetRotation: targetRotation, + initialTargetRotation: targetRotation, resolutionSelector: mockResolutionSelector, ); From 00c6aced81645d71a13628ce94b680256028f342 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Wed, 27 Dec 2023 10:47:04 -0800 Subject: [PATCH 24/29] Address review --- .../DeviceOrientationManagerHostApiImpl.java | 14 ++++++++++++-- .../plugins/camerax/GeneratedCameraXLibrary.java | 6 +++--- .../camerax/DeviceOrientationManagerTest.java | 4 ++-- .../lib/src/android_camera_camerax.dart | 15 +++++++++------ .../lib/src/camerax_library.g.dart | 4 ++-- .../lib/src/camerax_proxy.dart | 8 ++++---- .../lib/src/device_orientation_manager.dart | 9 +++++++-- .../pigeons/camerax_library.dart | 2 +- .../test/android_camera_camerax_test.dart | 9 ++++++--- .../test/device_orientation_manager_test.dart | 8 ++++---- .../test/test_camerax_library.g.dart | 6 +++--- 11 files changed, 53 insertions(+), 32 deletions(-) diff --git a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerHostApiImpl.java b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerHostApiImpl.java index 1e9267486aa..e617d53c99c 100644 --- a/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerHostApiImpl.java +++ b/packages/camera/camera_android_camerax/android/src/main/java/io/flutter/plugins/camerax/DeviceOrientationManagerHostApiImpl.java @@ -78,9 +78,19 @@ public void stopListeningForDeviceOrientationChange() { } } - /** Gets default capture rotation for CameraX {@code UseCase}s. */ + /** + * Gets default capture rotation for CameraX {@code UseCase}s. + * + *

The default capture rotation for CameraX is the rotation of default {@code Display} at the + * time that a {@code UseCase} is bound, but the default {@code Display} does not change in this + * plugin, so this value is {@code Display}-agnostic. + * + *

See + * https://developer.android.com/reference/androidx/camera/core/ImageCapture#setTargetRotation(int) + * for instance for more information on how this default value is used. + */ @Override - public @NonNull Long getDefaultRotation() { + public @NonNull Long getDefaultDisplayRotation() { int defaultRotation; try { defaultRotation = deviceOrientationManager.getDefaultRotation(); 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 6cdd8b5f27b..e8da1975336 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 @@ -1366,7 +1366,7 @@ void startListeningForDeviceOrientationChange( void stopListeningForDeviceOrientationChange(); @NonNull - Long getDefaultRotation(); + Long getDefaultDisplayRotation(); /** The codec used by DeviceOrientationManagerHostApi. */ static @NonNull MessageCodec getCodec() { @@ -1433,14 +1433,14 @@ static void setup( BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, - "dev.flutter.pigeon.DeviceOrientationManagerHostApi.getDefaultRotation", + "dev.flutter.pigeon.DeviceOrientationManagerHostApi.getDefaultDisplayRotation", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { ArrayList wrapped = new ArrayList(); try { - Long output = api.getDefaultRotation(); + Long output = api.getDefaultDisplayRotation(); wrapped.add(0, output); } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); diff --git a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/DeviceOrientationManagerTest.java b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/DeviceOrientationManagerTest.java index 1bb4077fb6d..8176944abed 100644 --- a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/DeviceOrientationManagerTest.java +++ b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/DeviceOrientationManagerTest.java @@ -149,11 +149,11 @@ private void setUpUIOrientationMocks(int orientation, int rotation) { } @Test - public void getDefaultRotation_returnsExpectedValue() { + public void getDefaultDisplayRotation_returnsExpectedValue() { final int expectedRotation = 90; when(mockDisplay.getRotation()).thenReturn(expectedRotation); - final int defaultRotation = deviceOrientationManager.getDefaultRotation(); + final int defaultRotation = deviceOrientationManager.getDefaultDisplayRotation(); assertEquals(defaultRotation, expectedRotation); } 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 a7691e242cb..fbb42d3664e 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 @@ -551,10 +551,11 @@ class AndroidCameraCameraX extends CameraPlatform { await imageCapture!.setFlashMode(ImageCapture.flashModeOff); } - // Set target rotation to current photo orientation only if capture + // Set target rotation to default CameraX rotation only if capture // orientation not locked. if (!captureOrientationLocked && shouldSetDefaultRotation) { - await imageCapture!.setTargetRotation(await proxy.getDefaultRotation()); + await imageCapture! + .setTargetRotation(await proxy.getDefaultDisplayRotation()); } final String picturePath = await imageCapture!.takePicture(); @@ -639,10 +640,11 @@ class AndroidCameraCameraX extends CameraPlatform { .bindToLifecycle(cameraSelector!, [videoCapture!]); } - // Set target rotation to current photo orientation only if capture + // Set target rotation to default CameraX rotation only if capture // orientation not locked. if (!captureOrientationLocked && shouldSetDefaultRotation) { - await videoCapture!.setTargetRotation(await proxy.getDefaultRotation()); + await videoCapture! + .setTargetRotation(await proxy.getDefaultDisplayRotation()); } videoOutputPath = @@ -746,10 +748,11 @@ class AndroidCameraCameraX extends CameraPlatform { /// Configures the [imageAnalysis] instance for image streaming. Future _configureImageAnalysis(int cameraId) async { - // Set target rotation to current photo orientation only if capture + // Set target rotation to default CameraX rotation only if capture // orientation not locked. if (!captureOrientationLocked && shouldSetDefaultRotation) { - await imageAnalysis!.setTargetRotation(await proxy.getDefaultRotation()); + await imageAnalysis! + .setTargetRotation(await proxy.getDefaultDisplayRotation()); } // Create and set Analyzer that can read image data for image streaming. 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 ebbd30fbfd9..f1528bbeec8 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 @@ -1008,9 +1008,9 @@ class DeviceOrientationManagerHostApi { } } - Future getDefaultRotation() async { + Future getDefaultDisplayRotation() async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.getDefaultRotation', + 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.getDefaultDisplayRotation', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send(null) as List?; diff --git a/packages/camera/camera_android_camerax/lib/src/camerax_proxy.dart b/packages/camera/camera_android_camerax/lib/src/camerax_proxy.dart index 4b52b075f57..87d3680ff2c 100644 --- a/packages/camera/camera_android_camerax/lib/src/camerax_proxy.dart +++ b/packages/camera/camera_android_camerax/lib/src/camerax_proxy.dart @@ -48,7 +48,7 @@ class CameraXProxy { this.startListeningForDeviceOrientationChange = _startListeningForDeviceOrientationChange, this.setPreviewSurfaceProvider = _setPreviewSurfaceProvider, - this.getDefaultRotation = _getDefaultRotation, + this.getDefaultDisplayRotation = _getDefaultDisplayRotation, }); /// Returns a [ProcessCameraProvider] instance. @@ -135,7 +135,7 @@ class CameraXProxy { /// Returns default rotation for [UseCase]s in terms of one of the [Surface] /// rotation constants. - Future Function() getDefaultRotation; + Future Function() getDefaultDisplayRotation; static Future _getProcessCameraProvider() { return ProcessCameraProvider.getInstance(); @@ -236,7 +236,7 @@ class CameraXProxy { return preview.setSurfaceProvider(); } - static Future _getDefaultRotation() async { - return DeviceOrientationManager.getDefaultRotation(); + static Future _getDefaultDisplayRotation() async { + return DeviceOrientationManager.getDefaultDisplayRotation(); } } diff --git a/packages/camera/camera_android_camerax/lib/src/device_orientation_manager.dart b/packages/camera/camera_android_camerax/lib/src/device_orientation_manager.dart index 7eea44ce826..db7edb6a0b5 100644 --- a/packages/camera/camera_android_camerax/lib/src/device_orientation_manager.dart +++ b/packages/camera/camera_android_camerax/lib/src/device_orientation_manager.dart @@ -52,14 +52,19 @@ class DeviceOrientationManager { /// Retrieves the default rotation that CameraX uses for [UseCase]s in terms /// of one of the [Surface] rotation constants. /// + /// The default rotation that CameraX uses is the rotation of the default + /// display at the time of binding a particular [UseCase], but the default + /// display does not change in the plugin, so this default value is + /// display-agnostic. + /// /// [startListeningForDeviceOrientationChange] must be called before calling /// this method. - static Future getDefaultRotation( + static Future getDefaultDisplayRotation( {BinaryMessenger? binaryMessenger}) async { final DeviceOrientationManagerHostApi api = DeviceOrientationManagerHostApi(binaryMessenger: binaryMessenger); - return api.getDefaultRotation(); + return api.getDefaultDisplayRotation(); } /// Serializes[DeviceOrientation] into a [String]. diff --git a/packages/camera/camera_android_camerax/pigeons/camerax_library.dart b/packages/camera/camera_android_camerax/pigeons/camerax_library.dart index 7a2422e17df..94285d148df 100644 --- a/packages/camera/camera_android_camerax/pigeons/camerax_library.dart +++ b/packages/camera/camera_android_camerax/pigeons/camerax_library.dart @@ -226,7 +226,7 @@ abstract class DeviceOrientationManagerHostApi { void stopListeningForDeviceOrientationChange(); - int getDefaultRotation(); + int getDefaultDisplayRotation(); } @FlutterApi() 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 25ff3222cd4..2dbda1bba54 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 @@ -1241,7 +1241,8 @@ void main() { // Tell plugin to mock call to get current video orientation. camera.proxy = CameraXProxy( - getDefaultRotation: () => Future.value(defaultTargetRotation)); + getDefaultDisplayRotation: () => + Future.value(defaultTargetRotation)); const int cameraId = 87; const String outputPath = '/temp/MOV123.temp'; @@ -1416,7 +1417,8 @@ void main() { // Tell plugin to mock call to get current photo orientation. camera.proxy = CameraXProxy( - getDefaultRotation: () => Future.value(defaultTargetRotation)); + getDefaultDisplayRotation: () => + Future.value(defaultTargetRotation)); when(camera.imageCapture!.takePicture()) .thenAnswer((_) async => 'test/absolute/path/to/picture'); @@ -1888,7 +1890,8 @@ void main() { // call to get current photo orientation. camera.proxy = CameraXProxy( createAnalyzer: (_) => MockAnalyzer(), - getDefaultRotation: () => Future.value(defaultTargetRotation)); + getDefaultDisplayRotation: () => + Future.value(defaultTargetRotation)); // Orientation is unlocked and plugin does not need to set default target // rotation manually. diff --git a/packages/camera/camera_android_camerax/test/device_orientation_manager_test.dart b/packages/camera/camera_android_camerax/test/device_orientation_manager_test.dart index 69c8d20e3fd..145ceeb278a 100644 --- a/packages/camera/camera_android_camerax/test/device_orientation_manager_test.dart +++ b/packages/camera/camera_android_camerax/test/device_orientation_manager_test.dart @@ -48,17 +48,17 @@ void main() { verify(mockApi.stopListeningForDeviceOrientationChange()); }); - test('getDefaultRotation retrieves expected rotation', () async { + test('getDefaultDisplayRotation retrieves expected rotation', () async { final MockTestDeviceOrientationManagerHostApi mockApi = MockTestDeviceOrientationManagerHostApi(); TestDeviceOrientationManagerHostApi.setup(mockApi); const int expectedRotation = Surface.ROTATION_180; - when(mockApi.getDefaultRotation()).thenReturn(expectedRotation); + when(mockApi.getDefaultDisplayRotation()).thenReturn(expectedRotation); - expect(await DeviceOrientationManager.getDefaultRotation(), + expect(await DeviceOrientationManager.getDefaultDisplayRotation(), equals(expectedRotation)); - verify(mockApi.getDefaultRotation()); + verify(mockApi.getDefaultDisplayRotation()); }); test('onDeviceOrientationChanged adds new orientation to stream', () { 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 b32133cb690..35d9d333c0c 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 @@ -574,7 +574,7 @@ abstract class TestDeviceOrientationManagerHostApi { void stopListeningForDeviceOrientationChange(); - int getDefaultRotation(); + int getDefaultDisplayRotation(); static void setup(TestDeviceOrientationManagerHostApi? api, {BinaryMessenger? binaryMessenger}) { @@ -625,7 +625,7 @@ abstract class TestDeviceOrientationManagerHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.getDefaultRotation', + 'dev.flutter.pigeon.DeviceOrientationManagerHostApi.getDefaultDisplayRotation', codec, binaryMessenger: binaryMessenger); if (api == null) { @@ -636,7 +636,7 @@ abstract class TestDeviceOrientationManagerHostApi { .setMockDecodedMessageHandler(channel, (Object? message) async { // ignore message - final int output = api.getDefaultRotation(); + final int output = api.getDefaultDisplayRotation(); return [output]; }); } From d2ecd9abea1eb3a48029e97c30b055bce81fd768 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Wed, 27 Dec 2023 11:08:39 -0800 Subject: [PATCH 25/29] Fix mocks --- .../test/device_orientation_manager_test.mocks.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/camera/camera_android_camerax/test/device_orientation_manager_test.mocks.dart b/packages/camera/camera_android_camerax/test/device_orientation_manager_test.mocks.dart index 0862bb7034a..840125ccc78 100644 --- a/packages/camera/camera_android_camerax/test/device_orientation_manager_test.mocks.dart +++ b/packages/camera/camera_android_camerax/test/device_orientation_manager_test.mocks.dart @@ -74,9 +74,9 @@ class MockTestDeviceOrientationManagerHostApi extends _i1.Mock ); @override - int getDefaultRotation() => (super.noSuchMethod( + int getDefaultDisplayRotation() => (super.noSuchMethod( Invocation.method( - #getDefaultRotation, + #getDefaultDisplayRotation, [], ), returnValue: 0, From 6e35acd898abac4b07df3369728bb2a569c47e37 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Wed, 27 Dec 2023 11:25:03 -0800 Subject: [PATCH 26/29] correct Java test --- .../plugins/camerax/DeviceOrientationManagerTest.java | 4 ++-- .../camerax/DeviceOrientationManagerWrapperTest.java | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/DeviceOrientationManagerTest.java b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/DeviceOrientationManagerTest.java index 8176944abed..1bb4077fb6d 100644 --- a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/DeviceOrientationManagerTest.java +++ b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/DeviceOrientationManagerTest.java @@ -149,11 +149,11 @@ private void setUpUIOrientationMocks(int orientation, int rotation) { } @Test - public void getDefaultDisplayRotation_returnsExpectedValue() { + public void getDefaultRotation_returnsExpectedValue() { final int expectedRotation = 90; when(mockDisplay.getRotation()).thenReturn(expectedRotation); - final int defaultRotation = deviceOrientationManager.getDefaultDisplayRotation(); + final int defaultRotation = deviceOrientationManager.getDefaultRotation(); assertEquals(defaultRotation, expectedRotation); } diff --git a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/DeviceOrientationManagerWrapperTest.java b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/DeviceOrientationManagerWrapperTest.java index c151ac5aa48..21a4ea6285e 100644 --- a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/DeviceOrientationManagerWrapperTest.java +++ b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/DeviceOrientationManagerWrapperTest.java @@ -83,14 +83,14 @@ public void deviceOrientationManagerWrapper_handlesDeviceOrientationChangesAsExp } @Test - public void getDefaultRotation_returnsExpectedRotation() { + public void getDefaultDisplayRotation_returnsExpectedRotation() { final DeviceOrientationManagerHostApiImpl hostApi = new DeviceOrientationManagerHostApiImpl(mockBinaryMessenger, mockInstanceManager); final int defaultRotation = 180; hostApi.deviceOrientationManager = mockDeviceOrientationManager; - when(mockDeviceOrientationManager.getDefaultRotation()).thenReturn(defaultRotation); + when(mockDeviceOrientationManager.getDefaultDisplayRotation()).thenReturn(defaultRotation); - assertEquals(hostApi.getDefaultRotation(), Long.valueOf(defaultRotation)); + assertEquals(hostApi.getDefaultDisplayRotation(), Long.valueOf(defaultRotation)); } } From cc80fc2df69e07eeed3c94dea3e87556cf076cb8 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Thu, 28 Dec 2023 08:13:46 -0800 Subject: [PATCH 27/29] Correct names --- .../plugins/camerax/DeviceOrientationManagerWrapperTest.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/DeviceOrientationManagerWrapperTest.java b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/DeviceOrientationManagerWrapperTest.java index 21a4ea6285e..26cfd77f126 100644 --- a/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/DeviceOrientationManagerWrapperTest.java +++ b/packages/camera/camera_android_camerax/android/src/test/java/io/flutter/plugins/camerax/DeviceOrientationManagerWrapperTest.java @@ -89,7 +89,7 @@ public void getDefaultDisplayRotation_returnsExpectedRotation() { final int defaultRotation = 180; hostApi.deviceOrientationManager = mockDeviceOrientationManager; - when(mockDeviceOrientationManager.getDefaultDisplayRotation()).thenReturn(defaultRotation); + when(mockDeviceOrientationManager.getDefaultRotation()).thenReturn(defaultRotation); assertEquals(hostApi.getDefaultDisplayRotation(), Long.valueOf(defaultRotation)); } From 06b38cfa7b4a30ce495e75d52131d9b8366381d0 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Tue, 2 Jan 2024 10:35:36 -0800 Subject: [PATCH 28/29] Nits --- .../lib/src/device_orientation_manager.dart | 2 +- .../camera/camera_android_camerax/lib/src/image_analysis.dart | 2 ++ .../camera/camera_android_camerax/lib/src/image_capture.dart | 2 ++ packages/camera/camera_android_camerax/lib/src/preview.dart | 2 ++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/camera/camera_android_camerax/lib/src/device_orientation_manager.dart b/packages/camera/camera_android_camerax/lib/src/device_orientation_manager.dart index db7edb6a0b5..10f20232485 100644 --- a/packages/camera/camera_android_camerax/lib/src/device_orientation_manager.dart +++ b/packages/camera/camera_android_camerax/lib/src/device_orientation_manager.dart @@ -67,7 +67,7 @@ class DeviceOrientationManager { return api.getDefaultDisplayRotation(); } - /// Serializes[DeviceOrientation] into a [String]. + /// Serializes [DeviceOrientation] into a [String]. static String serializeDeviceOrientation(DeviceOrientation orientation) { switch (orientation) { case DeviceOrientation.landscapeLeft: 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 c4fcdd1ed8b..9c3ddcff8a0 100644 --- a/packages/camera/camera_android_camerax/lib/src/image_analysis.dart +++ b/packages/camera/camera_android_camerax/lib/src/image_analysis.dart @@ -57,6 +57,8 @@ class ImageAnalysis extends UseCase { /// Should be specified in terms of one of the [Surface] /// rotation constants that represents the counter-clockwise degrees of /// rotation relative to [DeviceOrientation.portraitUp]. + /// + /// TODO(camsim99): Remove this parameter. https://github.com/flutter/flutter/issues/140664 final int? initialTargetRotation; /// Target resolution of the camera preview stream. 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 9b273dbaf45..346d55b8f80 100644 --- a/packages/camera/camera_android_camerax/lib/src/image_capture.dart +++ b/packages/camera/camera_android_camerax/lib/src/image_capture.dart @@ -56,6 +56,8 @@ class ImageCapture extends UseCase { /// Should be specified in terms of one of the [Surface] /// rotation constants that represents the counter-clockwise degrees of /// rotation relative to [DeviceOrientation.portraitUp]. + /// + /// TODO(camsim99): Remove this parameter. https://github.com/flutter/flutter/issues/140664 final int? initialTargetRotation; /// Flash mode used to take a picture. diff --git a/packages/camera/camera_android_camerax/lib/src/preview.dart b/packages/camera/camera_android_camerax/lib/src/preview.dart index c46a646e7d0..d94c5926c92 100644 --- a/packages/camera/camera_android_camerax/lib/src/preview.dart +++ b/packages/camera/camera_android_camerax/lib/src/preview.dart @@ -50,6 +50,8 @@ class Preview extends UseCase { /// Should be specified in terms of one of the [Surface] /// rotation constants that represents the counter-clockwise degrees of /// rotation relative to [DeviceOrientation.portraitUp]. + /// + /// TODO(camsim99): Remove this parameter. https://github.com/flutter/flutter/issues/140664 final int? initialTargetRotation; /// Target resolution of the camera preview stream. From 34d074cc8109487ab050f4a207d522b153fedb36 Mon Sep 17 00:00:00 2001 From: camsim99 Date: Tue, 2 Jan 2024 10:38:58 -0800 Subject: [PATCH 29/29] Fix todo format --- .../camera/camera_android_camerax/lib/src/image_analysis.dart | 3 +-- .../camera/camera_android_camerax/lib/src/image_capture.dart | 2 +- packages/camera/camera_android_camerax/lib/src/preview.dart | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) 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 9c3ddcff8a0..3dc21ce2a7b 100644 --- a/packages/camera/camera_android_camerax/lib/src/image_analysis.dart +++ b/packages/camera/camera_android_camerax/lib/src/image_analysis.dart @@ -57,8 +57,7 @@ class ImageAnalysis extends UseCase { /// Should be specified in terms of one of the [Surface] /// rotation constants that represents the counter-clockwise degrees of /// rotation relative to [DeviceOrientation.portraitUp]. - /// - /// TODO(camsim99): Remove this parameter. https://github.com/flutter/flutter/issues/140664 + // TODO(camsim99): Remove this parameter. https://github.com/flutter/flutter/issues/140664 final int? initialTargetRotation; /// Target resolution of the camera preview stream. 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 346d55b8f80..b2f8671cd9f 100644 --- a/packages/camera/camera_android_camerax/lib/src/image_capture.dart +++ b/packages/camera/camera_android_camerax/lib/src/image_capture.dart @@ -57,7 +57,7 @@ class ImageCapture extends UseCase { /// rotation constants that represents the counter-clockwise degrees of /// rotation relative to [DeviceOrientation.portraitUp]. /// - /// TODO(camsim99): Remove this parameter. https://github.com/flutter/flutter/issues/140664 + // TODO(camsim99): Remove this parameter. https://github.com/flutter/flutter/issues/140664 final int? initialTargetRotation; /// Flash mode used to take a picture. diff --git a/packages/camera/camera_android_camerax/lib/src/preview.dart b/packages/camera/camera_android_camerax/lib/src/preview.dart index d94c5926c92..8990313817b 100644 --- a/packages/camera/camera_android_camerax/lib/src/preview.dart +++ b/packages/camera/camera_android_camerax/lib/src/preview.dart @@ -51,7 +51,7 @@ class Preview extends UseCase { /// rotation constants that represents the counter-clockwise degrees of /// rotation relative to [DeviceOrientation.portraitUp]. /// - /// TODO(camsim99): Remove this parameter. https://github.com/flutter/flutter/issues/140664 + // TODO(camsim99): Remove this parameter. https://github.com/flutter/flutter/issues/140664 final int? initialTargetRotation; /// Target resolution of the camera preview stream.