- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
239 lines
12 KiB
Java
239 lines
12 KiB
Java
package com.fyber.inneractive.sdk.config.global;
|
|
|
|
import android.text.TextUtils;
|
|
import com.fyber.inneractive.sdk.config.IAConfigManager;
|
|
import com.fyber.inneractive.sdk.util.IAlog;
|
|
import com.fyber.inneractive.sdk.util.v;
|
|
import com.fyber.inneractive.sdk.util.w;
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.Iterator;
|
|
import java.util.Map;
|
|
import java.util.Random;
|
|
import org.json.JSONArray;
|
|
import org.json.JSONObject;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class s {
|
|
public HashMap c;
|
|
public JSONArray d;
|
|
public String b = "";
|
|
public final r a = new r();
|
|
|
|
public s() {
|
|
d();
|
|
HashMap a = a();
|
|
this.c = a;
|
|
IAlog.a("%s: created. Supported features: %s", "SupportedFeaturesProvider", a);
|
|
}
|
|
|
|
public static s b() {
|
|
boolean e = e();
|
|
s sVar = new s();
|
|
if (e) {
|
|
IAConfigManager iAConfigManager = IAConfigManager.L;
|
|
iAConfigManager.K.a(true, "");
|
|
iAConfigManager.D.a(iAConfigManager.K);
|
|
}
|
|
return sVar;
|
|
}
|
|
|
|
public static boolean e() {
|
|
int i = com.fyber.inneractive.sdk.config.g.a;
|
|
String property = System.getProperty("ia.testEnvironmentConfiguration.featuresConfig");
|
|
if (TextUtils.isEmpty(property)) {
|
|
return false;
|
|
}
|
|
try {
|
|
IAConfigManager.L.y.a = l.a(new JSONObject(property));
|
|
return true;
|
|
} catch (Exception unused) {
|
|
IAlog.a("failed parsing local features json", new Object[0]);
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public final HashMap a() {
|
|
HashMap hashMap = new HashMap();
|
|
for (Map.Entry entry : this.c.entrySet()) {
|
|
hashMap.put(entry.getKey(), ((com.fyber.inneractive.sdk.config.global.features.g) entry.getValue()).c());
|
|
}
|
|
return hashMap;
|
|
}
|
|
|
|
public final JSONArray c() {
|
|
JSONArray jSONArray = this.d;
|
|
if (jSONArray == null || jSONArray.length() == 0) {
|
|
JSONArray a = g.a(this.c, false);
|
|
this.d = a;
|
|
IAlog.a("%s: active experiments json set = %s", "SupportedFeaturesProvider", a);
|
|
}
|
|
return this.d;
|
|
}
|
|
|
|
public final void d() {
|
|
this.a.getClass();
|
|
HashMap hashMap = new HashMap();
|
|
hashMap.put(com.fyber.inneractive.sdk.config.global.features.r.class, new com.fyber.inneractive.sdk.config.global.features.r());
|
|
hashMap.put(com.fyber.inneractive.sdk.config.global.features.c.class, new com.fyber.inneractive.sdk.config.global.features.c());
|
|
hashMap.put(com.fyber.inneractive.sdk.config.global.features.l.class, new com.fyber.inneractive.sdk.config.global.features.l());
|
|
hashMap.put(com.fyber.inneractive.sdk.config.global.features.e.class, new com.fyber.inneractive.sdk.config.global.features.e());
|
|
hashMap.put(com.fyber.inneractive.sdk.config.global.features.k.class, new com.fyber.inneractive.sdk.config.global.features.k());
|
|
hashMap.put(com.fyber.inneractive.sdk.config.global.features.d.class, new com.fyber.inneractive.sdk.config.global.features.d());
|
|
hashMap.put(com.fyber.inneractive.sdk.config.global.features.q.class, new com.fyber.inneractive.sdk.config.global.features.q());
|
|
hashMap.put(com.fyber.inneractive.sdk.config.global.features.h.class, new com.fyber.inneractive.sdk.config.global.features.h());
|
|
hashMap.put(com.fyber.inneractive.sdk.config.global.features.i.class, new com.fyber.inneractive.sdk.config.global.features.i());
|
|
hashMap.put(com.fyber.inneractive.sdk.config.global.features.p.class, new com.fyber.inneractive.sdk.config.global.features.p());
|
|
hashMap.put(com.fyber.inneractive.sdk.config.global.features.n.class, new com.fyber.inneractive.sdk.config.global.features.n());
|
|
hashMap.put(com.fyber.inneractive.sdk.config.global.features.b.class, new com.fyber.inneractive.sdk.config.global.features.b());
|
|
hashMap.put(com.fyber.inneractive.sdk.config.global.features.m.class, new com.fyber.inneractive.sdk.config.global.features.m());
|
|
hashMap.put(com.fyber.inneractive.sdk.config.global.features.a.class, new com.fyber.inneractive.sdk.config.global.features.a());
|
|
hashMap.put(com.fyber.inneractive.sdk.config.global.features.f.class, new com.fyber.inneractive.sdk.config.global.features.f());
|
|
hashMap.put(com.fyber.inneractive.sdk.config.global.features.j.class, new com.fyber.inneractive.sdk.config.global.features.j());
|
|
this.c = hashMap;
|
|
this.d = null;
|
|
}
|
|
|
|
public final void a(e eVar) {
|
|
for (com.fyber.inneractive.sdk.config.global.features.g gVar : this.c.values()) {
|
|
gVar.getClass();
|
|
ArrayList arrayList = new ArrayList(gVar.c.values());
|
|
for (int size = arrayList.size() - 1; size >= 0; size--) {
|
|
b bVar = (b) arrayList.get(size);
|
|
ArrayList arrayList2 = bVar.d;
|
|
if (arrayList2 != null) {
|
|
Iterator it = arrayList2.iterator();
|
|
while (true) {
|
|
if (!it.hasNext()) {
|
|
break;
|
|
}
|
|
d dVar = (d) it.next();
|
|
if (dVar.a(eVar)) {
|
|
gVar.c.remove(bVar.a);
|
|
gVar.d.remove(bVar.a);
|
|
this.d = null;
|
|
IAlog.a("%s: Experiment %s filtered! after response %s", "SupportedFeaturesProvider", bVar.a, dVar);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public final <T extends com.fyber.inneractive.sdk.config.global.features.g> T a(Class<T> cls) {
|
|
if (this.c.containsKey(cls)) {
|
|
T t = (T) this.c.get(cls);
|
|
if (cls.isInstance(t)) {
|
|
return t;
|
|
}
|
|
}
|
|
try {
|
|
return cls.getConstructor(new Class[0]).newInstance(new Object[0]);
|
|
} catch (Exception e) {
|
|
IAlog.a("Couldn't create a feature for %s", e, cls.getName());
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public final void a(boolean z, String str) {
|
|
k kVar;
|
|
e eVar;
|
|
this.b = str;
|
|
a aVar = IAConfigManager.L.y;
|
|
aVar.b = this;
|
|
for (com.fyber.inneractive.sdk.config.global.features.g gVar : this.c.values()) {
|
|
boolean z2 = gVar instanceof com.fyber.inneractive.sdk.config.global.features.o;
|
|
if ((z2 && z) || (!z2 && !z)) {
|
|
l lVar = aVar.a;
|
|
if (gVar != null && lVar != null) {
|
|
q qVar = (q) lVar.a.get(gVar.b);
|
|
if (qVar != null) {
|
|
gVar.a = qVar.a;
|
|
IAlog.a("%s: Feature before variant merge: %s", "a", gVar);
|
|
HashMap hashMap = qVar.c;
|
|
Iterator it = hashMap.keySet().iterator();
|
|
while (it.hasNext()) {
|
|
b bVar = (b) hashMap.get((String) it.next());
|
|
if (bVar != null) {
|
|
int nextInt = new Random().nextInt(100) + 1;
|
|
if (bVar.b < nextInt) {
|
|
IAlog.a("%s: Experiment '%s' filtered! rand: %d, with perc: %d", "a", bVar.a, Integer.valueOf(nextInt), Integer.valueOf(bVar.b));
|
|
} else {
|
|
ArrayList arrayList = bVar.d;
|
|
char c = 0;
|
|
if (arrayList != null) {
|
|
Iterator it2 = arrayList.iterator();
|
|
while (it2.hasNext()) {
|
|
d dVar = (d) it2.next();
|
|
try {
|
|
Long valueOf = Long.valueOf(IAConfigManager.L.d);
|
|
eVar = new e();
|
|
eVar.b = valueOf;
|
|
eVar.c = com.fyber.inneractive.sdk.serverapi.a.a(aVar.b.b);
|
|
} catch (NumberFormatException unused) {
|
|
IAlog.a("%s: invalid publisherId", "a");
|
|
c = 0;
|
|
}
|
|
if (dVar.a(eVar)) {
|
|
Object[] objArr = new Object[3];
|
|
objArr[c] = "a";
|
|
objArr[1] = bVar.a;
|
|
objArr[2] = dVar;
|
|
IAlog.a("%s: Experiment '%s' filtered! with %s", objArr);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
if (gVar instanceof com.fyber.inneractive.sdk.config.global.features.r) {
|
|
Iterator it3 = bVar.c.iterator();
|
|
while (it3.hasNext()) {
|
|
k kVar2 = (k) it3.next();
|
|
n nVar = kVar2.a;
|
|
if (nVar != null && nVar.b() != null && kVar2.a.b().containsKey("use_fmp_cache_mechanism")) {
|
|
v vVar = (v) IAConfigManager.L.H.get(w.Video);
|
|
if (vVar != null && vVar.a()) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
IAlog.a("%s: Experiment '%s' NOT filtered! rand: %d, with perc: %d", "a", bVar.a, Integer.valueOf(nextInt), Integer.valueOf(bVar.b));
|
|
ArrayList arrayList2 = bVar.c;
|
|
int nextInt2 = new Random().nextInt(100) + 1;
|
|
IAlog.a("%s: selectVariant for experiment '%s' generated random number: %d", "a", bVar.a, Integer.valueOf(nextInt2));
|
|
Iterator it4 = arrayList2.iterator();
|
|
int i = 0;
|
|
while (true) {
|
|
if (!it4.hasNext()) {
|
|
kVar = null;
|
|
break;
|
|
}
|
|
kVar = (k) it4.next();
|
|
i += kVar.c;
|
|
IAlog.a("%s: selectVariant variant found: %s", "a", kVar);
|
|
if (i >= nextInt2) {
|
|
break;
|
|
} else {
|
|
IAlog.a("%s: selectVariant variant '%s' percentage outside selected range", "a", kVar.b);
|
|
}
|
|
}
|
|
if (kVar != null) {
|
|
IAlog.a("%s: experiment '%s' variant selected! %s", "a", bVar.a, kVar);
|
|
} else {
|
|
IAlog.a("%s: experiment '%s' no variant was selected! using control group", "a", bVar.a);
|
|
}
|
|
gVar.c.put(bVar.a, bVar);
|
|
if (kVar != null) {
|
|
gVar.d.put(bVar.a, kVar);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
IAlog.a("%s: Feature after variant merge: %s", "a", gVar);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|