472 lines
12 KiB
Java
472 lines
12 KiB
Java
|
package c.o.a.n;
|
||
|
|
||
|
import android.graphics.PointF;
|
||
|
import android.location.Location;
|
||
|
import android.os.Handler;
|
||
|
import android.os.HandlerThread;
|
||
|
import android.os.Looper;
|
||
|
import androidx.annotation.NonNull;
|
||
|
import androidx.annotation.Nullable;
|
||
|
import androidx.annotation.VisibleForTesting;
|
||
|
import c.i.a.f.n.b0;
|
||
|
import c.o.a.l;
|
||
|
import c.o.a.m.j;
|
||
|
import c.o.a.m.l;
|
||
|
import c.o.a.m.m;
|
||
|
import c.o.a.n.v.a;
|
||
|
import c.o.a.v.d;
|
||
|
import c.o.a.w.a;
|
||
|
import com.google.android.gms.tasks.Task;
|
||
|
import java.lang.Thread;
|
||
|
import java.util.HashSet;
|
||
|
import java.util.Iterator;
|
||
|
import java.util.Objects;
|
||
|
import java.util.concurrent.Callable;
|
||
|
import java.util.concurrent.CountDownLatch;
|
||
|
import java.util.concurrent.TimeUnit;
|
||
|
/* compiled from: CameraEngine */
|
||
|
public abstract class i implements a.c, d.a {
|
||
|
public static final c.o.a.b i = new c.o.a.b(i.class.getSimpleName());
|
||
|
public c.o.a.r.g j;
|
||
|
@VisibleForTesting
|
||
|
public Handler k;
|
||
|
public final g l;
|
||
|
public final c.o.a.n.v.f m = new c.o.a.n.v.f(new c());
|
||
|
|
||
|
/* compiled from: CameraEngine */
|
||
|
public class a implements Callable<Task<Void>> {
|
||
|
public a() {
|
||
|
}
|
||
|
|
||
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
||
|
@Override // java.util.concurrent.Callable
|
||
|
public Task<Void> call() throws Exception {
|
||
|
return i.this.R();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* compiled from: CameraEngine */
|
||
|
public class b implements Callable<Task<Void>> {
|
||
|
public b() {
|
||
|
}
|
||
|
|
||
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
||
|
@Override // java.util.concurrent.Callable
|
||
|
public Task<Void> call() throws Exception {
|
||
|
return i.this.U();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* compiled from: CameraEngine */
|
||
|
public class c implements a.b {
|
||
|
public c() {
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* compiled from: CameraEngine */
|
||
|
public class d implements c.i.a.f.n.c<Void> {
|
||
|
public final /* synthetic */ CountDownLatch a;
|
||
|
|
||
|
public d(i iVar, CountDownLatch countDownLatch) {
|
||
|
this.a = countDownLatch;
|
||
|
}
|
||
|
|
||
|
@Override // c.i.a.f.n.c
|
||
|
public void onComplete(@NonNull Task<Void> task) {
|
||
|
this.a.countDown();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* compiled from: CameraEngine */
|
||
|
public class e implements Callable<Task<Void>> {
|
||
|
public e() {
|
||
|
}
|
||
|
|
||
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
||
|
@Override // java.util.concurrent.Callable
|
||
|
public Task<Void> call() throws Exception {
|
||
|
if (i.this.z() != null && i.this.z().m()) {
|
||
|
return i.this.P();
|
||
|
}
|
||
|
b0 b0Var = new b0();
|
||
|
b0Var.u();
|
||
|
return b0Var;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* compiled from: CameraEngine */
|
||
|
public class f implements Callable<Task<Void>> {
|
||
|
public f() {
|
||
|
}
|
||
|
|
||
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
||
|
@Override // java.util.concurrent.Callable
|
||
|
public Task<Void> call() throws Exception {
|
||
|
return i.this.S();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* compiled from: CameraEngine */
|
||
|
public interface g {
|
||
|
}
|
||
|
|
||
|
/* compiled from: CameraEngine */
|
||
|
public class h implements Thread.UncaughtExceptionHandler {
|
||
|
public h(c cVar) {
|
||
|
}
|
||
|
|
||
|
@Override // java.lang.Thread.UncaughtExceptionHandler
|
||
|
public void uncaughtException(@NonNull Thread thread, @NonNull Throwable th) {
|
||
|
i.b(i.this, th, true);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* compiled from: CameraEngine */
|
||
|
/* renamed from: c.o.a.n.i$i reason: collision with other inner class name */
|
||
|
public static class C0163i implements Thread.UncaughtExceptionHandler {
|
||
|
public C0163i(c cVar) {
|
||
|
}
|
||
|
|
||
|
@Override // java.lang.Thread.UncaughtExceptionHandler
|
||
|
public void uncaughtException(@NonNull Thread thread, @NonNull Throwable th) {
|
||
|
i.i.a(2, "EXCEPTION:", "In the NoOpExceptionHandler, probably while destroying.", "Thread:", thread, "Error:", th);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public i(@NonNull g gVar) {
|
||
|
this.l = gVar;
|
||
|
this.k = new Handler(Looper.getMainLooper());
|
||
|
W(false);
|
||
|
}
|
||
|
|
||
|
public static void b(i iVar, Throwable th, boolean z2) {
|
||
|
Objects.requireNonNull(iVar);
|
||
|
if (z2) {
|
||
|
i.a(3, "EXCEPTION:", "Handler thread is gone. Replacing.");
|
||
|
iVar.W(false);
|
||
|
}
|
||
|
i.a(3, "EXCEPTION:", "Scheduling on the crash handler...");
|
||
|
iVar.k.post(new j(iVar, th));
|
||
|
}
|
||
|
|
||
|
public abstract float A();
|
||
|
|
||
|
public abstract void A0(int i2);
|
||
|
|
||
|
public abstract boolean B();
|
||
|
|
||
|
public abstract void B0(@NonNull l lVar);
|
||
|
|
||
|
@Nullable
|
||
|
public abstract c.o.a.x.b C(@NonNull c.o.a.n.t.b bVar);
|
||
|
|
||
|
public abstract void C0(int i2);
|
||
|
|
||
|
public abstract int D();
|
||
|
|
||
|
public abstract void D0(long j);
|
||
|
|
||
|
public abstract int E();
|
||
|
|
||
|
public abstract void E0(@NonNull c.o.a.x.c cVar);
|
||
|
|
||
|
@Nullable
|
||
|
public abstract c.o.a.x.b F(@NonNull c.o.a.n.t.b bVar);
|
||
|
|
||
|
public abstract void F0(@NonNull m mVar);
|
||
|
|
||
|
public abstract int G();
|
||
|
|
||
|
public abstract void G0(float f2, @Nullable PointF[] pointFArr, boolean z2);
|
||
|
|
||
|
@NonNull
|
||
|
public abstract l H();
|
||
|
|
||
|
@NonNull
|
||
|
public Task<Void> H0() {
|
||
|
i.a(1, "START:", "scheduled. State:", this.m.f);
|
||
|
Task<Void> q = this.m.f(c.o.a.n.v.e.OFF, c.o.a.n.v.e.ENGINE, true, new l(this)).q(new k(this));
|
||
|
J0();
|
||
|
K0();
|
||
|
return q;
|
||
|
}
|
||
|
|
||
|
public abstract int I();
|
||
|
|
||
|
public abstract void I0(@Nullable c.o.a.q.a aVar, @NonNull c.o.a.t.b bVar, @NonNull PointF pointF);
|
||
|
|
||
|
public abstract long J();
|
||
|
|
||
|
@NonNull
|
||
|
public final Task<Void> J0() {
|
||
|
return this.m.f(c.o.a.n.v.e.ENGINE, c.o.a.n.v.e.BIND, true, new e());
|
||
|
}
|
||
|
|
||
|
@Nullable
|
||
|
public abstract c.o.a.x.b K(@NonNull c.o.a.n.t.b bVar);
|
||
|
|
||
|
@NonNull
|
||
|
public final Task<Void> K0() {
|
||
|
return this.m.f(c.o.a.n.v.e.BIND, c.o.a.n.v.e.PREVIEW, true, new a());
|
||
|
}
|
||
|
|
||
|
@NonNull
|
||
|
public abstract c.o.a.x.c L();
|
||
|
|
||
|
@NonNull
|
||
|
public Task<Void> L0(boolean z2) {
|
||
|
i.a(1, "STOP:", "scheduled. State:", this.m.f);
|
||
|
N0(z2);
|
||
|
M0(z2);
|
||
|
b0 b0Var = (b0) this.m.f(c.o.a.n.v.e.ENGINE, c.o.a.n.v.e.OFF, !z2, new n(this));
|
||
|
b0Var.g(c.i.a.f.n.g.a, new m(this));
|
||
|
return b0Var;
|
||
|
}
|
||
|
|
||
|
@NonNull
|
||
|
public abstract m M();
|
||
|
|
||
|
@NonNull
|
||
|
public final Task<Void> M0(boolean z2) {
|
||
|
return this.m.f(c.o.a.n.v.e.BIND, c.o.a.n.v.e.ENGINE, !z2, new f());
|
||
|
}
|
||
|
|
||
|
public abstract float N();
|
||
|
|
||
|
@NonNull
|
||
|
public final Task<Void> N0(boolean z2) {
|
||
|
return this.m.f(c.o.a.n.v.e.PREVIEW, c.o.a.n.v.e.BIND, !z2, new b());
|
||
|
}
|
||
|
|
||
|
public final boolean O() {
|
||
|
boolean z2;
|
||
|
c.o.a.n.v.f fVar = this.m;
|
||
|
synchronized (fVar.e) {
|
||
|
Iterator<a.c<?>> it = fVar.f1497c.iterator();
|
||
|
while (true) {
|
||
|
if (!it.hasNext()) {
|
||
|
z2 = false;
|
||
|
break;
|
||
|
}
|
||
|
a.c<?> next = it.next();
|
||
|
if (next.a.contains(" >> ") || next.a.contains(" << ")) {
|
||
|
if (!next.b.a.o()) {
|
||
|
z2 = true;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return z2;
|
||
|
}
|
||
|
|
||
|
public abstract void O0(@NonNull l.a aVar);
|
||
|
|
||
|
@NonNull
|
||
|
public abstract Task<Void> P();
|
||
|
|
||
|
public abstract void P0(@NonNull l.a aVar);
|
||
|
|
||
|
@NonNull
|
||
|
public abstract Task<c.o.a.c> Q();
|
||
|
|
||
|
@NonNull
|
||
|
public abstract Task<Void> R();
|
||
|
|
||
|
@NonNull
|
||
|
public abstract Task<Void> S();
|
||
|
|
||
|
@NonNull
|
||
|
public abstract Task<Void> T();
|
||
|
|
||
|
@NonNull
|
||
|
public abstract Task<Void> U();
|
||
|
|
||
|
public final void V() {
|
||
|
i.a(1, "onSurfaceAvailable:", "Size is", z().l());
|
||
|
J0();
|
||
|
K0();
|
||
|
}
|
||
|
|
||
|
public final void W(boolean z2) {
|
||
|
c.o.a.r.g gVar = this.j;
|
||
|
if (gVar != null) {
|
||
|
HandlerThread handlerThread = gVar.e;
|
||
|
if (handlerThread.isAlive()) {
|
||
|
handlerThread.interrupt();
|
||
|
handlerThread.quit();
|
||
|
}
|
||
|
c.o.a.r.g.b.remove(gVar.d);
|
||
|
}
|
||
|
c.o.a.r.g b2 = c.o.a.r.g.b("CameraViewEngine");
|
||
|
this.j = b2;
|
||
|
b2.e.setUncaughtExceptionHandler(new h(null));
|
||
|
if (z2) {
|
||
|
c.o.a.n.v.f fVar = this.m;
|
||
|
synchronized (fVar.e) {
|
||
|
HashSet hashSet = new HashSet();
|
||
|
Iterator<a.c<?>> it = fVar.f1497c.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
hashSet.add(it.next().a);
|
||
|
}
|
||
|
Iterator it2 = hashSet.iterator();
|
||
|
while (it2.hasNext()) {
|
||
|
fVar.e((String) it2.next(), 0);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void X() {
|
||
|
i.a(1, "RESTART:", "scheduled. State:", this.m.f);
|
||
|
L0(false);
|
||
|
H0();
|
||
|
}
|
||
|
|
||
|
@NonNull
|
||
|
public Task<Void> Y() {
|
||
|
i.a(1, "RESTART BIND:", "scheduled. State:", this.m.f);
|
||
|
N0(false);
|
||
|
M0(false);
|
||
|
J0();
|
||
|
return K0();
|
||
|
}
|
||
|
|
||
|
public abstract void Z(@NonNull c.o.a.m.a aVar);
|
||
|
|
||
|
public abstract void a0(int i2);
|
||
|
|
||
|
public abstract void b0(@NonNull c.o.a.m.b bVar);
|
||
|
|
||
|
public abstract boolean c(@NonNull c.o.a.m.e eVar);
|
||
|
|
||
|
public abstract void c0(long j);
|
||
|
|
||
|
public final void d(boolean z2, int i2) {
|
||
|
c.o.a.b bVar = i;
|
||
|
bVar.a(1, "DESTROY:", "state:", this.m.f, "thread:", Thread.currentThread(), "depth:", Integer.valueOf(i2), "unrecoverably:", Boolean.valueOf(z2));
|
||
|
if (z2) {
|
||
|
this.j.e.setUncaughtExceptionHandler(new C0163i(null));
|
||
|
}
|
||
|
CountDownLatch countDownLatch = new CountDownLatch(1);
|
||
|
L0(true).c(this.j.g, new d(this, countDownLatch));
|
||
|
try {
|
||
|
if (!countDownLatch.await(6, TimeUnit.SECONDS)) {
|
||
|
bVar.a(3, "DESTROY: Could not destroy synchronously after 6 seconds.", "Current thread:", Thread.currentThread(), "Handler thread:", this.j.e);
|
||
|
int i3 = i2 + 1;
|
||
|
if (i3 < 2) {
|
||
|
W(true);
|
||
|
bVar.a(3, "DESTROY: Trying again on thread:", this.j.e);
|
||
|
d(z2, i3);
|
||
|
return;
|
||
|
}
|
||
|
bVar.a(2, "DESTROY: Giving up because DESTROY_RETRIES was reached.");
|
||
|
}
|
||
|
} catch (InterruptedException unused) {
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public abstract void d0(float f2, @NonNull float[] fArr, @Nullable PointF[] pointFArr, boolean z2);
|
||
|
|
||
|
@NonNull
|
||
|
public abstract c.o.a.n.t.a e();
|
||
|
|
||
|
public abstract void e0(@NonNull c.o.a.m.e eVar);
|
||
|
|
||
|
@NonNull
|
||
|
public abstract c.o.a.m.a f();
|
||
|
|
||
|
public abstract void f0(@NonNull c.o.a.m.f fVar);
|
||
|
|
||
|
public abstract int g();
|
||
|
|
||
|
public abstract void g0(int i2);
|
||
|
|
||
|
@NonNull
|
||
|
public abstract c.o.a.m.b h();
|
||
|
|
||
|
public abstract void h0(int i2);
|
||
|
|
||
|
public abstract long i();
|
||
|
|
||
|
public abstract void i0(int i2);
|
||
|
|
||
|
@Nullable
|
||
|
public abstract c.o.a.c j();
|
||
|
|
||
|
public abstract void j0(int i2);
|
||
|
|
||
|
public abstract float k();
|
||
|
|
||
|
public abstract void k0(boolean z2);
|
||
|
|
||
|
@NonNull
|
||
|
public abstract c.o.a.m.e l();
|
||
|
|
||
|
public abstract void l0(@NonNull c.o.a.m.h hVar);
|
||
|
|
||
|
@NonNull
|
||
|
public abstract c.o.a.m.f m();
|
||
|
|
||
|
public abstract void m0(@Nullable Location location);
|
||
|
|
||
|
public abstract int n();
|
||
|
|
||
|
public abstract void n0(@NonNull c.o.a.m.i iVar);
|
||
|
|
||
|
public abstract int o();
|
||
|
|
||
|
public abstract void o0(@Nullable c.o.a.u.a aVar);
|
||
|
|
||
|
public abstract int p();
|
||
|
|
||
|
public abstract void p0(@NonNull j jVar);
|
||
|
|
||
|
public abstract int q();
|
||
|
|
||
|
public abstract void q0(boolean z2);
|
||
|
|
||
|
@NonNull
|
||
|
public abstract c.o.a.m.h r();
|
||
|
|
||
|
public abstract void r0(@NonNull c.o.a.x.c cVar);
|
||
|
|
||
|
@Nullable
|
||
|
public abstract Location s();
|
||
|
|
||
|
public abstract void s0(boolean z2);
|
||
|
|
||
|
@NonNull
|
||
|
public abstract c.o.a.m.i t();
|
||
|
|
||
|
public abstract void t0(boolean z2);
|
||
|
|
||
|
@NonNull
|
||
|
public abstract j u();
|
||
|
|
||
|
public abstract void u0(@NonNull c.o.a.w.a aVar);
|
||
|
|
||
|
public abstract boolean v();
|
||
|
|
||
|
public abstract void v0(float f2);
|
||
|
|
||
|
@Nullable
|
||
|
public abstract c.o.a.x.b w(@NonNull c.o.a.n.t.b bVar);
|
||
|
|
||
|
public abstract void w0(boolean z2);
|
||
|
|
||
|
@NonNull
|
||
|
public abstract c.o.a.x.c x();
|
||
|
|
||
|
public abstract void x0(@Nullable c.o.a.x.c cVar);
|
||
|
|
||
|
public abstract boolean y();
|
||
|
|
||
|
public abstract void y0(int i2);
|
||
|
|
||
|
@Nullable
|
||
|
public abstract c.o.a.w.a z();
|
||
|
|
||
|
public abstract void z0(int i2);
|
||
|
}
|