package androidx.fragment.app;

import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.util.Log;
import android.view.View;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Map;

/* JADX INFO: loaded from: classes.dex */
public final class y1 implements Runnable {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ int f2615a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final int f2616b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final Object f2617c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final Object f2618d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final Object f2619e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final Object f2620f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public final Object f2621g;

    public /* synthetic */ y1(Object obj, int i10, Serializable serializable, Object obj2, Object obj3, Object obj4, int i11) {
        this.f2615a = i11;
        this.f2621g = obj;
        this.f2616b = i10;
        this.f2617c = serializable;
        this.f2618d = obj2;
        this.f2619e = obj3;
        this.f2620f = obj4;
    }

    @Override // java.lang.Runnable
    public final void run() {
        switch (this.f2615a) {
            case 0:
                break;
            case 1:
                com.google.android.gms.measurement.internal.y0 y0Var = ((com.google.android.gms.measurement.internal.m1) ((com.google.android.gms.measurement.internal.p0) this.f2621g).f31277a).f21756h;
                com.google.android.gms.measurement.internal.m1.c(y0Var);
                if (!y0Var.f21470b) {
                    Log.println(6, ((com.google.android.gms.measurement.internal.p0) this.f2621g).M(), "Persisted config not initialized. Not logging error/warn");
                    return;
                }
                com.google.android.gms.measurement.internal.p0 p0Var = (com.google.android.gms.measurement.internal.p0) this.f2621g;
                if (p0Var.f21831c == 0) {
                    com.google.android.gms.measurement.internal.g gVarS = p0Var.s();
                    if (gVarS.f21590e == null) {
                        synchronized (gVarS) {
                            try {
                                if (gVarS.f21590e == null) {
                                    ApplicationInfo applicationInfo = gVarS.zza().getApplicationInfo();
                                    String myProcessName = i8.g.getMyProcessName();
                                    if (applicationInfo != null) {
                                        String str = applicationInfo.processName;
                                        gVarS.f21590e = Boolean.valueOf(str != null && str.equals(myProcessName));
                                    }
                                    if (gVarS.f21590e == null) {
                                        gVarS.f21590e = Boolean.TRUE;
                                        gVarS.zzj().f21834f.c("My process not in the list of running processes");
                                    }
                                }
                            } finally {
                            }
                        }
                    }
                    if (gVarS.f21590e.booleanValue()) {
                        ((com.google.android.gms.measurement.internal.p0) this.f2621g).f21831c = 'C';
                    } else {
                        ((com.google.android.gms.measurement.internal.p0) this.f2621g).f21831c = 'c';
                    }
                    break;
                }
                com.google.android.gms.measurement.internal.p0 p0Var2 = (com.google.android.gms.measurement.internal.p0) this.f2621g;
                if (p0Var2.f21832d < 0) {
                    p0Var2.f21832d = 106000L;
                }
                char cCharAt = "01VDIWEA?".charAt(this.f2616b);
                com.google.android.gms.measurement.internal.p0 p0Var3 = (com.google.android.gms.measurement.internal.p0) this.f2621g;
                char c6 = p0Var3.f21831c;
                long j10 = p0Var3.f21832d;
                String strC = com.google.android.gms.measurement.internal.p0.C(true, (String) this.f2617c, this.f2618d, this.f2619e, this.f2620f);
                StringBuilder sb = new StringBuilder("2");
                sb.append(cCharAt);
                sb.append(c6);
                sb.append(j10);
                String strO = defpackage.e.o(sb, ":", strC);
                if (strO.length() > 1024) {
                    strO = ((String) this.f2617c).substring(0, 1024);
                }
                x4.d dVar = y0Var.f21988f;
                if (dVar != null) {
                    ((com.google.android.gms.measurement.internal.y0) dVar.f34721b).w();
                    if (((com.google.android.gms.measurement.internal.y0) dVar.f34721b).F().getLong((String) dVar.f34722c, 0L) == 0) {
                        dVar.e();
                    }
                    if (strO == null) {
                        strO = "";
                    }
                    long j11 = ((com.google.android.gms.measurement.internal.y0) dVar.f34721b).F().getLong((String) dVar.f34723d, 0L);
                    if (j11 <= 0) {
                        SharedPreferences.Editor editorEdit = ((com.google.android.gms.measurement.internal.y0) dVar.f34721b).F().edit();
                        editorEdit.putString((String) dVar.f34724e, strO);
                        editorEdit.putLong((String) dVar.f34723d, 1L);
                        editorEdit.apply();
                        return;
                    }
                    long j12 = j11 + 1;
                    i = (((com.google.android.gms.measurement.internal.y0) dVar.f34721b).v().I0().nextLong() & Long.MAX_VALUE) < Long.MAX_VALUE / j12 ? 1 : 0;
                    SharedPreferences.Editor editorEdit2 = ((com.google.android.gms.measurement.internal.y0) dVar.f34721b).F().edit();
                    if (i != 0) {
                        editorEdit2.putString((String) dVar.f34724e, strO);
                    }
                    editorEdit2.putLong((String) dVar.f34723d, j12);
                    editorEdit2.apply();
                    return;
                }
                return;
            default:
                ((com.google.android.gms.measurement.internal.u0) this.f2617c).a((String) this.f2620f, this.f2616b, (Throwable) this.f2618d, (byte[]) this.f2619e, (Map) this.f2621g);
                return;
        }
        while (i < this.f2616b) {
            androidx.core.view.s1.setTransitionName((View) ((ArrayList) this.f2617c).get(i), (String) ((ArrayList) this.f2618d).get(i));
            androidx.core.view.s1.setTransitionName((View) ((ArrayList) this.f2619e).get(i), (String) ((ArrayList) this.f2620f).get(i));
            i++;
        }
    }

    /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
    public /* synthetic */ y1(String str, com.google.android.gms.measurement.internal.u0 u0Var, int i10, IOException iOException, byte[] bArr, Map map) {
        this(str, u0Var, i10, iOException, bArr, map, 0);
        this.f2615a = 2;
    }

    public y1(String str, com.google.android.gms.measurement.internal.u0 u0Var, int i10, IOException iOException, byte[] bArr, Map map, int i11) {
        this.f2615a = 2;
        com.google.android.gms.common.internal.w.checkNotNull(u0Var);
        this.f2617c = u0Var;
        this.f2616b = i10;
        this.f2618d = iOException;
        this.f2619e = bArr;
        this.f2620f = str;
        this.f2621g = map;
    }
}
