package com.iab.omid.library.unity3d.walking; import android.view.View; import com.iab.omid.library.unity3d.internal.e; import com.iab.omid.library.unity3d.utils.h; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.WeakHashMap; /* loaded from: classes2.dex */ public class a { private final HashMap a = new HashMap<>(); private final HashMap b = new HashMap<>(); private final HashMap c = new HashMap<>(); private final HashSet d = new HashSet<>(); private final HashSet e = new HashSet<>(); private final HashSet f = new HashSet<>(); private final HashMap g = new HashMap<>(); private final Map h = new WeakHashMap(); private boolean i; /* renamed from: com.iab.omid.library.unity3d.walking.a$a, reason: collision with other inner class name */ public static class C0146a { private final e a; private final ArrayList b = new ArrayList<>(); public C0146a(e eVar, String str) { this.a = eVar; a(str); } public e a() { return this.a; } public void a(String str) { this.b.add(str); } public ArrayList b() { return this.b; } } private String a(View view) { if (!view.isAttachedToWindow()) { return "notAttached"; } if (b(view).booleanValue()) { return "noWindowFocus"; } HashSet hashSet = new HashSet(); while (view != null) { String a = h.a(view); if (a != null) { return a; } hashSet.add(view); Object parent = view.getParent(); view = parent instanceof View ? (View) parent : null; } this.d.addAll(hashSet); return null; } private void a(com.iab.omid.library.unity3d.adsession.a aVar) { Iterator it = aVar.d().iterator(); while (it.hasNext()) { a(it.next(), aVar); } } private void a(e eVar, com.iab.omid.library.unity3d.adsession.a aVar) { View view = eVar.c().get(); if (view == null) { return; } C0146a c0146a = this.b.get(view); if (c0146a != null) { c0146a.a(aVar.getAdSessionId()); } else { this.b.put(view, new C0146a(eVar, aVar.getAdSessionId())); } } private Boolean b(View view) { if (view.hasWindowFocus()) { this.h.remove(view); return Boolean.FALSE; } if (this.h.containsKey(view)) { return this.h.get(view); } Map map = this.h; Boolean bool = Boolean.FALSE; map.put(view, bool); return bool; } public View a(String str) { return this.c.get(str); } public void a() { this.a.clear(); this.b.clear(); this.c.clear(); this.d.clear(); this.e.clear(); this.f.clear(); this.g.clear(); this.i = false; } public String b(String str) { return this.g.get(str); } public HashSet b() { return this.f; } public C0146a c(View view) { C0146a c0146a = this.b.get(view); if (c0146a != null) { this.b.remove(view); } return c0146a; } public HashSet c() { return this.e; } public String d(View view) { if (this.a.size() == 0) { return null; } String str = this.a.get(view); if (str != null) { this.a.remove(view); } return str; } public void d() { this.i = true; } public c e(View view) { return this.d.contains(view) ? c.PARENT_VIEW : this.i ? c.OBSTRUCTION_VIEW : c.UNDERLYING_VIEW; } public void e() { com.iab.omid.library.unity3d.internal.c c = com.iab.omid.library.unity3d.internal.c.c(); if (c != null) { for (com.iab.omid.library.unity3d.adsession.a aVar : c.a()) { View c2 = aVar.c(); if (aVar.f()) { String adSessionId = aVar.getAdSessionId(); if (c2 != null) { String a = a(c2); if (a == null) { this.e.add(adSessionId); this.a.put(c2, adSessionId); a(aVar); } else if (a != "noWindowFocus") { this.f.add(adSessionId); this.c.put(adSessionId, c2); this.g.put(adSessionId, a); } } else { this.f.add(adSessionId); this.g.put(adSessionId, "noAdView"); } } } } } public boolean f(View view) { if (!this.h.containsKey(view)) { return true; } this.h.put(view, Boolean.TRUE); return false; } }