jimu-decompiled/sources/com/google/android/gms/measurement/internal/zza.java
2025-05-13 19:24:51 +02:00

146 lines
4.2 KiB
Java

package com.google.android.gms.measurement.internal;
import android.os.Bundle;
import androidx.collection.ArrayMap;
import com.google.android.gms.common.internal.Preconditions;
import java.util.Iterator;
import java.util.Map;
/* loaded from: classes.dex */
public final class zza extends zze {
private final Map<String, Long> b;
private final Map<String, Integer> c;
private long d;
public zza(zzbw zzbwVar) {
super(zzbwVar);
this.c = new ArrayMap();
this.b = new ArrayMap();
}
/* JADX INFO: Access modifiers changed from: private */
public final void c(String str, long j) {
g();
f();
Preconditions.b(str);
if (this.c.isEmpty()) {
this.d = j;
}
Integer num = this.c.get(str);
if (num != null) {
this.c.put(str, Integer.valueOf(num.intValue() + 1));
} else if (this.c.size() >= 100) {
e().w().a("Too many ads visible");
} else {
this.c.put(str, 1);
this.b.put(str, Long.valueOf(j));
}
}
/* JADX INFO: Access modifiers changed from: private */
public final void d(String str, long j) {
g();
f();
Preconditions.b(str);
Integer num = this.c.get(str);
if (num == null) {
e().t().a("Call to endAdUnitExposure for unknown ad unit id", str);
return;
}
zzdx B = s().B();
int intValue = num.intValue() - 1;
if (intValue != 0) {
this.c.put(str, Integer.valueOf(intValue));
return;
}
this.c.remove(str);
Long l = this.b.get(str);
if (l == null) {
e().t().a("First ad unit exposure time was never set");
} else {
long longValue = j - l.longValue();
this.b.remove(str);
a(str, longValue, B);
}
if (this.c.isEmpty()) {
long j2 = this.d;
if (j2 == 0) {
e().t().a("First ad exposure time was never set");
} else {
a(j - j2, B);
this.d = 0L;
}
}
}
public final void a(String str, long j) {
if (str == null || str.length() == 0) {
e().t().a("Ad unit id must be a non-empty string");
} else {
a().a(new zzb(this, str, j));
}
}
public final void b(String str, long j) {
if (str == null || str.length() == 0) {
e().t().a("Ad unit id must be a non-empty string");
} else {
a().a(new zzc(this, str, j));
}
}
private final void a(long j, zzdx zzdxVar) {
if (zzdxVar == null) {
e().B().a("Not logging ad exposure. No active activity");
return;
}
if (j < 1000) {
e().B().a("Not logging ad exposure. Less than 1000 ms. exposure", Long.valueOf(j));
return;
}
Bundle bundle = new Bundle();
bundle.putLong("_xt", j);
zzdy.a(zzdxVar, bundle, true);
p().b("am", "_xa", bundle);
}
/* JADX INFO: Access modifiers changed from: private */
public final void b(long j) {
Iterator<String> it = this.b.keySet().iterator();
while (it.hasNext()) {
this.b.put(it.next(), Long.valueOf(j));
}
if (this.b.isEmpty()) {
return;
}
this.d = j;
}
private final void a(String str, long j, zzdx zzdxVar) {
if (zzdxVar == null) {
e().B().a("Not logging ad unit exposure. No active activity");
return;
}
if (j < 1000) {
e().B().a("Not logging ad unit exposure. Less than 1000 ms. exposure", Long.valueOf(j));
return;
}
Bundle bundle = new Bundle();
bundle.putString("_ai", str);
bundle.putLong("_xt", j);
zzdy.a(zzdxVar, bundle, true);
p().b("am", "_xu", bundle);
}
public final void a(long j) {
zzdx B = s().B();
for (String str : this.b.keySet()) {
a(str, j - this.b.get(str).longValue(), B);
}
if (!this.b.isEmpty()) {
a(j - this.d, B);
}
b(j);
}
}