package com.kofax.mobile.sdk.g; import com.kofax.kmc.ken.engines.data.ImageSource; import com.kofax.kmc.kut.utilities.appstats.AppStatsClientEventLogger; import com.kofax.kmc.kut.utilities.appstats.dao.AppStatsDao; import com.kofax.kmc.kut.utilities.appstats.dao.ImageDao; import com.kofax.kmc.kut.utilities.appstats.dao.ImageProcessEventDao; import com.kofax.kmc.kut.utilities.appstats.type.AppStatsDsOpType; import com.kofax.kmc.kut.utilities.appstats.type.AppStatsEventIDType; import com.kofax.kmc.kut.utilities.appstats.type.AppStatsInstanceType; import com.kofax.mobile.sdk._internal.k; import java.util.ArrayList; import java.util.Date; /* loaded from: classes3.dex */ public class g extends a { private static final String TAG = "g"; ImageProcessEventDao xR; public g(AppStatsInstanceType appStatsInstanceType) { super(appStatsInstanceType); } public g(String str, AppStatsInstanceType appStatsInstanceType, boolean z) { super(str, appStatsInstanceType, z); } public void a(AppStatsEventIDType appStatsEventIDType, c cVar) { a(appStatsEventIDType, new AppStatsClientEventLogger(this, cVar) { // from class: com.kofax.mobile.sdk.g.g.1 final c xS; final g xT; { this.xT = this; this.xS = cVar; } @Override // com.kofax.kmc.kut.utilities.appstats.AppStatsClientEventLogger public void logEvent(AppStatsEventIDType appStatsEventIDType2) { int i = AnonymousClass2.xL[appStatsEventIDType2.ordinal()]; if (i == 1) { this.xT.a(appStatsEventIDType2); this.xT.a(this.xS); } else if (i == 2) { this.xT.a(appStatsEventIDType2); this.xT.b(this.xS); } } }); } /* renamed from: com.kofax.mobile.sdk.g.g$2, reason: invalid class name */ /* loaded from: classes3.dex */ static /* synthetic */ class AnonymousClass2 { static final int[] xL; static { int[] iArr = new int[AppStatsEventIDType.values().length]; xL = iArr; try { iArr[AppStatsEventIDType.APP_STATS_IMG_PROCESSING_START_EVENT.ordinal()] = 1; } catch (NoSuchFieldError unused) { } try { xL[AppStatsEventIDType.APP_STATS_IMG_PROCESSING_STOP_EVENT.ordinal()] = 2; } catch (NoSuchFieldError unused2) { } } } protected void a(c cVar) { ImageProcessEventDao imageProcessEventDao = new ImageProcessEventDao(); this.xR = imageProcessEventDao; imageProcessEventDao.setInstanceId(this.rG); this.xR.setSourceImage(cVar.iF()); this.xR.setStartTime(this.asFriend.currentEventTime()); ImageProcessEventDao imageProcessEventDao2 = this.xR; imageProcessEventDao2.setSessionKey(imageProcessEventDao2.getAppStatsSessionKey()); this.xR.setDsOperation(AppStatsDsOpType.APP_STATS_DS_INSERT); a(new AppStatsDao[]{this.xR}); } /* JADX INFO: Access modifiers changed from: private */ public void b(c cVar) { ArrayList arrayList = new ArrayList(); ImageProcessEventDao imageProcessEventDao = this.xR; if (imageProcessEventDao == null) { k.c(TAG, "imageprocessor dao property is null, start event was never fired (app issue)"); return; } ImageProcessEventDao imageProcessEventDao2 = (ImageProcessEventDao) imageProcessEventDao.mo279clone(); this.xR = imageProcessEventDao2; imageProcessEventDao2.setEndTime(System.currentTimeMillis()); String str = TAG; StringBuilder sb = new StringBuilder("endTme = "); sb.append(System.currentTimeMillis()); sb.append(new Date(System.currentTimeMillis()).toString()); k.c(str, sb.toString()); this.xR.setResultCode(cVar.getResultCode()); this.xR.setProcessingProfile(cVar.iD()); this.xR.setProcessedImage(cVar.iC()); this.xR.setSourceImage(cVar.iF()); ImageProcessEventDao imageProcessEventDao3 = this.xR; imageProcessEventDao3.setSessionKey(imageProcessEventDao3.getAppStatsSessionKey()); this.xR.setDsOperation(AppStatsDsOpType.APP_STATS_DS_UPDATE); if (cVar.iC() != null) { StringBuilder sb2 = new StringBuilder("ImageProcessing failed or cancelled : "); sb2.append(cVar.iC()); k.c(str, sb2.toString()); ImageDao imageDao = new ImageDao(); imageDao.setId(cVar.iC()); imageDao.setEventTime(this.asFriend.currentEventTime()); imageDao.setDsOperation(AppStatsDsOpType.APP_STATS_DS_UPDATE); imageDao.setFileSize(cVar.iE()); imageDao.setSource(ImageSource.PROCESSOR); imageDao.setDocumentId(cVar.getDocumentID()); imageDao.setSessionKey(this.xR.getAppStatsSessionKey()); arrayList.add(imageDao); } arrayList.add(this.xR); a((AppStatsDao[]) arrayList.toArray(new AppStatsDao[arrayList.size()])); this.xR = null; } }