package com.google.firebase.iid; import android.graphics.Color; import android.os.Build; import android.os.Bundle; import android.os.SystemClock; import android.text.TextUtils; import android.util.Base64; import android.view.View; import android.view.ViewConfiguration; import com.google.android.gms.common.GoogleApiAvailabilityLight; import com.google.android.gms.common.internal.LibraryVersion; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.tasks.Continuation; import com.google.android.gms.tasks.Task; import com.google.android.gms.tasks.TaskCompletionSource; import com.google.android.gms.tasks.Tasks; import com.google.firebase.FirebaseApp; import com.google.firebase.heartbeatinfo.HeartBeatInfo; import com.google.firebase.installations.FirebaseInstallationsApi; import com.google.firebase.installations.InstallationTokenResult; import com.google.firebase.platforminfo.UserAgentPublisher; import com.huawei.hms.framework.network.grs.GrsBaseInfo; import com.huawei.hms.support.api.entity.common.CommonConstant; import com.huawei.hms.support.hianalytics.HiAnalyticsConstant; import java.io.IOException; import java.lang.reflect.Method; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.concurrent.ExecutionException; import java.util.concurrent.Executor; import net.sf.scuba.smartcards.ISO7816; import o.TVH; import o.xzZ; import org.bouncycastle.pqc.jcajce.spec.McElieceCCA2KeyGenParameterSpec; /* loaded from: classes.dex */ public final class zzt { private final FirebaseApp zza; private final zzao zzb; private final zzau zzc; private final Executor zzd; private final UserAgentPublisher zze; private final HeartBeatInfo zzf; private final FirebaseInstallationsApi zzg; private static final byte[] $$a = {80, 41, ISO7816.INS_UPDATE_RECORD, 94}; private static final int $$b = 80; private static int $10 = 0; private static int $11 = 1; private static int b = 0; private static int a = 1; private static char[] e = {39998}; /* JADX WARN: Removed duplicated region for block: B:10:0x0029 */ /* JADX WARN: Removed duplicated region for block: B:7:0x0021 */ /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:10:0x0029 -> B:4:0x0032). 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 d(int r6, short r7, byte r8, java.lang.Object[] r9) { /* byte[] r0 = com.google.firebase.iid.zzt.$$a int r8 = r8 * 3 int r8 = r8 + 4 int r6 = r6 * 3 int r1 = 1 - r6 int r7 = r7 * 2 int r7 = r7 + 71 byte[] r1 = new byte[r1] r2 = 0 int r6 = 0 - r6 if (r0 != 0) goto L18 r3 = r8 r4 = r2 goto L32 L18: r3 = r2 L19: r5 = r8 r8 = r7 r7 = r5 byte r4 = (byte) r8 r1[r3] = r4 if (r3 != r6) goto L29 java.lang.String r6 = new java.lang.String r6.(r1, r2) r9[r2] = r6 return L29: int r3 = r3 + 1 r4 = r0[r7] r5 = r8 r8 = r7 r7 = r4 r4 = r3 r3 = r5 L32: int r8 = r8 + 1 int r7 = r7 + r3 r3 = r4 goto L19 */ throw new UnsupportedOperationException("Method not decompiled: com.google.firebase.iid.zzt.d(int, short, byte, java.lang.Object[]):void"); } public zzt(FirebaseApp firebaseApp, zzao zzaoVar, Executor executor, UserAgentPublisher userAgentPublisher, HeartBeatInfo heartBeatInfo, FirebaseInstallationsApi firebaseInstallationsApi) { this(firebaseApp, zzaoVar, executor, new zzau(firebaseApp.getApplicationContext(), zzaoVar), userAgentPublisher, heartBeatInfo, firebaseInstallationsApi); } private zzt(FirebaseApp firebaseApp, zzao zzaoVar, Executor executor, zzau zzauVar, UserAgentPublisher userAgentPublisher, HeartBeatInfo heartBeatInfo, FirebaseInstallationsApi firebaseInstallationsApi) { this.zza = firebaseApp; this.zzb = zzaoVar; this.zzc = zzauVar; this.zzd = executor; this.zze = userAgentPublisher; this.zzf = heartBeatInfo; this.zzg = firebaseInstallationsApi; } public final Task zza(String str, String str2, String str3) { int i = 2 % 2; Task zzb = zzb(zza(str, str2, str3, new Bundle())); int i2 = b + 85; a = i2 % 128; if (i2 % 2 != 0) { return zzb; } throw null; } public final Task zzc(String str, String str2, String str3) { String str4; int i = 2 % 2; Bundle bundle = new Bundle(); String valueOf = String.valueOf(str3); if (valueOf.length() != 0) { int i2 = a + 7; b = i2 % 128; int i3 = i2 % 2; str4 = "/topics/".concat(valueOf); int i4 = b + 29; a = i4 % 128; int i5 = i4 % 2; } else { str4 = new String("/topics/"); } bundle.putString("gcm.topic", str4); String valueOf2 = String.valueOf(str3); return zza(zzb(zza(str, str2, valueOf2.length() != 0 ? "/topics/".concat(valueOf2) : new String("/topics/"), bundle))); } public final Task zzd(String str, String str2, String str3) { String str4; int i = 2 % 2; Bundle bundle = new Bundle(); String valueOf = String.valueOf(str3); if (valueOf.length() != 0) { int i2 = b + 35; a = i2 % 128; if (i2 % 2 == 0) { str4 = "/topics/".concat(valueOf); int i3 = 20 / 0; } else { str4 = "/topics/".concat(valueOf); } } else { str4 = new String("/topics/"); } bundle.putString("gcm.topic", str4); Object[] objArr = new Object[1]; c(new byte[]{1}, new int[]{0, 1, 58, 1}, true, objArr); bundle.putString("delete", ((String) objArr[0]).intern()); String valueOf2 = String.valueOf(str3); Task zza = zza(zzb(zza(str, str2, valueOf2.length() != 0 ? "/topics/".concat(valueOf2) : new String("/topics/"), bundle))); int i4 = a + 21; b = i4 % 128; if (i4 % 2 == 0) { return zza; } Object obj = null; obj.hashCode(); throw null; } private final Task zza(final String str, final String str2, final String str3, final Bundle bundle) { int i = 2 % 2; final TaskCompletionSource taskCompletionSource = new TaskCompletionSource(); this.zzd.execute(new Runnable(this, str, str2, str3, bundle, taskCompletionSource) { // from class: com.google.firebase.iid.zzs private final zzt zza; private final String zzb; private final String zzc; private final String zzd; private final Bundle zze; private final TaskCompletionSource zzf; @Override // java.lang.Runnable public final void run() { this.zza.zza(this.zzb, this.zzc, this.zzd, this.zze, this.zzf); } /* JADX INFO: Access modifiers changed from: package-private */ { this.zza = this; this.zzb = str; this.zzc = str2; this.zzd = str3; this.zze = bundle; this.zzf = taskCompletionSource; } }); Task task = taskCompletionSource.getTask(); int i2 = a + 15; b = i2 % 128; if (i2 % 2 == 0) { return task; } Object obj = null; obj.hashCode(); throw null; } private final String zza() { String encodeToString; int i = 2 % 2; int i2 = b + 95; a = i2 % 128; try { if (i2 % 2 == 0) { encodeToString = Base64.encodeToString(MessageDigest.getInstance(McElieceCCA2KeyGenParameterSpec.SHA1).digest(this.zza.getName().getBytes()), 97); } else { encodeToString = Base64.encodeToString(MessageDigest.getInstance(McElieceCCA2KeyGenParameterSpec.SHA1).digest(this.zza.getName().getBytes()), 11); } return encodeToString; } catch (NoSuchAlgorithmException unused) { return "[HASH-ERROR]"; } } private final Bundle zzb(String str, String str2, String str3, Bundle bundle) { String str4; int i = 2 % 2; bundle.putString(CommonConstant.ReqAccessTokenParam.SCOPE_LABEL, str3); bundle.putString("sender", str2); bundle.putString("subtype", str2); bundle.putString(HiAnalyticsConstant.HaKey.BI_KEY_APPID, str); bundle.putString("gmp_app_id", this.zza.getOptions().getApplicationId()); bundle.putString("gmsv", Integer.toString(this.zzb.zze())); bundle.putString("osv", Integer.toString(Build.VERSION.SDK_INT)); bundle.putString("app_ver", this.zzb.zzc()); bundle.putString("app_ver_name", this.zzb.zzd()); bundle.putString("firebase-app-name-hash", zza()); try { String token = ((InstallationTokenResult) Tasks.await(this.zzg.getToken(false))).getToken(); if (!TextUtils.isEmpty(token)) { bundle.putString("Goog-Firebase-Installations-Auth", token); } } catch (InterruptedException | ExecutionException unused) { } String version = LibraryVersion.getInstance().getVersion("firebase-iid"); if (GrsBaseInfo.CountryCodeSource.UNKNOWN.equals(version)) { int i2 = GoogleApiAvailabilityLight.GOOGLE_PLAY_SERVICES_VERSION_CODE; StringBuilder sb = new StringBuilder(19); sb.append("unknown_"); sb.append(i2); version = sb.toString(); } String valueOf = String.valueOf(version); if (valueOf.length() != 0) { str4 = "fiid-".concat(valueOf); } else { str4 = new String("fiid-"); int i3 = b + 117; a = i3 % 128; int i4 = i3 % 2; } bundle.putString("cliv", str4); HeartBeatInfo.HeartBeat heartBeatCode = this.zzf.getHeartBeatCode("fire-iid"); if (heartBeatCode != HeartBeatInfo.HeartBeat.NONE) { int i5 = b + 91; a = i5 % 128; int i6 = i5 % 2; bundle.putString("Firebase-Client-Log-Type", Integer.toString(heartBeatCode.getCode())); bundle.putString("Firebase-Client", this.zze.getUserAgent()); } int i7 = b + 67; a = i7 % 128; int i8 = i7 % 2; return bundle; } private static Task zza(Task task) { int i = 2 % 2; int i2 = a + 47; b = i2 % 128; int i3 = i2 % 2; Task continueWith = task.continueWith(zzh.zza(), zzv.zza); int i4 = a + 87; b = i4 % 128; int i5 = i4 % 2; return continueWith; } private final Task zzb(Task task) { int i = 2 % 2; Task continueWith = task.continueWith(this.zzd, new Continuation(this) { // from class: com.google.firebase.iid.zzu private final zzt zza; @Override // com.google.android.gms.tasks.Continuation public final Object then(Task task2) { Bundle bundle = (Bundle) task2.getResult(IOException.class); if (bundle == null) { throw new IOException("SERVICE_NOT_AVAILABLE"); } String string = bundle.getString("registration_id"); if (string != null) { return string; } String string2 = bundle.getString("unregistered"); if (string2 != null) { return string2; } String string3 = bundle.getString("error"); if ("RST".equals(string3)) { throw new IOException("INSTANCE_ID_RESET"); } if (string3 != null) { throw new IOException(string3); } throw new IOException("SERVICE_NOT_AVAILABLE"); } /* JADX INFO: Access modifiers changed from: package-private */ { this.zza = this; } }); int i2 = b + 101; a = i2 % 128; if (i2 % 2 != 0) { return continueWith; } Object obj = null; obj.hashCode(); throw null; } /* JADX INFO: Access modifiers changed from: package-private */ public final /* synthetic */ void zza(String str, String str2, String str3, Bundle bundle, TaskCompletionSource taskCompletionSource) { int i = 2 % 2; int i2 = a + 115; b = i2 % 128; try { if (i2 % 2 == 0) { zzb(str, str2, str3, bundle); taskCompletionSource.setResult(this.zzc.zza(bundle)); } else { zzb(str, str2, str3, bundle); taskCompletionSource.setResult(this.zzc.zza(bundle)); throw null; } } catch (IOException e2) { taskCompletionSource.setException(e2); } } private static void c(byte[] bArr, int[] iArr, boolean z, Object[] objArr) { int i; int i2 = 2 % 2; TVH tvh = new TVH(); int i3 = 0; int i4 = iArr[0]; int i5 = iArr[1]; int i6 = iArr[2]; int i7 = iArr[3]; char[] cArr = e; if (cArr != null) { int length = cArr.length; char[] cArr2 = new char[length]; int i8 = 0; while (i8 < length) { int i9 = $10 + 99; $11 = i9 % 128; int i10 = i9 % 2; try { Object[] objArr2 = new Object[1]; objArr2[i3] = Integer.valueOf(cArr[i8]); Object obj = xzZ.y.get(1645349359); if (obj == null) { Class cls = (Class) xzZ.c(223 - Color.green(i3), (SystemClock.currentThreadTimeMillis() > (-1L) ? 1 : (SystemClock.currentThreadTimeMillis() == (-1L) ? 0 : -1)) + 4, (char) (41978 - (ViewConfiguration.getScrollFriction() > BitmapDescriptorFactory.HUE_RED ? 1 : (ViewConfiguration.getScrollFriction() == BitmapDescriptorFactory.HUE_RED ? 0 : -1)))); byte b2 = (byte) i3; byte b3 = b2; Object[] objArr3 = new Object[1]; d(b2, b3, b3, objArr3); obj = cls.getMethod((String) objArr3[0], Integer.TYPE); xzZ.y.put(1645349359, obj); } cArr2[i8] = ((Character) ((Method) obj).invoke(null, objArr2)).charValue(); i8++; i3 = 0; } catch (Throwable th) { Throwable cause = th.getCause(); if (cause == null) { throw th; } throw cause; } } cArr = cArr2; } char[] cArr3 = new char[i5]; System.arraycopy(cArr, i4, cArr3, 0, i5); if (bArr != null) { char[] cArr4 = new char[i5]; tvh.c = 0; char c = 0; while (tvh.c < i5) { if (bArr[tvh.c] == 1) { int i11 = $10 + 101; $11 = i11 % 128; int i12 = i11 % 2; int i13 = tvh.c; Object[] objArr4 = {Integer.valueOf(cArr3[tvh.c]), Integer.valueOf(c)}; Object obj2 = xzZ.y.get(850398076); if (obj2 == null) { obj2 = ((Class) xzZ.c((ViewConfiguration.getTouchSlop() >> 8) + 502, 4 - TextUtils.lastIndexOf("", '0'), (char) (54 - View.MeasureSpec.getSize(0)))).getMethod("F", Integer.TYPE, Integer.TYPE); xzZ.y.put(850398076, obj2); } cArr4[i13] = ((Character) ((Method) obj2).invoke(null, objArr4)).charValue(); } else { int i14 = tvh.c; Object[] objArr5 = {Integer.valueOf(cArr3[tvh.c]), Integer.valueOf(c)}; Object obj3 = xzZ.y.get(1084521042); if (obj3 == null) { obj3 = ((Class) xzZ.c((ViewConfiguration.getWindowTouchSlop() >> 8) + 15, Color.blue(0) + 5, (char) ((ViewConfiguration.getEdgeSlop() >> 16) + 58134))).getMethod("H", Integer.TYPE, Integer.TYPE); xzZ.y.put(1084521042, obj3); } cArr4[i14] = ((Character) ((Method) obj3).invoke(null, objArr5)).charValue(); } c = cArr4[tvh.c]; Object[] objArr6 = {tvh, tvh}; Object obj4 = xzZ.y.get(1698744941); if (obj4 == null) { Class cls2 = (Class) xzZ.c(401 - TextUtils.lastIndexOf("", '0', 0, 0), 5 - View.resolveSizeAndState(0, 0, 0), (char) (TextUtils.indexOf((CharSequence) "", '0') + 21609)); byte b4 = (byte) 0; byte b5 = (byte) (b4 + 1); Object[] objArr7 = new Object[1]; d(b4, b5, (byte) (b5 - 1), objArr7); obj4 = cls2.getMethod((String) objArr7[0], Object.class, Object.class); xzZ.y.put(1698744941, obj4); } ((Method) obj4).invoke(null, objArr6); } cArr3 = cArr4; } if (i7 > 0) { char[] cArr5 = new char[i5]; i = 0; System.arraycopy(cArr3, 0, cArr5, 0, i5); int i15 = i5 - i7; System.arraycopy(cArr5, 0, cArr3, i15, i7); System.arraycopy(cArr5, i7, cArr3, 0, i15); } else { i = 0; } if (!(!z)) { char[] cArr6 = new char[i5]; tvh.c = i; while (tvh.c < i5) { int i16 = $10 + 9; $11 = i16 % 128; int i17 = i16 % 2; cArr6[tvh.c] = cArr3[(i5 - tvh.c) - 1]; tvh.c++; int i18 = $10 + 53; $11 = i18 % 128; int i19 = i18 % 2; } cArr3 = cArr6; } if (i6 > 0) { int i20 = 0; while (true) { tvh.c = i20; if (tvh.c >= i5) { break; } cArr3[tvh.c] = (char) (cArr3[tvh.c] - iArr[2]); i20 = tvh.c + 1; } } objArr[0] = new String(cArr3); } }