package com.google.android.gms.measurement.internal;

import android.os.Bundle;
import java.util.Iterator;

/* JADX INFO: loaded from: classes2.dex */
public final class s extends b0 {

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final androidx.collection.f f21894b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final androidx.collection.f f21895c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public long f21896d;

    public s(m1 m1Var) {
        super(m1Var);
        this.f21895c = new androidx.collection.f(0);
        this.f21894b = new androidx.collection.f(0);
    }

    public final void D(long j10) {
        x2 x2VarG = A().G(false);
        androidx.collection.f fVar = this.f21894b;
        for (String str : (androidx.collection.c) fVar.keySet()) {
            G(str, j10 - ((Long) fVar.get(str)).longValue(), x2VarG);
        }
        if (!fVar.isEmpty()) {
            E(j10 - this.f21896d, x2VarG);
        }
        H(j10);
    }

    public final void E(long j10, x2 x2Var) {
        if (x2Var == null) {
            zzj().f21842n.c("Not logging ad exposure. No active activity");
            return;
        }
        if (j10 < 1000) {
            p0 p0VarZzj = zzj();
            p0VarZzj.f21842n.b(Long.valueOf(j10), "Not logging ad exposure. Less than 1000 ms. exposure");
        } else {
            Bundle bundle = new Bundle();
            bundle.putLong("_xt", j10);
            n4.X(x2Var, bundle, true);
            z().d0("am", "_xa", bundle);
        }
    }

    public final void F(long j10, String str) {
        if (str == null || str.length() == 0) {
            zzj().f21834f.c("Ad unit id must be a non-empty string");
        } else {
            zzl().I(new c(this, str, j10, 0));
        }
    }

    public final void G(String str, long j10, x2 x2Var) {
        if (x2Var == null) {
            zzj().f21842n.c("Not logging ad unit exposure. No active activity");
            return;
        }
        if (j10 < 1000) {
            p0 p0VarZzj = zzj();
            p0VarZzj.f21842n.b(Long.valueOf(j10), "Not logging ad unit exposure. Less than 1000 ms. exposure");
        } else {
            Bundle bundle = new Bundle();
            bundle.putString("_ai", str);
            bundle.putLong("_xt", j10);
            n4.X(x2Var, bundle, true);
            z().d0("am", "_xu", bundle);
        }
    }

    public final void H(long j10) {
        androidx.collection.f fVar = this.f21894b;
        Iterator it = ((androidx.collection.c) fVar.keySet()).iterator();
        while (it.hasNext()) {
            fVar.put((String) it.next(), Long.valueOf(j10));
        }
        if (fVar.isEmpty()) {
            return;
        }
        this.f21896d = j10;
    }

    public final void I(long j10, String str) {
        if (str == null || str.length() == 0) {
            zzj().f21834f.c("Ad unit id must be a non-empty string");
        } else {
            zzl().I(new c(this, str, j10, 1));
        }
    }
}
