package c.i.a.c.h2; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Handler; import android.os.Looper; import androidx.annotation.Nullable; import c.i.a.c.h2.d; import c.i.a.c.i2.f0; import c.i.a.c.i2.g; import c.i.a.c.i2.z; import c.i.b.b.r0; import c.i.b.b.u; import c.i.b.b.v; import c.i.b.b.w; import com.airbnb.lottie.parser.AnimatableValueParser; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.Map; import java.util.Objects; import java.util.Set; import java.util.SortedMap; /* compiled from: DefaultBandwidthMeter */ public final class n implements d, x { public static final v a = h(); public static final u b = u.u(6100000L, 3800000L, 2100000L, 1300000L, 590000L); /* renamed from: c reason: collision with root package name */ public static final u f885c = u.u(218000L, 159000L, 145000L, 130000L, 112000L); public static final u d = u.u(2200000L, 1300000L, 930000L, 730000L, 530000L); public static final u e = u.u(4800000L, 2700000L, 1800000L, 1200000L, 630000L); public static final u f = u.u(12000000L, 8800000L, 5900000L, 3500000L, 1800000L); @Nullable public static n g; @Nullable public final Context h; public final w i; public final d.a.C0092a j; public final z k; public final g l; public int m; public long n; public long o; public int p; public long q; public long r; /* renamed from: s reason: collision with root package name */ public long f886s; public long t; /* compiled from: DefaultBandwidthMeter */ public static class a extends BroadcastReceiver { public static a a; public final Handler b = new Handler(Looper.getMainLooper()); /* renamed from: c reason: collision with root package name */ public final ArrayList> f887c = new ArrayList<>(); public final void a() { for (int size = this.f887c.size() - 1; size >= 0; size--) { if (this.f887c.get(size).get() == null) { this.f887c.remove(size); } } } public final void b(n nVar) { v vVar = n.a; synchronized (nVar) { Context context = nVar.h; int q = context == null ? 0 : f0.q(context); if (nVar.p != q) { nVar.p = q; if (q != 1 && q != 0 && q != 8) { nVar.f886s = nVar.i(q); long c2 = nVar.l.c(); nVar.k(nVar.m > 0 ? (int) (c2 - nVar.n) : 0, nVar.o, nVar.f886s); nVar.n = c2; nVar.o = 0; nVar.r = 0; nVar.q = 0; z zVar = nVar.k; zVar.f915c.clear(); zVar.e = -1; zVar.f = 0; zVar.g = 0; } } } } @Override // android.content.BroadcastReceiver public synchronized void onReceive(Context context, Intent intent) { if (!isInitialStickyBroadcast()) { a(); for (int i = 0; i < this.f887c.size(); i++) { n nVar = this.f887c.get(i).get(); if (nVar != null) { b(nVar); } } } } } @Deprecated public n() { this(null, r0.l, 2000, g.a, false); } /* JADX WARNING: Code restructure failed: missing block: B:9:0x001c, code lost: if (r0.e() == false) goto L_0x005e; */ public n(@Nullable Context context, Map map, int i, g gVar, boolean z2) { w wVar; a aVar; this.h = context == null ? null : context.getApplicationContext(); if ((map instanceof w) && !(map instanceof SortedMap)) { wVar = (w) map; } Set> entrySet = map.entrySet(); boolean z3 = entrySet instanceof Collection; w.a aVar2 = new w.a(z3 ? entrySet.size() : 4); if (z3) { aVar2.b(entrySet.size() + aVar2.b); } Iterator it = entrySet.iterator(); while (it.hasNext()) { Map.Entry entry = (Map.Entry) it.next(); aVar2.c(entry.getKey(), entry.getValue()); } wVar = aVar2.a(); this.i = wVar; this.j = new d.a.C0092a(); this.k = new z(i); this.l = gVar; int q = context == null ? 0 : f0.q(context); this.p = q; this.f886s = i(q); if (context != null && z2) { a aVar3 = a.a; synchronized (a.class) { if (a.a == null) { a.a = new a(); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction("android.net.conn.CONNECTIVITY_CHANGE"); context.registerReceiver(a.a, intentFilter); } aVar = a.a; } synchronized (aVar) { aVar.a(); aVar.f887c.add(new WeakReference<>(this)); aVar.b.post(new b(aVar, this)); } } } public static v h() { v.a f2 = v.f(); f2.b("AD", 1, 2, 0, 0, 2); f2.b("AE", 1, 4, 4, 4, 1); f2.b("AF", 4, 4, 3, 4, 2); f2.b("AG", 2, 2, 1, 1, 2); f2.b("AI", 1, 2, 2, 2, 2); f2.b("AL", 1, 1, 0, 1, 2); f2.b("AM", 2, 2, 1, 2, 2); f2.b("AO", 3, 4, 4, 2, 2); f2.b("AR", 2, 4, 2, 2, 2); f2.b("AS", 2, 2, 4, 3, 2); f2.b("AT", 0, 3, 0, 0, 2); f2.b("AU", 0, 2, 0, 1, 1); f2.b("AW", 1, 2, 0, 4, 2); f2.b("AX", 0, 2, 2, 2, 2); f2.b("AZ", 3, 3, 3, 4, 2); f2.b("BA", 1, 1, 0, 1, 2); f2.b("BB", 0, 2, 0, 0, 2); f2.b("BD", 2, 0, 3, 3, 2); f2.b("BE", 0, 1, 2, 3, 2); f2.b("BF", 4, 4, 4, 2, 2); f2.b("BG", 0, 1, 0, 0, 2); f2.b("BH", 1, 0, 2, 4, 2); f2.b("BI", 4, 4, 4, 4, 2); f2.b("BJ", 4, 4, 3, 4, 2); f2.b("BL", 1, 2, 2, 2, 2); f2.b("BM", 1, 2, 0, 0, 2); f2.b("BN", 4, 0, 1, 1, 2); f2.b("BO", 2, 3, 3, 2, 2); f2.b("BQ", 1, 2, 1, 2, 2); f2.b("BR", 2, 4, 2, 1, 2); f2.b("BS", 3, 2, 2, 3, 2); f2.b("BT", 3, 0, 3, 2, 2); f2.b("BW", 3, 4, 2, 2, 2); f2.b("BY", 1, 0, 2, 1, 2); f2.b("BZ", 2, 2, 2, 1, 2); f2.b("CA", 0, 3, 1, 2, 3); f2.b("CD", 4, 3, 2, 2, 2); f2.b("CF", 4, 2, 2, 2, 2); f2.b("CG", 3, 4, 1, 1, 2); f2.b("CH", 0, 1, 0, 0, 0); f2.b("CI", 3, 3, 3, 3, 2); f2.b("CK", 3, 2, 1, 0, 2); f2.b("CL", 1, 1, 2, 3, 2); f2.b("CM", 3, 4, 3, 2, 2); f2.b("CN", 2, 2, 2, 1, 3); f2.b("CO", 2, 4, 3, 2, 2); f2.b("CR", 2, 3, 4, 4, 2); f2.b("CU", 4, 4, 2, 1, 2); f2.b("CV", 2, 3, 3, 3, 2); f2.b("CW", 1, 2, 0, 0, 2); f2.b("CY", 1, 2, 0, 0, 2); f2.b("CZ", 0, 1, 0, 0, 2); f2.b("DE", 0, 1, 1, 2, 0); f2.b("DJ", 4, 1, 4, 4, 2); f2.b("DK", 0, 0, 1, 0, 2); f2.b("DM", 1, 2, 2, 2, 2); f2.b("DO", 3, 4, 4, 4, 2); f2.b("DZ", 3, 2, 4, 4, 2); f2.b("EC", 2, 4, 3, 2, 2); f2.b("EE", 0, 0, 0, 0, 2); f2.b("EG", 3, 4, 2, 1, 2); f2.b("EH", 2, 2, 2, 2, 2); f2.b("ER", 4, 2, 2, 2, 2); f2.b("ES", 0, 1, 2, 1, 2); f2.b("ET", 4, 4, 4, 1, 2); f2.b("FI", 0, 0, 1, 0, 0); f2.b("FJ", 3, 0, 3, 3, 2); f2.b("FK", 2, 2, 2, 2, 2); f2.b("FM", 4, 2, 4, 3, 2); f2.b("FO", 0, 2, 0, 0, 2); f2.b("FR", 1, 0, 2, 1, 2); f2.b("GA", 3, 3, 1, 0, 2); f2.b("GB", 0, 0, 1, 2, 2); f2.b("GD", 1, 2, 2, 2, 2); f2.b("GE", 1, 0, 1, 3, 2); f2.b("GF", 2, 2, 2, 4, 2); f2.b("GG", 0, 2, 0, 0, 2); f2.b("GH", 3, 2, 3, 2, 2); f2.b("GI", 0, 2, 0, 0, 2); f2.b("GL", 1, 2, 2, 1, 2); f2.b("GM", 4, 3, 2, 4, 2); f2.b("GN", 4, 3, 4, 2, 2); f2.b("GP", 2, 2, 3, 4, 2); f2.b("GQ", 4, 2, 3, 4, 2); f2.b("GR", 1, 1, 0, 1, 2); f2.b("GT", 3, 2, 3, 2, 2); f2.b("GU", 1, 2, 4, 4, 2); f2.b("GW", 3, 4, 4, 3, 2); f2.b("GY", 3, 3, 1, 0, 2); f2.b("HK", 0, 2, 3, 4, 2); f2.b("HN", 3, 0, 3, 3, 2); f2.b("HR", 1, 1, 0, 1, 2); f2.b("HT", 4, 3, 4, 4, 2); f2.b("HU", 0, 1, 0, 0, 2); f2.b("ID", 3, 2, 2, 3, 2); f2.b("IE", 0, 0, 1, 1, 2); f2.b("IL", 1, 0, 2, 3, 2); f2.b("IM", 0, 2, 0, 1, 2); f2.b("IN", 2, 1, 3, 3, 2); f2.b("IO", 4, 2, 2, 4, 2); f2.b("IQ", 3, 2, 4, 3, 2); f2.b("IR", 4, 2, 3, 4, 2); f2.b("IS", 0, 2, 0, 0, 2); f2.b("IT", 0, 0, 1, 1, 2); f2.b("JE", 2, 2, 0, 2, 2); f2.b("JM", 3, 3, 4, 4, 2); f2.b("JO", 1, 2, 1, 1, 2); f2.b("JP", 0, 2, 0, 1, 3); f2.b("KE", 3, 4, 2, 2, 2); f2.b("KG", 1, 0, 2, 2, 2); f2.b("KH", 2, 0, 4, 3, 2); f2.b("KI", 4, 2, 3, 1, 2); f2.b("KM", 4, 2, 2, 3, 2); f2.b("KN", 1, 2, 2, 2, 2); f2.b("KP", 4, 2, 2, 2, 2); f2.b("KR", 0, 2, 1, 1, 1); f2.b("KW", 2, 3, 1, 1, 1); f2.b("KY", 1, 2, 0, 0, 2); f2.b("KZ", 1, 2, 2, 3, 2); f2.b("LA", 2, 2, 1, 1, 2); f2.b("LB", 3, 2, 0, 0, 2); f2.b("LC", 1, 1, 0, 0, 2); f2.b("LI", 0, 2, 2, 2, 2); f2.b("LK", 2, 0, 2, 3, 2); f2.b("LR", 3, 4, 3, 2, 2); f2.b("LS", 3, 3, 2, 3, 2); f2.b("LT", 0, 0, 0, 0, 2); f2.b("LU", 0, 0, 0, 0, 2); f2.b("LV", 0, 0, 0, 0, 2); f2.b("LY", 4, 2, 4, 3, 2); f2.b("MA", 2, 1, 2, 1, 2); f2.b("MC", 0, 2, 2, 2, 2); f2.b("MD", 1, 2, 0, 0, 2); f2.b("ME", 1, 2, 1, 2, 2); f2.b("MF", 1, 2, 1, 0, 2); f2.b("MG", 3, 4, 3, 3, 2); f2.b("MH", 4, 2, 2, 4, 2); f2.b("MK", 1, 0, 0, 0, 2); f2.b("ML", 4, 4, 1, 1, 2); f2.b("MM", 2, 3, 2, 2, 2); f2.b("MN", 2, 4, 1, 1, 2); f2.b("MO", 0, 2, 4, 4, 2); f2.b("MP", 0, 2, 2, 2, 2); f2.b("MQ", 2, 2, 2, 3, 2); f2.b("MR", 3, 0, 4, 2, 2); f2.b("MS", 1, 2, 2, 2, 2); f2.b("MT", 0, 2, 0, 1, 2); f2.b("MU", 3, 1, 2, 3, 2); f2.b("MV", 4, 3, 1, 4, 2); f2.b("MW", 4, 1, 1, 0, 2); f2.b("MX", 2, 4, 3, 3, 2); f2.b("MY", 2, 0, 3, 3, 2); f2.b("MZ", 3, 3, 2, 3, 2); f2.b("NA", 4, 3, 2, 2, 2); f2.b("NC", 2, 0, 4, 4, 2); f2.b("NE", 4, 4, 4, 4, 2); f2.b("NF", 2, 2, 2, 2, 2); f2.b("NG", 3, 3, 2, 2, 2); f2.b("NI", 3, 1, 4, 4, 2); f2.b("NL", 0, 2, 4, 2, 0); f2.b("NO", 0, 1, 1, 0, 2); f2.b("NP", 2, 0, 4, 3, 2); f2.b("NR", 4, 2, 3, 1, 2); f2.b("NU", 4, 2, 2, 2, 2); f2.b("NZ", 0, 2, 1, 2, 4); f2.b("OM", 2, 2, 0, 2, 2); f2.b("PA", 1, 3, 3, 4, 2); f2.b("PE", 2, 4, 4, 4, 2); f2.b("PF", 2, 2, 1, 1, 2); f2.b("PG", 4, 3, 3, 2, 2); f2.b("PH", 3, 0, 3, 4, 4); f2.b("PK", 3, 2, 3, 3, 2); f2.b("PL", 1, 0, 2, 2, 2); f2.b("PM", 0, 2, 2, 2, 2); f2.b("PR", 1, 2, 2, 3, 4); f2.b("PS", 3, 3, 2, 2, 2); f2.b("PT", 1, 1, 0, 0, 2); f2.b("PW", 1, 2, 3, 0, 2); f2.b("PY", 2, 0, 3, 3, 2); f2.b("QA", 2, 3, 1, 2, 2); f2.b("RE", 1, 0, 2, 1, 2); f2.b("RO", 1, 1, 1, 2, 2); f2.b("RS", 1, 2, 0, 0, 2); f2.b("RU", 0, 1, 0, 1, 2); f2.b("RW", 4, 3, 3, 4, 2); f2.b("SA", 2, 2, 2, 1, 2); f2.b("SB", 4, 2, 4, 2, 2); f2.b("SC", 4, 2, 0, 1, 2); f2.b("SD", 4, 4, 4, 3, 2); f2.b("SE", 0, 0, 0, 0, 2); f2.b("SG", 0, 0, 3, 3, 4); f2.b("SH", 4, 2, 2, 2, 2); f2.b("SI", 0, 1, 0, 0, 2); f2.b("SJ", 2, 2, 2, 2, 2); f2.b("SK", 0, 1, 0, 0, 2); f2.b("SL", 4, 3, 3, 1, 2); f2.b("SM", 0, 2, 2, 2, 2); f2.b("SN", 4, 4, 4, 3, 2); f2.b("SO", 3, 4, 4, 4, 2); f2.b("SR", 3, 2, 3, 1, 2); f2.b("SS", 4, 1, 4, 2, 2); f2.b("ST", 2, 2, 1, 2, 2); f2.b("SV", 2, 1, 4, 4, 2); f2.b("SX", 2, 2, 1, 0, 2); f2.b("SY", 4, 3, 2, 2, 2); f2.b("SZ", 3, 4, 3, 4, 2); f2.b("TC", 1, 2, 1, 0, 2); f2.b("TD", 4, 4, 4, 4, 2); f2.b("TG", 3, 2, 1, 0, 2); f2.b("TH", 1, 3, 4, 3, 0); f2.b("TJ", 4, 4, 4, 4, 2); f2.b("TL", 4, 1, 4, 4, 2); f2.b("TM", 4, 2, 1, 2, 2); f2.b("TN", 2, 1, 1, 1, 2); f2.b("TO", 3, 3, 4, 2, 2); f2.b("TR", 1, 2, 1, 1, 2); f2.b("TT", 1, 3, 1, 3, 2); f2.b("TV", 3, 2, 2, 4, 2); f2.b("TW", 0, 0, 0, 0, 1); f2.b("TZ", 3, 3, 3, 2, 2); f2.b("UA", 0, 3, 0, 0, 2); f2.b("UG", 3, 2, 2, 3, 2); f2.b("US", 0, 1, 3, 3, 3); f2.b("UY", 2, 1, 1, 1, 2); f2.b("UZ", 2, 0, 3, 2, 2); f2.b("VC", 2, 2, 2, 2, 2); f2.b("VE", 4, 4, 4, 4, 2); f2.b("VG", 2, 2, 1, 2, 2); f2.b("VI", 1, 2, 2, 4, 2); f2.b("VN", 0, 1, 4, 4, 2); f2.b("VU", 4, 1, 3, 1, 2); f2.b("WS", 3, 1, 4, 2, 2); f2.b("XK", 1, 1, 1, 0, 2); f2.b("YE", 4, 4, 4, 4, 2); f2.b("YT", 3, 2, 1, 3, 2); f2.b("ZA", 2, 3, 2, 2, 2); f2.b("ZM", 3, 2, 2, 3, 2); f2.b("ZW", 3, 3, 3, 3, 2); return f2.a(); } public static boolean j(l lVar, boolean z2) { return z2 && !lVar.c(8); } @Override // c.i.a.c.h2.x public synchronized void a(j jVar, l lVar, boolean z2) { if (j(lVar, z2)) { AnimatableValueParser.D(this.m > 0); long c2 = this.l.c(); int i = (int) (c2 - this.n); this.q += (long) i; long j = this.r; long j2 = this.o; this.r = j + j2; if (i > 0) { this.k.a((int) Math.sqrt((double) j2), (((float) j2) * 8000.0f) / ((float) i)); if (this.q >= 2000 || this.r >= 524288) { this.f886s = (long) this.k.b(0.5f); } k(i, this.o, this.f886s); this.n = c2; this.o = 0; } this.m--; } } @Override // c.i.a.c.h2.x public synchronized void b(j jVar, l lVar, boolean z2) { if (j(lVar, z2)) { if (this.m == 0) { this.n = this.l.c(); } this.m++; } } @Override // c.i.a.c.h2.d public x c() { return this; } @Override // c.i.a.c.h2.d public void d(d.a aVar) { this.j.a(aVar); } @Override // c.i.a.c.h2.x public synchronized void e(j jVar, l lVar, boolean z2, int i) { if (j(lVar, z2)) { this.o += (long) i; } } @Override // c.i.a.c.h2.d public void f(Handler handler, d.a aVar) { d.a.C0092a aVar2 = this.j; Objects.requireNonNull(aVar2); aVar2.a(aVar); aVar2.a.add(new d.a.C0092a.C0093a(handler, aVar)); } @Override // c.i.a.c.h2.x public void g(j jVar, l lVar, boolean z2) { } public final long i(int i) { Long l = this.i.get(Integer.valueOf(i)); if (l == null) { l = this.i.get(0); } if (l == null) { l = 1000000L; } return l.longValue(); } public final void k(int i, long j, long j2) { if (i != 0 || j != 0 || j2 != this.t) { this.t = j2; Iterator it = this.j.a.iterator(); while (it.hasNext()) { d.a.C0092a.C0093a next = it.next(); if (!next.f880c) { next.a.post(new a(next, i, j, j2)); } } } } }