- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
241 lines
7.7 KiB
Java
241 lines
7.7 KiB
Java
package com.iab.omid.library.unity3d.walking;
|
|
|
|
import android.os.Handler;
|
|
import android.os.Looper;
|
|
import android.view.View;
|
|
import androidx.annotation.VisibleForTesting;
|
|
import com.iab.omid.library.unity3d.processor.a;
|
|
import com.iab.omid.library.unity3d.utils.f;
|
|
import com.iab.omid.library.unity3d.utils.h;
|
|
import com.iab.omid.library.unity3d.walking.a;
|
|
import java.util.ArrayList;
|
|
import java.util.HashSet;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.concurrent.TimeUnit;
|
|
import org.json.JSONObject;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class TreeWalker implements a.InterfaceC0144a {
|
|
private static TreeWalker i = new TreeWalker();
|
|
private static Handler j = new Handler(Looper.getMainLooper());
|
|
private static Handler k = null;
|
|
private static final Runnable l = new b();
|
|
private static final Runnable m = new c();
|
|
private int b;
|
|
private long h;
|
|
private List<TreeWalkerTimeLogger> a = new ArrayList();
|
|
private boolean c = false;
|
|
private final List<com.iab.omid.library.unity3d.weakreference.a> d = new ArrayList();
|
|
private com.iab.omid.library.unity3d.walking.a f = new com.iab.omid.library.unity3d.walking.a();
|
|
private com.iab.omid.library.unity3d.processor.b e = new com.iab.omid.library.unity3d.processor.b();
|
|
private com.iab.omid.library.unity3d.walking.b g = new com.iab.omid.library.unity3d.walking.b(new com.iab.omid.library.unity3d.walking.async.c());
|
|
|
|
public interface TreeWalkerNanoTimeLogger extends TreeWalkerTimeLogger {
|
|
void onTreeProcessedNano(int i, long j);
|
|
}
|
|
|
|
public interface TreeWalkerTimeLogger {
|
|
void onTreeProcessed(int i, long j);
|
|
}
|
|
|
|
public class a implements Runnable {
|
|
public a() {
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
TreeWalker.this.g.b();
|
|
}
|
|
}
|
|
|
|
public class b implements Runnable {
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
TreeWalker.getInstance().l();
|
|
}
|
|
}
|
|
|
|
public class c implements Runnable {
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
if (TreeWalker.k != null) {
|
|
TreeWalker.k.post(TreeWalker.l);
|
|
TreeWalker.k.postDelayed(TreeWalker.m, 200L);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void a(long j2) {
|
|
if (this.a.size() > 0) {
|
|
for (TreeWalkerTimeLogger treeWalkerTimeLogger : this.a) {
|
|
treeWalkerTimeLogger.onTreeProcessed(this.b, TimeUnit.NANOSECONDS.toMillis(j2));
|
|
if (treeWalkerTimeLogger instanceof TreeWalkerNanoTimeLogger) {
|
|
((TreeWalkerNanoTimeLogger) treeWalkerTimeLogger).onTreeProcessedNano(this.b, j2);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private void a(View view, com.iab.omid.library.unity3d.processor.a aVar, JSONObject jSONObject, com.iab.omid.library.unity3d.walking.c cVar, boolean z) {
|
|
aVar.a(view, jSONObject, this, cVar == com.iab.omid.library.unity3d.walking.c.PARENT_VIEW, z);
|
|
}
|
|
|
|
private void a(String str, View view, JSONObject jSONObject) {
|
|
com.iab.omid.library.unity3d.processor.a b2 = this.e.b();
|
|
String b3 = this.f.b(str);
|
|
if (b3 != null) {
|
|
JSONObject a2 = b2.a(view);
|
|
com.iab.omid.library.unity3d.utils.c.a(a2, str);
|
|
com.iab.omid.library.unity3d.utils.c.b(a2, b3);
|
|
com.iab.omid.library.unity3d.utils.c.a(jSONObject, a2);
|
|
}
|
|
}
|
|
|
|
private boolean a(View view, JSONObject jSONObject) {
|
|
a.C0146a c2 = this.f.c(view);
|
|
if (c2 == null) {
|
|
return false;
|
|
}
|
|
com.iab.omid.library.unity3d.utils.c.a(jSONObject, c2);
|
|
return true;
|
|
}
|
|
|
|
private boolean b(View view, JSONObject jSONObject) {
|
|
String d = this.f.d(view);
|
|
if (d == null) {
|
|
return false;
|
|
}
|
|
com.iab.omid.library.unity3d.utils.c.a(jSONObject, d);
|
|
com.iab.omid.library.unity3d.utils.c.a(jSONObject, Boolean.valueOf(this.f.f(view)));
|
|
this.f.d();
|
|
return true;
|
|
}
|
|
|
|
private void d() {
|
|
a(f.b() - this.h);
|
|
}
|
|
|
|
private void e() {
|
|
this.b = 0;
|
|
this.d.clear();
|
|
this.c = false;
|
|
Iterator<com.iab.omid.library.unity3d.adsession.a> it = com.iab.omid.library.unity3d.internal.c.c().a().iterator();
|
|
while (true) {
|
|
if (!it.hasNext()) {
|
|
break;
|
|
} else if (it.next().e()) {
|
|
this.c = true;
|
|
break;
|
|
}
|
|
}
|
|
this.h = f.b();
|
|
}
|
|
|
|
public static TreeWalker getInstance() {
|
|
return i;
|
|
}
|
|
|
|
private void i() {
|
|
if (k == null) {
|
|
Handler handler = new Handler(Looper.getMainLooper());
|
|
k = handler;
|
|
handler.post(l);
|
|
k.postDelayed(m, 200L);
|
|
}
|
|
}
|
|
|
|
private void k() {
|
|
Handler handler = k;
|
|
if (handler != null) {
|
|
handler.removeCallbacks(m);
|
|
k = null;
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void l() {
|
|
e();
|
|
f();
|
|
d();
|
|
}
|
|
|
|
@Override // com.iab.omid.library.unity3d.processor.a.InterfaceC0144a
|
|
public void a(View view, com.iab.omid.library.unity3d.processor.a aVar, JSONObject jSONObject, boolean z) {
|
|
com.iab.omid.library.unity3d.walking.c e;
|
|
if (h.d(view) && (e = this.f.e(view)) != com.iab.omid.library.unity3d.walking.c.UNDERLYING_VIEW) {
|
|
JSONObject a2 = aVar.a(view);
|
|
com.iab.omid.library.unity3d.utils.c.a(jSONObject, a2);
|
|
if (!b(view, a2)) {
|
|
boolean z2 = z || a(view, a2);
|
|
if (this.c && e == com.iab.omid.library.unity3d.walking.c.OBSTRUCTION_VIEW && !z2) {
|
|
this.d.add(new com.iab.omid.library.unity3d.weakreference.a(view));
|
|
}
|
|
a(view, aVar, a2, e, z2);
|
|
}
|
|
this.b++;
|
|
}
|
|
}
|
|
|
|
public void addTimeLogger(TreeWalkerTimeLogger treeWalkerTimeLogger) {
|
|
if (this.a.contains(treeWalkerTimeLogger)) {
|
|
return;
|
|
}
|
|
this.a.add(treeWalkerTimeLogger);
|
|
}
|
|
|
|
@VisibleForTesting
|
|
public void f() {
|
|
this.f.e();
|
|
long b2 = f.b();
|
|
com.iab.omid.library.unity3d.processor.a a2 = this.e.a();
|
|
if (this.f.b().size() > 0) {
|
|
Iterator<String> it = this.f.b().iterator();
|
|
while (it.hasNext()) {
|
|
String next = it.next();
|
|
JSONObject a3 = a2.a(null);
|
|
a(next, this.f.a(next), a3);
|
|
com.iab.omid.library.unity3d.utils.c.b(a3);
|
|
HashSet<String> hashSet = new HashSet<>();
|
|
hashSet.add(next);
|
|
this.g.a(a3, hashSet, b2);
|
|
}
|
|
}
|
|
if (this.f.c().size() > 0) {
|
|
JSONObject a4 = a2.a(null);
|
|
a(null, a2, a4, com.iab.omid.library.unity3d.walking.c.PARENT_VIEW, false);
|
|
com.iab.omid.library.unity3d.utils.c.b(a4);
|
|
this.g.b(a4, this.f.c(), b2);
|
|
if (this.c) {
|
|
Iterator<com.iab.omid.library.unity3d.adsession.a> it2 = com.iab.omid.library.unity3d.internal.c.c().a().iterator();
|
|
while (it2.hasNext()) {
|
|
it2.next().a(this.d);
|
|
}
|
|
}
|
|
} else {
|
|
this.g.b();
|
|
}
|
|
this.f.a();
|
|
}
|
|
|
|
public void g() {
|
|
k();
|
|
}
|
|
|
|
public void h() {
|
|
i();
|
|
}
|
|
|
|
public void j() {
|
|
g();
|
|
this.a.clear();
|
|
j.post(new a());
|
|
}
|
|
|
|
public void removeTimeLogger(TreeWalkerTimeLogger treeWalkerTimeLogger) {
|
|
if (this.a.contains(treeWalkerTimeLogger)) {
|
|
this.a.remove(treeWalkerTimeLogger);
|
|
}
|
|
}
|
|
}
|