134 lines
4.7 KiB
Java
134 lines
4.7 KiB
Java
|
package com.kofax.mobile.sdk.k;
|
||
|
|
||
|
import android.graphics.Bitmap;
|
||
|
import com.kofax.kmc.ken.engines.data.SelfieDetectionSettings;
|
||
|
import com.kofax.mobile.sdk._internal.detection.IFaceDetectionResult;
|
||
|
import com.kofax.mobile.sdk._internal.detection.IFaceDetector;
|
||
|
import java.util.concurrent.Callable;
|
||
|
import java.util.concurrent.ExecutionException;
|
||
|
import java.util.concurrent.ExecutorService;
|
||
|
import java.util.concurrent.Executors;
|
||
|
import java.util.concurrent.TimeUnit;
|
||
|
|
||
|
/* loaded from: classes3.dex */
|
||
|
public class j implements IFaceDetector {
|
||
|
private final ExecutorService gt = Executors.newSingleThreadExecutor();
|
||
|
private final IFaceDetector np;
|
||
|
|
||
|
public j(IFaceDetector iFaceDetector) {
|
||
|
this.np = iFaceDetector;
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.detection.IFaceDetector
|
||
|
public IFaceDetectionResult detect(SelfieDetectionSettings selfieDetectionSettings, Bitmap bitmap, int i) {
|
||
|
return (IFaceDetectionResult) call(new Callable<IFaceDetectionResult>(this, selfieDetectionSettings, bitmap, i) { // from class: com.kofax.mobile.sdk.k.j.1
|
||
|
final SelfieDetectionSettings Gx;
|
||
|
final j Gy;
|
||
|
final int gw;
|
||
|
final Bitmap val$bitmap;
|
||
|
|
||
|
{
|
||
|
this.Gy = this;
|
||
|
this.Gx = selfieDetectionSettings;
|
||
|
this.val$bitmap = bitmap;
|
||
|
this.gw = i;
|
||
|
}
|
||
|
|
||
|
@Override // java.util.concurrent.Callable
|
||
|
/* renamed from: lt, reason: merged with bridge method [inline-methods] */
|
||
|
public IFaceDetectionResult call() {
|
||
|
return this.Gy.np.detect(this.Gx, this.val$bitmap, this.gw);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.detection.IFaceDetector
|
||
|
public IFaceDetectionResult detect(SelfieDetectionSettings selfieDetectionSettings, byte[] bArr, int i, int i2, int i3) {
|
||
|
return (IFaceDetectionResult) call(new Callable<IFaceDetectionResult>(this, selfieDetectionSettings, bArr, i, i2, i3) { // from class: com.kofax.mobile.sdk.k.j.2
|
||
|
final int GA;
|
||
|
final SelfieDetectionSettings Gx;
|
||
|
final j Gy;
|
||
|
final int Gz;
|
||
|
final byte[] gn;
|
||
|
final int gw;
|
||
|
|
||
|
{
|
||
|
this.Gy = this;
|
||
|
this.Gx = selfieDetectionSettings;
|
||
|
this.gn = bArr;
|
||
|
this.Gz = i;
|
||
|
this.GA = i2;
|
||
|
this.gw = i3;
|
||
|
}
|
||
|
|
||
|
@Override // java.util.concurrent.Callable
|
||
|
/* renamed from: lt, reason: merged with bridge method [inline-methods] */
|
||
|
public IFaceDetectionResult call() {
|
||
|
return this.Gy.np.detect(this.Gx, this.gn, this.Gz, this.GA, this.gw);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.detection.IFaceDetector
|
||
|
public boolean isOperational() {
|
||
|
return ((Boolean) call(new Callable<Boolean>(this) { // from class: com.kofax.mobile.sdk.k.j.3
|
||
|
final j Gy;
|
||
|
|
||
|
{
|
||
|
this.Gy = this;
|
||
|
}
|
||
|
|
||
|
@Override // java.util.concurrent.Callable
|
||
|
/* renamed from: lu, reason: merged with bridge method [inline-methods] */
|
||
|
public Boolean call() {
|
||
|
return Boolean.valueOf(this.Gy.np.isOperational());
|
||
|
}
|
||
|
})).booleanValue();
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.detection.IFaceDetector
|
||
|
public void destroy() {
|
||
|
call(new Callable<Void>(this) { // from class: com.kofax.mobile.sdk.k.j.4
|
||
|
final j Gy;
|
||
|
|
||
|
{
|
||
|
this.Gy = this;
|
||
|
}
|
||
|
|
||
|
@Override // java.util.concurrent.Callable
|
||
|
public Void call() {
|
||
|
this.Gy.np.destroy();
|
||
|
return null;
|
||
|
}
|
||
|
});
|
||
|
this.gt.shutdown();
|
||
|
try {
|
||
|
this.gt.awaitTermination(1L, TimeUnit.HOURS);
|
||
|
} catch (InterruptedException unused) {
|
||
|
throw new RuntimeException("Interrupted");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private <T> T call(Callable<T> callable) {
|
||
|
try {
|
||
|
return this.gt.submit(callable).get();
|
||
|
} catch (InterruptedException unused) {
|
||
|
throw new RuntimeException("Interrupted");
|
||
|
} catch (ExecutionException e) {
|
||
|
throwIfUnchecked(e.getCause());
|
||
|
throw new RuntimeException("Unexpected exception");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private static void throwIfUnchecked(Throwable th) {
|
||
|
throwIfInstanceOf(th, RuntimeException.class);
|
||
|
throwIfInstanceOf(th, Error.class);
|
||
|
}
|
||
|
|
||
|
private static <T extends Throwable> void throwIfInstanceOf(Throwable th, Class<T> cls) throws Throwable {
|
||
|
if (cls.isInstance(th)) {
|
||
|
throw cls.cast(th);
|
||
|
}
|
||
|
}
|
||
|
}
|