132 lines
4.6 KiB
Java
132 lines
4.6 KiB
Java
package c.o.a.v;
|
|
|
|
import android.hardware.camera2.CameraAccessException;
|
|
import android.hardware.camera2.CaptureRequest;
|
|
import android.hardware.camera2.CaptureResult;
|
|
import android.hardware.camera2.TotalCaptureResult;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.RequiresApi;
|
|
import c.o.a.l;
|
|
import c.o.a.n.d;
|
|
import c.o.a.n.o.e;
|
|
import c.o.a.n.o.h;
|
|
import c.o.a.n.o.i;
|
|
import java.util.Arrays;
|
|
/* compiled from: Snapshot2PictureRecorder */
|
|
@RequiresApi(21)
|
|
public class f extends g {
|
|
|
|
/* renamed from: s reason: collision with root package name */
|
|
public final c.o.a.n.o.a f1508s;
|
|
public final c.o.a.n.o.c t;
|
|
public final boolean u;
|
|
public Integer v;
|
|
public Integer w;
|
|
|
|
/* compiled from: Snapshot2PictureRecorder */
|
|
public class a extends c.o.a.n.o.f {
|
|
public a() {
|
|
}
|
|
|
|
@Override // c.o.a.n.o.f
|
|
public void b(@NonNull c.o.a.n.o.a aVar) {
|
|
i.l.a(1, "Taking picture with super.take().");
|
|
f.d(f.this);
|
|
}
|
|
}
|
|
|
|
/* compiled from: Snapshot2PictureRecorder */
|
|
public class b extends e {
|
|
public b(f fVar, a aVar) {
|
|
}
|
|
|
|
@Override // c.o.a.n.o.e, c.o.a.n.o.a
|
|
public void b(@NonNull c.o.a.n.o.c cVar, @NonNull CaptureRequest captureRequest, @NonNull TotalCaptureResult totalCaptureResult) {
|
|
Integer num = (Integer) totalCaptureResult.get(CaptureResult.FLASH_STATE);
|
|
if (num == null) {
|
|
i.l.a(2, "FlashAction:", "Waiting flash, but flashState is null!", "Taking snapshot.");
|
|
l(Integer.MAX_VALUE);
|
|
} else if (num.intValue() == 3) {
|
|
i.l.a(1, "FlashAction:", "Waiting flash and we have FIRED state!", "Taking snapshot.");
|
|
l(Integer.MAX_VALUE);
|
|
} else {
|
|
i.l.a(1, "FlashAction:", "Waiting flash but flashState is", num, ". Waiting...");
|
|
}
|
|
}
|
|
|
|
@Override // c.o.a.n.o.e
|
|
public void j(@NonNull c.o.a.n.o.c cVar) {
|
|
this.f1491c = cVar;
|
|
i.l.a(1, "FlashAction:", "Parameters locked, opening torch.");
|
|
((d) cVar).f1482h0.set(CaptureRequest.FLASH_MODE, 2);
|
|
d dVar = (d) cVar;
|
|
dVar.f1482h0.set(CaptureRequest.CONTROL_AE_MODE, 1);
|
|
dVar.k1();
|
|
}
|
|
}
|
|
|
|
/* compiled from: Snapshot2PictureRecorder */
|
|
public class c extends e {
|
|
public c(a aVar) {
|
|
}
|
|
|
|
@Override // c.o.a.n.o.e
|
|
public void j(@NonNull c.o.a.n.o.c cVar) {
|
|
this.f1491c = cVar;
|
|
try {
|
|
i.l.a(1, "ResetFlashAction:", "Reverting the flash changes.");
|
|
CaptureRequest.Builder builder = ((d) cVar).f1482h0;
|
|
builder.set(CaptureRequest.CONTROL_AE_MODE, 1);
|
|
builder.set(CaptureRequest.FLASH_MODE, 0);
|
|
((d) cVar).e1(this, builder);
|
|
builder.set(CaptureRequest.CONTROL_AE_MODE, f.this.v);
|
|
builder.set(CaptureRequest.FLASH_MODE, f.this.w);
|
|
((d) cVar).k1();
|
|
} catch (CameraAccessException unused) {
|
|
}
|
|
}
|
|
}
|
|
|
|
public f(@NonNull l.a aVar, @NonNull d dVar, @NonNull c.o.a.w.e eVar, @NonNull c.o.a.x.a aVar2) {
|
|
super(aVar, dVar, eVar, aVar2, dVar.f1486b0);
|
|
this.t = dVar;
|
|
boolean z2 = false;
|
|
Integer num = null;
|
|
h hVar = new h(Arrays.asList(new i(2500, new c.o.a.n.p.d()), new b(this, null)));
|
|
this.f1508s = hVar;
|
|
hVar.f(new a());
|
|
TotalCaptureResult totalCaptureResult = dVar.f1483i0;
|
|
if (totalCaptureResult == null) {
|
|
i.l.a(2, "Picture snapshot requested very early, before the first preview frame.", "Metering might not work as intended.");
|
|
}
|
|
num = totalCaptureResult != null ? (Integer) totalCaptureResult.get(CaptureResult.CONTROL_AE_STATE) : num;
|
|
if (dVar.G && num != null && num.intValue() == 4) {
|
|
z2 = true;
|
|
}
|
|
this.u = z2;
|
|
this.v = (Integer) dVar.f1482h0.get(CaptureRequest.CONTROL_AE_MODE);
|
|
this.w = (Integer) dVar.f1482h0.get(CaptureRequest.FLASH_MODE);
|
|
}
|
|
|
|
public static /* synthetic */ void d(f fVar) {
|
|
super.c();
|
|
}
|
|
|
|
@Override // c.o.a.v.g, c.o.a.v.d
|
|
public void b() {
|
|
new c(null).e(this.t);
|
|
super.b();
|
|
}
|
|
|
|
@Override // c.o.a.v.g, c.o.a.v.d
|
|
public void c() {
|
|
if (!this.u) {
|
|
i.l.a(1, "take:", "Engine does no metering or needs no flash.", "Taking fast snapshot.");
|
|
super.c();
|
|
return;
|
|
}
|
|
i.l.a(1, "take:", "Engine needs flash. Starting action");
|
|
this.f1508s.e(this.t);
|
|
}
|
|
}
|