what-the-bank/sources/com/kofax/mobile/sdk/aa/f.java

254 lines
8.8 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.kofax.mobile.sdk.aa;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import com.kofax.kmc.kut.utilities.AppContextProvider;
import com.kofax.kmc.kut.utilities.CertificateValidatorListener;
import com.kofax.kmc.kut.utilities.Licensing;
import com.kofax.kmc.kut.utilities.async.TaskRunner;
import com.kofax.kmc.kut.utilities.error.ErrorInfo;
import com.kofax.kmc.kut.utilities.error.NullPointerException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.CopyOnWriteArrayList;
/* loaded from: classes3.dex */
public class f {
private static final int Tk = 10;
private static final int Tl = 110;
private static final int Tm = 210;
private static final int Tn = 108;
private static final List<Licensing.VolumeLicenseEventListener> To = new CopyOnWriteArrayList();
private static Licensing.VolumeLicenseResultData Tp = null;
private static Licensing.VolumeLicenseFailureData Tq = null;
private static final String Tr = "SDKDATA_SERVER";
private static final String Ts = "SDKDATA_SERVER_TYPE";
private static final String Tt = "SDKDATA1";
private static final String Tu = "SDKDATA_TOT1";
private static final int Tv = -1;
static TaskRunner aZ;
static long bb;
static CertificateValidatorListener certificateValidatorListener;
public static ErrorInfo setMobileSDKLicenseServer(String str, Licensing.LicenseServerType licenseServerType) {
ErrorInfo errorInfo = ErrorInfo.KMC_SUCCESS;
a(new c(str, licenseServerType));
return errorInfo;
}
private static SharedPreferences qN() {
return PreferenceManager.getDefaultSharedPreferences(AppContextProvider.getContext());
}
private static c qO() {
SharedPreferences qN = qN();
Licensing.LicenseServerType licenseServerType = null;
String string = qN.getString(Tr, null);
int i = qN.getInt(Ts, -1);
if (e.Th.get(Licensing.LicenseServerType.RTTI.name()).intValue() == i) {
licenseServerType = Licensing.LicenseServerType.RTTI;
} else if (e.Th.get(Licensing.LicenseServerType.TotalAgility.name()).intValue() == i) {
licenseServerType = Licensing.LicenseServerType.TotalAgility;
}
return new c(string, licenseServerType);
}
private static void a(c cVar) {
SharedPreferences.Editor edit = qN().edit();
if (cVar.SW == null) {
edit.remove(Tr);
} else {
edit.putString(Tr, cVar.SW);
}
if (cVar.SX == null) {
edit.remove(Ts);
} else {
edit.putInt(Ts, e.Th.get(cVar.SX.name()).intValue());
}
edit.apply();
}
public static void acquireVolumeLicenses(Licensing.LicenseType licenseType, int i) {
int i2;
if (licenseType == null) {
a(ErrorInfo.KMC_UT_LICENSING_NULL_LICENSE_TYPE, 0, (Licensing.LicenseType) null);
return;
}
if (!c(licenseType)) {
a(ErrorInfo.KMC_UT_LICENSING_NOT_VOLUME_LICENSE, 0, licenseType);
return;
}
if (!Licensing.isSdkLicensed(licenseType)) {
a(ErrorInfo.KMC_UT_LICENSING_FEATURE_NOT_LICENSED, 0, licenseType);
return;
}
c qO = qO();
if (qO.SW == null) {
a(ErrorInfo.KMC_UT_LICENSING_NULL_LICENSE_SERVER, 0, licenseType);
return;
}
if (qO.SX == null) {
a(ErrorInfo.KMC_UT_LICENSING_NULL_LICENSE_SERVER_TYPE, 0, licenseType);
return;
}
String obj = UUID.randomUUID().toString();
int i3 = licenseType == Licensing.LicenseType.ID_EXTRACTION ? 110 : 0;
StringBuilder sb = new StringBuilder();
sb.append(qO.SW);
if (qO.SX == Licensing.LicenseServerType.RTTI) {
sb.append("/api/License");
i2 = Tm;
} else {
sb.append("/MobileServices/Lic/?sessionId=0");
i2 = 108;
}
b bVar = new b();
bVar.SU = obj;
ArrayList arrayList = new ArrayList();
a aVar = new a();
aVar.SR = i3;
aVar.SS = i;
arrayList.add(aVar);
a aVar2 = new a();
aVar2.SR = i2;
aVar2.SS = i;
arrayList.add(aVar2);
bVar.ST = arrayList;
bVar.SV = b(arrayList, obj);
a(sb.toString(), bVar, licenseType);
}
public static int getRemainingLicenseCount(Licensing.LicenseType licenseType) {
int b;
c qO = qO();
if (qO.SW == null || qO.SX == null || !c(licenseType) || !Licensing.isSdkLicensed(licenseType) || (b = b(licenseType) + 10) < 0) {
return 0;
}
return b;
}
public static void decrementRemainingLicenseCount(Licensing.LicenseType licenseType) {
a(licenseType, -1);
a(licenseType);
int b = b(licenseType);
if (b < 0) {
acquireVolumeLicenses(licenseType, -b);
}
}
public static void a(Licensing.LicenseType licenseType) {
String str = licenseType == Licensing.LicenseType.ID_EXTRACTION ? Tu : null;
if (str != null) {
SharedPreferences qN = qN();
int i = qN.getInt(str, 0);
SharedPreferences.Editor edit = qN.edit();
edit.putInt(str, i + 1);
edit.apply();
}
}
public static void a(Licensing.LicenseType licenseType, int i) {
int b = b(licenseType) + i;
if (b < -10) {
b = -10;
}
b(licenseType, b);
}
private static int b(Licensing.LicenseType licenseType) {
String str = licenseType == Licensing.LicenseType.ID_EXTRACTION ? Tt : null;
if (str != null) {
return qN().getInt(str, 0);
}
return -10;
}
private static void b(Licensing.LicenseType licenseType, int i) {
String str = licenseType == Licensing.LicenseType.ID_EXTRACTION ? Tt : null;
if (str != null) {
SharedPreferences.Editor edit = qN().edit();
edit.putInt(str, i);
edit.apply();
}
}
private static TaskRunner m() {
if (aZ == null) {
aZ = new TaskRunner(1);
}
return aZ;
}
private static void a(String str, b bVar, Licensing.LicenseType licenseType) {
g gVar = new g();
gVar.url = str;
gVar.Tw = bVar;
gVar.Tx = "PUT";
TaskRunner m = m();
h hVar = new h(gVar);
hVar.TG = bVar.SU;
hVar.licenseType = licenseType;
aZ.addOnTaskCompletedListener(hVar, gVar, false);
bb = m.submit(gVar);
}
private static String b(List<a> list, String str) {
StringBuilder sb = new StringBuilder();
for (a aVar : list) {
sb.append(aVar.SR);
sb.append(aVar.SS);
}
sb.append(str);
String aE = e.aE(sb.toString());
StringBuilder sb2 = new StringBuilder();
sb2.append(aE);
sb2.append("8C261B3A-125D-4EC2-990D-33AA824A6890");
return e.aE(sb2.toString());
}
private static boolean c(Licensing.LicenseType licenseType) {
return licenseType == Licensing.LicenseType.ID_EXTRACTION;
}
public static void addVolumeLicenseEventListener(Licensing.VolumeLicenseEventListener volumeLicenseEventListener) {
if (volumeLicenseEventListener == null) {
throw new NullPointerException("");
}
List<Licensing.VolumeLicenseEventListener> list = To;
if (list.contains(volumeLicenseEventListener)) {
return;
}
list.add(volumeLicenseEventListener);
}
public static void removeVolumeLicenseEventListener(Licensing.VolumeLicenseEventListener volumeLicenseEventListener) {
if (volumeLicenseEventListener != null) {
To.remove(volumeLicenseEventListener);
}
}
/* JADX INFO: Access modifiers changed from: package-private */
public static void a(ErrorInfo errorInfo, int i, Licensing.LicenseType licenseType) {
if (errorInfo == ErrorInfo.KMC_SUCCESS) {
Tp = new Licensing.VolumeLicenseResultData(errorInfo, i, licenseType);
Iterator<Licensing.VolumeLicenseEventListener> it = To.iterator();
while (it.hasNext()) {
it.next().licenseOperationSucceeded(Tp);
}
return;
}
Tp = null;
Tq = new Licensing.VolumeLicenseFailureData(errorInfo, licenseType);
Iterator<Licensing.VolumeLicenseEventListener> it2 = To.iterator();
while (it2.hasNext()) {
it2.next().licenseOperationFailed(Tq);
}
}
public static void setCertificateValidatorListener(CertificateValidatorListener certificateValidatorListener2) {
certificateValidatorListener = certificateValidatorListener2;
}
}