package com.huawei.hms.framework.common; import android.graphics.Color; import android.graphics.drawable.Drawable; import android.media.AudioTrack; import android.text.TextUtils; import android.util.Log; import android.view.Gravity; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; import android.view.ViewConfiguration; import android.widget.ExpandableListView; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import java.io.IOException; import java.lang.reflect.Method; import java.util.Arrays; import java.util.IllegalFormatException; import net.sf.scuba.smartcards.ISO7816; import net.sf.scuba.smartcards.ISOFileInfo; import o.C3614bBe; import o.xzZ; import org.json.JSONException; /* loaded from: classes2.dex */ public class Logger { private static final boolean DEBUG = false; private static final int MAX_STACK_DEEP_LENGTH = 20; private static final int MAX_STACK_DEEP_LENGTH_NORMAL = 8; private static final String SPLIT = "|"; private static final String TAG = "NetworkKit_Logger"; private static final String TAG_NETWORKKIT_PRE = "NetworkKit_"; private static final String TAG_NETWORK_SDK_PRE = "NetworkSdk_"; private static boolean a = false; private static int b = 0; private static int c = 0; private static boolean d = false; private static char[] e = null; private static ExtLogger extLogger = null; private static boolean kitPrint = true; private static final byte[] $$a = {124, -126, ISO7816.INS_MSE, 69}; private static final int $$b = 104; private static int $10 = 0; private static int $11 = 1; private static int i = 1; /* JADX WARN: Multi-variable type inference failed */ /* JADX WARN: Removed duplicated region for block: B:10:0x0025 */ /* JADX WARN: Removed duplicated region for block: B:7:0x001d */ /* JADX WARN: Type inference failed for: r8v2, types: [int] */ /* 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 g(byte r6, short r7, byte r8, java.lang.Object[] r9) { /* byte[] r0 = com.huawei.hms.framework.common.Logger.$$a int r8 = r8 * 57 int r8 = r8 + 65 int r7 = r7 * 2 int r1 = r7 + 1 int r6 = r6 * 3 int r6 = 4 - r6 byte[] r1 = new byte[r1] r2 = 0 if (r0 != 0) goto L17 r4 = r8 r3 = r2 r8 = r6 goto L2c L17: r3 = r2 L18: byte r4 = (byte) r8 r1[r3] = r4 if (r3 != r7) goto L25 java.lang.String r6 = new java.lang.String r6.(r1, r2) r9[r2] = r6 return L25: r4 = r0[r6] int r3 = r3 + 1 r5 = r8 r8 = r6 r6 = r5 L2c: int r6 = r6 + r4 int r8 = r8 + 1 r5 = r8 r8 = r6 r6 = r5 goto L18 */ throw new UnsupportedOperationException("Method not decompiled: com.huawei.hms.framework.common.Logger.g(byte, short, byte, java.lang.Object[]):void"); } public static void setExtLogger(ExtLogger extLogger2, boolean z) { int i2 = 2 % 2; extLogger = extLogger2; kitPrint = z; StringBuilder sb = new StringBuilder("logger = "); sb.append(extLogger2); sb.append(z); i(TAG, sb.toString()); int i3 = c + 65; i = i3 % 128; int i4 = i3 % 2; } public static void v(String str, String str2, Object... objArr) { int i2 = 2 % 2; int i3 = c + 85; i = i3 % 128; int i4 = i3 % 2; println(2, str, str2, objArr); int i5 = c + 45; i = i5 % 128; int i6 = i5 % 2; } public static void v(String str, Object obj) { int i2 = 2 % 2; int i3 = c + 89; i = i3 % 128; int i4 = i3 % 2; println(2, str, obj); int i5 = i + 113; c = i5 % 128; int i6 = i5 % 2; } public static void d(String str, Object obj) { int i2 = 2 % 2; int i3 = i + 119; c = i3 % 128; println(i3 % 2 != 0 ? 5 : 3, str, obj); int i4 = i + 45; c = i4 % 128; if (i4 % 2 != 0) { int i5 = 23 / 0; } } public static void d(String str, String str2, Object... objArr) { int i2 = 2 % 2; int i3 = c + 125; i = i3 % 128; int i4 = i3 % 2; println(3, str, str2, objArr); int i5 = i + 53; c = i5 % 128; if (i5 % 2 != 0) { int i6 = 93 / 0; } } public static void i(String str, Object obj) { int i2 = 2 % 2; int i3 = c + 67; i = i3 % 128; int i4 = i3 % 2; println(4, str, obj); int i5 = i + 47; c = i5 % 128; int i6 = i5 % 2; } public static void i(String str, String str2, Object... objArr) { int i2 = 2 % 2; int i3 = i + 77; c = i3 % 128; int i4 = i3 % 2; println(4, str, str2, objArr); int i5 = i + 99; c = i5 % 128; if (i5 % 2 == 0) { return; } Object obj = null; obj.hashCode(); throw null; } public static void w(String str, Object obj) { int i2 = 2 % 2; int i3 = c + 7; i = i3 % 128; println(i3 % 2 == 0 ? 4 : 5, str, obj); } public static void w(String str, String str2, Object... objArr) { int i2 = 2 % 2; int i3 = i + 31; c = i3 % 128; int i4 = i3 % 2; println(5, str, str2, objArr); int i5 = c + 1; i = i5 % 128; if (i5 % 2 == 0) { throw null; } } public static void w(String str, String str2, Throwable th) { int i2 = 2 % 2; int i3 = c + 47; i = i3 % 128; int i4 = i3 % 2; if (isAPPLoggable(5)) { int i5 = i + 65; c = i5 % 128; int i6 = i5 % 2; extLogger.w(complexAppTag(str), complexMsg(str2, 5), getNewThrowable(th)); } if (kitPrint) { int i7 = i + 79; c = i7 % 128; int i8 = i7 % 2; complexTag(str); if (i8 != 0) { complexMsg(str2, 4); } else { complexMsg(str2, 5); } getNewThrowable(th); } } public static void e(String str, Object obj) { int i2 = 2 % 2; int i3 = c + 81; i = i3 % 128; int i4 = i3 % 2; println(6, str, obj); int i5 = i + 79; c = i5 % 128; if (i5 % 2 == 0) { return; } Object obj2 = null; obj2.hashCode(); throw null; } private static void f(char[] cArr, byte[] bArr, int[] iArr, int i2, Object[] objArr) { char[] cArr2; int i3 = 2 % 2; C3614bBe c3614bBe = new C3614bBe(); char[] cArr3 = e; if (cArr3 != null) { int i4 = $10 + 53; $11 = i4 % 128; int i5 = i4 % 2; int length = cArr3.length; char[] cArr4 = new char[length]; for (int i6 = 0; i6 < length; i6++) { try { Object[] objArr2 = {Integer.valueOf(cArr3[i6])}; Object obj = xzZ.y.get(-950481649); if (obj == null) { Class cls = (Class) xzZ.c((ViewConfiguration.getWindowTouchSlop() >> 8) + 337, 5 - View.MeasureSpec.getMode(0), (char) (ViewConfiguration.getMaximumFlingVelocity() >> 16)); byte b2 = (byte) 0; byte b3 = b2; Object[] objArr3 = new Object[1]; g(b2, b3, b3, objArr3); obj = cls.getMethod((String) objArr3[0], Integer.TYPE); xzZ.y.put(-950481649, obj); } cArr4[i6] = ((Character) ((Method) obj).invoke(null, objArr2)).charValue(); } catch (Throwable th) { Throwable cause = th.getCause(); if (cause == null) { throw th; } throw cause; } } cArr3 = cArr4; } Object[] objArr4 = {Integer.valueOf(b)}; Object obj2 = xzZ.y.get(-1521625011); if (obj2 == null) { Class cls2 = (Class) xzZ.c(283 - Drawable.resolveOpacity(0, 0), 5 - Color.green(0), (char) ((AudioTrack.getMaxVolume() > BitmapDescriptorFactory.HUE_RED ? 1 : (AudioTrack.getMaxVolume() == BitmapDescriptorFactory.HUE_RED ? 0 : -1)) + 39812)); byte b4 = (byte) 0; byte b5 = b4; Object[] objArr5 = new Object[1]; g(b4, b5, (byte) (b5 + 1), objArr5); obj2 = cls2.getMethod((String) objArr5[0], Integer.TYPE); xzZ.y.put(-1521625011, obj2); } int intValue = ((Integer) ((Method) obj2).invoke(null, objArr4)).intValue(); if (!(!d)) { int i7 = $10 + 79; $11 = i7 % 128; if (i7 % 2 == 0) { c3614bBe.c = bArr.length; cArr2 = new char[c3614bBe.c]; c3614bBe.a = 1; } else { c3614bBe.c = bArr.length; cArr2 = new char[c3614bBe.c]; c3614bBe.a = 0; } while (c3614bBe.a < c3614bBe.c) { cArr2[c3614bBe.a] = (char) (cArr3[bArr[(c3614bBe.c - 1) - c3614bBe.a] + i2] - intValue); Object[] objArr6 = {c3614bBe, c3614bBe}; Object obj3 = xzZ.y.get(1779759091); if (obj3 == null) { obj3 = ((Class) xzZ.c(Color.green(0) + 40, 5 - Gravity.getAbsoluteGravity(0, 0), (char) ExpandableListView.getPackedPositionGroup(0L))).getMethod("D", Object.class, Object.class); xzZ.y.put(1779759091, obj3); } ((Method) obj3).invoke(null, objArr6); } objArr[0] = new String(cArr2); return; } if (!a) { c3614bBe.c = iArr.length; char[] cArr5 = new char[c3614bBe.c]; c3614bBe.a = 0; while (c3614bBe.a < c3614bBe.c) { int i8 = $11 + 51; $10 = i8 % 128; int i9 = i8 % 2; cArr5[c3614bBe.a] = (char) (cArr3[iArr[(c3614bBe.c - 1) - c3614bBe.a] - i2] - intValue); c3614bBe.a++; } objArr[0] = new String(cArr5); return; } c3614bBe.c = cArr.length; char[] cArr6 = new char[c3614bBe.c]; c3614bBe.a = 0; while (c3614bBe.a < c3614bBe.c) { cArr6[c3614bBe.a] = (char) (cArr3[cArr[(c3614bBe.c - 1) - c3614bBe.a] - i2] - intValue); Object[] objArr7 = {c3614bBe, c3614bBe}; Object obj4 = xzZ.y.get(1779759091); if (obj4 == null) { obj4 = ((Class) xzZ.c((ViewConfiguration.getScrollBarFadeDuration() >> 16) + 40, (KeyEvent.getMaxKeyCode() >> 16) + 5, (char) (MotionEvent.axisFromString("") + 1))).getMethod("D", Object.class, Object.class); xzZ.y.put(1779759091, obj4); } ((Method) obj4).invoke(null, objArr7); } objArr[0] = new String(cArr6); } public static void e(String str, String str2, Object... objArr) { int i2 = 2 % 2; int i3 = c + 7; i = i3 % 128; int i4 = i3 % 2; println(6, str, str2, objArr); int i5 = i + 53; c = i5 % 128; if (i5 % 2 != 0) { throw null; } } public static void e(String str, String str2, Throwable th) { ExtLogger extLogger2; String complexAppTag; String complexMsg; int i2 = 2 % 2; int i3 = i + 13; c = i3 % 128; int i4 = i3 % 2; if (isAPPLoggable(6)) { int i5 = i + 101; c = i5 % 128; if (i5 % 2 == 0) { extLogger2 = extLogger; complexAppTag = complexAppTag(str); complexMsg = complexMsg(str2, 5); } else { extLogger2 = extLogger; complexAppTag = complexAppTag(str); complexMsg = complexMsg(str2, 3); } extLogger2.e(complexAppTag, complexMsg, getNewThrowable(th)); } if (kitPrint) { int i6 = c + 15; i = i6 % 128; int i7 = i6 % 2; complexTag(str); complexMsg(str2, 5); getNewThrowable(th); } } private static boolean isKitLoggable(int i2) { boolean z; int i3 = 2 % 2; int i4 = i + 101; c = i4 % 128; if (i4 % 2 != 0) { Object obj = null; obj.hashCode(); throw null; } if (kitPrint && isLoggable(i2)) { z = true; } else { int i5 = c + 41; i = i5 % 128; int i6 = i5 % 2; z = false; } int i7 = c + 29; i = i7 % 128; int i8 = i7 % 2; return z; } private static Throwable getNewThrowable(Throwable th) { int i2 = 2 % 2; AnonymousClass1 anonymousClass1 = null; if (isLoggable(3)) { int i3 = c + 17; i = i3 % 128; if (i3 % 2 != 0) { return th; } anonymousClass1.hashCode(); throw null; } if (th == null) { int i4 = i + 101; c = i4 % 128; int i5 = i4 % 2; return null; } ThrowableWrapper throwableWrapper = new ThrowableWrapper(th); Throwable cause = th.getCause(); ThrowableWrapper throwableWrapper2 = throwableWrapper; while (cause != null) { ThrowableWrapper throwableWrapper3 = new ThrowableWrapper(cause); throwableWrapper2.setCause(throwableWrapper3); cause = cause.getCause(); throwableWrapper2 = throwableWrapper3; } return throwableWrapper; } private static String complexTag(String str) { int i2 = 2 % 2; int i3 = c + 91; i = i3 % 128; int i4 = i3 % 2; String concat = TAG_NETWORKKIT_PRE.concat(String.valueOf(str)); int i5 = c + 35; i = i5 % 128; int i6 = i5 % 2; return concat; } private static String complexAppTag(String str) { int i2 = 2 % 2; int i3 = i + 3; c = i3 % 128; int i4 = i3 % 2; String valueOf = String.valueOf(str); if (i4 == 0) { return TAG_NETWORK_SDK_PRE.concat(valueOf); } TAG_NETWORK_SDK_PRE.concat(valueOf); Object obj = null; obj.hashCode(); throw null; } private static String complexMsg(String str, int i2) { int i3 = 2 % 2; int i4 = i + 29; c = i4 % 128; if (i4 % 2 == 0) { if (TextUtils.isEmpty(str)) { return getCallMethodInfo(i2); } StringBuilder sb = new StringBuilder(); sb.append(getCallMethodInfo(i2)); sb.append("|"); sb.append(str); String obj = sb.toString(); int i5 = c + 47; i = i5 % 128; if (i5 % 2 != 0) { return obj; } throw null; } TextUtils.isEmpty(str); throw null; } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public static class ThrowableWrapper extends Throwable { private static final long serialVersionUID = 7129050843360571879L; private String message; private Throwable ownerThrowable; private Throwable thisCause; private ThrowableWrapper(Throwable th) { this.ownerThrowable = th; StackTraceElement[] stackTrace = th.getStackTrace(); int i = ((th instanceof IOException) || (th instanceof JSONException)) ? 8 : 20; if (stackTrace.length > i) { setStackTrace((StackTraceElement[]) Arrays.copyOf(stackTrace, i)); } else { setStackTrace(stackTrace); } setMessage(StringUtils.anonymizeMessage(th.getMessage())); } @Override // java.lang.Throwable public Throwable getCause() { Throwable th; synchronized (this) { th = this.thisCause; if (th == this) { th = null; } } return th; } /* JADX INFO: Access modifiers changed from: private */ public void setCause(Throwable th) { synchronized (this) { this.thisCause = th; } } @Override // java.lang.Throwable public String toString() { Throwable th = this.ownerThrowable; if (th == null) { return ""; } String name = th.getClass().getName(); if (this.message == null) { return name; } StringBuilder sb = new StringBuilder(); sb.append(name); sb.append(": "); String obj = sb.toString(); if (this.message.startsWith(obj)) { return this.message; } StringBuilder sb2 = new StringBuilder(); sb2.append(obj); sb2.append(this.message); return sb2.toString(); } public void setMessage(String str) { this.message = str; } @Override // java.lang.Throwable public String getMessage() { return this.message; } } public static boolean isLoggable(int i2) { int i3 = 2 % 2; int i4 = i + 37; c = i4 % 128; int i5 = i4 % 2; boolean isLoggable = Log.isLoggable(TAG_NETWORKKIT_PRE, i2); if (i5 != 0) { int i6 = 46 / 0; } int i7 = i + 25; c = i7 % 128; int i8 = i7 % 2; return isLoggable; } private static String getCallMethodInfo(int i2) { int i3 = 2 % 2; int i4 = i + 55; c = i4 % 128; int i5 = i4 % 2; StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace(); if (stackTrace.length <= i2) { int i6 = c + 33; i = i6 % 128; if (i6 % 2 == 0) { int i7 = 6 / 0; } return ""; } StackTraceElement stackTraceElement = stackTrace[i2]; StringBuilder sb = new StringBuilder(); sb.append(Thread.currentThread().getName()); sb.append("|"); sb.append(stackTraceElement.getFileName()); sb.append("|"); sb.append(stackTraceElement.getClassName()); sb.append("|"); sb.append(stackTraceElement.getMethodName()); sb.append("|"); sb.append(stackTraceElement.getLineNumber()); return sb.toString(); } private static int logPrintln(int i2, String str, String str2) { int i3 = 2 % 2; if (isAPPLoggable(i2)) { extLogPrintln(i2, complexAppTag(str), complexMsg(str2, 7)); int i4 = i + 123; c = i4 % 128; int i5 = i4 % 2; } if (!isKitLoggable(i2)) { return 1; } int i6 = c + 27; i = i6 % 128; return Log.println(i2, complexTag(str), i6 % 2 == 0 ? complexMsg(str2, 71) : complexMsg(str2, 7)); } public static void println(int i2, String str, Object obj) { String obj2; int i3 = 2 % 2; int i4 = c + 39; i = i4 % 128; int i5 = i4 % 2; if (i2 < 3) { return; } if (obj == null) { Object[] objArr = new Object[1]; f(null, new byte[]{ISOFileInfo.FILE_IDENTIFIER, ISOFileInfo.FILE_IDENTIFIER, -126, ISOFileInfo.DATA_BYTES2}, null, 127 - (ViewConfiguration.getWindowTouchSlop() >> 8), objArr); obj2 = ((String) objArr[0]).intern(); } else { obj2 = obj.toString(); } logPrintln(i2, str, obj2); int i6 = i + 63; c = i6 % 128; int i7 = i6 % 2; } private static void extLogPrintln(int i2, String str, String str2) { int i3 = 2 % 2; if (i2 == 2) { extLogger.v(str, str2); int i4 = c + 13; i = i4 % 128; int i5 = i4 % 2; return; } if (i2 == 3) { extLogger.d(str, str2); return; } int i6 = i + 107; int i7 = i6 % 128; c = i7; if (i6 % 2 == 0 ? i2 == 4 : i2 == 3) { extLogger.i(str, str2); int i8 = i + 91; c = i8 % 128; int i9 = i8 % 2; return; } if (i2 == 5) { extLogger.w(str, str2); return; } int i10 = i7 + 79; i = i10 % 128; int i11 = i10 % 2; if (i2 == 6) { extLogger.e(str, str2); } } public static void println(int i2, String str, String str2, Object... objArr) { int i3 = 2 % 2; int i4 = c + 79; i = i4 % 128; if (i4 % 2 == 0) { if (i2 < 2) { return; } } else if (i2 < 3) { return; } if (str2 == null) { return; } try { logPrintln(i2, str, StringUtils.format(str2, objArr)); int i5 = i + 89; c = i5 % 128; int i6 = i5 % 2; } catch (IllegalFormatException e2) { w(TAG, "log format error".concat(String.valueOf(str2)), e2); } } static void d() { e = new char[]{15910, 15965, 15908}; b = 1934311112; a = true; d = true; } private static boolean isAPPLoggable(int i2) { int i3 = 2 % 2; int i4 = c + 65; int i5 = i4 % 128; i = i5; if (i4 % 2 == 0) { throw null; } if (extLogger != null && i2 >= 3) { return true; } int i6 = i5 + 95; c = i6 % 128; int i7 = i6 % 2; return false; } static { c = 0; d(); int i2 = i + 7; c = i2 % 128; int i3 = i2 % 2; } }