package o; import android.content.Context; import android.net.ConnectivityManager; import android.net.Network; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import o.InterfaceC17714zBx; import o.TAS; /* loaded from: classes.dex */ final class WPT { private static volatile WPT c; final HBt b; boolean d; final Set e = new HashSet(); /* loaded from: classes.dex */ interface HBt { boolean a(); void b(); } /* JADX INFO: Access modifiers changed from: package-private */ public static WPT e(Context context) { if (c == null) { synchronized (WPT.class) { if (c == null) { c = new WPT(context.getApplicationContext()); } } } return c; } private WPT(Context context) { this.b = new RVV(new TAS.AnonymousClass4(new TAS.LWm(this, context) { // from class: o.WPT.4 private Context b; private WPT c; { this.c = this; this.b = context; } @Override // o.TAS.LWm public final /* synthetic */ ConnectivityManager c() { return (ConnectivityManager) this.b.getSystemService("connectivity"); } }), new InterfaceC17714zBx.Sts(this) { // from class: o.WPT.1 private WPT b; { this.b = this; } @Override // o.InterfaceC17714zBx.Sts public final void d(boolean z) { ArrayList arrayList; FKd.d(); synchronized (this.b) { arrayList = new ArrayList(this.b.e); } Iterator it = arrayList.iterator(); while (it.hasNext()) { ((InterfaceC17714zBx.Sts) it.next()).d(z); } } }); } /* loaded from: classes.dex */ static final class RVV implements HBt { private final ConnectivityManager.NetworkCallback b = new AnonymousClass3(this); final InterfaceC17714zBx.Sts c; boolean d; private final TAS.LWm e; /* renamed from: o.WPT$RVV$3, reason: invalid class name */ /* loaded from: classes.dex */ final class AnonymousClass3 extends ConnectivityManager.NetworkCallback { final RVV b; AnonymousClass3(RVV rvv) { this.b = rvv; } /* renamed from: o.WPT$RVV$3$3, reason: invalid class name and collision with other inner class name */ /* loaded from: classes.dex */ final class RunnableC00973 implements Runnable { private AnonymousClass3 a; private boolean d; RunnableC00973(AnonymousClass3 anonymousClass3, boolean z) { this.a = anonymousClass3; this.d = z; } @Override // java.lang.Runnable public final void run() { AnonymousClass3 anonymousClass3 = this.a; boolean z = this.d; FKd.d(); boolean z2 = anonymousClass3.b.d; anonymousClass3.b.d = z; if (z2 != z) { anonymousClass3.b.c.d(z); } } } @Override // android.net.ConnectivityManager.NetworkCallback public final void onAvailable(Network network) { FKd.e(new RunnableC00973(this, true)); } @Override // android.net.ConnectivityManager.NetworkCallback public final void onLost(Network network) { FKd.e(new RunnableC00973(this, false)); } } RVV(TAS.LWm lWm, InterfaceC17714zBx.Sts sts) { this.e = lWm; this.c = sts; } @Override // o.WPT.HBt public final boolean a() { this.d = this.e.c().getActiveNetwork() != null; try { this.e.c().registerDefaultNetworkCallback(this.b); return true; } catch (RuntimeException unused) { return false; } } @Override // o.WPT.HBt public final void b() { this.e.c().unregisterNetworkCallback(this.b); } } }