667 lines
16 KiB
Java
667 lines
16 KiB
Java
package c.o.a.n;
|
|
|
|
import android.location.Location;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.Nullable;
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
import c.o.a.l;
|
|
import c.o.a.m.e;
|
|
import c.o.a.m.f;
|
|
import c.o.a.m.h;
|
|
import c.o.a.m.i;
|
|
import c.o.a.m.j;
|
|
import c.o.a.m.l;
|
|
import c.o.a.m.m;
|
|
import c.o.a.n.i;
|
|
import com.otaliastudios.cameraview.CameraException;
|
|
import com.otaliastudios.cameraview.CameraView;
|
|
import java.util.ArrayList;
|
|
import java.util.Collections;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Set;
|
|
/* compiled from: CameraBaseEngine */
|
|
public abstract class g extends i {
|
|
public j A;
|
|
public Location B;
|
|
public float C;
|
|
public float D;
|
|
public boolean E;
|
|
public boolean F;
|
|
public boolean G;
|
|
public float H;
|
|
public boolean I;
|
|
public c.o.a.p.c J;
|
|
public final c.o.a.n.t.a K = new c.o.a.n.t.a();
|
|
@Nullable
|
|
public c.o.a.x.c L;
|
|
public c.o.a.x.c M;
|
|
public c.o.a.x.c N;
|
|
public e O;
|
|
public i P;
|
|
public c.o.a.m.a Q;
|
|
public long R;
|
|
public int S;
|
|
public int T;
|
|
public int U;
|
|
public long V;
|
|
public int W;
|
|
public int X;
|
|
public int Y;
|
|
public int Z;
|
|
|
|
/* renamed from: a0 reason: collision with root package name */
|
|
public int f1518a0;
|
|
|
|
/* renamed from: b0 reason: collision with root package name */
|
|
public c.o.a.u.a f1519b0;
|
|
public c.o.a.w.a n;
|
|
public c.o.a.c o;
|
|
public c.o.a.v.d p;
|
|
public c.o.a.x.b q;
|
|
public c.o.a.x.b r;
|
|
|
|
/* renamed from: s reason: collision with root package name */
|
|
public c.o.a.x.b f1520s;
|
|
public int t;
|
|
public boolean u;
|
|
public f v;
|
|
public m w;
|
|
|
|
/* renamed from: x reason: collision with root package name */
|
|
public l f1521x;
|
|
|
|
/* renamed from: y reason: collision with root package name */
|
|
public c.o.a.m.b f1522y;
|
|
|
|
/* renamed from: z reason: collision with root package name */
|
|
public h f1523z;
|
|
|
|
/* compiled from: CameraBaseEngine */
|
|
public class a implements Runnable {
|
|
public final /* synthetic */ e i;
|
|
public final /* synthetic */ e j;
|
|
|
|
public a(e eVar, e eVar2) {
|
|
this.i = eVar;
|
|
this.j = eVar2;
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
if (g.this.c(this.i)) {
|
|
g.this.X();
|
|
return;
|
|
}
|
|
g.this.O = this.j;
|
|
}
|
|
}
|
|
|
|
/* compiled from: CameraBaseEngine */
|
|
public class b implements Runnable {
|
|
public b() {
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
g.this.X();
|
|
}
|
|
}
|
|
|
|
/* compiled from: CameraBaseEngine */
|
|
public class c implements Runnable {
|
|
public final /* synthetic */ l.a i;
|
|
public final /* synthetic */ boolean j;
|
|
|
|
public c(l.a aVar, boolean z2) {
|
|
this.i = aVar;
|
|
this.j = z2;
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
i.i.a(1, "takePicture:", "running. isTakingPicture:", Boolean.valueOf(g.this.W0()));
|
|
if (!g.this.W0()) {
|
|
g gVar = g.this;
|
|
if (gVar.P != i.VIDEO) {
|
|
l.a aVar = this.i;
|
|
aVar.a = false;
|
|
aVar.b = gVar.B;
|
|
aVar.e = gVar.O;
|
|
aVar.g = gVar.A;
|
|
gVar.Y0(aVar, this.j);
|
|
return;
|
|
}
|
|
throw new IllegalStateException("Can't take hq pictures while in VIDEO mode");
|
|
}
|
|
}
|
|
}
|
|
|
|
/* compiled from: CameraBaseEngine */
|
|
public class d implements Runnable {
|
|
public final /* synthetic */ l.a i;
|
|
public final /* synthetic */ boolean j;
|
|
|
|
public d(l.a aVar, boolean z2) {
|
|
this.i = aVar;
|
|
this.j = z2;
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
i.i.a(1, "takePictureSnapshot:", "running. isTakingPicture:", Boolean.valueOf(g.this.W0()));
|
|
if (!g.this.W0()) {
|
|
l.a aVar = this.i;
|
|
g gVar = g.this;
|
|
aVar.b = gVar.B;
|
|
aVar.a = true;
|
|
aVar.e = gVar.O;
|
|
aVar.g = j.JPEG;
|
|
g.this.Z0(this.i, c.o.a.x.a.g(gVar.U0(c.o.a.n.t.b.OUTPUT)), this.j);
|
|
}
|
|
}
|
|
}
|
|
|
|
public g(@NonNull i.g gVar) {
|
|
super(gVar);
|
|
c.i.a.f.e.o.f.R(null);
|
|
c.i.a.f.e.o.f.R(null);
|
|
c.i.a.f.e.o.f.R(null);
|
|
c.i.a.f.e.o.f.R(null);
|
|
c.i.a.f.e.o.f.R(null);
|
|
c.i.a.f.e.o.f.R(null);
|
|
c.i.a.f.e.o.f.R(null);
|
|
c.i.a.f.e.o.f.R(null);
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final float A() {
|
|
return this.H;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final void A0(int i) {
|
|
this.T = i;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final boolean B() {
|
|
return this.I;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final void B0(@NonNull c.o.a.m.l lVar) {
|
|
this.f1521x = lVar;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
@Nullable
|
|
public final c.o.a.x.b C(@NonNull c.o.a.n.t.b bVar) {
|
|
c.o.a.x.b bVar2 = this.r;
|
|
if (bVar2 == null) {
|
|
return null;
|
|
}
|
|
return this.K.b(c.o.a.n.t.b.SENSOR, bVar) ? bVar2.f() : bVar2;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final void C0(int i) {
|
|
this.S = i;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final int D() {
|
|
return this.X;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final void D0(long j) {
|
|
this.R = j;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final int E() {
|
|
return this.W;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final void E0(@NonNull c.o.a.x.c cVar) {
|
|
this.N = cVar;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
@Nullable
|
|
public final c.o.a.x.b F(@NonNull c.o.a.n.t.b bVar) {
|
|
c.o.a.x.b C = C(bVar);
|
|
if (C == null) {
|
|
return null;
|
|
}
|
|
boolean b2 = this.K.b(bVar, c.o.a.n.t.b.VIEW);
|
|
int i = b2 ? this.X : this.W;
|
|
int i2 = b2 ? this.W : this.X;
|
|
if (i <= 0) {
|
|
i = Integer.MAX_VALUE;
|
|
}
|
|
if (i2 <= 0) {
|
|
i2 = Integer.MAX_VALUE;
|
|
}
|
|
HashMap<String, c.o.a.x.a> hashMap = c.o.a.x.a.i;
|
|
float i3 = c.o.a.x.a.f(C.i, C.j).i();
|
|
if (c.o.a.x.a.f(i, i2).i() >= i3) {
|
|
int min = Math.min(C.j, i2);
|
|
return new c.o.a.x.b((int) Math.floor((double) (((float) min) * i3)), min);
|
|
}
|
|
int min2 = Math.min(C.i, i);
|
|
return new c.o.a.x.b(min2, (int) Math.floor((double) (((float) min2) / i3)));
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final int G() {
|
|
return this.T;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
@NonNull
|
|
public final c.o.a.m.l H() {
|
|
return this.f1521x;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final int I() {
|
|
return this.S;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final long J() {
|
|
return this.R;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
@Nullable
|
|
public final c.o.a.x.b K(@NonNull c.o.a.n.t.b bVar) {
|
|
c.o.a.x.b bVar2 = this.q;
|
|
if (bVar2 == null || this.P == c.o.a.m.i.PICTURE) {
|
|
return null;
|
|
}
|
|
return this.K.b(c.o.a.n.t.b.SENSOR, bVar) ? bVar2.f() : bVar2;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
@NonNull
|
|
public final c.o.a.x.c L() {
|
|
return this.N;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
@NonNull
|
|
public final m M() {
|
|
return this.w;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final float N() {
|
|
return this.C;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public void O0(@NonNull l.a aVar) {
|
|
boolean z2 = this.F;
|
|
c.o.a.n.v.f fVar = this.m;
|
|
fVar.b("take picture", true, new c.o.a.n.v.h(fVar, c.o.a.n.v.e.BIND, new c(aVar, z2)));
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public void P0(@NonNull l.a aVar) {
|
|
boolean z2 = this.G;
|
|
c.o.a.n.v.f fVar = this.m;
|
|
fVar.b("take picture snapshot", true, new c.o.a.n.v.h(fVar, c.o.a.n.v.e.BIND, new d(aVar, z2)));
|
|
}
|
|
|
|
@NonNull
|
|
public final c.o.a.x.b Q0(@NonNull c.o.a.m.i iVar) {
|
|
Set set;
|
|
c.o.a.x.c cVar;
|
|
boolean b2 = this.K.b(c.o.a.n.t.b.SENSOR, c.o.a.n.t.b.VIEW);
|
|
if (iVar == c.o.a.m.i.PICTURE) {
|
|
cVar = this.M;
|
|
set = Collections.unmodifiableSet(this.o.e);
|
|
} else {
|
|
cVar = this.N;
|
|
set = Collections.unmodifiableSet(this.o.f);
|
|
}
|
|
c.o.a.x.c G0 = c.i.a.f.e.o.f.G0(cVar, new c.o.a.x.e());
|
|
ArrayList arrayList = new ArrayList(set);
|
|
c.o.a.x.b bVar = ((c.o.a.x.l) G0).a(arrayList).get(0);
|
|
if (arrayList.contains(bVar)) {
|
|
i.i.a(1, "computeCaptureSize:", "result:", bVar, "flip:", Boolean.valueOf(b2), "mode:", iVar);
|
|
return b2 ? bVar.f() : bVar;
|
|
}
|
|
throw new RuntimeException("SizeSelectors must not return Sizes other than those in the input list.");
|
|
}
|
|
|
|
@NonNull
|
|
public final c.o.a.x.b R0() {
|
|
c.o.a.n.t.b bVar = c.o.a.n.t.b.VIEW;
|
|
List<c.o.a.x.b> T0 = T0();
|
|
boolean b2 = this.K.b(c.o.a.n.t.b.SENSOR, bVar);
|
|
ArrayList arrayList = new ArrayList(T0.size());
|
|
for (c.o.a.x.b bVar2 : T0) {
|
|
if (b2) {
|
|
bVar2 = bVar2.f();
|
|
}
|
|
arrayList.add(bVar2);
|
|
}
|
|
c.o.a.x.b U0 = U0(bVar);
|
|
if (U0 != null) {
|
|
c.o.a.x.b bVar3 = this.q;
|
|
c.o.a.x.a f = c.o.a.x.a.f(bVar3.i, bVar3.j);
|
|
if (b2) {
|
|
f = c.o.a.x.a.f(f.k, f.j);
|
|
}
|
|
c.o.a.b bVar4 = i.i;
|
|
bVar4.a(1, "computePreviewStreamSize:", "targetRatio:", f, "targetMinSize:", U0);
|
|
c.o.a.x.c d2 = c.i.a.f.e.o.f.d(c.i.a.f.e.o.f.l1(new c.o.a.x.d(f.i(), 0.0f)), new c.o.a.x.e());
|
|
c.o.a.x.c d3 = c.i.a.f.e.o.f.d(c.i.a.f.e.o.f.C0(U0.j), c.i.a.f.e.o.f.D0(U0.i), new c.o.a.x.f());
|
|
c.o.a.x.c G0 = c.i.a.f.e.o.f.G0(c.i.a.f.e.o.f.d(d2, d3), d3, d2, new c.o.a.x.e());
|
|
c.o.a.x.c cVar = this.L;
|
|
if (cVar != null) {
|
|
G0 = c.i.a.f.e.o.f.G0(cVar, G0);
|
|
}
|
|
c.o.a.x.b bVar5 = ((c.o.a.x.l) G0).a(arrayList).get(0);
|
|
if (arrayList.contains(bVar5)) {
|
|
if (b2) {
|
|
bVar5 = bVar5.f();
|
|
}
|
|
bVar4.a(1, "computePreviewStreamSize:", "result:", bVar5, "flip:", Boolean.valueOf(b2));
|
|
return bVar5;
|
|
}
|
|
throw new RuntimeException("SizeSelectors must not return Sizes other than those in the input list.");
|
|
}
|
|
throw new IllegalStateException("targetMinSize should not be null here.");
|
|
}
|
|
|
|
@NonNull
|
|
public c.o.a.p.c S0() {
|
|
if (this.J == null) {
|
|
this.J = V0(this.f1518a0);
|
|
}
|
|
return this.J;
|
|
}
|
|
|
|
@NonNull
|
|
public abstract List<c.o.a.x.b> T0();
|
|
|
|
@Nullable
|
|
public final c.o.a.x.b U0(@NonNull c.o.a.n.t.b bVar) {
|
|
c.o.a.w.a aVar = this.n;
|
|
if (aVar == null) {
|
|
return null;
|
|
}
|
|
return this.K.b(c.o.a.n.t.b.VIEW, bVar) ? aVar.l().f() : aVar.l();
|
|
}
|
|
|
|
@NonNull
|
|
public abstract c.o.a.p.c V0(int i);
|
|
|
|
public final boolean W0() {
|
|
return this.p != null;
|
|
}
|
|
|
|
public abstract void X0();
|
|
|
|
public abstract void Y0(@NonNull l.a aVar, boolean z2);
|
|
|
|
@Override // c.o.a.n.i
|
|
public final void Z(@NonNull c.o.a.m.a aVar) {
|
|
if (this.Q != aVar) {
|
|
this.Q = aVar;
|
|
}
|
|
}
|
|
|
|
public abstract void Z0(@NonNull l.a aVar, @NonNull c.o.a.x.a aVar2, boolean z2);
|
|
|
|
@Override // c.o.a.v.d.a
|
|
public void a(@Nullable l.a aVar, @Nullable Exception exc) {
|
|
this.p = null;
|
|
if (aVar != null) {
|
|
CameraView.b bVar = (CameraView.b) this.l;
|
|
bVar.b.a(1, "dispatchOnPictureTaken", aVar);
|
|
CameraView.this.f2502s.post(new c.o.a.i(bVar, aVar));
|
|
return;
|
|
}
|
|
i.i.a(3, "onPictureResult", "result is null: something went wrong.", exc);
|
|
((CameraView.b) this.l).a(new CameraException(exc, 4));
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final void a0(int i) {
|
|
this.U = i;
|
|
}
|
|
|
|
public final boolean a1() {
|
|
long j = this.V;
|
|
return j > 0 && j != RecyclerView.FOREVER_NS;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final void b0(@NonNull c.o.a.m.b bVar) {
|
|
this.f1522y = bVar;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final void c0(long j) {
|
|
this.V = j;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
@NonNull
|
|
public final c.o.a.n.t.a e() {
|
|
return this.K;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final void e0(@NonNull e eVar) {
|
|
e eVar2 = this.O;
|
|
if (eVar != eVar2) {
|
|
this.O = eVar;
|
|
c.o.a.n.v.f fVar = this.m;
|
|
fVar.b("facing", true, new c.o.a.n.v.h(fVar, c.o.a.n.v.e.ENGINE, new a(eVar, eVar2)));
|
|
}
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
@NonNull
|
|
public final c.o.a.m.a f() {
|
|
return this.Q;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final int g() {
|
|
return this.U;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
@NonNull
|
|
public final c.o.a.m.b h() {
|
|
return this.f1522y;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final void h0(int i) {
|
|
this.Z = i;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final long i() {
|
|
return this.V;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final void i0(int i) {
|
|
this.Y = i;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
@Nullable
|
|
public final c.o.a.c j() {
|
|
return this.o;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final void j0(int i) {
|
|
this.f1518a0 = i;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final float k() {
|
|
return this.D;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
@NonNull
|
|
public final e l() {
|
|
return this.O;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
@NonNull
|
|
public final f m() {
|
|
return this.v;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final int n() {
|
|
return this.t;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final void n0(@NonNull c.o.a.m.i iVar) {
|
|
if (iVar != this.P) {
|
|
this.P = iVar;
|
|
c.o.a.n.v.f fVar = this.m;
|
|
fVar.b("mode", true, new c.o.a.n.v.h(fVar, c.o.a.n.v.e.ENGINE, new b()));
|
|
}
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final int o() {
|
|
return this.Z;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final void o0(@Nullable c.o.a.u.a aVar) {
|
|
this.f1519b0 = aVar;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final int p() {
|
|
return this.Y;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final int q() {
|
|
return this.f1518a0;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final void q0(boolean z2) {
|
|
this.F = z2;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
@NonNull
|
|
public final h r() {
|
|
return this.f1523z;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final void r0(@NonNull c.o.a.x.c cVar) {
|
|
this.M = cVar;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
@Nullable
|
|
public final Location s() {
|
|
return this.B;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final void s0(boolean z2) {
|
|
this.G = z2;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
@NonNull
|
|
public final c.o.a.m.i t() {
|
|
return this.P;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
@NonNull
|
|
public final j u() {
|
|
return this.A;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final void u0(@NonNull c.o.a.w.a aVar) {
|
|
c.o.a.w.a aVar2 = this.n;
|
|
if (aVar2 != null) {
|
|
aVar2.t(null);
|
|
}
|
|
this.n = aVar;
|
|
aVar.t(this);
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final boolean v() {
|
|
return this.F;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
@Nullable
|
|
public final c.o.a.x.b w(@NonNull c.o.a.n.t.b bVar) {
|
|
c.o.a.x.b bVar2 = this.q;
|
|
if (bVar2 == null || this.P == c.o.a.m.i.VIDEO) {
|
|
return null;
|
|
}
|
|
return this.K.b(c.o.a.n.t.b.SENSOR, bVar) ? bVar2.f() : bVar2;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final void w0(boolean z2) {
|
|
this.I = z2;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
@NonNull
|
|
public final c.o.a.x.c x() {
|
|
return this.M;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final void x0(@Nullable c.o.a.x.c cVar) {
|
|
this.L = cVar;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final boolean y() {
|
|
return this.G;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final void y0(int i) {
|
|
this.X = i;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
@NonNull
|
|
public final c.o.a.w.a z() {
|
|
return this.n;
|
|
}
|
|
|
|
@Override // c.o.a.n.i
|
|
public final void z0(int i) {
|
|
this.W = i;
|
|
}
|
|
}
|