package com.facetec.sdk; import android.content.Context; import android.media.AudioTrack; import android.os.Process; import android.os.SystemClock; import android.provider.Settings; import android.text.TextUtils; import android.util.TypedValue; import android.view.View; import android.view.ViewConfiguration; import android.widget.ExpandableListView; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.common.base.Ascii; import java.io.File; import java.io.FileNotFoundException; import java.lang.reflect.Method; import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Iterator; import net.sf.scuba.smartcards.ISOFileInfo; import org.bouncycastle.i18n.LocalizedMessage; import org.json.JSONObject; /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public final class as { private static final byte[] $$a = null; private static final int $$b = 0; private static int $10; private static int $11; private static char[] a; private static boolean b; private static String c; private static HashMap d; private static String e; private static int f; private static boolean g; private static int h; private static boolean i; private static int j; /* JADX WARN: Removed duplicated region for block: B:10:0x0025 */ /* JADX WARN: Removed duplicated region for block: B:7:0x001d */ /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:10:0x0025 -> B:4:0x002c). Please report as a decompilation issue!!! */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ private static void l(int r6, byte r7, byte r8, java.lang.Object[] r9) { /* int r8 = r8 << 1 int r7 = r7 * 3 int r7 = 3 - r7 byte[] r0 = com.facetec.sdk.as.$$a int r1 = r8 + 1 byte[] r1 = new byte[r1] r2 = 0 if (r0 != 0) goto L13 r6 = r7 r4 = r8 r3 = r2 goto L2c L13: int r6 = r6 + 112 r3 = r2 L16: int r7 = r7 + 1 byte r4 = (byte) r6 r1[r3] = r4 if (r3 != r8) goto L25 java.lang.String r6 = new java.lang.String r6.(r1, r2) r9[r2] = r6 return L25: r4 = r0[r7] int r3 = r3 + 1 r5 = r7 r7 = r6 r6 = r5 L2c: int r7 = r7 - r4 r5 = r7 r7 = r6 r6 = r5 goto L16 */ throw new UnsupportedOperationException("Method not decompiled: com.facetec.sdk.as.l(int, byte, byte, java.lang.Object[]):void"); } as() { } static { init$0(); $10 = 0; $11 = 1; f = 0; j = 1; d(); c = ""; b = false; e = ""; f = (j + 73) % 128; } /* JADX INFO: Access modifiers changed from: package-private */ public static void b(Context context) { f = (j + 111) % 128; if (b) { return; } d = new HashMap<>(); FaceTecSessionStatus[] values = FaceTecSessionStatus.values(); int length = values.length; int i2 = 0; while (i2 < length) { f = (j + 29) % 128; d.put(c(values[i2]), 0); i2++; f = (j + 101) % 128; } d.put("FC", 1); c = context.getPackageName(); e = Settings.Secure.getString(context.getContentResolver(), "android_id"); a(context); b = true; } /* JADX INFO: Access modifiers changed from: package-private */ public static void d(FaceTecSessionStatus faceTecSessionStatus, Context context) { f = (j + 109) % 128; if (b) { String c2 = c(faceTecSessionStatus); if (d.get(c2) != null) { HashMap hashMap = d; hashMap.put(c2, Integer.valueOf(hashMap.get(c2).intValue() + 1)); } else { f = (j + 27) % 128; d.put(c2, 0); } d(context); } } /* JADX INFO: Access modifiers changed from: package-private */ public static void c(Context context) { int i2 = f + 69; j = i2 % 128; if (i2 % 2 == 0) { throw null; } if (b) { if (d.get("FC") != null) { HashMap hashMap = d; hashMap.put("FC", Integer.valueOf(hashMap.get("FC").intValue() + 1)); } else { j = (f + 17) % 128; d.put("FC", 1); } d(context); } } /* JADX INFO: Access modifiers changed from: package-private */ public static String c() { j = (f + 35) % 128; String obj = d.toString(); j = (f + 119) % 128; return obj; } /* JADX INFO: Access modifiers changed from: package-private */ public static int e(Context context) { f = (j + 19) % 128; if (!d.containsKey("FC")) { f = (j + 99) % 128; c(context); } return d.get("FC").intValue(); } private static void a(Context context) { int i2 = f + 37; j = i2 % 128; try { if (i2 % 2 != 0) { h(context); int i3 = f + 113; j = i3 % 128; if (i3 % 2 == 0) { throw null; } return; } h(context); throw new NullPointerException(); } catch (FileNotFoundException unused) { } catch (Exception e2) { av.e(e2.getMessage()); e2.getStackTrace(); } } private static void d(final Context context) { int i2 = f + 31; j = i2 % 128; if (i2 % 2 == 0) { throw null; } if (context == null) { return; } cy.c(new Runnable(context) { // from class: com.facetec.sdk.as$$ExternalSyntheticLambda0 public final Context f$0; @Override // java.lang.Runnable public final void run() { as.i(this.f$0); } { this.f$0 = context; } }); f = (j + 65) % 128; } /* JADX INFO: Access modifiers changed from: private */ public static /* synthetic */ void i(Context context) { int i2 = j + 25; f = i2 % 128; try { if (i2 % 2 == 0) { c(context.getCacheDir()); int i3 = f + 95; j = i3 % 128; if (i3 % 2 == 0) { throw null; } return; } c(context.getCacheDir()); throw null; } catch (Exception e2) { av.e(e2.getMessage()); } } private static void h(Context context) throws Exception { byte[] a2 = bh.a(new File(context.getCacheDir(), e()), a()); JSONObject jSONObject = new JSONObject(new String(a2, 0, a2.length, StandardCharsets.UTF_8)); d.clear(); JSONObject optJSONObject = jSONObject.optJSONObject("history"); if (optJSONObject != null) { Iterator keys = optJSONObject.keys(); while (keys.hasNext()) { int i2 = j + 125; f = i2 % 128; if (i2 % 2 == 0) { String next = keys.next(); d.put(next, Integer.valueOf(optJSONObject.optInt(next))); } else { String next2 = keys.next(); d.put(next2, Integer.valueOf(optJSONObject.optInt(next2))); throw null; } } } j = (f + 123) % 128; } private static void c(File file) throws Exception { JSONObject jSONObject = new JSONObject(); jSONObject.put("history", new JSONObject(d)); Object[] objArr = new Object[1]; k((ViewConfiguration.getEdgeSlop() >> 16) + 127, null, null, "\u0081", objArr); jSONObject.put(((String) objArr[0]).intern(), av.c(16, 128)); bh.d(new File(file, e()), a(), jSONObject.toString().getBytes(StandardCharsets.UTF_8)); int i2 = f + 57; j = i2 % 128; if (i2 % 2 == 0) { throw null; } } private static String e() throws Exception { StringBuilder sb = new StringBuilder(); sb.append(c); sb.append(e); sb.append("history_file_internal"); String e2 = bl.e(sb.toString()); int i2 = j + 3; f = i2 % 128; if (i2 % 2 == 0) { return e2; } throw null; } private static byte[] a() throws Exception { StringBuilder sb = new StringBuilder(); sb.append(c); sb.append(e); sb.append("history_key"); byte[] d2 = bl.d(sb.toString()); int i2 = f + 55; j = i2 % 128; if (i2 % 2 != 0) { return d2; } throw null; } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: com.facetec.sdk.as$3, reason: invalid class name */ /* loaded from: classes.dex */ public static final /* synthetic */ class AnonymousClass3 { static final int[] c; static { int[] iArr = new int[FaceTecSessionStatus.values().length]; c = iArr; try { iArr[FaceTecSessionStatus.NON_PRODUCTION_MODE_KEY_INVALID.ordinal()] = 1; } catch (NoSuchFieldError unused) { } try { c[FaceTecSessionStatus.NON_PRODUCTION_MODE_NETWORK_REQUIRED.ordinal()] = 2; } catch (NoSuchFieldError unused2) { } try { c[FaceTecSessionStatus.USER_CANCELLED.ordinal()] = 3; } catch (NoSuchFieldError unused3) { } try { c[FaceTecSessionStatus.USER_CANCELLED_VIA_HARDWARE_BUTTON.ordinal()] = 4; } catch (NoSuchFieldError unused4) { } try { c[FaceTecSessionStatus.SESSION_COMPLETED_SUCCESSFULLY.ordinal()] = 5; } catch (NoSuchFieldError unused5) { } try { c[FaceTecSessionStatus.SESSION_UNSUCCESSFUL.ordinal()] = 6; } catch (NoSuchFieldError unused6) { } try { c[FaceTecSessionStatus.CAMERA_PERMISSION_DENIED.ordinal()] = 7; } catch (NoSuchFieldError unused7) { } try { c[FaceTecSessionStatus.ENCRYPTION_KEY_INVALID.ordinal()] = 8; } catch (NoSuchFieldError unused8) { } try { c[FaceTecSessionStatus.TIMEOUT.ordinal()] = 9; } catch (NoSuchFieldError unused9) { } try { c[FaceTecSessionStatus.CONTEXT_SWITCH.ordinal()] = 10; } catch (NoSuchFieldError unused10) { } try { c[FaceTecSessionStatus.CAMERA_INITIALIZATION_ISSUE.ordinal()] = 11; } catch (NoSuchFieldError unused11) { } try { c[FaceTecSessionStatus.UNKNOWN_INTERNAL_ERROR.ordinal()] = 12; } catch (NoSuchFieldError unused12) { } try { c[FaceTecSessionStatus.LANDSCAPE_MODE_NOT_ALLOWED.ordinal()] = 13; } catch (NoSuchFieldError unused13) { } try { c[FaceTecSessionStatus.REVERSE_PORTRAIT_NOT_ALLOWED.ordinal()] = 14; } catch (NoSuchFieldError unused14) { } try { c[FaceTecSessionStatus.LOCKED_OUT.ordinal()] = 15; } catch (NoSuchFieldError unused15) { } try { c[FaceTecSessionStatus.MISSING_GUIDANCE_IMAGES.ordinal()] = 16; } catch (NoSuchFieldError unused16) { } } } private static String c(FaceTecSessionStatus faceTecSessionStatus) { int i2 = f + 53; j = i2 % 128; if (i2 % 2 == 0) { int i3 = AnonymousClass3.c[faceTecSessionStatus.ordinal()]; throw null; } switch (AnonymousClass3.c[faceTecSessionStatus.ordinal()]) { case 1: int i4 = j + 37; f = i4 % 128; if (i4 % 2 == 0) { return "LI"; } throw null; case 2: return "DM"; case 3: return "UC"; case 4: return "CH"; case 5: return "PS"; case 6: return "NP"; case 7: return "CD"; case 8: int i5 = f + 123; j = i5 % 128; if (i5 % 2 != 0) { return "EI"; } throw null; case 9: return "TO"; case 10: return "CS"; case 11: return "CE"; case 12: return "IE"; case 13: return "LA"; case 14: return "RP"; case 15: return "UL"; case 16: return "GI"; default: return "NA"; } } private static void k(int i2, String str, int[] iArr, String str2, Object[] objArr) { String str3 = str2; byte[] bArr = str3; if (str3 != null) { byte[] bytes = str3.getBytes(LocalizedMessage.DEFAULT_ENCODING); $11 = ($10 + 73) % 128; bArr = bytes; } byte[] bArr2 = bArr; char[] charArray = str != null ? str.toCharArray() : str; gi giVar = new gi(); char[] cArr = a; int i3 = 2; if (cArr != null) { int length = cArr.length; char[] cArr2 = new char[length]; int i4 = 0; while (i4 < length) { int i5 = $11 + 89; $10 = i5 % 128; if (i5 % i3 != 0) { try { Object[] objArr2 = {Integer.valueOf(cArr[i4])}; Object obj = bo.s.get(1952646647); if (obj == null) { Class cls = (Class) bo.e(((Process.getThreadPriority(0) + 20) >> 6) + 1091, (char) (2832 - (ViewConfiguration.getMaximumFlingVelocity() >> 16)), 23 - (ViewConfiguration.getKeyRepeatDelay() >> 16)); Object[] objArr3 = new Object[1]; l(0, (byte) 0, (byte) 0, objArr3); obj = cls.getMethod((String) objArr3[0], Integer.TYPE); bo.s.put(1952646647, obj); } cArr2[i4] = ((Character) ((Method) obj).invoke(null, objArr2)).charValue(); } catch (Throwable th) { Throwable cause = th.getCause(); if (cause == null) { throw th; } throw cause; } } else { try { Object[] objArr4 = {Integer.valueOf(cArr[i4])}; Object obj2 = bo.s.get(1952646647); if (obj2 == null) { Class cls2 = (Class) bo.e(1092 - (SystemClock.elapsedRealtimeNanos() > 0L ? 1 : (SystemClock.elapsedRealtimeNanos() == 0L ? 0 : -1)), (char) (2833 - (SystemClock.currentThreadTimeMillis() > (-1L) ? 1 : (SystemClock.currentThreadTimeMillis() == (-1L) ? 0 : -1))), (ViewConfiguration.getScrollDefaultDelay() >> 16) + 23); Object[] objArr5 = new Object[1]; l(0, (byte) 0, (byte) 0, objArr5); obj2 = cls2.getMethod((String) objArr5[0], Integer.TYPE); bo.s.put(1952646647, obj2); } cArr2[i4] = ((Character) ((Method) obj2).invoke(null, objArr4)).charValue(); i4++; } catch (Throwable th2) { Throwable cause2 = th2.getCause(); if (cause2 == null) { throw th2; } throw cause2; } } i3 = 2; } cArr = cArr2; } try { Object[] objArr6 = {Integer.valueOf(h)}; Object obj3 = bo.s.get(-1943762483); if (obj3 == null) { Class cls3 = (Class) bo.e(1570 - ExpandableListView.getPackedPositionGroup(0L), (char) (11060 - (ViewConfiguration.getEdgeSlop() >> 16)), 23 - (ViewConfiguration.getScrollDefaultDelay() >> 16)); Object[] objArr7 = new Object[1]; l(7, (byte) 0, (byte) 0, objArr7); obj3 = cls3.getMethod((String) objArr7[0], Integer.TYPE); bo.s.put(-1943762483, obj3); } int intValue = ((Integer) ((Method) obj3).invoke(null, objArr6)).intValue(); if (!g) { if (!i) { giVar.d = iArr.length; char[] cArr3 = new char[giVar.d]; giVar.e = 0; while (giVar.e < giVar.d) { $11 = ($10 + 119) % 128; cArr3[giVar.e] = (char) (cArr[iArr[(giVar.d - 1) - giVar.e] - i2] - intValue); giVar.e++; $10 = ($11 + 11) % 128; } objArr[0] = new String(cArr3); return; } $11 = ($10 + 15) % 128; giVar.d = charArray.length; char[] cArr4 = new char[giVar.d]; giVar.e = 0; while (giVar.e < giVar.d) { cArr4[giVar.e] = (char) (cArr[charArray[(giVar.d - 1) - giVar.e] - i2] - intValue); try { Object[] objArr8 = {giVar, giVar}; Object obj4 = bo.s.get(655191618); if (obj4 == null) { Class cls4 = (Class) bo.e(218 - View.MeasureSpec.getMode(0), (char) View.resolveSizeAndState(0, 0, 0), (ViewConfiguration.getDoubleTapTimeout() >> 16) + 24); Object[] objArr9 = new Object[1]; l((byte) ($$b & 29), (byte) 0, (byte) 0, objArr9); obj4 = cls4.getMethod((String) objArr9[0], Object.class, Object.class); bo.s.put(655191618, obj4); } ((Method) obj4).invoke(null, objArr8); } catch (Throwable th3) { Throwable cause3 = th3.getCause(); if (cause3 == null) { throw th3; } throw cause3; } } objArr[0] = new String(cArr4); return; } giVar.d = bArr2.length; char[] cArr5 = new char[giVar.d]; giVar.e = 0; while (giVar.e < giVar.d) { int i6 = $10 + 113; $11 = i6 % 128; if (i6 % 2 == 0) { cArr5[giVar.e] = (char) (cArr[bArr2[giVar.d - giVar.e] << i2] + intValue); try { Object[] objArr10 = {giVar, giVar}; Object obj5 = bo.s.get(655191618); if (obj5 == null) { Class cls5 = (Class) bo.e(219 - (AudioTrack.getMaxVolume() > BitmapDescriptorFactory.HUE_RED ? 1 : (AudioTrack.getMaxVolume() == BitmapDescriptorFactory.HUE_RED ? 0 : -1)), (char) (ViewConfiguration.getEdgeSlop() >> 16), 24 - View.MeasureSpec.getSize(0)); Object[] objArr11 = new Object[1]; l((byte) ($$b & 29), (byte) 0, (byte) 0, objArr11); obj5 = cls5.getMethod((String) objArr11[0], Object.class, Object.class); bo.s.put(655191618, obj5); } ((Method) obj5).invoke(null, objArr10); } catch (Throwable th4) { Throwable cause4 = th4.getCause(); if (cause4 == null) { throw th4; } throw cause4; } } else { cArr5[giVar.e] = (char) (cArr[bArr2[(giVar.d - 1) - giVar.e] + i2] - intValue); try { Object[] objArr12 = {giVar, giVar}; Object obj6 = bo.s.get(655191618); if (obj6 == null) { Class cls6 = (Class) bo.e((ViewConfiguration.getFadingEdgeLength() >> 16) + 218, (char) ((-1) - TextUtils.indexOf((CharSequence) "", '0', 0, 0)), 24 - (TypedValue.complexToFraction(0, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED) > BitmapDescriptorFactory.HUE_RED ? 1 : (TypedValue.complexToFraction(0, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED) == BitmapDescriptorFactory.HUE_RED ? 0 : -1))); Object[] objArr13 = new Object[1]; l((byte) ($$b & 29), (byte) 0, (byte) 0, objArr13); obj6 = cls6.getMethod((String) objArr13[0], Object.class, Object.class); bo.s.put(655191618, obj6); } ((Method) obj6).invoke(null, objArr12); } catch (Throwable th5) { Throwable cause5 = th5.getCause(); if (cause5 == null) { throw th5; } throw cause5; } } } objArr[0] = new String(cArr5); } catch (Throwable th6) { Throwable cause6 = th6.getCause(); if (cause6 == null) { throw th6; } throw cause6; } } static void init$0() { $$a = new byte[]{13, Ascii.EM, ISOFileInfo.DATA_BYTES2, ISOFileInfo.LCS_BYTE}; $$b = 107; } static void d() { h = -2056769014; i = true; a = new char[]{12920}; g = true; } }