package com.kofax.mobile.sdk.aa; import com.kofax.kmc.kut.utilities.Licensing; import com.kofax.kmc.kut.utilities.LicensingVolume; import com.kofax.kmc.kut.utilities.async.TaskRunner; import com.kofax.kmc.kut.utilities.error.ErrorInfo; import com.kofax.mobile.sdk._internal.k; /* loaded from: classes3.dex */ class h implements TaskRunner.TaskCompletedListener { private static final String TA = "unitsConsumed"; private static final String TAG = "h"; private static final String TB = "unitsRequested"; private static final String TC = "licenseToken"; private static final int TD = -1; private static final String Ty = "licenseResultArray"; private static final String Tz = "licenseID"; private final g TF; public String TG; public Licensing.LicenseType licenseType; public h(g gVar) { this.TF = gVar; } @Override // com.kofax.kmc.kut.utilities.async.TaskRunner.TaskCompletedListener public void onTaskCompleted(TaskRunner.TaskCompletedEvent taskCompletedEvent) { f.aZ.removeOnTaskCompletedListener(this, this.TF); long taskID = taskCompletedEvent.getTaskID(); String str = TAG; StringBuilder sb = new StringBuilder("Task "); sb.append(taskID); sb.append(" completed."); k.c(str, sb.toString()); ErrorInfo taskError = taskCompletedEvent.getTaskError(); if (taskError == ErrorInfo.KMC_SUCCESS) { k.c(str, "No Task Error. Good."); if (f.bb != taskID) { StringBuilder sb2 = new StringBuilder("Unexpected: Task "); sb2.append(f.bb); sb2.append(" was running."); k.c(str, sb2.toString()); } } else { StringBuilder sb3 = new StringBuilder("Task Error: "); sb3.append(taskError.toString()); k.c(str, sb3.toString()); } f.bb = 0L; LicensingVolume.LicenseResults licenseResults = (LicensingVolume.LicenseResults) taskCompletedEvent.getTaskReturnValue(); if (licenseResults.errorInfo != ErrorInfo.KMC_SUCCESS) { f.a(licenseResults.errorInfo, 0, this.licenseType); } else { a(licenseResults, this.TG, this.licenseType); } } /* JADX WARN: Removed duplicated region for block: B:25:0x00aa */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ private void a(com.kofax.kmc.kut.utilities.LicensingVolume.LicenseResults r17, java.lang.String r18, com.kofax.kmc.kut.utilities.Licensing.LicenseType r19) { /* r16 = this; r1 = r19 com.kofax.kmc.kut.utilities.error.ErrorInfo r2 = com.kofax.kmc.kut.utilities.error.ErrorInfo.KMC_SUCCESS java.lang.StringBuilder r3 = new java.lang.StringBuilder r3.() r4 = 0 r5 = 0 org.json.JSONObject r0 = new org.json.JSONObject // Catch: org.json.JSONException -> L76 r6 = r17 java.lang.String r6 = r6.result // Catch: org.json.JSONException -> L76 r0.(r6) // Catch: org.json.JSONException -> L76 java.lang.String r6 = "licenseToken" java.lang.String r5 = r0.getString(r6) // Catch: org.json.JSONException -> L76 java.lang.String r6 = "licenseResultArray" org.json.JSONArray r0 = r0.getJSONArray(r6) // Catch: org.json.JSONException -> L76 r6 = r4 r7 = r6 L22: int r8 = r0.length() // Catch: org.json.JSONException -> L70 if (r7 >= r8) goto L86 org.json.JSONObject r8 = r0.getJSONObject(r7) // Catch: org.json.JSONException -> L70 java.lang.String r9 = "licenseID" java.lang.String r9 = r8.getString(r9) // Catch: org.json.JSONException -> L70 r3.append(r9) // Catch: org.json.JSONException -> L70 java.lang.String r10 = "unitsConsumed" java.lang.String r10 = r8.getString(r10) // Catch: org.json.JSONException -> L70 java.lang.String r11 = "unitsRequested" java.lang.String r8 = r8.getString(r11) // Catch: org.json.JSONException -> L70 r3.append(r8) // Catch: org.json.JSONException -> L70 int r10 = java.lang.Integer.parseInt(r10) // Catch: org.json.JSONException -> L70 r11 = -1 if (r10 != r11) goto L66 java.lang.String r12 = com.kofax.mobile.sdk.aa.h.TAG // Catch: org.json.JSONException -> L70 java.lang.StringBuilder r13 = new java.lang.StringBuilder // Catch: org.json.JSONException -> L70 r13.() // Catch: org.json.JSONException -> L70 java.lang.String r14 = "license ID " r13.append(r14) // Catch: org.json.JSONException -> L70 r13.append(r9) // Catch: org.json.JSONException -> L70 java.lang.String r9 = " not found" r13.append(r9) // Catch: org.json.JSONException -> L70 java.lang.String r9 = r13.toString() // Catch: org.json.JSONException -> L70 com.kofax.mobile.sdk._internal.k.c(r12, r9) // Catch: org.json.JSONException -> L70 L66: int r6 = java.lang.Integer.parseInt(r8) // Catch: org.json.JSONException -> L70 if (r4 == r11) goto L6d r4 = r10 L6d: int r7 = r7 + 1 goto L22 L70: r0 = move-exception r15 = r5 r5 = r4 r4 = r6 r6 = r15 goto L79 L76: r0 = move-exception r6 = r5 r5 = r4 L79: java.lang.String r7 = com.kofax.mobile.sdk.aa.h.TAG java.lang.String r0 = r0.getMessage() com.kofax.mobile.sdk._internal.k.e(r7, r0) r15 = r6 r6 = r4 r4 = r5 r5 = r15 L86: java.lang.String r0 = r3.toString() r3 = r16 r7 = r18 java.lang.String r0 = r3.H(r0, r7) if (r5 == 0) goto L9f boolean r0 = r5.equals(r0) if (r0 == 0) goto L9f if (r4 == r6) goto La8 com.kofax.kmc.kut.utilities.error.ErrorInfo r2 = com.kofax.kmc.kut.utilities.error.ErrorInfo.KMC_UT_OUT_OF_VOLUME_LICENSE goto La8 L9f: java.lang.String r0 = com.kofax.mobile.sdk.aa.h.TAG java.lang.String r2 = "license token does not match" com.kofax.mobile.sdk._internal.k.c(r0, r2) com.kofax.kmc.kut.utilities.error.ErrorInfo r2 = com.kofax.kmc.kut.utilities.error.ErrorInfo.KMC_UT_LICENSING_INVALID_SERVER_RESPONSE La8: if (r4 <= 0) goto Lad com.kofax.mobile.sdk.aa.f.a(r1, r4) Lad: com.kofax.mobile.sdk.aa.f.a(r2, r4, r1) return */ throw new UnsupportedOperationException("Method not decompiled: com.kofax.mobile.sdk.aa.h.a(com.kofax.kmc.kut.utilities.LicensingVolume$LicenseResults, java.lang.String, com.kofax.kmc.kut.utilities.Licensing$LicenseType):void"); } private String H(String str, String str2) { StringBuilder sb = new StringBuilder(); sb.append(str); sb.append(str2); String aE = e.aE(sb.toString()); StringBuilder sb2 = new StringBuilder(); sb2.append(aE); sb2.append("CA10BF68-FD0D-4217-AF1D-8A0711ED39D7"); return e.aE(sb2.toString()); } }