what-the-bank/sources/com/kofax/mobile/sdk/k/p.java

100 lines
3.3 KiB
Java

package com.kofax.mobile.sdk.k;
import com.kofax.kmc.kui.uicontrols.PreviewFrameEvent;
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;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes3.dex */
public class p implements com.kofax.mobile.sdk._internal.capture.c {
private final com.kofax.mobile.sdk._internal.capture.c Fk;
private final ExecutorService gt = Executors.newSingleThreadExecutor();
/* JADX INFO: Access modifiers changed from: package-private */
public p(com.kofax.mobile.sdk._internal.capture.c cVar) {
this.Fk = cVar;
}
@Override // com.kofax.mobile.sdk._internal.capture.c
public void a(com.kofax.mobile.sdk._internal.capture.a aVar) {
this.Fk.a(aVar);
}
@Override // com.kofax.mobile.sdk._internal.capture.c
public com.kofax.mobile.sdk._internal.capture.d a(PreviewFrameEvent previewFrameEvent) {
return (com.kofax.mobile.sdk._internal.capture.d) call(new Callable<com.kofax.mobile.sdk._internal.capture.d>(this, previewFrameEvent) { // from class: com.kofax.mobile.sdk.k.p.1
final PreviewFrameEvent GT;
final p GU;
{
this.GU = this;
this.GT = previewFrameEvent;
}
@Override // java.util.concurrent.Callable
/* renamed from: lD, reason: merged with bridge method [inline-methods] */
public com.kofax.mobile.sdk._internal.capture.d call() {
return this.GU.Fk.a(this.GT);
}
});
}
@Override // com.kofax.mobile.sdk._internal.capture.c
public void doCleanUp() {
call(new Callable<Void>(this) { // from class: com.kofax.mobile.sdk.k.p.2
final p GU;
{
this.GU = this;
}
@Override // java.util.concurrent.Callable
public Void call() {
this.GU.Fk.doCleanUp();
return null;
}
});
this.gt.shutdown();
try {
this.gt.awaitTermination(1L, TimeUnit.DAYS);
} catch (InterruptedException unused) {
throw new RuntimeException("Interrupted");
}
}
@Override // com.kofax.mobile.sdk._internal.capture.c
public double getMaxFillFraction() {
return this.Fk.getMaxFillFraction();
}
@Override // com.kofax.mobile.sdk._internal.capture.c
public o bt() {
return this.Fk.bt();
}
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);
}
}
}