package io.flutter.plugins.camera; import android.os.Handler; import android.text.TextUtils; import io.flutter.embedding.engine.systemchannels.PlatformChannel; import io.flutter.plugin.common.BinaryMessenger; import io.flutter.plugin.common.MethodChannel; import io.flutter.plugins.camera.features.autofocus.FocusMode; import io.flutter.plugins.camera.features.exposurelock.ExposureMode; import java.util.HashMap; import java.util.Map; /* loaded from: classes6.dex */ public class DartMessenger { static final boolean $assertionsDisabled = false; private MethodChannel cameraChannel; private MethodChannel deviceChannel; private final Handler handler; /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes6.dex */ public enum DeviceEventType { ORIENTATION_CHANGED("orientation_changed"); private final String method; DeviceEventType(String str) { this.method = str; } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes6.dex */ public enum CameraEventType { ERROR("error"), CLOSING("camera_closing"), INITIALIZED("initialized"); private final String method; CameraEventType(String str) { this.method = str; } } /* JADX INFO: Access modifiers changed from: package-private */ public DartMessenger(BinaryMessenger binaryMessenger, long j, Handler handler) { this.cameraChannel = new MethodChannel(binaryMessenger, "plugins.flutter.io/camera_android/camera".concat(String.valueOf(j))); this.deviceChannel = new MethodChannel(binaryMessenger, "plugins.flutter.io/camera_android/fromPlatform"); this.handler = handler; } public void sendDeviceOrientationChangeEvent(PlatformChannel.DeviceOrientation deviceOrientation) { send(DeviceEventType.ORIENTATION_CHANGED, new HashMap(this, deviceOrientation) { // from class: io.flutter.plugins.camera.DartMessenger.1 final DartMessenger this$0; final PlatformChannel.DeviceOrientation val$orientation; { this.this$0 = this; this.val$orientation = deviceOrientation; put("orientation", CameraUtils.serializeDeviceOrientation(deviceOrientation)); } }); } /* JADX INFO: Access modifiers changed from: package-private */ public void sendCameraInitializedEvent(Integer num, Integer num2, ExposureMode exposureMode, FocusMode focusMode, Boolean bool, Boolean bool2) { send(CameraEventType.INITIALIZED, new HashMap(this, num, num2, exposureMode, focusMode, bool, bool2) { // from class: io.flutter.plugins.camera.DartMessenger.2 final DartMessenger this$0; final ExposureMode val$exposureMode; final Boolean val$exposurePointSupported; final FocusMode val$focusMode; final Boolean val$focusPointSupported; final Integer val$previewHeight; final Integer val$previewWidth; { this.this$0 = this; this.val$previewWidth = num; this.val$previewHeight = num2; this.val$exposureMode = exposureMode; this.val$focusMode = focusMode; this.val$exposurePointSupported = bool; this.val$focusPointSupported = bool2; put("previewWidth", Double.valueOf(num.doubleValue())); put("previewHeight", Double.valueOf(num2.doubleValue())); put("exposureMode", exposureMode.toString()); put("focusMode", focusMode.toString()); put("exposurePointSupported", bool); put("focusPointSupported", bool2); } }); } /* JADX INFO: Access modifiers changed from: package-private */ public void sendCameraClosingEvent() { send(CameraEventType.CLOSING); } /* JADX INFO: Access modifiers changed from: package-private */ public void sendCameraErrorEvent(String str) { send(CameraEventType.ERROR, new HashMap(this, str) { // from class: io.flutter.plugins.camera.DartMessenger.3 final DartMessenger this$0; final String val$description; { this.this$0 = this; this.val$description = str; if (TextUtils.isEmpty(str)) { return; } put("description", str); } }); } private void send(CameraEventType cameraEventType) { send(cameraEventType, new HashMap()); } private void send(CameraEventType cameraEventType, Map map) { if (this.cameraChannel == null) { return; } this.handler.post(new Runnable(this, cameraEventType, map) { // from class: io.flutter.plugins.camera.DartMessenger.4 final DartMessenger this$0; final Map val$args; final CameraEventType val$eventType; { this.this$0 = this; this.val$eventType = cameraEventType; this.val$args = map; } @Override // java.lang.Runnable public void run() { this.this$0.cameraChannel.invokeMethod(this.val$eventType.method, this.val$args); } }); } private void send(DeviceEventType deviceEventType) { send(deviceEventType, new HashMap()); } private void send(DeviceEventType deviceEventType, Map map) { if (this.deviceChannel == null) { return; } this.handler.post(new Runnable(this, deviceEventType, map) { // from class: io.flutter.plugins.camera.DartMessenger.5 final DartMessenger this$0; final Map val$args; final DeviceEventType val$eventType; { this.this$0 = this; this.val$eventType = deviceEventType; this.val$args = map; } @Override // java.lang.Runnable public void run() { this.this$0.deviceChannel.invokeMethod(this.val$eventType.method, this.val$args); } }); } public void finish(final MethodChannel.Result result, final Object obj) { this.handler.post(new Runnable(result, obj) { // from class: io.flutter.plugins.camera.DartMessenger$$ExternalSyntheticLambda0 public final MethodChannel.Result f$0; public final Object f$1; @Override // java.lang.Runnable public final void run() { this.f$0.success(this.f$1); } { this.f$0 = result; this.f$1 = obj; } }); } public void error(final MethodChannel.Result result, final String str, final String str2, final Object obj) { this.handler.post(new Runnable(result, str, str2, obj) { // from class: io.flutter.plugins.camera.DartMessenger$$ExternalSyntheticLambda1 public final MethodChannel.Result f$0; public final String f$1; public final String f$2; public final Object f$3; @Override // java.lang.Runnable public final void run() { this.f$0.error(this.f$1, this.f$2, this.f$3); } { this.f$0 = result; this.f$1 = str; this.f$2 = str2; this.f$3 = obj; } }); } }