what-the-bank/sources/com/kofax/kmc/kut/utilities/appstats/AppStatsEnvSettings.java

226 lines
7.3 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.kofax.kmc.kut.utilities.appstats;
import android.os.Build;
import android.telephony.TelephonyManager;
import com.airbnb.deeplinkdispatch.base.MatchIndex;
import com.kofax.kmc.kut.utilities.AppContextProvider;
import com.kofax.kmc.kut.utilities.SdkVersion;
import com.kofax.kmc.kut.utilities.appstats.dao.EnvironmentEventDao;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
import java.util.UUID;
import o.gjJ;
/* loaded from: classes3.dex */
public class AppStatsEnvSettings {
private final String pn;
private final String po;
private String pp;
private String pq;
private String pr;
private String ps;
private String pt;
private String pu;
private String pv;
private String pw;
private String px;
private String py;
public AppStatsEnvSettings(boolean z) {
this.pn = "unknown memory size";
this.po = "Android";
this.pp = "";
this.pq = "";
this.pr = "";
this.ps = "";
this.pt = "";
this.pu = "";
this.pv = "";
this.pw = "";
this.px = "";
this.py = "";
if (z) {
getEnvManufacturer(true);
getEnvModel(true);
getEnvMemorySize(true);
getEnvOsVersion(true);
getEnvLanguage(true);
getEnvSdkVersion(true);
getEnvTimeZone(true);
getEnvCarrier(true);
getEnvOsName(true);
}
}
public AppStatsEnvSettings(EnvironmentEventDao environmentEventDao) {
this.pn = "unknown memory size";
this.po = "Android";
this.pp = "";
this.pq = "";
this.pr = "";
this.ps = "";
this.pt = "";
this.pu = "";
this.pv = "";
this.pw = "";
this.px = "";
this.py = "";
this.pp = environmentEventDao.getDeviceID();
this.pq = environmentEventDao.getManufacturer();
this.pr = environmentEventDao.getModel();
this.ps = environmentEventDao.getMemory();
this.pt = environmentEventDao.getOsVersion();
this.pu = environmentEventDao.getLanguage();
this.pv = environmentEventDao.getSdkVersion();
this.pw = environmentEventDao.getTimeZone();
this.px = environmentEventDao.getCarrier();
this.py = environmentEventDao.getOsName();
}
public String getEnvDeviceID(boolean z) {
if (z) {
this.pp = UUID.randomUUID().toString();
}
return this.pp;
}
public String getEnvManufacturer(boolean z) {
if (z) {
StringBuilder sb = new StringBuilder();
sb.append(Character.toUpperCase(Build.MANUFACTURER.charAt(0)));
sb.append(Build.MANUFACTURER.substring(1));
this.pq = sb.toString();
}
return this.pq;
}
public String getEnvModel(boolean z) {
String obj;
if (z) {
StringBuilder sb = new StringBuilder();
sb.append(Character.toUpperCase(Build.MANUFACTURER.charAt(0)));
sb.append(Build.MANUFACTURER.substring(1));
String obj2 = sb.toString();
if (gjJ.d((CharSequence) Build.MODEL, (CharSequence) obj2)) {
obj = Build.MODEL;
} else {
StringBuilder sb2 = new StringBuilder();
sb2.append(obj2);
sb2.append(" ");
sb2.append(Build.MODEL);
obj = sb2.toString();
}
this.pr = obj;
}
return this.pr;
}
public String getEnvMemorySize(boolean z) {
if (z) {
try {
this.ps = aP();
} catch (IOException unused) {
this.pr = "unknown memory size";
}
}
return this.ps;
}
public String getEnvOsVersion(boolean z) {
if (z) {
this.pt = Build.VERSION.RELEASE;
}
return this.pt;
}
public String getEnvLanguage(boolean z) {
if (z) {
this.pu = Locale.getDefault().toString();
}
return this.pu;
}
public String getEnvSdkVersion(boolean z) {
if (z) {
this.pv = SdkVersion.getSdkVersion();
}
return this.pv;
}
public String getEnvTimeZone(boolean z) {
if (z) {
this.pw = TimeZone.getDefault().getDisplayName(TimeZone.getDefault().inDaylightTime(new Date(System.currentTimeMillis())), 0);
}
return this.pw;
}
public String getEnvCarrier(boolean z) {
if (z) {
this.px = ((TelephonyManager) AppContextProvider.getContext().getSystemService("phone")).getNetworkOperatorName();
}
return this.px;
}
public boolean equals(Object obj) {
if (obj == null || getClass() != obj.getClass()) {
return false;
}
AppStatsEnvSettings appStatsEnvSettings = (AppStatsEnvSettings) obj;
return bothNullOrEqual(this.pp, appStatsEnvSettings.getEnvDeviceID(false)) && bothNullOrEqual(this.pq, appStatsEnvSettings.getEnvManufacturer(false)) && bothNullOrEqual(this.pr, appStatsEnvSettings.getEnvModel(false)) && bothNullOrEqual(this.ps, appStatsEnvSettings.getEnvMemorySize(false)) && bothNullOrEqual(this.pt, appStatsEnvSettings.getEnvOsVersion(false)) && bothNullOrEqual(this.pu, appStatsEnvSettings.getEnvLanguage(false)) && bothNullOrEqual(this.pv, appStatsEnvSettings.getEnvSdkVersion(false)) && bothNullOrEqual(this.pw, appStatsEnvSettings.getEnvTimeZone(false)) && bothNullOrEqual(this.px, appStatsEnvSettings.getEnvCarrier(false)) && bothNullOrEqual(this.py, appStatsEnvSettings.getEnvOsName(false));
}
public boolean bothNullOrEqual(Object obj, Object obj2) {
if (obj == null) {
return obj2 == null;
}
return obj.equals(obj2);
}
private static String aP() throws IOException {
Throwable th;
RandomAccessFile randomAccessFile;
try {
randomAccessFile = new RandomAccessFile("/proc/meminfo", MatchIndex.ROOT_VALUE);
try {
String readLine = randomAccessFile.readLine();
String[] split = readLine.split("\\s+");
if (split != null) {
readLine = split.length > 1 ? split[1] : split[0];
if (split.length > 2 && gjJ.d((CharSequence) split[2], (CharSequence) "kB")) {
StringBuilder sb = new StringBuilder();
sb.append(readLine);
sb.append(" ");
sb.append(split[2]);
readLine = sb.toString();
}
}
randomAccessFile.close();
return readLine;
} catch (Throwable th2) {
th = th2;
if (randomAccessFile != null) {
randomAccessFile.close();
}
throw th;
}
} catch (Throwable th3) {
th = th3;
randomAccessFile = null;
}
}
public void setEnvDeviceID(String str) {
this.pp = str;
}
public String getEnvOsName(boolean z) {
if (z) {
this.py = "Android";
}
return this.py;
}
}