what-the-bank/sources/com/kofax/kmc/ken/engines/data/Image.java

1862 lines
69 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package com.kofax.kmc.ken.engines.data;
import android.graphics.Bitmap;
import android.graphics.Rect;
import android.net.Uri;
import android.webkit.MimeTypeMap;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.kofax.BuildConfig;
import com.kofax.kmc.ken.engines.ImageClassificationResult;
import com.kofax.kmc.ken.engines.iplib.IpFileBuffer;
import com.kofax.kmc.ken.engines.service.ImageService;
import com.kofax.kmc.ken.engines.version.KenVersion;
import com.kofax.kmc.kut.utilities.AppContextProvider;
import com.kofax.kmc.kut.utilities.SdkVersion;
import com.kofax.kmc.kut.utilities.error.ErrorInfo;
import com.kofax.kmc.kut.utilities.error.IllegalArgumentException;
import com.kofax.kmc.kut.utilities.error.IllegalThreadStateException;
import com.kofax.kmc.kut.utilities.error.InternalError;
import com.kofax.kmc.kut.utilities.error.KmcException;
import com.kofax.kmc.kut.utilities.error.KmcRuntimeException;
import com.kofax.kmc.kut.utilities.error.NullPointerException;
import com.kofax.mobile.sdk._internal.IBus;
import com.kofax.mobile.sdk._internal.dagger.Injector;
import com.kofax.mobile.sdk._internal.k;
import com.kofax.mobile.sdk.r.c;
import java.io.File;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import o.gjJ;
import org.jmrtd.lds.ImageInfo;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes3.dex */
public class Image implements Serializable {
public static final int DEFAULT_JPEG_QUALITY = 90;
public static final int MAX_JPEG_QUALITY = 100;
public static final float MAX_SCALING_FACTOR = 1.0f;
public static final int MIN_DPI_VALUE = 25;
public static final int MIN_JPEG_QUALITY = 1;
public static final float MIN_SCALING_FACTOR = 0.1f;
private static final String TAG = "Image";
private static final int cT = 10;
private static final int cU = 72;
private static final long serialVersionUID = 1704759624970925806L;
private transient IBus _bus;
private transient File cV;
private transient ImageMimeType cW;
private transient Bitmap cX;
private transient ImageRep cY;
private transient Integer cZ;
private transient String dA;
private transient boolean dB;
private transient Rect dC;
private transient Integer da;
private transient Float db;
private transient Integer dc;
private transient Integer dd;
private transient String de;
private transient String df;
private transient String dg;
private transient String dh;
private transient ImagePerfectionProfile di;
private transient BasicSettingsProfile dj;
private transient QuickAnalysisFeedback dk;
private transient Float dl;
private transient Float dm;
private transient List<BarCodeResult> dn;
/* renamed from: do, reason: not valid java name */
private transient List<ImageClassificationResult> f0do;
private transient Float dp;
private transient Float dq;
private transient String dr;
private transient Integer ds;
private transient Integer dt;
private transient OutputColor du;
private transient FileIOEngine dv;
private transient ImageFileRep dw;
private transient IpFileBuffer dx;
private transient String dy;
private transient long dz;
/* loaded from: classes3.dex */
public enum FileIOEngine {
FILE_ENG_KFIL,
FILE_ENG_ANDROID
}
/* loaded from: classes3.dex */
public enum FileRestriction {
NONE,
ANSI_X9
}
/* loaded from: classes3.dex */
public enum ImageFileRep {
FILE_NONE,
FILE_STORED,
FILE_BUFFERED
}
/* loaded from: classes3.dex */
public enum ImageMimeType {
MIMETYPE_JPEG,
MIMETYPE_PNG,
MIMETYPE_TIFF,
MIMETYPE_UNKNOWN
}
/* loaded from: classes3.dex */
public enum ImageRep {
IMAGE_REP_NONE,
IMAGE_REP_BITMAP,
IMAGE_REP_FILE,
IMAGE_REP_BOTH
}
/* loaded from: classes3.dex */
enum a {
IMAGE_REP_NONE_NONE,
IMAGE_REP_FILE_STORED,
IMAGE_REP_FILE_BUFFERED,
IMAGE_REP_BITMAP_NONE,
IMAGE_REP_BOTH_STORED,
IMAGE_REP_BOTH_BUFFERED
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes3.dex */
public enum b {
FILE_IO_READ,
FILE_IO_WRITE
}
/* loaded from: classes3.dex */
public enum OutputColor {
BITDEPTH_BITONAL(1, 1),
BITDEPTH_GRAYSCALE(1, 8),
BITDEPTH_COLOR(3, 8);
private int bitsPerPixel;
private int dV;
private int dW;
OutputColor(int i, int i2) {
this.dV = i;
this.dW = i2;
this.bitsPerPixel = i * i2;
}
public final int getChannels() {
return this.dV;
}
public final int getBitsPerPixel() {
return this.bitsPerPixel;
}
public final int getBitsPerChannel() {
return this.dW;
}
}
/* JADX INFO: Access modifiers changed from: protected */
/* loaded from: classes3.dex */
public class BitmapDataObject implements Serializable {
private static final long serialVersionUID = 2569305159857742532L;
final Image dF;
public byte[] imageByteArray;
protected BitmapDataObject(Image image) {
this.dF = image;
}
}
/* loaded from: classes3.dex */
public static class KenBitmap {
public Bitmap bitmap;
public ErrorInfo errInfo;
public Integer mDpiX;
public Integer mDpiY;
public int scaleFactor;
public KenBitmap() {
this.bitmap = null;
this.mDpiX = null;
this.mDpiY = null;
this.scaleFactor = 1;
this.errInfo = ErrorInfo.KMC_SUCCESS;
}
public KenBitmap(Bitmap bitmap) {
this.bitmap = null;
this.mDpiX = null;
this.mDpiY = null;
this.scaleFactor = 1;
this.errInfo = ErrorInfo.KMC_SUCCESS;
this.bitmap = bitmap;
}
private void recycle() {
Bitmap bitmap = this.bitmap;
if (bitmap != null) {
bitmap.recycle();
this.bitmap = null;
}
}
}
/* JADX WARN: Code restructure failed: missing block: B:21:0x0038, code lost:
if (r0 != 4) goto L23;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public long getImageSize() {
/*
r4 = this;
com.kofax.kmc.ken.engines.data.Image$ImageRep r0 = r4.getImageRepresentation()
com.kofax.kmc.ken.engines.data.Image$ImageFileRep r1 = r4.getImageFileRep()
com.kofax.kmc.ken.engines.data.Image$ImageFileRep r2 = com.kofax.kmc.ken.engines.data.Image.ImageFileRep.FILE_BUFFERED
if (r1 != r2) goto L11
com.kofax.kmc.ken.engines.iplib.IpFileBuffer r0 = r4.dx
int r0 = r0.mFileBufferLength
goto L4a
L11:
com.kofax.kmc.ken.engines.data.Image$ImageRep r1 = com.kofax.kmc.ken.engines.data.Image.ImageRep.IMAGE_REP_FILE
if (r0 == r1) goto L4f
com.kofax.kmc.ken.engines.data.Image$ImageRep r1 = com.kofax.kmc.ken.engines.data.Image.ImageRep.IMAGE_REP_BOTH
if (r0 == r1) goto L4f
com.kofax.kmc.ken.engines.data.Image$ImageRep r1 = com.kofax.kmc.ken.engines.data.Image.ImageRep.IMAGE_REP_BITMAP
if (r0 != r1) goto L4c
android.graphics.Bitmap r0 = r4.cX
android.graphics.Bitmap$Config r0 = r0.getConfig()
r1 = 4
if (r0 != 0) goto L27
goto L3c
L27:
int[] r2 = com.kofax.kmc.ken.engines.data.Image.AnonymousClass1.dD
int r0 = r0.ordinal()
r0 = r2[r0]
r2 = 1
if (r0 == r2) goto L3b
r2 = 2
if (r0 == r2) goto L3b
r3 = 3
if (r0 == r3) goto L3c
if (r0 == r1) goto L3b
goto L3c
L3b:
r1 = r2
L3c:
java.lang.Integer r0 = r4.da
int r0 = r0.intValue()
java.lang.Integer r2 = r4.cZ
int r2 = r2.intValue()
int r0 = r0 * r2
int r0 = r0 * r1
L4a:
long r0 = (long) r0
goto L55
L4c:
r0 = 0
goto L55
L4f:
java.io.File r0 = r4.cV
long r0 = r0.length()
L55:
return r0
*/
throw new UnsupportedOperationException("Method not decompiled: com.kofax.kmc.ken.engines.data.Image.getImageSize():long");
}
public Image() {
this.cV = null;
this.cW = ImageMimeType.MIMETYPE_UNKNOWN;
this.cX = null;
this.cY = ImageRep.IMAGE_REP_NONE;
this.cZ = null;
this.da = null;
this.db = Float.valueOf(1.0f);
this.dc = null;
this.dd = null;
this.de = new String();
this.df = new String();
this.dg = new String();
this.dh = new String();
this.di = null;
this.dj = null;
this.dk = null;
this.dl = null;
this.dm = null;
this.dn = new ArrayList();
this.f0do = new ArrayList();
this.dp = null;
this.dq = null;
this.dr = new String();
this.ds = null;
this.dt = 90;
this.du = OutputColor.BITDEPTH_COLOR;
this.dv = FileIOEngine.FILE_ENG_KFIL;
this.dw = ImageFileRep.FILE_NONE;
this.dx = null;
this.dy = new String();
this.dz = 0L;
this.dA = new String();
this.dB = false;
this.dC = null;
this.cY = ImageRep.IMAGE_REP_NONE;
this.dw = ImageFileRep.FILE_NONE;
this.cW = ImageMimeType.MIMETYPE_UNKNOWN;
Date date = new Date();
this.dr = ImageService.UTCStringFromDate(date);
this.dA = ImageService.exifTimeFromDate(date, "UTC");
this.df = UUID.randomUUID().toString();
String str = TAG;
StringBuilder sb = new StringBuilder("imgCreateDateTime: ");
sb.append(this.dr);
k.c(str, sb.toString());
t();
}
public Image(Bitmap bitmap) throws NullPointerException {
this.cV = null;
this.cW = ImageMimeType.MIMETYPE_UNKNOWN;
this.cX = null;
this.cY = ImageRep.IMAGE_REP_NONE;
this.cZ = null;
this.da = null;
this.db = Float.valueOf(1.0f);
this.dc = null;
this.dd = null;
this.de = new String();
this.df = new String();
this.dg = new String();
this.dh = new String();
this.di = null;
this.dj = null;
this.dk = null;
this.dl = null;
this.dm = null;
this.dn = new ArrayList();
this.f0do = new ArrayList();
this.dp = null;
this.dq = null;
this.dr = new String();
this.ds = null;
this.dt = 90;
this.du = OutputColor.BITDEPTH_COLOR;
this.dv = FileIOEngine.FILE_ENG_KFIL;
this.dw = ImageFileRep.FILE_NONE;
this.dx = null;
this.dy = new String();
this.dz = 0L;
this.dA = new String();
this.dB = false;
this.dC = null;
if (bitmap == null) {
throw new NullPointerException("bitmap parameter is null");
}
this.cX = bitmap;
this.cY = ImageRep.IMAGE_REP_BITMAP;
this.dw = ImageFileRep.FILE_NONE;
Date date = new Date();
this.dr = ImageService.UTCStringFromDate(date);
this.dA = ImageService.exifTimeFromDate(date, "UTC");
this.ds = 72;
this.df = UUID.randomUUID().toString();
this.cZ = Integer.valueOf(this.cX.getWidth());
this.da = Integer.valueOf(this.cX.getHeight());
t();
}
public Image(File file, ImageMimeType imageMimeType) {
this.cV = null;
this.cW = ImageMimeType.MIMETYPE_UNKNOWN;
this.cX = null;
this.cY = ImageRep.IMAGE_REP_NONE;
this.cZ = null;
this.da = null;
this.db = Float.valueOf(1.0f);
this.dc = null;
this.dd = null;
this.de = new String();
this.df = new String();
this.dg = new String();
this.dh = new String();
this.di = null;
this.dj = null;
this.dk = null;
this.dl = null;
this.dm = null;
this.dn = new ArrayList();
this.f0do = new ArrayList();
this.dp = null;
this.dq = null;
this.dr = new String();
this.ds = null;
this.dt = 90;
this.du = OutputColor.BITDEPTH_COLOR;
this.dv = FileIOEngine.FILE_ENG_KFIL;
this.dw = ImageFileRep.FILE_NONE;
this.dx = null;
this.dy = new String();
this.dz = 0L;
this.dA = new String();
this.dB = false;
this.dC = null;
a(file, imageMimeType, true);
this.cV = new File(file.getAbsolutePath());
this.cY = ImageRep.IMAGE_REP_FILE;
this.dw = ImageFileRep.FILE_STORED;
this.cW = imageMimeType;
Date date = new Date();
this.dr = ImageService.UTCStringFromDate(date);
this.dA = ImageService.exifTimeFromDate(date, "UTC");
this.df = UUID.randomUUID().toString();
d(this.cV.getAbsolutePath());
t();
}
public Image(String str, ImageMimeType imageMimeType) {
this.cV = null;
this.cW = ImageMimeType.MIMETYPE_UNKNOWN;
this.cX = null;
this.cY = ImageRep.IMAGE_REP_NONE;
this.cZ = null;
this.da = null;
this.db = Float.valueOf(1.0f);
this.dc = null;
this.dd = null;
this.de = new String();
this.df = new String();
this.dg = new String();
this.dh = new String();
this.di = null;
this.dj = null;
this.dk = null;
this.dl = null;
this.dm = null;
this.dn = new ArrayList();
this.f0do = new ArrayList();
this.dp = null;
this.dq = null;
this.dr = new String();
this.ds = null;
this.dt = 90;
this.du = OutputColor.BITDEPTH_COLOR;
this.dv = FileIOEngine.FILE_ENG_KFIL;
this.dw = ImageFileRep.FILE_NONE;
this.dx = null;
this.dy = new String();
this.dz = 0L;
this.dA = new String();
this.dB = false;
this.dC = null;
File file = new File(str);
a(file, imageMimeType, true);
this.cV = file;
this.cY = ImageRep.IMAGE_REP_FILE;
this.dw = ImageFileRep.FILE_STORED;
this.cW = imageMimeType;
Date date = new Date();
this.dr = ImageService.UTCStringFromDate(date);
this.dA = ImageService.exifTimeFromDate(date, "UTC");
this.df = UUID.randomUUID().toString();
d(this.cV.getAbsolutePath());
t();
}
private void t() {
if (this.cY == ImageRep.IMAGE_REP_NONE || AppContextProvider.getContext() == null) {
return;
}
if (!this.dB) {
this._bus = Injector.getInjector(AppContextProvider.getContext()).getIBus();
this.dz = System.currentTimeMillis();
this._bus.post(new com.kofax.mobile.sdk.r.b(this, ImageSource.IMAGE));
this.dB = true;
return;
}
this._bus.post(new c(this, ImageSource.IMAGE));
}
public String getImageFilePath() {
File file = this.cV;
return file == null ? "" : file.getAbsolutePath();
}
public void setImageFilePath(String str) throws KmcRuntimeException {
File file;
ImageMimeType imageMimeType;
if (str != null) {
file = new File(str);
imageMimeType = a(file);
} else {
file = null;
imageMimeType = null;
}
if (imageMimeType == ImageMimeType.MIMETYPE_UNKNOWN && !str.isEmpty()) {
throw new KmcRuntimeException(ErrorInfo.KMC_ED_UNRECOGNIZED_MIME_TYPE);
}
a(str, imageMimeType, false, true);
if (!file.exists()) {
this.cY = (z() || A()) ? ImageRep.IMAGE_REP_BITMAP : ImageRep.IMAGE_REP_NONE;
this.dw = ImageFileRep.FILE_NONE;
this.dc = null;
this.dd = null;
} else {
if (z() || A()) {
throw new KmcRuntimeException(ErrorInfo.KMC_ED_OBJECT_REP_FILE_MISMATCH);
}
this.cY = ImageRep.IMAGE_REP_FILE;
this.dw = ImageFileRep.FILE_STORED;
d(str);
}
if (str.isEmpty()) {
this.cV = null;
} else {
this.cV = file;
this.cW = imageMimeType;
}
t();
}
public void setImageMimeType(ImageMimeType imageMimeType) {
if (imageMimeType == null) {
throw new IllegalArgumentException("imgMimeType may not null");
}
this.cW = imageMimeType;
}
public void setImageBitmap(Bitmap bitmap) throws KmcRuntimeException {
d(bitmap);
x();
if (A() || y()) {
throw new KmcRuntimeException(ErrorInfo.KMC_ED_OBJECT_REP_FILE_MISMATCH);
}
Bitmap bitmap2 = this.cX;
if (bitmap2 != null) {
bitmap2.recycle();
this.cX = null;
}
this.cX = bitmap;
this.cY = ImageRep.IMAGE_REP_BITMAP;
this.dw = ImageFileRep.FILE_NONE;
this.ds = 72;
this.cZ = Integer.valueOf(this.cX.getWidth());
this.da = Integer.valueOf(this.cX.getHeight());
t();
}
private boolean u() {
if (A()) {
return (this.cX.getWidth() == getImageFileWidth().intValue() && this.cX.getHeight() == getImageFileHeight().intValue()) ? false : true;
}
throw new IllegalStateException();
}
@Deprecated
public ImagePerfectionProfile getImagePerfectProfileUsed() {
ImagePerfectionProfile imagePerfectionProfile = this.di;
if (imagePerfectionProfile != null) {
return imagePerfectionProfile.m269clone();
}
return null;
}
@Deprecated
public BasicSettingsProfile getBasicSettingsProfileUsed() {
BasicSettingsProfile basicSettingsProfile = this.dj;
if (basicSettingsProfile != null) {
return basicSettingsProfile.m267clone();
}
return null;
}
public void setImageBarCodes(List<BarCodeResult> list) {
a(list, "imageBarCodes");
this.dn = list;
}
@Deprecated
public void setImageClassifyResults(List<ImageClassificationResult> list) {
a(list, "imgClassifyResults");
this.f0do = list;
}
void a(float f) {
this.dp = Float.valueOf(f);
}
void b(float f) {
this.dq = Float.valueOf(f);
}
public void setImageCreateDateTime(String str) {
a(str, "imgCreateDateTime");
ImageService.checkDateTimeFormat(str);
this.dr = str;
}
public void setImageDPI(int i) {
if (i < 25) {
throw new KmcRuntimeException(ErrorInfo.KMC_ED_INVALID_DPI);
}
this.ds = Integer.valueOf(i);
}
public void setImageJpegQuality(int i) {
if (i <= 0 || i > 100) {
throw new KmcRuntimeException(ErrorInfo.KMC_ED_INVALID_JPEG_QUALITY_VALUE);
}
this.dt = Integer.valueOf(i);
}
public ByteBuffer getImageFileBuffer() {
if (!D()) {
return ByteBuffer.allocate(0);
}
IpFileBuffer ipFileBuffer = this.dx;
if (ipFileBuffer == null) {
throw new InternalError("Image.fileBuffer is null");
}
return ipFileBuffer.mByteBuffer.asReadOnlyBuffer();
}
public ErrorInfo imageWriteToFile() throws KmcException, KmcRuntimeException {
return imageWriteToFile(this.dv);
}
public ErrorInfo imageWriteToFile(FileIOEngine fileIOEngine) throws KmcException, KmcRuntimeException {
return a(fileIOEngine, FileRestriction.NONE);
}
public ErrorInfo imageWriteToFile(FileRestriction fileRestriction) throws KmcException, KmcRuntimeException {
return a(FileIOEngine.FILE_ENG_KFIL, fileRestriction);
}
/* JADX WARN: Removed duplicated region for block: B:14:0x015c */
/* JADX WARN: Removed duplicated region for block: B:21:0x016e */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private com.kofax.kmc.kut.utilities.error.ErrorInfo a(com.kofax.kmc.ken.engines.data.Image.FileIOEngine r11, com.kofax.kmc.ken.engines.data.Image.FileRestriction r12) throws com.kofax.kmc.kut.utilities.error.KmcException, com.kofax.kmc.kut.utilities.error.KmcRuntimeException {
/*
Method dump skipped, instructions count: 391
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.kofax.kmc.ken.engines.data.Image.a(com.kofax.kmc.ken.engines.data.Image$FileIOEngine, com.kofax.kmc.ken.engines.data.Image$FileRestriction):com.kofax.kmc.kut.utilities.error.ErrorInfo");
}
public ErrorInfo imageWriteToFileBuffer() throws KmcException, KmcRuntimeException {
return imageWriteToFileBuffer(FileIOEngine.FILE_ENG_KFIL);
}
public ErrorInfo imageWriteToFileBuffer(FileIOEngine fileIOEngine) throws KmcException, KmcRuntimeException {
return b(fileIOEngine, FileRestriction.NONE);
}
public ErrorInfo imageWriteToFileBuffer(FileRestriction fileRestriction) throws KmcException, KmcRuntimeException {
return b(FileIOEngine.FILE_ENG_KFIL, fileRestriction);
}
/* JADX WARN: Removed duplicated region for block: B:11:0x009b */
/* JADX WARN: Removed duplicated region for block: B:18:0x00ad */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private com.kofax.kmc.kut.utilities.error.ErrorInfo b(com.kofax.kmc.ken.engines.data.Image.FileIOEngine r5, com.kofax.kmc.ken.engines.data.Image.FileRestriction r6) throws com.kofax.kmc.kut.utilities.error.KmcException, com.kofax.kmc.kut.utilities.error.KmcRuntimeException {
/*
r4 = this;
com.kofax.kmc.kut.utilities.error.ErrorInfo r0 = com.kofax.kmc.kut.utilities.error.ErrorInfo.KMC_SUCCESS
android.graphics.Bitmap r0 = r4.cX
if (r0 != 0) goto Le
com.kofax.kmc.kut.utilities.error.ErrorInfo r6 = com.kofax.kmc.kut.utilities.error.ErrorInfo.KMC_ED_OBJECT_REP_NO_BITMAP
java.lang.String r0 = "imgBitmap field is null"
r6.setErrCause(r0)
goto L4b
Le:
com.kofax.kmc.ken.engines.data.Image$ImageMimeType r0 = r4.cW
com.kofax.kmc.ken.engines.data.Image$ImageMimeType r1 = com.kofax.kmc.ken.engines.data.Image.ImageMimeType.MIMETYPE_UNKNOWN
if (r0 != r1) goto L1c
com.kofax.kmc.kut.utilities.error.ErrorInfo r6 = com.kofax.kmc.kut.utilities.error.ErrorInfo.KMC_ED_MIMETYPE
java.lang.String r0 = "imgMimeType set to MIMETYPE_UNKNOWN"
r6.setErrCause(r0)
goto L4b
L1c:
boolean r0 = r4.D()
if (r0 == 0) goto L2a
com.kofax.kmc.kut.utilities.error.ErrorInfo r6 = com.kofax.kmc.kut.utilities.error.ErrorInfo.KMC_ED_ALREADY_BUFFERED
java.lang.String r0 = "imgFileRep set to FILE_BUFFERED"
r6.setErrCause(r0)
goto L4b
L2a:
boolean r0 = r4.C()
if (r0 == 0) goto L38
com.kofax.kmc.kut.utilities.error.ErrorInfo r6 = com.kofax.kmc.kut.utilities.error.ErrorInfo.KMC_ED_OBJECT_REP_FILE_MISMATCH
java.lang.String r0 = "imgFileRep set to FILE_BUFFERED or FILE_STORED"
r6.setErrCause(r0)
goto L4b
L38:
com.kofax.kmc.ken.engines.data.Image$ImageMimeType r0 = r4.cW
com.kofax.kmc.ken.engines.data.Image$ImageMimeType r1 = com.kofax.kmc.ken.engines.data.Image.ImageMimeType.MIMETYPE_JPEG
if (r0 != r1) goto L4d
com.kofax.kmc.ken.engines.data.Image$OutputColor r0 = r4.du
com.kofax.kmc.ken.engines.data.Image$OutputColor r1 = com.kofax.kmc.ken.engines.data.Image.OutputColor.BITDEPTH_BITONAL
if (r0 != r1) goto L4d
com.kofax.kmc.kut.utilities.error.ErrorInfo r6 = com.kofax.kmc.kut.utilities.error.ErrorInfo.KMC_ED_JPEG_BITDEPTH
java.lang.String r0 = "OutputColor cannot be BITDEPTH_BITONAL when MIME type is MIMETYPE_JPEG"
r6.setErrCause(r0)
L4b:
r0 = r5
goto L8e
L4d:
com.kofax.kmc.ken.engines.data.Image$FileIOEngine r0 = com.kofax.kmc.ken.engines.data.Image.FileIOEngine.FILE_ENG_KFIL
java.lang.Integer r1 = r4.ds
if (r1 == 0) goto L58
int r1 = r1.intValue()
goto L5a
L58:
r1 = 72
L5a:
com.kofax.kmc.kut.utilities.error.ErrorInfo r2 = com.kofax.kmc.ken.engines.service.ImageService.verifyRestrictions(r4, r6)
com.kofax.kmc.kut.utilities.error.ErrorInfo r3 = com.kofax.kmc.kut.utilities.error.ErrorInfo.KMC_SUCCESS
if (r3 != r2) goto L8d
java.lang.String r2 = r4.dh
boolean r3 = r2.isEmpty()
if (r3 == 0) goto L71
java.lang.String r2 = com.kofax.kmc.ken.engines.service.ImageService.createMetadataFromImage(r4, r6)
r4.dh = r2
goto L81
L71:
java.lang.String r3 = r4.dh
boolean r3 = com.kofax.kmc.ken.engines.service.ImageService.isImageProcessingMetadata(r3)
if (r3 != 0) goto L7d
com.kofax.kmc.ken.engines.data.Image$FileRestriction r3 = com.kofax.kmc.ken.engines.data.Image.FileRestriction.NONE
if (r3 == r6) goto L81
L7d:
java.lang.String r2 = com.kofax.kmc.ken.engines.service.ImageService.createMetadataFromImage(r4, r6)
L81:
r4.e(r2)
android.graphics.Bitmap r6 = r4.cX
com.kofax.kmc.ken.engines.iplib.IpFileBuffer r2 = r4.dx
com.kofax.kmc.kut.utilities.error.ErrorInfo r6 = com.kofax.kmc.ken.engines.service.ImageService.saveIpBitmap(r6, r1, r2)
goto L8e
L8d:
r6 = r2
L8e:
com.kofax.kmc.kut.utilities.error.ErrorInfo r1 = com.kofax.kmc.kut.utilities.error.ErrorInfo.KMC_ED_IMAGE_WRITTEN_IS_NOT_BITONAL
if (r6 == r1) goto Lb1
com.kofax.kmc.kut.utilities.error.ErrorInfo r1 = com.kofax.kmc.kut.utilities.error.ErrorInfo.KMC_ED_IMAGE_WRITTEN_IS_NOT_GRAY
if (r6 != r1) goto L97
goto Lb1
L97:
com.kofax.kmc.kut.utilities.error.ErrorInfo r1 = com.kofax.kmc.kut.utilities.error.ErrorInfo.KMC_SUCCESS
if (r6 == r1) goto Lad
boolean r5 = a(r6)
if (r5 == 0) goto La7
com.kofax.kmc.kut.utilities.error.KmcException r5 = new com.kofax.kmc.kut.utilities.error.KmcException
r5.<init>(r6)
throw r5
La7:
com.kofax.kmc.kut.utilities.error.KmcRuntimeException r5 = new com.kofax.kmc.kut.utilities.error.KmcRuntimeException
r5.<init>(r6)
throw r5
Lad:
if (r0 == r5) goto Lb1
com.kofax.kmc.kut.utilities.error.ErrorInfo r6 = com.kofax.kmc.kut.utilities.error.ErrorInfo.KMC_ED_ALTERNATE_FILEIO_ENGINE
Lb1:
com.kofax.kmc.ken.engines.data.Image$ImageRep r5 = com.kofax.kmc.ken.engines.data.Image.ImageRep.IMAGE_REP_BOTH
r4.cY = r5
com.kofax.kmc.ken.engines.data.Image$ImageFileRep r5 = com.kofax.kmc.ken.engines.data.Image.ImageFileRep.FILE_BUFFERED
r4.dw = r5
com.kofax.kmc.ken.engines.iplib.IpFileBuffer r5 = r4.dx
r4.a(r5)
r4.t()
return r6
*/
throw new UnsupportedOperationException("Method not decompiled: com.kofax.kmc.ken.engines.data.Image.b(com.kofax.kmc.ken.engines.data.Image$FileIOEngine, com.kofax.kmc.ken.engines.data.Image$FileRestriction):com.kofax.kmc.kut.utilities.error.ErrorInfo");
}
public ErrorInfo imageReadFromFile() throws KmcException, KmcRuntimeException {
return a(this.dv, true, this.db.floatValue());
}
public ErrorInfo imageReadFromFile(float f) throws KmcException, KmcRuntimeException {
return a(FileIOEngine.FILE_ENG_KFIL, false, f);
}
public ErrorInfo imageReadFromFileBuffer() throws KmcException, KmcRuntimeException {
return a(FileIOEngine.FILE_ENG_KFIL, this.db.floatValue());
}
public ErrorInfo imageReadFromFileBuffer(float f) throws KmcException, KmcRuntimeException {
return a(FileIOEngine.FILE_ENG_KFIL, f);
}
private static KenBitmap a(IpFileBuffer ipFileBuffer, FileIOEngine fileIOEngine, float f) {
if (fileIOEngine == FileIOEngine.FILE_ENG_ANDROID) {
KenBitmap loadBitmapFromFileBuffer = ImageService.loadBitmapFromFileBuffer(ipFileBuffer);
String str = TAG;
StringBuilder sb = new StringBuilder("kenBitmap: width=");
sb.append(loadBitmapFromFileBuffer.bitmap.getWidth());
k.c(str, sb.toString());
StringBuilder sb2 = new StringBuilder("kenBitmap: height=");
sb2.append(loadBitmapFromFileBuffer.bitmap.getHeight());
k.c(str, sb2.toString());
if (f >= 1.0f) {
return loadBitmapFromFileBuffer;
}
KenBitmap createScaledBitmapFromBitmapWithMatrix = ImageService.createScaledBitmapFromBitmapWithMatrix(loadBitmapFromFileBuffer.bitmap, f);
StringBuilder sb3 = new StringBuilder("kenBitmapScaled: width=");
sb3.append(createScaledBitmapFromBitmapWithMatrix.bitmap.getWidth());
k.c(str, sb3.toString());
StringBuilder sb4 = new StringBuilder("kenBitmapScaled: height=");
sb4.append(createScaledBitmapFromBitmapWithMatrix.bitmap.getHeight());
k.c(str, sb4.toString());
loadBitmapFromFileBuffer.bitmap.recycle();
loadBitmapFromFileBuffer.bitmap = null;
return createScaledBitmapFromBitmapWithMatrix;
}
return ImageService.readBitmapFromFileBufferUsingIp(ipFileBuffer, f);
}
public ErrorInfo imageDeleteFile() throws KmcException, KmcRuntimeException {
ErrorInfo deleteImage;
ErrorInfo errorInfo = ErrorInfo.KMC_SUCCESS;
File file = this.cV;
if (file == null) {
deleteImage = ErrorInfo.KMC_ED_FILEPATH;
deleteImage.setErrCause("imgFile field is null");
} else if (!file.exists()) {
deleteImage = ErrorInfo.KMC_GN_FILE_NOT_FOUND;
} else if (D()) {
deleteImage = ErrorInfo.KMC_ED_DELETE_BUFFERED_FILE;
} else {
deleteImage = ImageService.deleteImage(this.cV);
}
if (deleteImage == ErrorInfo.KMC_SUCCESS || deleteImage == ErrorInfo.KMC_GN_FILE_NOT_FOUND) {
this.cV = null;
this.cY = this.cX != null ? ImageRep.IMAGE_REP_BITMAP : ImageRep.IMAGE_REP_NONE;
this.cW = ImageMimeType.MIMETYPE_UNKNOWN;
this.dc = null;
this.dd = null;
this.dw = ImageFileRep.FILE_NONE;
t();
return deleteImage;
}
if (a(deleteImage)) {
throw new KmcException(deleteImage);
}
throw new KmcRuntimeException(deleteImage);
}
public ErrorInfo imageClearBitmap() {
ErrorInfo errorInfo = ErrorInfo.KMC_SUCCESS;
x();
Bitmap bitmap = this.cX;
if (bitmap != null) {
bitmap.recycle();
this.cX = null;
this.cY = z() ? ImageRep.IMAGE_REP_NONE : ImageRep.IMAGE_REP_FILE;
if (ImageRep.IMAGE_REP_NONE == this.cY) {
this.ds = null;
}
this.cZ = null;
this.da = null;
t();
return errorInfo;
}
return ErrorInfo.KMC_ED_ALREADY_CLEAR;
}
public ErrorInfo imageClearFileBuffer() throws KmcException {
ErrorInfo errorInfo = ErrorInfo.KMC_SUCCESS;
if (D()) {
ErrorInfo clearFileBufferUsingIp = ImageService.clearFileBufferUsingIp(this.dx);
this.dx = null;
this.cY = A() ? ImageRep.IMAGE_REP_BITMAP : ImageRep.IMAGE_REP_NONE;
this.dw = ImageFileRep.FILE_NONE;
t();
return clearFileBufferUsingIp;
}
return ErrorInfo.KMC_ED_BUFFER_ALREADY_CLEARED;
}
public Bitmap createScaledBitmap(float f) throws KmcException {
Bitmap bitmap = this.cX;
if (bitmap == null) {
throw new KmcRuntimeException(ErrorInfo.KMC_ED_OBJECT_REP_NO_BITMAP);
}
if (f < 0.1f || f > 1.0f) {
throw new KmcRuntimeException(ErrorInfo.KMC_ED_IMAGE_INVALID_SCALING_FACTOR);
}
KenBitmap createScaledBitmapFromBitmapWithMatrix = ImageService.createScaledBitmapFromBitmapWithMatrix(bitmap, f);
if (createScaledBitmapFromBitmapWithMatrix.errInfo != ErrorInfo.KMC_SUCCESS) {
throw new KmcException(createScaledBitmapFromBitmapWithMatrix.errInfo);
}
return createScaledBitmapFromBitmapWithMatrix.bitmap;
}
private String v() throws JSONException {
JSONArray jSONArray = new JSONObject(this.dh).getJSONObject("Front Side").getJSONObject("Text Lines").getJSONArray("Lines");
String str = new String();
for (int i = 0; i < jSONArray.length(); i++) {
if ("MICR".equals(jSONArray.getJSONObject(i).getString("Label"))) {
str = jSONArray.getJSONObject(i).getString("OCR Data");
if (jSONArray.getJSONObject(i).getInt("BLy") - jSONArray.getJSONObject(i).getInt("TLy") >= 8 && str.matches(".*C\\d{9}C.*")) {
break;
}
}
}
return str;
}
public String getMicrData() throws JSONException {
String str = this.dy;
if (str == null || str.isEmpty()) {
this.dy = v();
}
return this.dy;
}
public void setMicrData(String str) throws NullPointerException {
if (str == null) {
throw new NullPointerException("micrData parameter is null");
}
this.dy = str;
}
/* loaded from: classes3.dex */
public class FriendI {
final Image dF;
public FriendI(Image image, String str) throws KmcException {
this.dF = image;
if (!gjJ.c((CharSequence) str, (CharSequence) BuildConfig.APPLICATION_ID)) {
throw new KmcException(ErrorInfo.KMC_GN_UNSUPPORTED_OPERATION);
}
}
public void setImageBitmapInternal(Bitmap bitmap) {
this.dF.d(bitmap);
this.dF.x();
if (this.dF.cX != null) {
this.dF.cX.recycle();
this.dF.cX = null;
}
this.dF.cX = bitmap;
this.dF.cZ = Integer.valueOf(bitmap.getWidth());
this.dF.da = Integer.valueOf(bitmap.getHeight());
}
public ErrorInfo clearBitmapWithoutRecycle() {
ErrorInfo errorInfo = ErrorInfo.KMC_SUCCESS;
this.dF.x();
if (this.dF.cX != null) {
this.dF.cX = null;
Image image = this.dF;
image.cY = image.z() ? ImageRep.IMAGE_REP_NONE : ImageRep.IMAGE_REP_FILE;
if (ImageRep.IMAGE_REP_NONE == this.dF.cY) {
this.dF.ds = null;
}
this.dF.cZ = null;
this.dF.da = null;
return errorInfo;
}
return ErrorInfo.KMC_ED_ALREADY_CLEAR;
}
public long getFileBufferLength() {
if (this.dF.dw == ImageFileRep.FILE_BUFFERED) {
return this.dF.dx.mFileBufferLength;
}
return 0L;
}
public void setImageFileWidth(int i) {
this.dF.dc = Integer.valueOf(i);
}
public void setImageFileHeight(int i) {
this.dF.dd = Integer.valueOf(i);
}
public void setImageID(String str) {
this.dF.a(str, "imdID");
this.dF.df = str;
}
public void setImageSrcID(String str) {
this.dF.a(str, "imgSrcID");
this.dF.dg = str;
}
public void setImageMetaData(String str) {
this.dF.a(str, "imgMetaData");
this.dF.dh = str;
}
public void setImageDPI(Integer num) {
this.dF.ds = num;
}
public void setImageFileRepresentation(ImageFileRep imageFileRep) {
this.dF.dw = imageFileRep;
}
public void setImagePerfectProfileUsed(ImagePerfectionProfile imagePerfectionProfile) {
this.dF.a(imagePerfectionProfile, "imgPerfectProfileUsed");
this.dF.di = imagePerfectionProfile.m269clone();
}
public void setBasicSettingsProfileUsed(BasicSettingsProfile basicSettingsProfile) {
this.dF.a(basicSettingsProfile, "basicSettingsProfileUsed");
this.dF.dj = basicSettingsProfile;
}
public void setImageLatitude(Float f) {
this.dF.dl = f;
}
public void setImageLongitude(Float f) {
this.dF.dm = f;
}
public void setImagePitch(Float f) {
this.dF.dp = f;
}
public void setImageRoll(Float f) {
this.dF.dq = f;
}
public void setImageQuickAnalysisFeedBack(QuickAnalysisFeedback quickAnalysisFeedback) {
this.dF.a(quickAnalysisFeedback, "imgQckAnalysisFeedBck");
this.dF.dk = quickAnalysisFeedback;
}
public void setImageBitmap(Bitmap bitmap) {
this.dF.d(bitmap);
this.dF.x();
if (!this.dF.A()) {
if (this.dF.cX != null) {
this.dF.cX.recycle();
this.dF.cX = null;
}
this.dF.cX = bitmap;
if (this.dF.y()) {
this.dF.cY = ImageRep.IMAGE_REP_BOTH;
} else {
this.dF.cY = ImageRep.IMAGE_REP_BITMAP;
}
this.dF.ds = 72;
Image image = this.dF;
image.cZ = Integer.valueOf(image.cX.getWidth());
Image image2 = this.dF;
image2.da = Integer.valueOf(image2.cX.getHeight());
return;
}
throw new KmcRuntimeException(ErrorInfo.KMC_ED_OBJECT_REP_FILE_MISMATCH);
}
public long getImageCreationTime() {
return this.dF.dz;
}
public void setImageOriginalDateTime(String str) {
this.dF.dA = str;
}
public String getImageOriginalDateTime() {
return this.dF.dA;
}
}
private void w() {
this.cV = null;
this.cW = ImageMimeType.MIMETYPE_UNKNOWN;
Bitmap bitmap = this.cX;
if (bitmap != null) {
bitmap.recycle();
this.cX = null;
}
this.cY = ImageRep.IMAGE_REP_NONE;
this.dw = ImageFileRep.FILE_NONE;
this.de = new String();
this.df = new String();
this.dg = new String();
this.dh = new String();
this.di = null;
this.dj = null;
this.dk = null;
this.dl = null;
this.dm = null;
this.dn = null;
this.f0do = null;
this.dp = null;
this.dq = null;
this.dr = new String();
this.ds = null;
this.dv = FileIOEngine.FILE_ENG_KFIL;
this.du = OutputColor.BITDEPTH_COLOR;
}
private void a(String str, ImageMimeType imageMimeType, boolean z, boolean z2) {
if (str == null) {
throw new NullPointerException("filePath parameter is null");
}
if (z2) {
return;
}
a(new File(str), imageMimeType, z);
}
private void a(File file, ImageMimeType imageMimeType, boolean z) {
if (file == null) {
throw new NullPointerException("file parameter is null");
}
if (imageMimeType == ImageMimeType.MIMETYPE_UNKNOWN) {
throw new IllegalArgumentException("imgMimeType cannot be set to UNKNOWN");
}
if (z && !file.exists()) {
StringBuilder sb = new StringBuilder("file: ");
sb.append(file.getName());
sb.append(" does not exist");
throw new IllegalArgumentException(sb.toString());
}
if (a(file).equals(imageMimeType)) {
return;
}
StringBuilder sb2 = new StringBuilder("imgMimeType: ");
sb2.append(imageMimeType.toString());
sb2.append(" does not match MIME type of file");
throw new IllegalArgumentException(sb2.toString());
}
/* JADX INFO: Access modifiers changed from: private */
public void d(Bitmap bitmap) {
if (bitmap == null) {
throw new NullPointerException("imgBitmap parameter is null");
}
if (bitmap.isRecycled()) {
throw new IllegalArgumentException("imgBitmap is invalid because it's been recycled");
}
if (bitmap.getWidth() < 10 || bitmap.getHeight() < 10) {
throw new IllegalArgumentException("imgBitmap is invalid because it's smaller than 10 x 10");
}
}
/* JADX INFO: Access modifiers changed from: private */
public void a(Object obj, String str) {
if (obj == null) {
StringBuilder sb = new StringBuilder();
sb.append(str);
sb.append(" parameter is null");
throw new NullPointerException(sb.toString());
}
if (!obj.getClass().getSimpleName().equals("Integer") || ((Integer) obj).intValue() >= 0) {
return;
}
ErrorInfo errorInfo = ErrorInfo.KMC_GN_PARAM_NEGATIVE;
StringBuilder sb2 = new StringBuilder("'");
sb2.append(str);
sb2.append("' parameter is negative");
errorInfo.setErrCause(sb2.toString());
throw new KmcRuntimeException(errorInfo);
}
/* JADX INFO: Access modifiers changed from: private */
public void x() {
File file = this.cV;
boolean z = file != null && file.exists();
if (this.cX != null && !z() && !A()) {
throw new IllegalThreadStateException("internal BITMAP state is inconsistent with imageRepresentation property");
}
if (!z || y() || A()) {
return;
}
k.b(TAG, "Warning: imgFileExists && !isImgRepFile() && !isImgRepBoth()");
}
private ImageMimeType a(File file) {
ImageMimeType imageMimeType = ImageMimeType.MIMETYPE_UNKNOWN;
if (file != null) {
String fileExtensionFromUrl = MimeTypeMap.getFileExtensionFromUrl(Uri.fromFile(file).toString());
String mimeTypeFromExtension = MimeTypeMap.getSingleton().getMimeTypeFromExtension(fileExtensionFromUrl.toLowerCase());
if (mimeTypeFromExtension == null) {
if (gjJ.a((CharSequence) fileExtensionFromUrl, (CharSequence) "tif") || gjJ.a((CharSequence) fileExtensionFromUrl, (CharSequence) "tiff")) {
imageMimeType = ImageMimeType.MIMETYPE_TIFF;
}
} else if (mimeTypeFromExtension.equals("image/tiff")) {
imageMimeType = ImageMimeType.MIMETYPE_TIFF;
} else if (mimeTypeFromExtension.equals(ImageInfo.JPEG_MIME_TYPE)) {
imageMimeType = ImageMimeType.MIMETYPE_JPEG;
} else if (mimeTypeFromExtension.equals("image/png")) {
imageMimeType = ImageMimeType.MIMETYPE_PNG;
}
k.c(TAG, "getMimeTypeFromFile: fileExtension=".concat(String.valueOf(fileExtensionFromUrl)));
}
String str = TAG;
StringBuilder sb = new StringBuilder("getMimeTypeFromFile: imgMimeType=");
sb.append(imageMimeType.toString());
k.c(str, sb.toString());
return imageMimeType;
}
private FileIOEngine a(FileIOEngine fileIOEngine, b bVar) {
if (fileIOEngine == FileIOEngine.FILE_ENG_ANDROID) {
return (this.cW == ImageMimeType.MIMETYPE_JPEG || this.cW == ImageMimeType.MIMETYPE_PNG) ? FileIOEngine.FILE_ENG_ANDROID : FileIOEngine.FILE_ENG_KFIL;
}
if (fileIOEngine == FileIOEngine.FILE_ENG_KFIL && bVar == b.FILE_IO_READ) {
return (this.cW == ImageMimeType.MIMETYPE_JPEG || this.cW == ImageMimeType.MIMETYPE_TIFF) ? FileIOEngine.FILE_ENG_KFIL : FileIOEngine.FILE_ENG_ANDROID;
}
return FileIOEngine.FILE_ENG_KFIL;
}
/* JADX INFO: Access modifiers changed from: private */
public boolean y() {
return this.cY == ImageRep.IMAGE_REP_FILE;
}
/* JADX INFO: Access modifiers changed from: private */
public boolean z() {
return this.cY == ImageRep.IMAGE_REP_BITMAP;
}
/* JADX INFO: Access modifiers changed from: private */
public boolean A() {
return this.cY == ImageRep.IMAGE_REP_BOTH;
}
private boolean B() {
return this.cY == ImageRep.IMAGE_REP_NONE;
}
private boolean C() {
return this.dw == ImageFileRep.FILE_STORED;
}
private boolean D() {
return this.dw == ImageFileRep.FILE_BUFFERED;
}
private boolean E() {
return this.dw == ImageFileRep.FILE_NONE;
}
private boolean F() {
return this.du == OutputColor.BITDEPTH_COLOR && this.cW != ImageMimeType.MIMETYPE_TIFF;
}
private static boolean a(ErrorInfo errorInfo) {
int i = AnonymousClass1.bd[errorInfo.ordinal()];
return i == 1 || i == 2 || i == 3 || i == 4 || i == 5;
}
private static Exception b(ErrorInfo errorInfo) {
if (a(errorInfo)) {
return new KmcException(errorInfo);
}
return new KmcRuntimeException(errorInfo);
}
private void G() {
String[] b2;
Boolean bool = Boolean.FALSE;
int i = 0;
Float f = null;
Float f2 = null;
Float f3 = null;
Float f4 = null;
Boolean bool2 = bool;
for (String str : this.dh.split("[\\r\\n]+")) {
if (str.startsWith("GPS Latitude Reference:")) {
bool = Boolean.valueOf(str.contains(": N"));
i |= 1;
} else if (str.startsWith("GPS Latitude:")) {
String[] b3 = b(str.trim());
if (b3 != null) {
f = c(b3[0].trim());
f2 = Float.valueOf(c(b3[1].trim()).floatValue() / 60.0f);
i |= 2;
}
} else if (str.startsWith("GPS Longitude Reference:")) {
bool2 = Boolean.valueOf(str.contains(": W"));
i |= 4;
} else if (str.startsWith("GPS Longitude:") && (b2 = b(str)) != null) {
f3 = c(b2[0].trim());
f4 = Float.valueOf(c(b2[1].trim()).floatValue() / 60.0f);
i |= 8;
}
}
if (i == 15) {
this.dl = Float.valueOf(bool.booleanValue() ? f.floatValue() + f2.floatValue() : BitmapDescriptorFactory.HUE_RED - (f.floatValue() + f2.floatValue()));
this.dm = Float.valueOf(bool2.booleanValue() ? BitmapDescriptorFactory.HUE_RED - (f3.floatValue() + f4.floatValue()) : f4.floatValue() + f3.floatValue());
}
}
private void H() {
for (String str : this.dh.split("[\\r\\n]+")) {
if (str.startsWith("Subject Area: ")) {
String[] split = str.substring(14).split(", ");
try {
if (split.length == 4) {
int intValue = Integer.valueOf(split[2].trim()).intValue();
int intValue2 = Integer.valueOf(split[3].trim()).intValue();
int intValue3 = Integer.valueOf(split[0].trim()).intValue() - (intValue / 2);
int intValue4 = Integer.valueOf(split[1].trim()).intValue() - (intValue2 / 2);
setTargetFrame(new Rect(intValue3, intValue4, intValue + intValue3, intValue2 + intValue4));
}
} catch (NumberFormatException e) {
k.e(e);
}
}
}
}
private String[] b(String str) {
String[] split = str.split(":");
if (split.length != 2) {
return null;
}
String[] split2 = split[1].split(",");
if (split2.length == 3) {
return split2;
}
return null;
}
/* JADX WARN: Removed duplicated region for block: B:20:0x012d */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private com.kofax.kmc.kut.utilities.error.ErrorInfo a(com.kofax.kmc.ken.engines.data.Image.FileIOEngine r9, boolean r10, float r11) throws com.kofax.kmc.kut.utilities.error.KmcException, com.kofax.kmc.kut.utilities.error.KmcRuntimeException {
/*
Method dump skipped, instructions count: 346
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.kofax.kmc.ken.engines.data.Image.a(com.kofax.kmc.ken.engines.data.Image$FileIOEngine, boolean, float):com.kofax.kmc.kut.utilities.error.ErrorInfo");
}
/* JADX WARN: Removed duplicated region for block: B:11:0x0037 */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private com.kofax.kmc.kut.utilities.error.ErrorInfo a(com.kofax.kmc.ken.engines.data.Image.FileIOEngine r5, float r6) throws com.kofax.kmc.kut.utilities.error.KmcException, com.kofax.kmc.kut.utilities.error.KmcRuntimeException {
/*
r4 = this;
r0 = 1036831949(0x3dcccccd, float:0.1)
int r0 = (r6 > r0 ? 1 : (r6 == r0 ? 0 : -1))
if (r0 < 0) goto L8b
r0 = 1065353216(0x3f800000, float:1.0)
int r0 = (r6 > r0 ? 1 : (r6 == r0 ? 0 : -1))
if (r0 > 0) goto L8b
com.kofax.kmc.kut.utilities.error.ErrorInfo r0 = com.kofax.kmc.kut.utilities.error.ErrorInfo.KMC_SUCCESS
android.graphics.Bitmap r0 = r4.cX
if (r0 == 0) goto L16
com.kofax.kmc.kut.utilities.error.ErrorInfo r6 = com.kofax.kmc.kut.utilities.error.ErrorInfo.KMC_ED_IMAGELEAK
goto L1e
L16:
boolean r0 = r4.D()
if (r0 != 0) goto L21
com.kofax.kmc.kut.utilities.error.ErrorInfo r6 = com.kofax.kmc.kut.utilities.error.ErrorInfo.KMC_ED_NO_BUFFERED_IMAGE
L1e:
r0 = 0
r1 = r5
goto L33
L21:
com.kofax.kmc.ken.engines.data.Image$b r0 = com.kofax.kmc.ken.engines.data.Image.b.FILE_IO_READ
com.kofax.kmc.ken.engines.data.Image$FileIOEngine r0 = r4.a(r5, r0)
com.kofax.kmc.ken.engines.iplib.IpFileBuffer r1 = r4.dx
com.kofax.kmc.ken.engines.data.Image$KenBitmap r6 = a(r1, r0, r6)
com.kofax.kmc.kut.utilities.error.ErrorInfo r1 = r6.errInfo
r3 = r0
r0 = r6
r6 = r1
r1 = r3
L33:
com.kofax.kmc.kut.utilities.error.ErrorInfo r2 = com.kofax.kmc.kut.utilities.error.ErrorInfo.KMC_SUCCESS
if (r6 != r2) goto L68
android.graphics.Bitmap r2 = r0.bitmap
if (r2 == 0) goto L60
com.kofax.kmc.ken.engines.data.Image$ImageRep r2 = com.kofax.kmc.ken.engines.data.Image.ImageRep.IMAGE_REP_BOTH
r4.cY = r2
android.graphics.Bitmap r2 = r0.bitmap
r4.cX = r2
java.lang.Integer r0 = r0.mDpiX
r4.ds = r0
android.graphics.Bitmap r0 = r4.cX
int r0 = r0.getWidth()
java.lang.Integer r0 = java.lang.Integer.valueOf(r0)
r4.cZ = r0
android.graphics.Bitmap r0 = r4.cX
int r0 = r0.getHeight()
java.lang.Integer r0 = java.lang.Integer.valueOf(r0)
r4.da = r0
goto L68
L60:
com.kofax.kmc.kut.utilities.error.InternalError r5 = new com.kofax.kmc.kut.utilities.error.InternalError
java.lang.String r6 = "imageReadFromFileBuffer: kenBitmap.bitmap == null"
r5.<init>(r6)
throw r5
L68:
com.kofax.kmc.kut.utilities.error.ErrorInfo r0 = com.kofax.kmc.kut.utilities.error.ErrorInfo.KMC_SUCCESS
if (r6 == r0) goto L82
com.kofax.kmc.kut.utilities.error.ErrorInfo r0 = com.kofax.kmc.kut.utilities.error.ErrorInfo.KMC_ED_IMAGE_IS_SCALED
if (r6 == r0) goto L82
boolean r5 = a(r6)
if (r5 == 0) goto L7c
com.kofax.kmc.kut.utilities.error.KmcException r5 = new com.kofax.kmc.kut.utilities.error.KmcException
r5.<init>(r6)
throw r5
L7c:
com.kofax.kmc.kut.utilities.error.KmcRuntimeException r5 = new com.kofax.kmc.kut.utilities.error.KmcRuntimeException
r5.<init>(r6)
throw r5
L82:
com.kofax.kmc.kut.utilities.error.ErrorInfo r0 = com.kofax.kmc.kut.utilities.error.ErrorInfo.KMC_SUCCESS
if (r6 != r0) goto L8a
if (r1 == r5) goto L8a
com.kofax.kmc.kut.utilities.error.ErrorInfo r6 = com.kofax.kmc.kut.utilities.error.ErrorInfo.KMC_ED_ALTERNATE_FILEIO_ENGINE
L8a:
return r6
L8b:
com.kofax.kmc.kut.utilities.error.KmcRuntimeException r5 = new com.kofax.kmc.kut.utilities.error.KmcRuntimeException
com.kofax.kmc.kut.utilities.error.ErrorInfo r6 = com.kofax.kmc.kut.utilities.error.ErrorInfo.KMC_ED_IMAGE_INVALID_SCALING_FACTOR
r5.<init>(r6)
throw r5
*/
throw new UnsupportedOperationException("Method not decompiled: com.kofax.kmc.ken.engines.data.Image.a(com.kofax.kmc.ken.engines.data.Image$FileIOEngine, float):com.kofax.kmc.kut.utilities.error.ErrorInfo");
}
private Float c(String str) {
try {
if (str.split("/").length == 2) {
return Float.valueOf(Integer.parseInt(r4[0].trim()) / Integer.parseInt(r4[1].trim()));
}
} catch (NumberFormatException e) {
String str2 = TAG;
StringBuilder sb = new StringBuilder("getGPSValue: NumberFormatException = ");
sb.append(e.toString());
k.c(str2, sb.toString());
}
return Float.valueOf(BitmapDescriptorFactory.HUE_RED);
}
private void d(String str) {
try {
ImageService.ImageDimension imageDimension = ImageService.getImageDimension(str);
this.dc = Integer.valueOf(imageDimension.getWidth());
this.dd = Integer.valueOf(imageDimension.getHeight());
} catch (IOException e) {
ErrorInfo.KMC_ED_IMAGE_FILE_DIMENSIONS_ERROR.setErrCause(e.getMessage());
throw new KmcRuntimeException(ErrorInfo.KMC_ED_IMAGE_FILE_DIMENSIONS_ERROR);
}
}
private void a(IpFileBuffer ipFileBuffer) {
this.dc = Integer.valueOf(ipFileBuffer.mWidth);
this.dd = Integer.valueOf(ipFileBuffer.mHeight);
}
private void e(String str) {
this.dx = new IpFileBuffer(this.cW, this.du.getBitsPerPixel(), this.dt.intValue(), str);
}
private void a(ObjectOutputStream objectOutputStream) throws IOException {
a(objectOutputStream, this.cX);
}
private void a(ObjectOutputStream objectOutputStream, Bitmap bitmap) throws IOException {
a(objectOutputStream, com.kofax.mobile.sdk.ak.a.m(bitmap));
}
private void a(ObjectOutputStream objectOutputStream, byte[] bArr) throws IOException {
BitmapDataObject bitmapDataObject = new BitmapDataObject(this);
bitmapDataObject.imageByteArray = bArr;
objectOutputStream.writeObject(bitmapDataObject);
}
private void a(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
boolean z = this.cY == ImageRep.IMAGE_REP_BITMAP || this.cY == ImageRep.IMAGE_REP_BOTH;
boolean z2 = this.db.floatValue() != 1.0f;
try {
c(objectInputStream);
this.dw = ImageFileRep.FILE_NONE;
imageWriteToFileBuffer();
if (!z) {
imageClearBitmap();
} else if (z2) {
imageClearBitmap();
imageReadFromFileBuffer();
}
} catch (KmcException e) {
throw new IOException(e);
}
}
private void b(ObjectOutputStream objectOutputStream) throws IOException {
objectOutputStream.writeInt(this.dx.mIpFileType);
objectOutputStream.writeInt(this.dx.mBitDepth);
objectOutputStream.writeInt(this.dx.mJpegQuality);
objectOutputStream.writeObject(this.dx.mExifMetadataStr);
objectOutputStream.writeInt(this.dx.mWidth);
objectOutputStream.writeInt(this.dx.mHeight);
ByteBuffer imageFileBuffer = getImageFileBuffer();
byte[] bArr = new byte[imageFileBuffer.capacity()];
imageFileBuffer.get(bArr);
objectOutputStream.writeObject(bArr);
}
private void b(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
IpFileBuffer ipFileBuffer = new IpFileBuffer(objectInputStream.readInt(), objectInputStream.readInt(), objectInputStream.readInt(), (String) objectInputStream.readObject());
this.dx = ipFileBuffer;
ipFileBuffer.mWidth = objectInputStream.readInt();
this.dx.mHeight = objectInputStream.readInt();
ErrorInfo saveToFileBuffer = ImageService.saveToFileBuffer((byte[]) objectInputStream.readObject(), this.dx);
if (saveToFileBuffer != ErrorInfo.KMC_SUCCESS) {
throw new IOException(b(saveToFileBuffer));
}
}
private void writeObject(ObjectOutputStream objectOutputStream) throws IOException {
objectOutputStream.defaultWriteObject();
objectOutputStream.writeObject(Image.class.getName());
objectOutputStream.writeObject(KenVersion.getPackageVersion());
objectOutputStream.writeObject(getImageFilePath());
objectOutputStream.writeObject(this.cW);
objectOutputStream.writeObject(this.cY);
objectOutputStream.writeObject(this.cZ);
objectOutputStream.writeObject(this.da);
objectOutputStream.writeObject(this.db);
objectOutputStream.writeObject(this.dc);
objectOutputStream.writeObject(this.dd);
objectOutputStream.writeObject(this.de);
objectOutputStream.writeObject(this.df);
objectOutputStream.writeObject(this.dg);
objectOutputStream.writeObject(this.dh);
objectOutputStream.writeObject(this.di);
objectOutputStream.writeObject(this.dj);
objectOutputStream.writeObject(this.dk);
objectOutputStream.writeObject(this.dl);
objectOutputStream.writeObject(this.dm);
objectOutputStream.writeObject(this.dn);
objectOutputStream.writeObject(this.f0do);
objectOutputStream.writeObject(this.dp);
objectOutputStream.writeObject(this.dq);
objectOutputStream.writeObject(this.dr);
objectOutputStream.writeObject(this.ds);
objectOutputStream.writeObject(this.dt);
objectOutputStream.writeObject(this.du);
objectOutputStream.writeObject(this.dv);
objectOutputStream.writeObject(this.dw);
if (!B() || !E()) {
if (y() && C()) {
objectOutputStream.writeObject(a.IMAGE_REP_FILE_STORED);
} else if (y() && D()) {
objectOutputStream.writeObject(a.IMAGE_REP_FILE_BUFFERED);
b(objectOutputStream);
} else if (z() && E()) {
objectOutputStream.writeObject(a.IMAGE_REP_BITMAP_NONE);
a(objectOutputStream);
} else if (A() && C()) {
objectOutputStream.writeObject(a.IMAGE_REP_BOTH_STORED);
a(objectOutputStream);
} else if (A() && D()) {
objectOutputStream.writeObject(a.IMAGE_REP_BOTH_BUFFERED);
a(objectOutputStream);
b(objectOutputStream);
}
objectOutputStream.writeObject(this.dy);
objectOutputStream.writeObject(this.dA);
objectOutputStream.writeObject(this.dC);
}
objectOutputStream.writeObject(a.IMAGE_REP_NONE_NONE);
objectOutputStream.writeObject(this.dy);
objectOutputStream.writeObject(this.dA);
objectOutputStream.writeObject(this.dC);
}
private void c(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException {
this.cX = com.kofax.mobile.sdk.ak.a.j(((BitmapDataObject) objectInputStream.readObject()).imageByteArray);
}
private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException, KmcRuntimeException {
objectInputStream.defaultReadObject();
if (Image.class.getName().compareToIgnoreCase((String) objectInputStream.readObject()) == 0) {
String str = (String) objectInputStream.readObject();
if (SdkVersion.versionCompatible(KenVersion.getPackageVersion(), str).booleanValue()) {
setImageFilePath((String) objectInputStream.readObject());
this.cW = (ImageMimeType) objectInputStream.readObject();
this.cY = (ImageRep) objectInputStream.readObject();
this.cZ = (Integer) objectInputStream.readObject();
this.da = (Integer) objectInputStream.readObject();
this.db = (Float) objectInputStream.readObject();
this.dc = (Integer) objectInputStream.readObject();
this.dd = (Integer) objectInputStream.readObject();
this.de = (String) objectInputStream.readObject();
this.df = (String) objectInputStream.readObject();
this.dg = (String) objectInputStream.readObject();
this.dh = (String) objectInputStream.readObject();
this.di = (ImagePerfectionProfile) objectInputStream.readObject();
this.dj = (BasicSettingsProfile) objectInputStream.readObject();
this.dk = (QuickAnalysisFeedback) objectInputStream.readObject();
this.dl = (Float) objectInputStream.readObject();
this.dm = (Float) objectInputStream.readObject();
this.dn = (ArrayList) objectInputStream.readObject();
this.f0do = (ArrayList) objectInputStream.readObject();
this.dp = (Float) objectInputStream.readObject();
this.dq = (Float) objectInputStream.readObject();
this.dr = (String) objectInputStream.readObject();
this.ds = (Integer) objectInputStream.readObject();
this.dt = (Integer) objectInputStream.readObject();
this.du = (OutputColor) objectInputStream.readObject();
this.dv = (FileIOEngine) objectInputStream.readObject();
this.dw = (ImageFileRep) objectInputStream.readObject();
int i = AnonymousClass1.dE[((a) objectInputStream.readObject()).ordinal()];
if (i != 1) {
if (i == 2 || i == 3) {
c(objectInputStream);
} else if (i != 4) {
this.cX = null;
this.dx = null;
} else if (SdkVersion.compare(str, "3.3.0.0") >= 0) {
c(objectInputStream);
b(objectInputStream);
} else {
a(objectInputStream);
}
} else if (SdkVersion.compare(str, "3.3.0.0") >= 0) {
b(objectInputStream);
} else {
a(objectInputStream);
}
if (SdkVersion.compare(str, "2.4.0.0") >= 0) {
this.dy = (String) objectInputStream.readObject();
this.dA = (String) objectInputStream.readObject();
}
if (SdkVersion.compare(str, "3.1.0.0") >= 0) {
this.dC = (Rect) objectInputStream.readObject();
return;
}
return;
}
throw new KmcRuntimeException(ErrorInfo.KMC_GN_DESERIALIZE_VERSION_ERROR);
}
throw new KmcRuntimeException(ErrorInfo.KMC_GN_DESERIALIZE_OBJECT_ERROR);
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: com.kofax.kmc.ken.engines.data.Image$1, reason: invalid class name */
/* loaded from: classes3.dex */
public static /* synthetic */ class AnonymousClass1 {
static final int[] bd;
static final int[] dD;
static final int[] dE;
static {
int[] iArr = new int[a.values().length];
dE = iArr;
try {
iArr[a.IMAGE_REP_FILE_BUFFERED.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
dE[a.IMAGE_REP_BITMAP_NONE.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
dE[a.IMAGE_REP_BOTH_STORED.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
dE[a.IMAGE_REP_BOTH_BUFFERED.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
dE[a.IMAGE_REP_NONE_NONE.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
dE[a.IMAGE_REP_FILE_STORED.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
int[] iArr2 = new int[ErrorInfo.values().length];
bd = iArr2;
try {
iArr2[ErrorInfo.KMC_GN_FILE_NOT_FOUND.ordinal()] = 1;
} catch (NoSuchFieldError unused7) {
}
try {
bd[ErrorInfo.KMC_GN_OUT_OF_MEMORY.ordinal()] = 2;
} catch (NoSuchFieldError unused8) {
}
try {
bd[ErrorInfo.KMC_ED_FILE_STILL_REMAINS.ordinal()] = 3;
} catch (NoSuchFieldError unused9) {
}
try {
bd[ErrorInfo.KMC_ED_FILE_EXISTS.ordinal()] = 4;
} catch (NoSuchFieldError unused10) {
}
try {
bd[ErrorInfo.KMC_ED_IMAGELEAK.ordinal()] = 5;
} catch (NoSuchFieldError unused11) {
}
int[] iArr3 = new int[Bitmap.Config.values().length];
dD = iArr3;
try {
iArr3[Bitmap.Config.ALPHA_8.ordinal()] = 1;
} catch (NoSuchFieldError unused12) {
}
try {
dD[Bitmap.Config.ARGB_4444.ordinal()] = 2;
} catch (NoSuchFieldError unused13) {
}
try {
dD[Bitmap.Config.ARGB_8888.ordinal()] = 3;
} catch (NoSuchFieldError unused14) {
}
try {
dD[Bitmap.Config.RGB_565.ordinal()] = 4;
} catch (NoSuchFieldError unused15) {
}
}
}
public void setTargetFrame(Rect rect) {
this.dC = rect;
}
public void setImageTag(String str) {
this.de = str;
}
public void setImageOutputColor(OutputColor outputColor) {
this.du = outputColor;
}
public Rect getTargetFrame() {
return this.dC;
}
public String getImageTag() {
return this.de;
}
public String getImageSrcID() {
return this.dg;
}
public Float getImageRoll() {
return this.dq;
}
public ImageRep getImageRepresentation() {
return this.cY;
}
public QuickAnalysisFeedback getImageQuickAnalysisFeedBack() {
return this.dk;
}
public Float getImagePitch() {
return this.dp;
}
public OutputColor getImageOutputColor() {
return this.du;
}
public ImageMimeType getImageMimeType() {
return this.cW;
}
public String getImageMetaData() {
return this.dh;
}
public Float getImageLongitude() {
return this.dm;
}
public Float getImageLatitude() {
return this.dl;
}
public Integer getImageJpegQuality() {
return this.dt;
}
public String getImageID() {
return this.df;
}
public Integer getImageFileWidth() {
return this.dc;
}
public ImageFileRep getImageFileRep() {
return this.dw;
}
public Integer getImageFileHeight() {
return this.dd;
}
public Integer getImageDPI() {
return this.ds;
}
public String getImageCreateDateTime() {
return this.dr;
}
@Deprecated
public List<ImageClassificationResult> getImageClassifyResults() {
return this.f0do;
}
public Integer getImageBitmapWidth() {
return this.cZ;
}
public Float getImageBitmapScaling() {
return this.db;
}
public Integer getImageBitmapHeight() {
return this.da;
}
public Bitmap getImageBitmap() {
return this.cX;
}
public List<BarCodeResult> getImageBarCodes() {
return this.dn;
}
private void setImageMetaData(String str) {
this.dh = str;
}
}