- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
153 lines
4.0 KiB
Java
153 lines
4.0 KiB
Java
package com.applovin.impl;
|
|
|
|
import com.applovin.impl.sdk.utils.JsonUtils;
|
|
import com.applovin.impl.tm;
|
|
import java.util.HashMap;
|
|
import java.util.Iterator;
|
|
import java.util.Map;
|
|
import org.json.JSONException;
|
|
import org.json.JSONObject;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class da {
|
|
private final com.applovin.impl.sdk.j a;
|
|
private final Map b = new HashMap();
|
|
|
|
public da(com.applovin.impl.sdk.j jVar) {
|
|
if (jVar == null) {
|
|
throw new IllegalArgumentException("No sdk specified");
|
|
}
|
|
this.a = jVar;
|
|
}
|
|
|
|
public void a() {
|
|
synchronized (this.b) {
|
|
this.b.clear();
|
|
}
|
|
f();
|
|
}
|
|
|
|
public void b() {
|
|
synchronized (this.b) {
|
|
try {
|
|
Iterator it = ca.a().iterator();
|
|
while (it.hasNext()) {
|
|
this.b.remove(((ca) it.next()).b());
|
|
}
|
|
f();
|
|
} catch (Throwable th) {
|
|
throw th;
|
|
}
|
|
}
|
|
}
|
|
|
|
public JSONObject c() {
|
|
JSONObject jSONObject;
|
|
synchronized (this.b) {
|
|
try {
|
|
jSONObject = new JSONObject();
|
|
for (Map.Entry entry : this.b.entrySet()) {
|
|
JsonUtils.putLong(jSONObject, (String) entry.getKey(), ((Long) entry.getValue()).longValue());
|
|
}
|
|
} catch (Throwable th) {
|
|
throw th;
|
|
}
|
|
}
|
|
return jSONObject;
|
|
}
|
|
|
|
public void e() {
|
|
try {
|
|
JSONObject jSONObject = new JSONObject((String) this.a.a(uj.z, JsonUtils.EMPTY_JSON));
|
|
synchronized (this.b) {
|
|
Iterator<String> keys = jSONObject.keys();
|
|
while (keys.hasNext()) {
|
|
try {
|
|
String next = keys.next();
|
|
this.b.put(next, Long.valueOf(jSONObject.getLong(next)));
|
|
} catch (JSONException unused) {
|
|
}
|
|
}
|
|
}
|
|
} catch (Throwable th) {
|
|
this.a.J();
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.a.J().a("GlobalStatsManager", "Unable to load stats", th);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void f() {
|
|
this.a.j0().a(new Runnable() { // from class: com.applovin.impl.da$$ExternalSyntheticLambda0
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
da.this.d();
|
|
}
|
|
}, tm.b.OTHER);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ void d() {
|
|
try {
|
|
this.a.b(uj.z, c().toString());
|
|
} catch (Throwable th) {
|
|
this.a.J();
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.a.J().a("GlobalStatsManager", "Unable to save stats", th);
|
|
}
|
|
}
|
|
}
|
|
|
|
public long c(ca caVar) {
|
|
return a(caVar, 1L);
|
|
}
|
|
|
|
public long b(ca caVar) {
|
|
long longValue;
|
|
synchronized (this.b) {
|
|
try {
|
|
Long l = (Long) this.b.get(caVar.b());
|
|
if (l == null) {
|
|
l = 0L;
|
|
}
|
|
longValue = l.longValue();
|
|
} catch (Throwable th) {
|
|
throw th;
|
|
}
|
|
}
|
|
return longValue;
|
|
}
|
|
|
|
public void a(ca caVar) {
|
|
synchronized (this.b) {
|
|
this.b.remove(caVar.b());
|
|
}
|
|
f();
|
|
}
|
|
|
|
public long a(ca caVar, long j) {
|
|
long longValue;
|
|
synchronized (this.b) {
|
|
try {
|
|
Long l = (Long) this.b.get(caVar.b());
|
|
if (l == null) {
|
|
l = 0L;
|
|
}
|
|
longValue = l.longValue() + j;
|
|
this.b.put(caVar.b(), Long.valueOf(longValue));
|
|
} catch (Throwable th) {
|
|
throw th;
|
|
}
|
|
}
|
|
f();
|
|
return longValue;
|
|
}
|
|
|
|
public void b(ca caVar, long j) {
|
|
synchronized (this.b) {
|
|
this.b.put(caVar.b(), Long.valueOf(j));
|
|
}
|
|
f();
|
|
}
|
|
}
|