350 lines
13 KiB
Java
350 lines
13 KiB
Java
|
package com.kofax.kmc.ken.engines.data;
|
||
|
|
||
|
import android.graphics.Bitmap;
|
||
|
import android.graphics.Point;
|
||
|
import com.kofax.BuildConfig;
|
||
|
import com.kofax.kmc.ken.engines.version.KenVersion;
|
||
|
import com.kofax.kmc.kut.utilities.SdkVersion;
|
||
|
import com.kofax.kmc.kut.utilities.error.ErrorInfo;
|
||
|
import com.kofax.kmc.kut.utilities.error.KmcException;
|
||
|
import com.kofax.kmc.kut.utilities.error.KmcRuntimeException;
|
||
|
import com.kofax.mobile.sdk._internal.k;
|
||
|
import com.kofax.mobile.sdk.ak.a;
|
||
|
import java.io.IOException;
|
||
|
import java.io.ObjectInputStream;
|
||
|
import java.io.ObjectOutputStream;
|
||
|
import java.io.Serializable;
|
||
|
import java.util.HashMap;
|
||
|
import java.util.Iterator;
|
||
|
import java.util.Map;
|
||
|
import o.gjJ;
|
||
|
import org.json.JSONException;
|
||
|
import org.json.JSONObject;
|
||
|
|
||
|
/* loaded from: classes3.dex */
|
||
|
public class QuickAnalysisFeedback implements Serializable, Cloneable {
|
||
|
private static int ex = 20;
|
||
|
private static final long serialVersionUID = -5200932471645846116L;
|
||
|
private String TAG = "QuickAnalysisFeedback";
|
||
|
private transient Point eA;
|
||
|
private transient Point eB;
|
||
|
private transient Point eC;
|
||
|
private transient Boolean em;
|
||
|
private transient Boolean en;
|
||
|
private transient Boolean eo;
|
||
|
private transient Boolean ep;
|
||
|
private transient Boolean eq;
|
||
|
private transient Boolean er;
|
||
|
private transient Boolean es;
|
||
|
private transient Boolean et;
|
||
|
private transient BoundingTetragon eu;
|
||
|
private transient String ev;
|
||
|
private transient Bitmap ew;
|
||
|
private transient Map<String, String> ey;
|
||
|
private transient Point ez;
|
||
|
|
||
|
public QuickAnalysisFeedback() {
|
||
|
Boolean bool = Boolean.FALSE;
|
||
|
this.em = bool;
|
||
|
this.eq = bool;
|
||
|
this.er = bool;
|
||
|
this.es = bool;
|
||
|
this.et = bool;
|
||
|
this.eu = null;
|
||
|
this.ev = new String();
|
||
|
this.ew = null;
|
||
|
this.ey = null;
|
||
|
this.ez = null;
|
||
|
this.eA = null;
|
||
|
this.eB = null;
|
||
|
this.eC = null;
|
||
|
if (this.eu == null) {
|
||
|
this.eu = new BoundingTetragon();
|
||
|
this.ez = new Point();
|
||
|
this.eA = new Point();
|
||
|
this.eB = new Point();
|
||
|
this.eC = new Point();
|
||
|
}
|
||
|
I();
|
||
|
}
|
||
|
|
||
|
/* renamed from: clone, reason: merged with bridge method [inline-methods] */
|
||
|
public QuickAnalysisFeedback m270clone() {
|
||
|
k.c(this.TAG, "Enter:: QuickAnalysisFeedback clone");
|
||
|
try {
|
||
|
return (QuickAnalysisFeedback) super.clone();
|
||
|
} catch (CloneNotSupportedException unused) {
|
||
|
throw new InternalError("QuickAnalysisFeedback: unexpected clone not supported exception");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public boolean isBlurry() {
|
||
|
return this.en.booleanValue();
|
||
|
}
|
||
|
|
||
|
public boolean isGlareDetected() {
|
||
|
return this.em.booleanValue();
|
||
|
}
|
||
|
|
||
|
public boolean isOversaturated() {
|
||
|
return this.eo.booleanValue();
|
||
|
}
|
||
|
|
||
|
public boolean isUndersaturated() {
|
||
|
return this.ep.booleanValue();
|
||
|
}
|
||
|
|
||
|
public boolean isOverlySkewed() {
|
||
|
return this.eq.booleanValue();
|
||
|
}
|
||
|
|
||
|
public boolean isShadowed() {
|
||
|
return this.er.booleanValue();
|
||
|
}
|
||
|
|
||
|
public boolean isMissingBorders() {
|
||
|
return this.es.booleanValue();
|
||
|
}
|
||
|
|
||
|
public boolean isLowContrastBackground() {
|
||
|
return this.et.booleanValue();
|
||
|
}
|
||
|
|
||
|
public BoundingTetragon getTetragonCorners() {
|
||
|
BoundingTetragon boundingTetragon = this.eu;
|
||
|
if (boundingTetragon != null) {
|
||
|
return boundingTetragon.m268clone();
|
||
|
}
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
public Map<String, String> a(JSONObject jSONObject, Map<String, String> map) throws JSONException {
|
||
|
String string;
|
||
|
Iterator<String> keys = jSONObject.keys();
|
||
|
while (keys.hasNext()) {
|
||
|
String next = keys.next();
|
||
|
try {
|
||
|
String str = this.TAG;
|
||
|
StringBuilder sb = new StringBuilder();
|
||
|
sb.append("Key in recursion :: ");
|
||
|
sb.append(next);
|
||
|
k.b(str, sb.toString());
|
||
|
a(jSONObject.getJSONObject(next), map);
|
||
|
string = null;
|
||
|
} catch (Exception unused) {
|
||
|
string = jSONObject.getString(next);
|
||
|
}
|
||
|
if (string != null) {
|
||
|
map.put(next, string);
|
||
|
}
|
||
|
}
|
||
|
return map;
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
public void I() {
|
||
|
Boolean bool = Boolean.FALSE;
|
||
|
this.en = bool;
|
||
|
this.eo = bool;
|
||
|
this.ep = bool;
|
||
|
this.em = bool;
|
||
|
this.et = bool;
|
||
|
this.er = bool;
|
||
|
this.eq = bool;
|
||
|
this.es = bool;
|
||
|
this.ev = "";
|
||
|
Bitmap bitmap = this.ew;
|
||
|
if (bitmap != null) {
|
||
|
bitmap.recycle();
|
||
|
this.ew = null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
public void a(Map<String, String> map) {
|
||
|
if (map != null) {
|
||
|
b(map);
|
||
|
String str = map.get("Blurry");
|
||
|
if (str != null && str.equals("true")) {
|
||
|
this.en = Boolean.TRUE;
|
||
|
}
|
||
|
String str2 = map.get("Oversaturated");
|
||
|
if (str2 != null && str2.equals("true")) {
|
||
|
this.eo = Boolean.TRUE;
|
||
|
}
|
||
|
String str3 = map.get("Undersaturated");
|
||
|
if (str3 != null && str3.equals("true")) {
|
||
|
this.ep = Boolean.TRUE;
|
||
|
}
|
||
|
String str4 = map.get("GlareDetected");
|
||
|
if (str4 != null && str4.equals("true")) {
|
||
|
this.em = Boolean.TRUE;
|
||
|
}
|
||
|
String str5 = map.get("Max Deviation from 90 in degrees");
|
||
|
String str6 = map.get("Skew Angle");
|
||
|
if (Math.abs(str5 != null ? (int) Float.parseFloat(str5) : 0) > ex) {
|
||
|
this.eq = Boolean.TRUE;
|
||
|
} else {
|
||
|
if (Math.abs(str6 != null ? (int) Float.parseFloat(str6) : 0) > ex) {
|
||
|
this.eq = Boolean.TRUE;
|
||
|
}
|
||
|
}
|
||
|
k.b(this.TAG, "Blurry Val ==> ".concat(String.valueOf(str)));
|
||
|
k.b(this.TAG, "Oversaturated Val ==> ".concat(String.valueOf(str2)));
|
||
|
k.b(this.TAG, "Undersaturated Val ==> ".concat(String.valueOf(str3)));
|
||
|
k.b(this.TAG, "GlareDetected Val ==> ".concat(String.valueOf(str4)));
|
||
|
k.b(this.TAG, "Max Deviation Val ==> ".concat(String.valueOf(str5)));
|
||
|
k.b(this.TAG, "Skew Angle Val ==> ".concat(String.valueOf(str6)));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void b(Map<String, String> map) {
|
||
|
this.ez.set((int) Float.parseFloat(map.get("TLx")), (int) Float.parseFloat(map.get("TLy")));
|
||
|
this.eu.setTopLeft(this.ez);
|
||
|
this.eA.set((int) Float.parseFloat(map.get("TRx")), (int) Float.parseFloat(map.get("TRy")));
|
||
|
this.eu.setTopRight(this.eA);
|
||
|
this.eB.set((int) Float.parseFloat(map.get("BLx")), (int) Float.parseFloat(map.get("BLy")));
|
||
|
this.eu.setBottomLeft(this.eB);
|
||
|
this.eC.set((int) Float.parseFloat(map.get("BRx")), (int) Float.parseFloat(map.get("BRy")));
|
||
|
this.eu.setBottomRight(this.eC);
|
||
|
}
|
||
|
|
||
|
private void writeObject(ObjectOutputStream objectOutputStream) throws IOException {
|
||
|
objectOutputStream.defaultWriteObject();
|
||
|
objectOutputStream.writeObject(QuickAnalysisFeedback.class.getName());
|
||
|
objectOutputStream.writeObject(KenVersion.getPackageVersion());
|
||
|
objectOutputStream.writeObject(this.em);
|
||
|
objectOutputStream.writeObject(this.en);
|
||
|
objectOutputStream.writeObject(this.eo);
|
||
|
objectOutputStream.writeObject(this.ep);
|
||
|
objectOutputStream.writeObject(this.eu);
|
||
|
objectOutputStream.writeObject(this.ev);
|
||
|
objectOutputStream.writeObject(this.ey);
|
||
|
objectOutputStream.writeObject(Integer.valueOf(this.ez.x));
|
||
|
objectOutputStream.writeObject(Integer.valueOf(this.ez.y));
|
||
|
objectOutputStream.writeObject(Integer.valueOf(this.eA.x));
|
||
|
objectOutputStream.writeObject(Integer.valueOf(this.eA.y));
|
||
|
objectOutputStream.writeObject(Integer.valueOf(this.eB.x));
|
||
|
objectOutputStream.writeObject(Integer.valueOf(this.eB.y));
|
||
|
objectOutputStream.writeObject(Integer.valueOf(this.eC.x));
|
||
|
objectOutputStream.writeObject(Integer.valueOf(this.eC.y));
|
||
|
a.b(objectOutputStream, this.ew);
|
||
|
objectOutputStream.writeObject(this.eq);
|
||
|
objectOutputStream.writeObject(this.er);
|
||
|
objectOutputStream.writeObject(this.es);
|
||
|
objectOutputStream.writeObject(this.et);
|
||
|
}
|
||
|
|
||
|
private void readObject(ObjectInputStream objectInputStream) throws IOException, ClassNotFoundException, KmcRuntimeException {
|
||
|
objectInputStream.defaultReadObject();
|
||
|
if (QuickAnalysisFeedback.class.getName().compareToIgnoreCase((String) objectInputStream.readObject()) == 0) {
|
||
|
String str = (String) objectInputStream.readObject();
|
||
|
if (SdkVersion.versionCompatible(KenVersion.getPackageVersion(), str).booleanValue()) {
|
||
|
this.em = (Boolean) objectInputStream.readObject();
|
||
|
this.en = (Boolean) objectInputStream.readObject();
|
||
|
this.eo = (Boolean) objectInputStream.readObject();
|
||
|
this.ep = (Boolean) objectInputStream.readObject();
|
||
|
this.eu = (BoundingTetragon) objectInputStream.readObject();
|
||
|
this.ev = (String) objectInputStream.readObject();
|
||
|
this.ey = (Map) objectInputStream.readObject();
|
||
|
this.ez = new Point(((Integer) objectInputStream.readObject()).intValue(), ((Integer) objectInputStream.readObject()).intValue());
|
||
|
this.eA = new Point(((Integer) objectInputStream.readObject()).intValue(), ((Integer) objectInputStream.readObject()).intValue());
|
||
|
this.eB = new Point(((Integer) objectInputStream.readObject()).intValue(), ((Integer) objectInputStream.readObject()).intValue());
|
||
|
this.eC = new Point(((Integer) objectInputStream.readObject()).intValue(), ((Integer) objectInputStream.readObject()).intValue());
|
||
|
if (SdkVersion.compare(str, "2.4.0.0") >= 0) {
|
||
|
this.ew = a.d(objectInputStream);
|
||
|
}
|
||
|
if (SdkVersion.compare(str, "3.2.0.0") >= 0) {
|
||
|
this.eq = (Boolean) objectInputStream.readObject();
|
||
|
this.er = (Boolean) objectInputStream.readObject();
|
||
|
this.es = (Boolean) objectInputStream.readObject();
|
||
|
this.et = (Boolean) objectInputStream.readObject();
|
||
|
return;
|
||
|
}
|
||
|
return;
|
||
|
}
|
||
|
throw new KmcRuntimeException(ErrorInfo.KMC_GN_DESERIALIZE_VERSION_ERROR);
|
||
|
}
|
||
|
throw new KmcRuntimeException(ErrorInfo.KMC_GN_DESERIALIZE_OBJECT_ERROR);
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes3.dex */
|
||
|
public class FriendQAF {
|
||
|
final QuickAnalysisFeedback eD;
|
||
|
|
||
|
public FriendQAF(QuickAnalysisFeedback quickAnalysisFeedback, String str) throws KmcException {
|
||
|
this.eD = quickAnalysisFeedback;
|
||
|
if (!gjJ.c((CharSequence) str, (CharSequence) BuildConfig.APPLICATION_ID)) {
|
||
|
throw new KmcException(ErrorInfo.KMC_GN_UNSUPPORTED_OPERATION);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void setBlurry(boolean z) {
|
||
|
this.eD.en = Boolean.valueOf(z);
|
||
|
}
|
||
|
|
||
|
public void setOversaturated(boolean z) {
|
||
|
this.eD.eo = Boolean.valueOf(z);
|
||
|
}
|
||
|
|
||
|
public void setUndersaturated(boolean z) {
|
||
|
this.eD.ep = Boolean.valueOf(z);
|
||
|
}
|
||
|
|
||
|
public void setIsShadowed(boolean z) {
|
||
|
this.eD.er = Boolean.valueOf(z);
|
||
|
}
|
||
|
|
||
|
public void setGlareDetected(boolean z) {
|
||
|
this.eD.em = Boolean.valueOf(z);
|
||
|
}
|
||
|
|
||
|
public void setOverlySkewed(boolean z) {
|
||
|
this.eD.eq = Boolean.valueOf(z);
|
||
|
}
|
||
|
|
||
|
public void setMissingBorder(boolean z) {
|
||
|
this.eD.es = Boolean.valueOf(z);
|
||
|
}
|
||
|
|
||
|
public void setLowContrastBackground(boolean z) {
|
||
|
this.eD.et = Boolean.valueOf(z);
|
||
|
}
|
||
|
|
||
|
public void setMetadata(String str) {
|
||
|
k.c(this.eD.TAG, "metadata from EVRS = ".concat(String.valueOf(str)));
|
||
|
this.eD.I();
|
||
|
this.eD.ev = str;
|
||
|
if (this.eD.ev != null) {
|
||
|
try {
|
||
|
JSONObject jSONObject = new JSONObject(str);
|
||
|
if (this.eD.ey == null) {
|
||
|
this.eD.ey = new HashMap();
|
||
|
} else {
|
||
|
this.eD.ey.clear();
|
||
|
}
|
||
|
QuickAnalysisFeedback quickAnalysisFeedback = this.eD;
|
||
|
quickAnalysisFeedback.a(jSONObject, (Map<String, String>) quickAnalysisFeedback.ey);
|
||
|
QuickAnalysisFeedback quickAnalysisFeedback2 = this.eD;
|
||
|
quickAnalysisFeedback2.a((Map<String, String>) quickAnalysisFeedback2.ey);
|
||
|
} catch (JSONException unused) {
|
||
|
k.e(this.eD.TAG, "Exception:: ");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public String getMetadata() {
|
||
|
return this.eD.ev;
|
||
|
}
|
||
|
|
||
|
public void setViewBoundariesImage(Bitmap bitmap) {
|
||
|
this.eD.ew = bitmap;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public Bitmap getViewBoundariesImage() {
|
||
|
return this.ew;
|
||
|
}
|
||
|
}
|