discord-jadx/app/src/main/java/c/o/a/n/b.java

829 lines
29 KiB
Java

package c.o.a.n;
import android.annotation.TargetApi;
import android.graphics.PointF;
import android.graphics.SurfaceTexture;
import android.hardware.Camera;
import android.location.Location;
import android.view.SurfaceHolder;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import c.o.a.l;
import c.o.a.m.j;
import c.o.a.m.m;
import c.o.a.n.i;
import c.o.a.p.a;
import com.google.android.gms.tasks.Task;
import com.otaliastudios.cameraview.CameraException;
import com.otaliastudios.cameraview.CameraView;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
/* compiled from: Camera1Engine */
public class b extends g implements Camera.PreviewCallback, Camera.ErrorCallback, a.AbstractC0165a {
/* renamed from: c0 reason: collision with root package name */
public final c.o.a.n.q.a f1474c0 = c.o.a.n.q.a.a();
/* renamed from: d0 reason: collision with root package name */
public Camera f1475d0;
@VisibleForTesting
/* renamed from: e0 reason: collision with root package name */
public int f1476e0;
/* compiled from: Camera1Engine */
public class a implements Runnable {
public final /* synthetic */ c.o.a.t.b i;
public final /* synthetic */ c.o.a.q.a j;
public final /* synthetic */ PointF k;
/* compiled from: Camera1Engine */
/* renamed from: c.o.a.n.b$a$a reason: collision with other inner class name */
public class RunnableC0157a implements Runnable {
public RunnableC0157a() {
}
@Override // java.lang.Runnable
public void run() {
a aVar = a.this;
((CameraView.b) b.this.l).d(aVar.j, false, aVar.k);
}
}
/* compiled from: Camera1Engine */
/* renamed from: c.o.a.n.b$a$b reason: collision with other inner class name */
public class C0158b implements Camera.AutoFocusCallback {
/* compiled from: Camera1Engine */
/* renamed from: c.o.a.n.b$a$b$a reason: collision with other inner class name */
public class RunnableC0159a implements Runnable {
public RunnableC0159a() {
}
@Override // java.lang.Runnable
public void run() {
b.this.f1475d0.cancelAutoFocus();
Camera.Parameters parameters = b.this.f1475d0.getParameters();
int maxNumFocusAreas = parameters.getMaxNumFocusAreas();
int maxNumMeteringAreas = parameters.getMaxNumMeteringAreas();
if (maxNumFocusAreas > 0) {
parameters.setFocusAreas(null);
}
if (maxNumMeteringAreas > 0) {
parameters.setMeteringAreas(null);
}
b.this.c1(parameters);
b.this.f1475d0.setParameters(parameters);
}
}
public C0158b() {
}
@Override // android.hardware.Camera.AutoFocusCallback
public void onAutoFocus(boolean z2, Camera camera) {
b.this.m.e("focus end", 0);
b.this.m.e("focus reset", 0);
a aVar = a.this;
((CameraView.b) b.this.l).d(aVar.j, z2, aVar.k);
if (b.this.a1()) {
b bVar = b.this;
c.o.a.n.v.f fVar = bVar.m;
fVar.c("focus reset", true, bVar.V, new c.o.a.n.v.i(fVar, c.o.a.n.v.e.ENGINE, new RunnableC0159a()));
}
}
}
public a(c.o.a.t.b bVar, c.o.a.q.a aVar, PointF pointF) {
this.i = bVar;
this.j = aVar;
this.k = pointF;
}
@Override // java.lang.Runnable
public void run() {
if (b.this.o.o) {
b bVar = b.this;
c.o.a.n.s.a aVar = new c.o.a.n.s.a(bVar.K, bVar.n.l());
c.o.a.t.b c2 = this.i.c(aVar);
Camera.Parameters parameters = b.this.f1475d0.getParameters();
int maxNumFocusAreas = parameters.getMaxNumFocusAreas();
int maxNumMeteringAreas = parameters.getMaxNumMeteringAreas();
if (maxNumFocusAreas > 0) {
parameters.setFocusAreas(c2.b(maxNumFocusAreas, aVar));
}
if (maxNumMeteringAreas > 0) {
parameters.setMeteringAreas(c2.b(maxNumMeteringAreas, aVar));
}
parameters.setFocusMode("auto");
b.this.f1475d0.setParameters(parameters);
((CameraView.b) b.this.l).e(this.j, this.k);
b.this.m.e("focus end", 0);
b.this.m.c("focus end", true, 2500, new RunnableC0157a());
try {
b.this.f1475d0.autoFocus(new C0158b());
} catch (RuntimeException e) {
i.i.a(3, "startAutoFocus:", "Error calling autoFocus", e);
}
}
}
}
/* compiled from: Camera1Engine */
/* renamed from: c.o.a.n.b$b reason: collision with other inner class name */
public class RunnableC0160b implements Runnable {
public final /* synthetic */ c.o.a.m.f i;
public RunnableC0160b(c.o.a.m.f fVar) {
this.i = fVar;
}
@Override // java.lang.Runnable
public void run() {
Camera.Parameters parameters = b.this.f1475d0.getParameters();
if (b.this.e1(parameters, this.i)) {
b.this.f1475d0.setParameters(parameters);
}
}
}
/* compiled from: Camera1Engine */
public class c implements Runnable {
public final /* synthetic */ Location i;
public c(Location location) {
this.i = location;
}
@Override // java.lang.Runnable
public void run() {
Camera.Parameters parameters = b.this.f1475d0.getParameters();
b.this.g1(parameters);
b.this.f1475d0.setParameters(parameters);
}
}
/* compiled from: Camera1Engine */
public class d implements Runnable {
public final /* synthetic */ m i;
public d(m mVar) {
this.i = mVar;
}
@Override // java.lang.Runnable
public void run() {
Camera.Parameters parameters = b.this.f1475d0.getParameters();
if (b.this.j1(parameters, this.i)) {
b.this.f1475d0.setParameters(parameters);
}
}
}
/* compiled from: Camera1Engine */
public class e implements Runnable {
public final /* synthetic */ c.o.a.m.h i;
public e(c.o.a.m.h hVar) {
this.i = hVar;
}
@Override // java.lang.Runnable
public void run() {
Camera.Parameters parameters = b.this.f1475d0.getParameters();
if (b.this.f1(parameters, this.i)) {
b.this.f1475d0.setParameters(parameters);
}
}
}
/* compiled from: Camera1Engine */
public class f implements Runnable {
public final /* synthetic */ float i;
public final /* synthetic */ boolean j;
public final /* synthetic */ PointF[] k;
public f(float f, boolean z2, PointF[] pointFArr) {
this.i = f;
this.j = z2;
this.k = pointFArr;
}
@Override // java.lang.Runnable
public void run() {
Camera.Parameters parameters = b.this.f1475d0.getParameters();
if (b.this.k1(parameters, this.i)) {
b.this.f1475d0.setParameters(parameters);
if (this.j) {
b bVar = b.this;
((CameraView.b) bVar.l).f(bVar.C, this.k);
}
}
}
}
/* compiled from: Camera1Engine */
public class g implements Runnable {
public final /* synthetic */ float i;
public final /* synthetic */ boolean j;
public final /* synthetic */ float[] k;
public final /* synthetic */ PointF[] l;
public g(float f, boolean z2, float[] fArr, PointF[] pointFArr) {
this.i = f;
this.j = z2;
this.k = fArr;
this.l = pointFArr;
}
@Override // java.lang.Runnable
public void run() {
Camera.Parameters parameters = b.this.f1475d0.getParameters();
if (b.this.d1(parameters, this.i)) {
b.this.f1475d0.setParameters(parameters);
if (this.j) {
b bVar = b.this;
((CameraView.b) bVar.l).c(bVar.D, this.k, this.l);
}
}
}
}
/* compiled from: Camera1Engine */
public class h implements Runnable {
public final /* synthetic */ boolean i;
public h(boolean z2) {
this.i = z2;
}
@Override // java.lang.Runnable
public void run() {
b.this.h1(this.i);
}
}
/* compiled from: Camera1Engine */
public class i implements Runnable {
public final /* synthetic */ float i;
public i(float f) {
this.i = f;
}
@Override // java.lang.Runnable
public void run() {
Camera.Parameters parameters = b.this.f1475d0.getParameters();
if (b.this.i1(parameters, this.i)) {
b.this.f1475d0.setParameters(parameters);
}
}
}
public b(@NonNull i.g gVar) {
super(gVar);
}
@Override // c.o.a.n.i
public void F0(@NonNull m mVar) {
m mVar2 = this.w;
this.w = mVar;
c.o.a.n.v.f fVar = this.m;
fVar.b("white balance (" + mVar + ")", true, new c.o.a.n.v.h(fVar, c.o.a.n.v.e.ENGINE, new d(mVar2)));
}
@Override // c.o.a.n.i
public void G0(float f2, @Nullable PointF[] pointFArr, boolean z2) {
float f3 = this.C;
this.C = f2;
this.m.e("zoom", 20);
c.o.a.n.v.f fVar = this.m;
fVar.b("zoom", true, new c.o.a.n.v.h(fVar, c.o.a.n.v.e.ENGINE, new f(f3, z2, pointFArr)));
}
@Override // c.o.a.n.i
public void I0(@Nullable c.o.a.q.a aVar, @NonNull c.o.a.t.b bVar, @NonNull PointF pointF) {
c.o.a.n.v.f fVar = this.m;
fVar.b("auto focus", true, new c.o.a.n.v.h(fVar, c.o.a.n.v.e.BIND, new a(bVar, aVar, pointF)));
}
@Override // c.o.a.n.i
@NonNull
public Task<Void> P() {
c.o.a.b bVar = i.i;
bVar.a(1, "onStartBind:", "Started");
try {
if (this.n.j() == SurfaceHolder.class) {
this.f1475d0.setPreviewDisplay((SurfaceHolder) this.n.i());
} else if (this.n.j() == SurfaceTexture.class) {
this.f1475d0.setPreviewTexture((SurfaceTexture) this.n.i());
} else {
throw new RuntimeException("Unknown CameraPreview output class.");
}
this.q = Q0(this.P);
this.r = R0();
bVar.a(1, "onStartBind:", "Returning");
return c.i.a.f.e.o.c.F(null);
} catch (IOException e2) {
i.i.a(3, "onStartBind:", "Failed to bind.", e2);
throw new CameraException(e2, 2);
}
}
@Override // c.o.a.n.i
@NonNull
public Task<c.o.a.c> Q() {
try {
Camera open = Camera.open(this.f1476e0);
this.f1475d0 = open;
if (open != null) {
open.setErrorCallback(this);
c.o.a.b bVar = i.i;
bVar.a(1, "onStartEngine:", "Applying default parameters.");
try {
Camera.Parameters parameters = this.f1475d0.getParameters();
int i2 = this.f1476e0;
c.o.a.n.t.a aVar = this.K;
c.o.a.n.t.b bVar2 = c.o.a.n.t.b.SENSOR;
c.o.a.n.t.b bVar3 = c.o.a.n.t.b.VIEW;
this.o = new c.o.a.n.u.a(parameters, i2, aVar.b(bVar2, bVar3));
b1(parameters);
this.f1475d0.setParameters(parameters);
try {
this.f1475d0.setDisplayOrientation(this.K.c(bVar2, bVar3, 1));
bVar.a(1, "onStartEngine:", "Ended");
return c.i.a.f.e.o.c.F(this.o);
} catch (Exception unused) {
i.i.a(3, "onStartEngine:", "Failed to connect. Can't set display orientation, maybe preview already exists?");
throw new CameraException(1);
}
} catch (Exception e2) {
i.i.a(3, "onStartEngine:", "Failed to connect. Problem with camera params");
throw new CameraException(e2, 1);
}
} else {
i.i.a(3, "onStartEngine:", "Failed to connect. Camera is null, maybe in use by another app or already released?");
throw new CameraException(1);
}
} catch (Exception e3) {
i.i.a(3, "onStartEngine:", "Failed to connect. Maybe in use by another app?");
throw new CameraException(e3, 1);
}
}
@Override // c.o.a.n.i
@NonNull
public Task<Void> R() {
c.o.a.b bVar = i.i;
bVar.a(1, "onStartPreview", "Dispatching onCameraPreviewStreamSizeChanged.");
((CameraView.b) this.l).h();
c.o.a.x.b C = C(c.o.a.n.t.b.VIEW);
if (C != null) {
this.n.s(C.i, C.j);
this.n.r(0);
try {
Camera.Parameters parameters = this.f1475d0.getParameters();
parameters.setPreviewFormat(17);
c.o.a.x.b bVar2 = this.r;
parameters.setPreviewSize(bVar2.i, bVar2.j);
c.o.a.m.i iVar = this.P;
c.o.a.m.i iVar2 = c.o.a.m.i.PICTURE;
if (iVar == iVar2) {
c.o.a.x.b bVar3 = this.q;
parameters.setPictureSize(bVar3.i, bVar3.j);
} else {
c.o.a.x.b Q0 = Q0(iVar2);
parameters.setPictureSize(Q0.i, Q0.j);
}
try {
this.f1475d0.setParameters(parameters);
this.f1475d0.setPreviewCallbackWithBuffer(null);
this.f1475d0.setPreviewCallbackWithBuffer(this);
l1().e(17, this.r, this.K);
bVar.a(1, "onStartPreview", "Starting preview with startPreview().");
try {
this.f1475d0.startPreview();
bVar.a(1, "onStartPreview", "Started preview.");
return c.i.a.f.e.o.c.F(null);
} catch (Exception e2) {
i.i.a(3, "onStartPreview", "Failed to start preview.", e2);
throw new CameraException(e2, 2);
}
} catch (Exception e3) {
i.i.a(3, "onStartPreview:", "Failed to set params for camera. Maybe incorrect parameter put in params?");
throw new CameraException(e3, 2);
}
} catch (Exception e4) {
i.i.a(3, "onStartPreview:", "Failed to get params from camera. Maybe low level problem with camera or camera has already released?");
throw new CameraException(e4, 2);
}
} else {
throw new IllegalStateException("previewStreamSize should not be null at this point.");
}
}
@Override // c.o.a.n.i
@NonNull
public Task<Void> S() {
this.r = null;
this.q = null;
try {
if (this.n.j() == SurfaceHolder.class) {
this.f1475d0.setPreviewDisplay(null);
} else if (this.n.j() == SurfaceTexture.class) {
this.f1475d0.setPreviewTexture(null);
} else {
throw new RuntimeException("Unknown CameraPreview output class.");
}
} catch (IOException e2) {
i.i.a(3, "onStopBind", "Could not release surface", e2);
}
return c.i.a.f.e.o.c.F(null);
}
@Override // c.o.a.n.i
@NonNull
public Task<Void> T() {
c.o.a.b bVar = i.i;
bVar.a(1, "onStopEngine:", "About to clean up.");
this.m.e("focus reset", 0);
this.m.e("focus end", 0);
if (this.f1475d0 != null) {
try {
bVar.a(1, "onStopEngine:", "Clean up.", "Releasing camera.");
this.f1475d0.release();
bVar.a(1, "onStopEngine:", "Clean up.", "Released camera.");
} catch (Exception e2) {
i.i.a(2, "onStopEngine:", "Clean up.", "Exception while releasing camera.", e2);
}
this.f1475d0 = null;
this.o = null;
}
this.o = null;
this.f1475d0 = null;
i.i.a(2, "onStopEngine:", "Clean up.", "Returning.");
return c.i.a.f.e.o.c.F(null);
}
@Override // c.o.a.n.g
@NonNull
public List<c.o.a.x.b> T0() {
try {
List<Camera.Size> supportedPreviewSizes = this.f1475d0.getParameters().getSupportedPreviewSizes();
ArrayList arrayList = new ArrayList(supportedPreviewSizes.size());
for (Camera.Size size : supportedPreviewSizes) {
c.o.a.x.b bVar = new c.o.a.x.b(size.width, size.height);
if (!arrayList.contains(bVar)) {
arrayList.add(bVar);
}
}
i.i.a(1, "getPreviewStreamAvailableSizes:", arrayList);
return arrayList;
} catch (Exception e2) {
i.i.a(3, "getPreviewStreamAvailableSizes:", "Failed to compute preview size. Camera params is empty");
throw new CameraException(e2, 2);
}
}
@Override // c.o.a.n.i
@NonNull
public Task<Void> U() {
c.o.a.b bVar = i.i;
bVar.a(1, "onStopPreview:", "Started.");
this.p = null;
l1().d();
bVar.a(1, "onStopPreview:", "Releasing preview buffers.");
this.f1475d0.setPreviewCallbackWithBuffer(null);
try {
bVar.a(1, "onStopPreview:", "Stopping preview.");
this.f1475d0.stopPreview();
bVar.a(1, "onStopPreview:", "Stopped preview.");
} catch (Exception e2) {
i.i.a(3, "stopPreview", "Could not stop preview", e2);
}
return c.i.a.f.e.o.c.F(null);
}
@Override // c.o.a.n.g
@NonNull
public c.o.a.p.c V0(int i2) {
return new c.o.a.p.a(i2, this);
}
@Override // c.o.a.n.g
public void X0() {
i.i.a(1, "RESTART PREVIEW:", "scheduled. State:", this.m.f);
N0(false);
K0();
}
@Override // c.o.a.n.g
public void Y0(@NonNull l.a aVar, boolean z2) {
c.o.a.b bVar = i.i;
bVar.a(1, "onTakePicture:", "executing.");
c.o.a.n.t.a aVar2 = this.K;
c.o.a.n.t.b bVar2 = c.o.a.n.t.b.SENSOR;
c.o.a.n.t.b bVar3 = c.o.a.n.t.b.OUTPUT;
aVar.f1473c = aVar2.c(bVar2, bVar3, 2);
aVar.d = w(bVar3);
c.o.a.v.a aVar3 = new c.o.a.v.a(aVar, this, this.f1475d0);
this.p = aVar3;
aVar3.c();
bVar.a(1, "onTakePicture:", "executed.");
}
@Override // c.o.a.n.g
public void Z0(@NonNull l.a aVar, @NonNull c.o.a.x.a aVar2, boolean z2) {
c.o.a.b bVar = i.i;
bVar.a(1, "onTakePictureSnapshot:", "executing.");
c.o.a.n.t.b bVar2 = c.o.a.n.t.b.OUTPUT;
aVar.d = F(bVar2);
if (this.n instanceof c.o.a.w.e) {
aVar.f1473c = this.K.c(c.o.a.n.t.b.VIEW, bVar2, 1);
this.p = new c.o.a.v.g(aVar, this, (c.o.a.w.e) this.n, aVar2, this.f1486b0);
} else {
aVar.f1473c = this.K.c(c.o.a.n.t.b.SENSOR, bVar2, 2);
this.p = new c.o.a.v.e(aVar, this, this.f1475d0, aVar2);
}
this.p.c();
bVar.a(1, "onTakePictureSnapshot:", "executed.");
}
public final void b1(@NonNull Camera.Parameters parameters) {
parameters.setRecordingHint(this.P == c.o.a.m.i.VIDEO);
c1(parameters);
e1(parameters, c.o.a.m.f.OFF);
g1(parameters);
j1(parameters, m.AUTO);
f1(parameters, c.o.a.m.h.OFF);
k1(parameters, 0.0f);
d1(parameters, 0.0f);
h1(this.E);
i1(parameters, 0.0f);
}
@Override // c.o.a.n.i
public boolean c(@NonNull c.o.a.m.e eVar) {
Objects.requireNonNull(this.f1474c0);
int intValue = c.o.a.n.q.a.d.get(eVar).intValue();
i.i.a(1, "collectCameraInfo", "Facing:", eVar, "Internal:", Integer.valueOf(intValue), "Cameras:", Integer.valueOf(Camera.getNumberOfCameras()));
Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
int numberOfCameras = Camera.getNumberOfCameras();
for (int i2 = 0; i2 < numberOfCameras; i2++) {
Camera.getCameraInfo(i2, cameraInfo);
if (cameraInfo.facing == intValue) {
this.K.f(eVar, cameraInfo.orientation);
this.f1476e0 = i2;
return true;
}
}
return false;
}
public final void c1(@NonNull Camera.Parameters parameters) {
List<String> supportedFocusModes = parameters.getSupportedFocusModes();
if (this.P == c.o.a.m.i.VIDEO && supportedFocusModes.contains("continuous-video")) {
parameters.setFocusMode("continuous-video");
} else if (supportedFocusModes.contains("continuous-picture")) {
parameters.setFocusMode("continuous-picture");
} else if (supportedFocusModes.contains("infinity")) {
parameters.setFocusMode("infinity");
} else if (supportedFocusModes.contains("fixed")) {
parameters.setFocusMode("fixed");
}
}
@Override // c.o.a.n.i
public void d0(float f2, @NonNull float[] fArr, @Nullable PointF[] pointFArr, boolean z2) {
float f3 = this.D;
this.D = f2;
this.m.e("exposure correction", 20);
c.o.a.n.v.f fVar = this.m;
fVar.b("exposure correction", true, new c.o.a.n.v.h(fVar, c.o.a.n.v.e.ENGINE, new g(f3, z2, fArr, pointFArr)));
}
public final boolean d1(@NonNull Camera.Parameters parameters, float f2) {
c.o.a.c cVar = this.o;
if (cVar.l) {
float f3 = cVar.n;
float f4 = cVar.m;
float f5 = this.D;
if (f5 < f4) {
f3 = f4;
} else if (f5 <= f3) {
f3 = f5;
}
this.D = f3;
parameters.setExposureCompensation((int) (f3 / parameters.getExposureCompensationStep()));
return true;
}
this.D = f2;
return false;
}
public final boolean e1(@NonNull Camera.Parameters parameters, @NonNull c.o.a.m.f fVar) {
if (this.o.c(this.v)) {
c.o.a.n.q.a aVar = this.f1474c0;
c.o.a.m.f fVar2 = this.v;
Objects.requireNonNull(aVar);
parameters.setFlashMode(c.o.a.n.q.a.b.get(fVar2));
return true;
}
this.v = fVar;
return false;
}
@Override // c.o.a.n.i
public void f0(@NonNull c.o.a.m.f fVar) {
c.o.a.m.f fVar2 = this.v;
this.v = fVar;
c.o.a.n.v.f fVar3 = this.m;
fVar3.b("flash (" + fVar + ")", true, new c.o.a.n.v.h(fVar3, c.o.a.n.v.e.ENGINE, new RunnableC0160b(fVar2)));
}
public final boolean f1(@NonNull Camera.Parameters parameters, @NonNull c.o.a.m.h hVar) {
if (this.o.c(this.f1490z)) {
c.o.a.n.q.a aVar = this.f1474c0;
c.o.a.m.h hVar2 = this.f1490z;
Objects.requireNonNull(aVar);
parameters.setSceneMode(c.o.a.n.q.a.e.get(hVar2));
return true;
}
this.f1490z = hVar;
return false;
}
@Override // c.o.a.n.i
public void g0(int i2) {
this.t = 17;
}
public final boolean g1(@NonNull Camera.Parameters parameters) {
Location location = this.B;
if (location == null) {
return true;
}
parameters.setGpsLatitude(location.getLatitude());
parameters.setGpsLongitude(this.B.getLongitude());
parameters.setGpsAltitude(this.B.getAltitude());
parameters.setGpsTimestamp(this.B.getTime());
parameters.setGpsProcessingMethod(this.B.getProvider());
return true;
}
@TargetApi(17)
public final boolean h1(boolean z2) {
Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
Camera.getCameraInfo(this.f1476e0, cameraInfo);
if (cameraInfo.canDisableShutterSound) {
try {
return this.f1475d0.enableShutterSound(this.E);
} catch (RuntimeException unused) {
return false;
}
} else if (this.E) {
return true;
} else {
this.E = z2;
return false;
}
}
public final boolean i1(@NonNull Camera.Parameters parameters, float f2) {
List<int[]> supportedPreviewFpsRange = parameters.getSupportedPreviewFpsRange();
if (!this.I || this.H == 0.0f) {
Collections.sort(supportedPreviewFpsRange, new a(this));
} else {
Collections.sort(supportedPreviewFpsRange, new c(this));
}
float f3 = this.H;
if (f3 == 0.0f) {
for (int[] iArr : supportedPreviewFpsRange) {
float f4 = ((float) iArr[0]) / 1000.0f;
float f5 = ((float) iArr[1]) / 1000.0f;
if ((f4 <= 30.0f && 30.0f <= f5) || (f4 <= 24.0f && 24.0f <= f5)) {
parameters.setPreviewFpsRange(iArr[0], iArr[1]);
return true;
}
}
} else {
float min = Math.min(f3, this.o.q);
this.H = min;
this.H = Math.max(min, this.o.p);
for (int[] iArr2 : supportedPreviewFpsRange) {
float f6 = ((float) iArr2[1]) / 1000.0f;
float round = (float) Math.round(this.H);
if (((float) iArr2[0]) / 1000.0f <= round && round <= f6) {
parameters.setPreviewFpsRange(iArr2[0], iArr2[1]);
return true;
}
}
}
this.H = f2;
return false;
}
public final boolean j1(@NonNull Camera.Parameters parameters, @NonNull m mVar) {
if (this.o.c(this.w)) {
c.o.a.n.q.a aVar = this.f1474c0;
m mVar2 = this.w;
Objects.requireNonNull(aVar);
parameters.setWhiteBalance(c.o.a.n.q.a.f1492c.get(mVar2));
parameters.remove("auto-whitebalance-lock");
return true;
}
this.w = mVar;
return false;
}
@Override // c.o.a.n.i
public void k0(boolean z2) {
this.u = z2;
}
public final boolean k1(@NonNull Camera.Parameters parameters, float f2) {
if (this.o.k) {
parameters.setZoom((int) (this.C * ((float) parameters.getMaxZoom())));
this.f1475d0.setParameters(parameters);
return true;
}
this.C = f2;
return false;
}
@Override // c.o.a.n.i
public void l0(@NonNull c.o.a.m.h hVar) {
c.o.a.m.h hVar2 = this.f1490z;
this.f1490z = hVar;
c.o.a.n.v.f fVar = this.m;
fVar.b("hdr (" + hVar + ")", true, new c.o.a.n.v.h(fVar, c.o.a.n.v.e.ENGINE, new e(hVar2)));
}
@NonNull
public c.o.a.p.a l1() {
return (c.o.a.p.a) S0();
}
@Override // c.o.a.n.i
public void m0(@Nullable Location location) {
Location location2 = this.B;
this.B = location;
c.o.a.n.v.f fVar = this.m;
fVar.b("location", true, new c.o.a.n.v.h(fVar, c.o.a.n.v.e.ENGINE, new c(location2)));
}
public void m1(@NonNull byte[] bArr) {
c.o.a.n.v.e eVar = this.m.f;
c.o.a.n.v.e eVar2 = c.o.a.n.v.e.ENGINE;
if (eVar.f(eVar2) && this.m.g.f(eVar2)) {
this.f1475d0.addCallbackBuffer(bArr);
}
}
@Override // android.hardware.Camera.ErrorCallback
public void onError(int i2, Camera camera) {
int i3 = 0;
RuntimeException runtimeException = new RuntimeException(i.i.a(3, "Internal Camera1 error.", Integer.valueOf(i2)));
if (i2 == 1 || i2 == 2 || i2 == 100) {
i3 = 3;
}
throw new CameraException(runtimeException, i3);
}
@Override // android.hardware.Camera.PreviewCallback
public void onPreviewFrame(byte[] bArr, Camera camera) {
c.o.a.p.b a2;
if (bArr != null && (a2 = l1().a(bArr, System.currentTimeMillis())) != null) {
((CameraView.b) this.l).b(a2);
}
}
@Override // c.o.a.n.i
public void p0(@NonNull j jVar) {
if (jVar == j.JPEG) {
this.A = jVar;
return;
}
throw new UnsupportedOperationException("Unsupported picture format: " + jVar);
}
@Override // c.o.a.n.i
public void t0(boolean z2) {
boolean z3 = this.E;
this.E = z2;
c.o.a.n.v.f fVar = this.m;
fVar.b("play sounds (" + z2 + ")", true, new c.o.a.n.v.h(fVar, c.o.a.n.v.e.ENGINE, new h(z3)));
}
@Override // c.o.a.n.i
public void v0(float f2) {
this.H = f2;
c.o.a.n.v.f fVar = this.m;
fVar.b("preview fps (" + f2 + ")", true, new c.o.a.n.v.h(fVar, c.o.a.n.v.e.ENGINE, new i(f2)));
}
}