what-the-bank/sources/com/pingan/ai/i.java

159 lines
5.7 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.pingan.ai;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.os.Message;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.pingan.ai.face.common.FixedLinkedList;
import com.pingan.ai.face.entity.PaFaceDetectFrame;
import com.pingan.ai.face.utils.PaFaceLogger;
import java.util.Iterator;
import java.util.LinkedList;
import pingan.ai.paverify.vertify.PFaceDetector;
/* loaded from: classes3.dex */
public class i {
public a a;
public HandlerThread b;
/* loaded from: classes3.dex */
public final class a extends Handler {
public LinkedList<Float> a;
public d b;
public int c;
public a(i iVar, Looper looper, d dVar) {
super(looper);
this.c = 0;
this.a = new FixedLinkedList(5);
this.b = dVar;
}
@Override // android.os.Handler
public final void handleMessage(Message message) {
PaFaceDetectFrame paFaceDetectFrame;
int i;
super.handleMessage(message);
if (10 != message.what || (paFaceDetectFrame = (PaFaceDetectFrame) message.obj) == null) {
return;
}
long currentTimeMillis = System.currentTimeMillis();
float nativeImageOptLive = PFaceDetector.nativeImageOptLive(paFaceDetectFrame.frame, paFaceDetectFrame.frameOri, paFaceDetectFrame.frameWidth, paFaceDetectFrame.frameHeight, paFaceDetectFrame.landmarkPosition);
StringBuilder sb = new StringBuilder("nativeImageOptLive live score : ");
sb.append(nativeImageOptLive);
sb.append(",noLivingNum:");
sb.append(this.c);
sb.append(",scoreListSize=");
sb.append(this.a.size());
sb.append(", atomic optLive use time:");
sb.append(System.currentTimeMillis() - currentTimeMillis);
PaFaceLogger.i(sb.toString());
d dVar = this.b;
StringBuilder sb2 = new StringBuilder();
sb2.append(c.a());
sb2.append(" nativeImageOptLive live score : ");
sb2.append(nativeImageOptLive);
sb2.append(",noLivingNum:");
sb2.append(this.c);
sb2.append(",scoreListSize=");
sb2.append(this.a.size());
sb2.append(", atomic optLive use time:");
sb2.append(System.currentTimeMillis() - currentTimeMillis);
dVar.c(sb2.toString());
if (nativeImageOptLive > 0.0045f) {
this.a.add(Float.valueOf(nativeImageOptLive));
if (this.a.size() == 5) {
Iterator<Float> it = this.a.iterator();
float f = BitmapDescriptorFactory.HUE_RED;
while (it.hasNext()) {
f += it.next().floatValue();
}
float f2 = f / 5.0f;
if (f2 > 0.5f) {
this.a.clear();
i = 0;
} else {
i = this.c + 1;
}
this.c = i;
d dVar2 = this.b;
StringBuilder sb3 = new StringBuilder();
sb3.append(c.a());
sb3.append(" detect live vote,average live score : ");
sb3.append(f2);
sb3.append(", noLivingNum:");
sb3.append(this.c);
dVar2.c(sb3.toString());
PaFaceLogger.i("detect live vote,average live score : ".concat(String.valueOf(f2)));
}
} else {
this.c++;
d dVar3 = this.b;
StringBuilder sb4 = new StringBuilder();
sb4.append(c.a());
sb4.append(" noLivingNum : ");
sb4.append(this.c);
dVar3.c(sb4.toString());
}
if (this.b.b()) {
d dVar4 = this.b;
StringBuilder sb5 = new StringBuilder();
sb5.append(c.a());
sb5.append(" is detecting all donereset it.");
dVar4.c(sb5.toString());
PaFaceLogger.i("is detecting all donereset it.");
a();
return;
}
if (this.c >= 3) {
d dVar5 = this.b;
StringBuilder sb6 = new StringBuilder();
sb6.append(c.a());
sb6.append(" SILENT_ERRORlive vote failed");
dVar5.a(sb6.toString());
PaFaceLogger.error("SILENT_ERRORlive vote failed");
this.b.b(3001);
this.b.a(true);
a();
}
}
public final void a() {
this.c = 0;
this.a.clear();
removeCallbacksAndMessages(null);
}
}
public native void a(PaFaceDetectFrame paFaceDetectFrame);
public void a(boolean z) {
a aVar = this.a;
if (aVar != null) {
aVar.a();
}
if (z) {
HandlerThread handlerThread = this.b;
if (handlerThread != null) {
handlerThread.quit();
}
this.b = null;
this.a = null;
PaFaceLogger.i("quit multi live thread");
}
}
public i(d dVar) {
HandlerThread handlerThread = this.b;
if (handlerThread == null || !handlerThread.isAlive()) {
HandlerThread handlerThread2 = new HandlerThread("silentLiveThread");
this.b = handlerThread2;
handlerThread2.start();
}
if (this.a == null) {
this.a = new a(this, this.b.getLooper(), dVar);
}
}
}