package com.kofax.mobile.sdk.f; import com.kofax.kmc.kut.utilities.appstats.type.AppStatsEventIDType; import com.kofax.kmc.kut.utilities.appstats.type.AppStatsInstanceType; import com.kofax.kmc.kut.utilities.error.ErrorInfo; import com.kofax.kmc.kut.utilities.error.KmcRuntimeException; import com.kofax.mobile.sdk._internal.IBus; import com.kofax.mobile.sdk._internal.impl.event.ImageCapturedBusEvent; import com.kofax.mobile.sdk._internal.impl.event.aa; import com.kofax.mobile.sdk._internal.impl.event.ad; import com.kofax.mobile.sdk._internal.impl.event.ap; import com.kofax.mobile.sdk._internal.impl.event.av; import com.kofax.mobile.sdk._internal.impl.event.aw; import o.InterfaceC13006fNs; import o.InterfaceC13391fZD; /* loaded from: classes3.dex */ public class j { private IBus _bus; private final String xj; private com.kofax.mobile.sdk.g.h xk; private com.kofax.mobile.sdk.g.i xl; private boolean xm; private boolean xn; private boolean xo; private AppStatsEventIDType xp; private boolean xq; @InterfaceC13391fZD public j(IBus iBus) { String iu = com.kofax.mobile.sdk.g.a.iu(); this.xj = iu; this.xk = new com.kofax.mobile.sdk.g.h(iu, AppStatsInstanceType.INST_TYPE_IMAGE_CAPTURE, false); this.xl = new com.kofax.mobile.sdk.g.i(iu, AppStatsInstanceType.INST_TYPE_IMAGE_CAPTURE, false); this.xm = false; this.xo = false; this._bus = iBus; iBus.register(this); } @InterfaceC13006fNs public void a(av avVar) { if (this.xm) { throw new KmcRuntimeException(ErrorInfo.KMC_GN_SESSION_CREATE_ERROR); } this.xk.iv(); this.xl.R(this.xk.getInstanceId()); this.xm = true; } @InterfaceC13006fNs public void a(aw awVar) { if (!this.xm) { throw new KmcRuntimeException(ErrorInfo.KMC_GN_SESSION_DISMISS_ERROR); } this.xk.iw(); this.xm = false; } @InterfaceC13006fNs public void a(ad adVar) { AppStatsEventIDType appStatsEventIDType = adVar.IL ? AppStatsEventIDType.APP_STATS_IMG_EXP_CAPTURE_EVENT : AppStatsEventIDType.APP_STATS_IMG_FORCE_CAPTURE_EVENT; this.xk.g(1); this.xk.b(appStatsEventIDType); this.xp = appStatsEventIDType; this.xq = true; } @InterfaceC13006fNs public void a(ImageCapturedBusEvent imageCapturedBusEvent) { this.xk.g(1); if (this.xq) { this.xk.a(this.xp, imageCapturedBusEvent.image.getImageID()); return; } AppStatsEventIDType appStatsEventIDType = AppStatsEventIDType.APP_STATS_IMG_CAPTURE_EVENT; this.xp = appStatsEventIDType; this.xk.a(appStatsEventIDType, imageCapturedBusEvent.image.getImageID()); this.xq = false; } @InterfaceC13006fNs public void b(ap apVar) { boolean z = this.xo; boolean z2 = apVar.Jf; if (z != z2) { try { this.xk.g(z2 ? 1 : 0); this.xk.b(AppStatsEventIDType.APP_STATS_IMG_CAPTURE_PAGEDETECT); } finally { this.xo = z2; } } } @InterfaceC13006fNs public void onFocusChangedEvent(aa aaVar) { boolean z = this.xn; boolean z2 = aaVar.II; if (z != z2) { try { this.xk.g(z2 ? 1 : 0); this.xk.b(AppStatsEventIDType.APP_STATS_IMG_CAPTURE_FOCUS); } finally { this.xn = z2; } } } }