package com.google.firebase.crashlytics.internal; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.graphics.Color; import android.os.Process; import android.telephony.cdma.CdmaCellLocation; import android.text.TextUtils; import android.util.TypedValue; import android.view.Gravity; import android.view.View; import android.view.ViewConfiguration; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.tasks.Continuation; import com.google.android.gms.tasks.SuccessContinuation; import com.google.android.gms.tasks.Task; import com.google.firebase.FirebaseApp; import com.google.firebase.crashlytics.internal.common.CommonUtils; import com.google.firebase.crashlytics.internal.common.CrashlyticsCore; import com.google.firebase.crashlytics.internal.common.DataCollectionArbiter; import com.google.firebase.crashlytics.internal.common.DeliveryMechanism; import com.google.firebase.crashlytics.internal.common.IdManager; import com.google.firebase.crashlytics.internal.network.HttpRequestFactory; import com.google.firebase.crashlytics.internal.settings.SettingsCacheBehavior; import com.google.firebase.crashlytics.internal.settings.SettingsController; import com.google.firebase.crashlytics.internal.settings.model.AppRequestData; import com.google.firebase.crashlytics.internal.settings.model.AppSettingsData; import com.google.firebase.crashlytics.internal.settings.network.CreateAppSpiCall; import com.google.firebase.crashlytics.internal.settings.network.UpdateAppSpiCall; import java.lang.reflect.Method; import java.util.concurrent.Executor; import net.sf.scuba.smartcards.ISOFileInfo; import o.xzZ; import o.zUI; /* loaded from: classes.dex */ public class Onboarding { static final String CRASHLYTICS_API_ENDPOINT = "com.crashlytics.ApiEndpoint"; private final FirebaseApp app; private String applicationLabel; private final Context context; private DataCollectionArbiter dataCollectionArbiter; private IdManager idManager; private String installerPackageName; private PackageInfo packageInfo; private PackageManager packageManager; private String packageName; private final HttpRequestFactory requestFactory = new HttpRequestFactory(); private String targetAndroidSdkVersion; private String versionCode; private String versionName; private static final byte[] $$a = {94, -19, ISOFileInfo.FCP_BYTE, 2}; private static final int $$b = 68; private static int $10 = 0; private static int $11 = 1; private static int c = 0; private static int e = 1; private static int a = 2015661568; /* JADX WARN: Removed duplicated region for block: B:10:0x0027 */ /* JADX WARN: Removed duplicated region for block: B:7:0x001f */ /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:10:0x0027 -> B:4:0x002d). 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 f(short r6, int r7, short r8, java.lang.Object[] r9) { /* byte[] r0 = com.google.firebase.crashlytics.internal.Onboarding.$$a int r7 = r7 * 2 int r1 = r7 + 1 int r8 = r8 * 3 int r8 = r8 + 4 int r6 = r6 * 7 int r6 = r6 + 69 byte[] r1 = new byte[r1] r2 = 0 if (r0 != 0) goto L17 r3 = r8 r4 = r2 r8 = r7 goto L2d L17: r3 = r2 L18: byte r4 = (byte) r6 r1[r3] = r4 int r4 = r3 + 1 if (r3 != r7) goto L27 java.lang.String r6 = new java.lang.String r6.(r1, r2) r9[r2] = r6 return L27: r3 = r0[r8] r5 = r8 r8 = r6 r6 = r3 r3 = r5 L2d: int r6 = -r6 int r6 = r6 + r8 int r8 = r3 + 1 r3 = r4 goto L18 */ throw new UnsupportedOperationException("Method not decompiled: com.google.firebase.crashlytics.internal.Onboarding.f(short, int, short, java.lang.Object[]):void"); } static /* synthetic */ void access$000(Onboarding onboarding, AppSettingsData appSettingsData, String str, SettingsController settingsController, Executor executor, boolean z) { int i = 2 % 2; int i2 = e + 93; c = i2 % 128; int i3 = i2 % 2; onboarding.performAutoConfigure(appSettingsData, str, settingsController, executor, z); int i4 = e + 23; c = i4 % 128; int i5 = i4 % 2; } public Onboarding(FirebaseApp firebaseApp, Context context, IdManager idManager, DataCollectionArbiter dataCollectionArbiter) { this.app = firebaseApp; this.context = context; this.idManager = idManager; this.dataCollectionArbiter = dataCollectionArbiter; } private static String getVersion() { int i = 2 % 2; int i2 = e + 93; c = i2 % 128; int i3 = i2 % 2; String version = CrashlyticsCore.getVersion(); int i4 = e + 73; c = i4 % 128; if (i4 % 2 == 0) { return version; } Object obj = null; obj.hashCode(); throw null; } public boolean onPreExecute() { String str; int i = 2 % 2; try { this.installerPackageName = this.idManager.getInstallerPackageName(); this.packageManager = this.context.getPackageManager(); String packageName = this.context.getPackageName(); this.packageName = packageName; PackageInfo packageInfo = this.packageManager.getPackageInfo(packageName, 0); this.packageInfo = packageInfo; this.versionCode = Integer.toString(packageInfo.versionCode); if (this.packageInfo.versionName == null) { int i2 = e + 23; c = i2 % 128; int i3 = i2 % 2; str = IdManager.DEFAULT_VERSION_NAME; } else { String str2 = this.packageInfo.versionName; int i4 = e + 49; c = i4 % 128; int i5 = i4 % 2; str = str2; } this.versionName = str; this.applicationLabel = this.packageManager.getApplicationLabel(this.context.getApplicationInfo()).toString(); this.targetAndroidSdkVersion = Integer.toString(this.context.getApplicationInfo().targetSdkVersion); return true; } catch (PackageManager.NameNotFoundException e2) { Logger.getLogger().e("Failed init", e2); return false; } } public void doOnboarding(Executor executor, SettingsController settingsController) { int i = 2 % 2; this.dataCollectionArbiter.waitForDataCollectionPermission().onSuccessTask(executor, new SuccessContinuation(this, settingsController) { // from class: com.google.firebase.crashlytics.internal.Onboarding.2 final Onboarding this$0; final SettingsController val$settingsDataController; { this.this$0 = this; this.val$settingsDataController = settingsController; } @Override // com.google.android.gms.tasks.SuccessContinuation public Task then(Void r1) throws Exception { return this.val$settingsDataController.getAppSettings(); } }).onSuccessTask(executor, new SuccessContinuation(this, this.app.getOptions().getApplicationId(), settingsController, executor) { // from class: com.google.firebase.crashlytics.internal.Onboarding.1 final Onboarding this$0; final Executor val$backgroundExecutor; final String val$googleAppId; final SettingsController val$settingsDataController; { this.this$0 = this; this.val$googleAppId = r2; this.val$settingsDataController = settingsController; this.val$backgroundExecutor = executor; } @Override // com.google.android.gms.tasks.SuccessContinuation public Task then(AppSettingsData appSettingsData) throws Exception { try { Onboarding.access$000(this.this$0, appSettingsData, this.val$googleAppId, this.val$settingsDataController, this.val$backgroundExecutor, true); return null; } catch (Exception e2) { Logger.getLogger().e("Error performing auto configuration.", e2); throw e2; } } }); int i2 = e + 31; c = i2 % 128; int i3 = i2 % 2; } private static void d(int i, int i2, int i3, char[] cArr, boolean z, Object[] objArr) { int i4 = 2 % 2; zUI zui = new zUI(); char[] cArr2 = new char[i]; zui.d = 0; while (zui.d < i) { int i5 = $10 + 33; $11 = i5 % 128; int i6 = i5 % 2; zui.c = cArr[zui.d]; cArr2[zui.d] = (char) (i3 + zui.c); int i7 = zui.d; try { Object[] objArr2 = {Integer.valueOf(cArr2[i7]), Integer.valueOf(a)}; Object obj = xzZ.y.get(880493502); if (obj == null) { Class cls = (Class) xzZ.c(143 - (TypedValue.complexToFloat(0) > BitmapDescriptorFactory.HUE_RED ? 1 : (TypedValue.complexToFloat(0) == BitmapDescriptorFactory.HUE_RED ? 0 : -1)), 7 - (ViewConfiguration.getDoubleTapTimeout() >> 16), (char) (ViewConfiguration.getEdgeSlop() >> 16)); byte b = (byte) 0; byte b2 = b; Object[] objArr3 = new Object[1]; f(b, b2, b2, objArr3); obj = cls.getMethod((String) objArr3[0], Integer.TYPE, Integer.TYPE); xzZ.y.put(880493502, obj); } cArr2[i7] = ((Character) ((Method) obj).invoke(null, objArr2)).charValue(); Object[] objArr4 = {zui, zui}; Object obj2 = xzZ.y.get(1294990079); if (obj2 == null) { Class cls2 = (Class) xzZ.c(342 - (Process.myPid() >> 22), TextUtils.indexOf((CharSequence) "", '0', 0) + 6, (char) Gravity.getAbsoluteGravity(0, 0)); byte b3 = (byte) ($$a[3] - 1); byte b4 = (byte) (b3 - 1); Object[] objArr5 = new Object[1]; f(b3, b4, b4, objArr5); obj2 = cls2.getMethod((String) objArr5[0], Object.class, Object.class); xzZ.y.put(1294990079, obj2); } ((Method) obj2).invoke(null, objArr4); } catch (Throwable th) { Throwable cause = th.getCause(); if (cause == null) { throw th; } throw cause; } } if (i2 > 0) { zui.a = i2; char[] cArr3 = new char[i]; System.arraycopy(cArr2, 0, cArr3, 0, i); System.arraycopy(cArr3, 0, cArr2, i - zui.a, zui.a); System.arraycopy(cArr3, zui.a, cArr2, 0, i - zui.a); } if (z) { int i8 = $11 + 53; $10 = i8 % 128; int i9 = i8 % 2; char[] cArr4 = new char[i]; zui.d = 0; while (zui.d < i) { int i10 = $11 + 47; $10 = i10 % 128; int i11 = i10 % 2; cArr4[zui.d] = cArr2[(i - zui.d) - 1]; Object[] objArr6 = {zui, zui}; Object obj3 = xzZ.y.get(1294990079); if (obj3 == null) { Class cls3 = (Class) xzZ.c(342 - View.resolveSizeAndState(0, 0, 0), View.combineMeasuredStates(0, 0) + 5, (char) (1 - (ViewConfiguration.getGlobalActionKeyTimeout() > 0L ? 1 : (ViewConfiguration.getGlobalActionKeyTimeout() == 0L ? 0 : -1)))); byte b5 = (byte) ($$a[3] - 1); byte b6 = (byte) (b5 - 1); Object[] objArr7 = new Object[1]; f(b5, b6, b6, objArr7); obj3 = cls3.getMethod((String) objArr7[0], Object.class, Object.class); xzZ.y.put(1294990079, obj3); } ((Method) obj3).invoke(null, objArr6); } cArr2 = cArr4; } objArr[0] = new String(cArr2); } public SettingsController retrieveSettingsData(Context context, FirebaseApp firebaseApp, Executor executor) { int i = 2 % 2; SettingsController create = SettingsController.create(context, firebaseApp.getOptions().getApplicationId(), this.idManager, this.requestFactory, this.versionCode, this.versionName, getOverridenSpiEndpoint(), this.dataCollectionArbiter); create.loadSettingsData(executor).continueWith(executor, new Continuation(this) { // from class: com.google.firebase.crashlytics.internal.Onboarding.3 final Onboarding this$0; { this.this$0 = this; } @Override // com.google.android.gms.tasks.Continuation public Object then(Task task) throws Exception { if (task.isSuccessful()) { return null; } Logger.getLogger().e("Error fetching settings.", task.getException()); return null; } }); int i2 = e + 39; c = i2 % 128; if (i2 % 2 == 0) { return create; } throw null; } private void performAutoConfigure(AppSettingsData appSettingsData, String str, SettingsController settingsController, Executor executor, boolean z) { int i = 2 % 2; Object obj = null; if (AppSettingsData.STATUS_NEW.equals(appSettingsData.status)) { int i2 = c + 105; e = i2 % 128; if (i2 % 2 == 0) { performCreateApp(appSettingsData, str, z); throw null; } if (!performCreateApp(appSettingsData, str, z)) { Logger.getLogger().e("Failed to create app with Crashlytics service.", null); return; } int i3 = c + 35; e = i3 % 128; if (i3 % 2 != 0) { settingsController.loadSettingsData(SettingsCacheBehavior.SKIP_CACHE_LOOKUP, executor); return; } else { settingsController.loadSettingsData(SettingsCacheBehavior.SKIP_CACHE_LOOKUP, executor); throw null; } } if (AppSettingsData.STATUS_CONFIGURED.equals(appSettingsData.status)) { int i4 = e + 5; c = i4 % 128; int i5 = i4 % 2; settingsController.loadSettingsData(SettingsCacheBehavior.SKIP_CACHE_LOOKUP, executor); return; } if (appSettingsData.updateRequired) { int i6 = c + 107; e = i6 % 128; if (i6 % 2 != 0) { Logger.getLogger().d("Server says an update is required - forcing a full App update."); performUpdateApp(appSettingsData, str, z); } else { Logger.getLogger().d("Server says an update is required - forcing a full App update."); performUpdateApp(appSettingsData, str, z); obj.hashCode(); throw null; } } } private boolean performCreateApp(AppSettingsData appSettingsData, String str, boolean z) { int i = 2 % 2; boolean invoke = new CreateAppSpiCall(getOverridenSpiEndpoint(), appSettingsData.url, this.requestFactory, getVersion()).invoke(buildAppRequest(appSettingsData.organizationId, str), z); int i2 = c + 95; e = i2 % 128; if (i2 % 2 == 0) { int i3 = 10 / 0; } return invoke; } private boolean performUpdateApp(AppSettingsData appSettingsData, String str, boolean z) { int i = 2 % 2; boolean invoke = new UpdateAppSpiCall(getOverridenSpiEndpoint(), appSettingsData.url, this.requestFactory, getVersion()).invoke(buildAppRequest(appSettingsData.organizationId, str), z); int i2 = c + 107; e = i2 % 128; if (i2 % 2 != 0) { return invoke; } Object obj = null; obj.hashCode(); throw null; } private AppRequestData buildAppRequest(String str, String str2) { int i = 2 % 2; String createInstanceIdFrom = CommonUtils.createInstanceIdFrom(CommonUtils.getMappingFileId(getContext()), str2, this.versionName, this.versionCode); int id = DeliveryMechanism.determineFrom(this.installerPackageName).getId(); String appIdentifier = getIdManager().getAppIdentifier(); String str3 = this.versionName; String str4 = this.versionCode; String str5 = this.applicationLabel; String str6 = this.targetAndroidSdkVersion; Object[] objArr = new Object[1]; d((CdmaCellLocation.convertQuartSecToDecDegrees(0) > 0.0d ? 1 : (CdmaCellLocation.convertQuartSecToDecDegrees(0) == 0.0d ? 0 : -1)) + 1, View.MeasureSpec.getSize(0) + 1, (-16777129) - Color.rgb(0, 0, 0), new char[]{0}, true, objArr); AppRequestData appRequestData = new AppRequestData(str, str2, appIdentifier, str3, str4, createInstanceIdFrom, str5, id, str6, ((String) objArr[0]).intern()); int i2 = c + 43; e = i2 % 128; if (i2 % 2 != 0) { return appRequestData; } Object obj = null; obj.hashCode(); throw null; } String getOverridenSpiEndpoint() { int i = 2 % 2; int i2 = c + 17; e = i2 % 128; int i3 = i2 % 2; String stringsFileValue = CommonUtils.getStringsFileValue(this.context, CRASHLYTICS_API_ENDPOINT); int i4 = e + 21; c = i4 % 128; int i5 = i4 % 2; return stringsFileValue; } public Context getContext() { int i = 2 % 2; int i2 = c; int i3 = i2 + 31; e = i3 % 128; if (i3 % 2 == 0) { Object obj = null; obj.hashCode(); throw null; } Context context = this.context; int i4 = i2 + 75; e = i4 % 128; int i5 = i4 % 2; return context; } private IdManager getIdManager() { int i = 2 % 2; int i2 = e; int i3 = i2 + 67; c = i3 % 128; if (i3 % 2 != 0) { Object obj = null; obj.hashCode(); throw null; } IdManager idManager = this.idManager; int i4 = i2 + 57; c = i4 % 128; if (i4 % 2 != 0) { int i5 = 76 / 0; } return idManager; } }