Files
Daniel Elliott f9d20bb3fc Add decompiled APK source code (JADX)
- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-18 14:52:23 -08:00

124 lines
4.3 KiB
Java

package com.mbridge.msdk.foundation.tools;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.IntentFilter;
import android.text.TextUtils;
import com.mbridge.msdk.foundation.same.broadcast.NetWorkChangeReceiver;
import org.json.JSONObject;
/* loaded from: classes4.dex */
public final class v {
IntentFilter a;
private JSONObject b;
private com.mbridge.msdk.c.j c;
private long d;
private final BroadcastReceiver e;
public static final class a {
static final v a = new v();
}
private v() {
this.b = new JSONObject();
this.e = new NetWorkChangeReceiver();
IntentFilter intentFilter = new IntentFilter();
this.a = intentFilter;
intentFilter.addAction("android.net.conn.CONNECTIVITY_CHANGE");
}
public static v a() {
return a.a;
}
public final void a(String str) {
if (this.b == null) {
this.b = new JSONObject();
}
try {
if (!this.b.optString("KEY_INFO", "").equals(str)) {
this.b.put("KEY_INFO", str);
c.b(com.mbridge.msdk.foundation.controller.c.m().c(), "KEY_INFO", str);
}
} catch (Exception e) {
af.b("NetAddressManager", e.getMessage());
}
try {
if (TextUtils.isEmpty(str)) {
return;
}
long currentTimeMillis = System.currentTimeMillis();
this.b.put("KEY_TIME", currentTimeMillis);
c.b(com.mbridge.msdk.foundation.controller.c.m().c(), "KEY_TIME", Long.valueOf(currentTimeMillis));
} catch (Exception e2) {
af.b("NetAddressManager", e2.getMessage());
}
}
public final String b() {
try {
if (this.b == null) {
this.b = new JSONObject();
}
if (this.b.length() < 2) {
try {
this.b.put("KEY_INFO", (String) c.a(com.mbridge.msdk.foundation.controller.c.m().c(), "KEY_INFO", ""));
} catch (Exception e) {
af.b("NetAddressManager", e.getMessage());
}
try {
this.b.put("KEY_TIME", ((Long) c.a(com.mbridge.msdk.foundation.controller.c.m().c(), "KEY_TIME", 0L)).longValue());
} catch (Exception e2) {
af.b("NetAddressManager", e2.getMessage());
}
}
String optString = this.b.optString("KEY_INFO");
if (TextUtils.isEmpty(optString)) {
return "";
}
com.mbridge.msdk.c.g a2 = com.mbridge.msdk.c.h.a().a(com.mbridge.msdk.foundation.controller.c.m().k());
return System.currentTimeMillis() - this.b.optLong("KEY_TIME") > (a2 != null ? a2.c() : 3600L) * 1000 ? "" : optString;
} catch (Exception e3) {
af.b("NetAddressManager", e3.getMessage());
return "";
}
}
public final void c() {
long currentTimeMillis = System.currentTimeMillis();
if (currentTimeMillis - this.d > 3000) {
if (this.c == null) {
this.c = new com.mbridge.msdk.c.j();
}
this.c.a(com.mbridge.msdk.foundation.controller.c.m().c(), com.mbridge.msdk.foundation.controller.c.m().k(), com.mbridge.msdk.foundation.controller.c.m().b());
this.d = currentTimeMillis;
}
}
public final void d() {
Context c;
try {
if (com.mbridge.msdk.c.h.a().a(com.mbridge.msdk.foundation.controller.c.m().k()).a() != 1 || (c = com.mbridge.msdk.foundation.controller.c.m().c()) == null) {
return;
}
IntentFilter intentFilter = new IntentFilter();
this.a = intentFilter;
intentFilter.addAction("android.net.conn.CONNECTIVITY_CHANGE");
c.registerReceiver(this.e, this.a);
} catch (Exception e) {
af.b("NetAddressManager", e.getMessage());
}
}
public final void e() {
Context c = com.mbridge.msdk.foundation.controller.c.m().c();
if (c != null) {
try {
c.unregisterReceiver(this.e);
} catch (Exception e) {
af.b("NetAddressManager", e.getMessage());
}
}
}
}