package o;

import android.os.Bundle;
import com.google.android.gms.common.internal.Preconditions;
import java.util.concurrent.ConcurrentHashMap;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.pt0, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C2191pt0 extends AbstractC2090oq0 {
    public volatile C1431ht0 c;
    public volatile C1431ht0 d;
    public C1431ht0 e;
    public final ConcurrentHashMap f;
    public Ep0 g;
    public volatile boolean h;
    public volatile C1431ht0 i;
    public C1431ht0 j;
    public boolean k;
    public final Object l;

    public C2191pt0(Kr0 kr0) {
        super(kr0);
        this.l = new Object();
        this.f = new ConcurrentHashMap();
    }

    public final void A(Ep0 ep0, Bundle bundle) {
        Bundle bundle2;
        if (!((Kr0) this.a).d.G() || bundle == null || (bundle2 = bundle.getBundle("com.google.app_measurement.screen_service")) == null) {
            return;
        }
        this.f.put(Integer.valueOf(ep0.l), new C1431ht0(bundle2.getString("name"), bundle2.getString("referrer_name"), bundle2.getLong("id")));
    }

    public final void B(String str, C1431ht0 c1431ht0, boolean z) {
        C1431ht0 c1431ht02;
        C1431ht0 c1431ht03 = this.c == null ? this.d : this.c;
        if (c1431ht0.b == null) {
            c1431ht02 = new C1431ht0(c1431ht0.a, str != null ? z(str) : null, c1431ht0.c, c1431ht0.e, c1431ht0.f);
        } else {
            c1431ht02 = c1431ht0;
        }
        this.d = this.c;
        this.c = c1431ht02;
        Kr0 kr0 = (Kr0) this.a;
        long jElapsedRealtime = kr0.k.elapsedRealtime();
        Fr0 fr0 = kr0.g;
        Kr0.l(fr0);
        fr0.B(new RunnableC1621jt0(this, c1431ht02, c1431ht03, jElapsedRealtime, z));
    }

    /* JADX WARN: Removed duplicated region for block: B:10:0x0033  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final void C(o.C1431ht0 r18, o.C1431ht0 r19, long r20, boolean r22, android.os.Bundle r23) {
        /*
            Method dump skipped, instructions count: 221
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: o.C2191pt0.C(o.ht0, o.ht0, long, boolean, android.os.Bundle):void");
    }

    @Override // o.AbstractC2090oq0
    public final boolean v() {
        return false;
    }

    public final void w(C1431ht0 c1431ht0, boolean z, long j) {
        Kr0 kr0 = (Kr0) this.a;
        C2752vp0 c2752vp0 = kr0.n;
        Kr0.i(c2752vp0);
        c2752vp0.v(kr0.k.elapsedRealtime());
        boolean z2 = c1431ht0 != null && c1431ht0.d;
        C2382ru0 c2382ru0 = kr0.h;
        Kr0.k(c2382ru0);
        if (!c2382ru0.f.a(z2, z, j) || c1431ht0 == null) {
            return;
        }
        c1431ht0.d = false;
    }

    public final C1431ht0 x(Ep0 ep0) {
        Preconditions.checkNotNull(ep0);
        Integer numValueOf = Integer.valueOf(ep0.l);
        ConcurrentHashMap concurrentHashMap = this.f;
        C1431ht0 c1431ht0 = (C1431ht0) concurrentHashMap.get(numValueOf);
        if (c1431ht0 == null) {
            String strZ = z(ep0.m);
            C2574tv0 c2574tv0 = ((Kr0) this.a).i;
            Kr0.j(c2574tv0);
            C1431ht0 c1431ht02 = new C1431ht0(null, strZ, c2574tv0.n0());
            concurrentHashMap.put(numValueOf, c1431ht02);
            c1431ht0 = c1431ht02;
        }
        return this.i != null ? this.i : c1431ht0;
    }

    public final C1431ht0 y(boolean z) {
        t();
        r();
        if (!z) {
            return this.e;
        }
        C1431ht0 c1431ht0 = this.e;
        return c1431ht0 != null ? c1431ht0 : this.j;
    }

    public final String z(String str) {
        if (str == null) {
            return "Activity";
        }
        String[] strArrSplit = str.split("\\.");
        int length = strArrSplit.length;
        String str2 = length > 0 ? strArrSplit[length - 1] : "";
        Kr0 kr0 = (Kr0) this.a;
        int length2 = str2.length();
        kr0.d.getClass();
        if (length2 <= 500) {
            return str2;
        }
        kr0.d.getClass();
        return str2.substring(0, 500);
    }
}
