package o; import android.content.Context; import android.hardware.Camera; import android.os.Build; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; import org.bouncycastle.crypto.tls.CipherSuite; /* renamed from: o.eTk, reason: case insensitive filesystem */ /* loaded from: classes3.dex */ public final class C10943eTk { OVZ b; Camera c; tuL d; Camera.CameraInfo e; VDF f; Context g; boolean h; VDF i; public OTQ j; private String n; public Xad l = new Xad(); int k = -1; final HBt a = new HBt(this); /* renamed from: o.eTk$HBt */ /* loaded from: classes3.dex */ final class HBt implements Camera.PreviewCallback { InterfaceC17149uMa a; private C10943eTk d; VDF e; public HBt(C10943eTk c10943eTk) { this.d = c10943eTk; } @Override // android.hardware.Camera.PreviewCallback public final void onPreviewFrame(byte[] bArr, Camera camera) { VDF vdf = this.e; InterfaceC17149uMa interfaceC17149uMa = this.a; if (vdf == null || interfaceC17149uMa == null) { if (interfaceC17149uMa != null) { interfaceC17149uMa.c(); return; } return; } try { if (bArr == null) { throw new NullPointerException("No preview data received"); } GuZ guZ = new GuZ(bArr, vdf.c, vdf.b, camera.getParameters().getPreviewFormat(), this.d.k); if (this.d.e.facing == 1) { guZ.b = true; } interfaceC17149uMa.b(guZ); } catch (RuntimeException unused) { interfaceC17149uMa.c(); } } } public C10943eTk(Context context) { this.g = context; } public final boolean a() { int i = this.k; if (i != -1) { return i % CipherSuite.TLS_DHE_PSK_WITH_NULL_SHA256 != 0; } throw new IllegalStateException("Rotation not calculated yet. Call configure() first."); } /* JADX INFO: Access modifiers changed from: package-private */ public final void d(boolean z) { Camera.Parameters parameters = this.c.getParameters(); String str = this.n; if (str == null) { this.n = parameters.flatten(); } else { parameters.unflatten(str); } if (parameters == null) { return; } parameters.flatten(); Jmf.Ot_(parameters, this.l.a, z); if (!z) { Jmf.Ou_(parameters, false); boolean z2 = this.l.f; boolean z3 = this.l.e; boolean z4 = this.l.j; } List supportedPreviewSizes = parameters.getSupportedPreviewSizes(); ArrayList arrayList = new ArrayList(); if (supportedPreviewSizes == null) { Camera.Size previewSize = parameters.getPreviewSize(); if (previewSize != null) { new VDF(previewSize.width, previewSize.height); arrayList.add(new VDF(previewSize.width, previewSize.height)); } } else { for (Camera.Size size : supportedPreviewSizes) { arrayList.add(new VDF(size.width, size.height)); } } VDF vdf = null; if (arrayList.size() == 0) { this.f = null; } else { OTQ otq = this.j; boolean a = a(); VDF vdf2 = otq.c; if (vdf2 != null) { vdf = a ? new VDF(vdf2.b, vdf2.c) : vdf2; } OtF otF = otq.b; if (vdf != null) { Collections.sort(arrayList, new Comparator(otF, vdf) { // from class: o.OtF.4 private VDF b; private OtF d; public AnonymousClass4(OtF otF2, VDF vdf3) { this.d = otF2; this.b = vdf3; } @Override // java.util.Comparator public final /* synthetic */ int compare(VDF vdf3, VDF vdf4) { return Float.compare(this.d.a(vdf4, this.b), this.d.a(vdf3, this.b)); } }); } VDF vdf3 = (VDF) arrayList.get(0); this.f = vdf3; parameters.setPreviewSize(vdf3.c, this.f.b); } if (Build.DEVICE.equals("glass-1")) { Jmf.Os_(parameters); } parameters.flatten(); this.c.setParameters(parameters); } public final void b(boolean z) { if (this.c != null) { try { if (z != d()) { OVZ ovz = this.b; if (ovz != null) { ovz.c(); } Camera.Parameters parameters = this.c.getParameters(); Jmf.Ou_(parameters, z); boolean z2 = this.l.c; this.c.setParameters(parameters); OVZ ovz2 = this.b; if (ovz2 != null) { ovz2.b(); } } } catch (RuntimeException unused) { } } } private boolean d() { String flashMode; Camera.Parameters parameters = this.c.getParameters(); if (parameters == null || (flashMode = parameters.getFlashMode()) == null) { return false; } return "on".equals(flashMode) || "torch".equals(flashMode); } }