what-the-bank/sources/o/C13120fRb.java

344 lines
12 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package o;
import android.content.Context;
import android.graphics.ImageFormat;
import android.hardware.Camera;
import android.os.SystemClock;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.firebase.ml.vision.common.FirebaseVisionImage;
import com.google.firebase.ml.vision.common.FirebaseVisionImageMetadata;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.lang.Thread;
import java.nio.ByteBuffer;
import java.util.HashMap;
import java.util.Map;
/* renamed from: o.fRb, reason: case insensitive filesystem */
/* loaded from: classes5.dex */
public final class C13120fRb {
public Camera a;
Context b;
int c;
public final Object d;
public int e;
public fQN f;
float g;
int h;
int i;
public String j;
Thread k;
Map<byte[], ByteBuffer> l;
public String n;
/* renamed from: o, reason: collision with root package name */
public Sts f9108o;
/* renamed from: o.fRb$RVV */
/* loaded from: classes5.dex */
public interface RVV {
void e(InputStream inputStream);
}
/* renamed from: o.fRb$saX */
/* loaded from: classes5.dex */
public interface saX {
}
/* renamed from: o.fRb$HBt */
/* loaded from: classes5.dex */
public class HBt implements Camera.PictureCallback {
public RVV b;
private C13120fRb e;
@Override // android.hardware.Camera.PictureCallback
public final void onPictureTaken(byte[] bArr, Camera camera) {
RVV rvv = this.b;
if (rvv != null) {
rvv.e(new ByteArrayInputStream(bArr));
}
synchronized (this.e.d) {
if (this.e.a != null) {
this.e.a.startPreview();
}
}
}
public /* synthetic */ HBt(C13120fRb c13120fRb, byte b) {
this(c13120fRb);
}
private HBt(C13120fRb c13120fRb) {
this.e = c13120fRb;
}
}
/* renamed from: o.fRb$IeS */
/* loaded from: classes5.dex */
class IeS implements Camera.PreviewCallback {
private C13120fRb a;
@Override // android.hardware.Camera.PreviewCallback
public final void onPreviewFrame(byte[] bArr, Camera camera) {
Sts sts = this.a.f9108o;
synchronized (sts.b) {
try {
ByteBuffer byteBuffer = sts.j;
if (byteBuffer != null) {
camera.addCallbackBuffer(byteBuffer.array());
sts.j = null;
}
sts.e = SystemClock.elapsedRealtime() - sts.c;
sts.f++;
sts.j = sts.d.l.get(bArr);
sts.b.notifyAll();
} catch (Exception unused) {
}
}
}
/* synthetic */ IeS(C13120fRb c13120fRb, byte b) {
this(c13120fRb);
}
private IeS(C13120fRb c13120fRb) {
this.a = c13120fRb;
}
}
/* renamed from: o.fRb$LWm */
/* loaded from: classes5.dex */
public static class LWm {
public C13120fRb a;
public final InterfaceC13090fQd<?> e;
public LWm(Context context, InterfaceC13090fQd<?> interfaceC13090fQd) {
C13120fRb c13120fRb = new C13120fRb((byte) 0);
this.a = c13120fRb;
if (context == null) {
throw new IllegalArgumentException("No context supplied.");
}
if (interfaceC13090fQd == null) {
throw new IllegalArgumentException("No detector supplied.");
}
this.e = interfaceC13090fQd;
c13120fRb.b = context;
}
public final LWm c(float f) {
if (f <= BitmapDescriptorFactory.HUE_RED) {
throw new IllegalArgumentException("Invalid fps: ".concat(String.valueOf(f)));
}
this.a.g = f;
return this;
}
public final LWm c(int i) {
if (i != 0 && i != 1) {
throw new IllegalArgumentException("Invalid camera: ".concat(String.valueOf(i)));
}
this.a.e = i;
return this;
}
public final LWm b(int i, int i2) {
if (i > 0 && i <= 1000000 && i2 > 0 && i2 <= 1000000) {
this.a.h = i;
this.a.i = i2;
return this;
}
StringBuilder sb = new StringBuilder("Invalid preview size: ");
sb.append(i);
sb.append("x");
sb.append(i2);
throw new IllegalArgumentException(sb.toString());
}
}
/* renamed from: o.fRb$Sts */
/* loaded from: classes5.dex */
public class Sts implements Runnable {
private static boolean i = true;
final C13120fRb d;
long e;
private InterfaceC13090fQd<?> g;
ByteBuffer j;
long c = SystemClock.elapsedRealtime();
final Object b = new Object();
boolean a = true;
int f = 0;
final void d() {
if (!i && this.d.k.getState() != Thread.State.TERMINATED) {
throw new AssertionError();
}
InterfaceC13090fQd<?> interfaceC13090fQd = this.g;
if (interfaceC13090fQd != null) {
interfaceC13090fQd.a();
this.g = null;
}
}
@Override // java.lang.Runnable
public final void run() {
boolean z;
FirebaseVisionImage fromByteBuffer;
ByteBuffer byteBuffer;
while (true) {
synchronized (this.b) {
while (true) {
z = this.a;
if (!z || this.j != null) {
break;
}
try {
this.b.wait();
} catch (InterruptedException unused) {
return;
}
}
if (!z) {
return;
}
fromByteBuffer = FirebaseVisionImage.fromByteBuffer(this.j, new FirebaseVisionImageMetadata.Builder().setWidth(this.d.f.b).setHeight(this.d.f.e).setFormat(17).setRotation(this.d.c).build());
byteBuffer = this.j;
this.j = null;
}
try {
this.g.a(fromByteBuffer, this.d);
this.d.a.addCallbackBuffer(byteBuffer.array());
} catch (Throwable unused2) {
this.d.a.addCallbackBuffer(byteBuffer.array());
}
}
}
public Sts(C13120fRb c13120fRb, InterfaceC13090fQd<?> interfaceC13090fQd) {
this.d = c13120fRb;
this.g = interfaceC13090fQd;
}
}
private byte[] e(fQN fqn) {
byte[] bArr = new byte[((int) Math.ceil(((fqn.e * fqn.b) * ImageFormat.getBitsPerPixel(17)) / 8.0d)) + 1];
ByteBuffer wrap = ByteBuffer.wrap(bArr);
if (!wrap.hasArray() || wrap.array() != bArr) {
throw new IllegalStateException("Failed to create valid buffer for camera source.");
}
this.l.put(bArr, wrap);
return bArr;
}
/* JADX WARN: Removed duplicated region for block: B:107:0x0176 A[Catch: all -> 0x0238, TryCatch #0 {, blocks: (B:4:0x0005, B:6:0x0009, B:9:0x000b, B:10:0x0013, B:12:0x001a, B:18:0x0028, B:19:0x0045, B:21:0x004b, B:22:0x005c, B:24:0x0062, B:27:0x007c, B:33:0x0085, B:35:0x008c, B:36:0x0090, B:38:0x0096, B:40:0x00a5, B:41:0x00ae, B:43:0x00b4, B:46:0x00c2, B:56:0x00d8, B:57:0x00f0, B:59:0x00f7, B:68:0x0116, B:70:0x011c, B:71:0x0123, B:80:0x0162, B:82:0x016e, B:83:0x017e, B:85:0x018c, B:87:0x0198, B:88:0x019d, B:90:0x01a7, B:92:0x01ad, B:94:0x01b9, B:95:0x01be, B:96:0x020d, B:100:0x0216, B:101:0x021b, B:105:0x021e, B:106:0x021f, B:107:0x0176, B:111:0x0220, B:112:0x0227, B:113:0x0228, B:114:0x022f, B:115:0x0230, B:116:0x0237, B:14:0x0022, B:98:0x020e, B:99:0x0215), top: B:3:0x0005, inners: #1 }] */
/* JADX WARN: Removed duplicated region for block: B:82:0x016e A[Catch: all -> 0x0238, TryCatch #0 {, blocks: (B:4:0x0005, B:6:0x0009, B:9:0x000b, B:10:0x0013, B:12:0x001a, B:18:0x0028, B:19:0x0045, B:21:0x004b, B:22:0x005c, B:24:0x0062, B:27:0x007c, B:33:0x0085, B:35:0x008c, B:36:0x0090, B:38:0x0096, B:40:0x00a5, B:41:0x00ae, B:43:0x00b4, B:46:0x00c2, B:56:0x00d8, B:57:0x00f0, B:59:0x00f7, B:68:0x0116, B:70:0x011c, B:71:0x0123, B:80:0x0162, B:82:0x016e, B:83:0x017e, B:85:0x018c, B:87:0x0198, B:88:0x019d, B:90:0x01a7, B:92:0x01ad, B:94:0x01b9, B:95:0x01be, B:96:0x020d, B:100:0x0216, B:101:0x021b, B:105:0x021e, B:106:0x021f, B:107:0x0176, B:111:0x0220, B:112:0x0227, B:113:0x0228, B:114:0x022f, B:115:0x0230, B:116:0x0237, B:14:0x0022, B:98:0x020e, B:99:0x0215), top: B:3:0x0005, inners: #1 }] */
/* JADX WARN: Removed duplicated region for block: B:97:0x020e A[EXC_TOP_SPLITTER, SYNTHETIC] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final o.C13120fRb aCy_(android.view.SurfaceHolder r17) throws java.io.IOException {
/*
Method dump skipped, instructions count: 571
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: o.C13120fRb.aCy_(android.view.SurfaceHolder):o.fRb");
}
public final void a() {
synchronized (this.d) {
Sts sts = this.f9108o;
if (sts != null) {
synchronized (sts.b) {
sts.a = false;
sts.b.notifyAll();
}
}
Thread thread = this.k;
if (thread != null) {
try {
thread.join();
} catch (InterruptedException unused) {
}
this.k = null;
}
this.l.clear();
Camera camera = this.a;
if (camera != null) {
camera.stopPreview();
this.a.setPreviewCallbackWithBuffer(null);
try {
this.a.setPreviewTexture(null);
} catch (Exception unused2) {
}
this.a.release();
this.a = null;
}
}
}
/* renamed from: o.fRb$jbe */
/* loaded from: classes5.dex */
public class jbe implements Camera.ShutterCallback {
private C13120fRb b;
public saX e;
@Override // android.hardware.Camera.ShutterCallback
public final void onShutter() {
}
public /* synthetic */ jbe(C13120fRb c13120fRb, byte b) {
this(c13120fRb);
}
private jbe(C13120fRb c13120fRb) {
this.b = c13120fRb;
}
}
public final void b() {
synchronized (this.d) {
a();
Sts sts = this.f9108o;
if (sts != null) {
sts.d();
this.f9108o = null;
}
Camera camera = this.a;
if (camera != null) {
camera.release();
this.a = null;
}
System.gc();
}
}
/* renamed from: o.fRb$ojQ */
/* loaded from: classes5.dex */
static class ojQ {
fQN c;
fQN d;
public ojQ(Camera.Size size, Camera.Size size2) {
this.c = new fQN(size.width, size.height);
if (size2 != null) {
this.d = new fQN(size2.width, size2.height);
}
}
}
/* synthetic */ C13120fRb(byte b) {
this();
}
private C13120fRb() {
this.d = new Object();
this.e = 0;
this.g = 30.0f;
this.h = 1024;
this.i = 768;
this.j = null;
this.n = null;
this.l = new HashMap();
}
}