- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
406 lines
18 KiB
Java
406 lines
18 KiB
Java
package com.mbridge.msdk.foundation.controller;
|
|
|
|
import android.content.Context;
|
|
import android.content.SharedPreferences;
|
|
import android.os.Handler;
|
|
import android.os.Looper;
|
|
import android.os.Message;
|
|
import android.text.TextUtils;
|
|
import com.mbridge.msdk.MBridgeConstans;
|
|
import com.mbridge.msdk.MBridgeSDK;
|
|
import com.mbridge.msdk.c.g;
|
|
import com.mbridge.msdk.c.j;
|
|
import com.mbridge.msdk.foundation.controller.a;
|
|
import com.mbridge.msdk.foundation.download.core.DownloadCommon;
|
|
import com.mbridge.msdk.foundation.entity.l;
|
|
import com.mbridge.msdk.foundation.same.report.h;
|
|
import com.mbridge.msdk.foundation.same.report.i;
|
|
import com.mbridge.msdk.foundation.tools.FastKV;
|
|
import com.mbridge.msdk.foundation.tools.ab;
|
|
import com.mbridge.msdk.foundation.tools.af;
|
|
import com.mbridge.msdk.foundation.tools.ah;
|
|
import com.mbridge.msdk.foundation.tools.ai;
|
|
import com.mbridge.msdk.foundation.tools.f;
|
|
import com.mbridge.msdk.foundation.tools.z;
|
|
import com.mbridge.msdk.interstitialvideo.out.MBInterstitialVideoHandler;
|
|
import com.mbridge.msdk.out.MBRewardVideoHandler;
|
|
import com.mbridge.msdk.out.MBridgeSDKFactory;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public class d {
|
|
private static volatile d c;
|
|
private int d;
|
|
private Map<String, Object> e;
|
|
private FastKV f;
|
|
private String h;
|
|
private String i;
|
|
private String j;
|
|
private Context k;
|
|
private String l;
|
|
private com.mbridge.msdk.b.a m;
|
|
private String n;
|
|
public final int a = 2;
|
|
private boolean g = false;
|
|
Handler b = new Handler(Looper.getMainLooper()) { // from class: com.mbridge.msdk.foundation.controller.d.6
|
|
@Override // android.os.Handler
|
|
public final void handleMessage(Message message) {
|
|
List list;
|
|
List list2;
|
|
try {
|
|
int i = message.what;
|
|
if (i == 2) {
|
|
Object obj = message.obj;
|
|
if (!(obj instanceof List) || (list = (List) obj) == null || list.size() <= 0) {
|
|
return;
|
|
}
|
|
h hVar = new h(d.this.k, 0);
|
|
for (int i2 = 0; i2 < list.size(); i2++) {
|
|
l lVar = (l) list.get(i2);
|
|
Boolean bool = Boolean.FALSE;
|
|
if (i2 == list.size() - 1) {
|
|
bool = Boolean.TRUE;
|
|
}
|
|
hVar.a(lVar, bool);
|
|
}
|
|
return;
|
|
}
|
|
if (i == 7) {
|
|
Object obj2 = message.obj;
|
|
if (obj2 == null || !(obj2 instanceof List) || (list2 = (List) obj2) == null) {
|
|
return;
|
|
}
|
|
list2.size();
|
|
return;
|
|
}
|
|
if (i != 9) {
|
|
return;
|
|
}
|
|
g gVar = (g) message.obj;
|
|
com.mbridge.msdk.foundation.tools.h d = c.m().d();
|
|
if (d != null && d.b() && gVar != null && gVar.L() == 1) {
|
|
com.mbridge.msdk.foundation.same.report.b.d.a(d.this.k).b();
|
|
}
|
|
if (d == null || !d.a()) {
|
|
return;
|
|
}
|
|
com.mbridge.msdk.foundation.same.report.b.c.a();
|
|
} catch (Exception unused) {
|
|
af.b("SDKController", "REPORT HANDLE ERROR!");
|
|
}
|
|
}
|
|
};
|
|
|
|
private d() {
|
|
}
|
|
|
|
public static d a() {
|
|
if (c == null) {
|
|
synchronized (d.class) {
|
|
try {
|
|
if (c == null) {
|
|
c = new d();
|
|
}
|
|
} finally {
|
|
}
|
|
}
|
|
}
|
|
return c;
|
|
}
|
|
|
|
public final void a(Map map, final Context context) {
|
|
Object obj;
|
|
String str;
|
|
if (context != null) {
|
|
if (!TextUtils.isEmpty(MBridgeConstans.DEVELOPER_CUSTOM_PACKAGE)) {
|
|
c.m().f(MBridgeConstans.DEVELOPER_CUSTOM_PACKAGE);
|
|
} else if (map.containsKey(MBridgeConstans.KEY_MBRIDGE_CUSTOM_PACKAGE_NAME) && (obj = map.get(MBridgeConstans.KEY_MBRIDGE_CUSTOM_PACKAGE_NAME)) != null) {
|
|
String str2 = (String) obj;
|
|
if (!TextUtils.isEmpty(str2)) {
|
|
c.m().f(str2);
|
|
}
|
|
}
|
|
if (map != null) {
|
|
if (map.containsKey(MBridgeConstans.ID_MBRIDGE_APPID)) {
|
|
this.h = (String) map.get(MBridgeConstans.ID_MBRIDGE_APPID);
|
|
}
|
|
if (map.containsKey(MBridgeConstans.ID_MBRIDGE_APPKEY)) {
|
|
this.i = (String) map.get(MBridgeConstans.ID_MBRIDGE_APPKEY);
|
|
}
|
|
if (map.containsKey(MBridgeConstans.ID_MBRIDGE_WX_APPID)) {
|
|
this.n = (String) map.get(MBridgeConstans.ID_MBRIDGE_WX_APPID);
|
|
}
|
|
if (map.containsKey(MBridgeConstans.PACKAGE_NAME_MANIFEST)) {
|
|
this.j = (String) map.get(MBridgeConstans.PACKAGE_NAME_MANIFEST);
|
|
}
|
|
if (map.containsKey(MBridgeConstans.ID_MBRIDGE_STARTUPCRASH)) {
|
|
this.l = (String) map.get(MBridgeConstans.ID_MBRIDGE_STARTUPCRASH);
|
|
}
|
|
}
|
|
this.k = context.getApplicationContext();
|
|
c.m().b(this.k);
|
|
c.m().d(this.h);
|
|
c.m().e(this.i);
|
|
c.m().a(this.n);
|
|
c.m().c(this.j);
|
|
c.m().a(new a.InterfaceC0196a() { // from class: com.mbridge.msdk.foundation.controller.d.4
|
|
}, this.b);
|
|
try {
|
|
com.mbridge.msdk.foundation.same.net.e.d.f().e();
|
|
} catch (Throwable th) {
|
|
af.b("SDKController", th.getMessage());
|
|
}
|
|
if (this.g) {
|
|
return;
|
|
}
|
|
ai.a(this.k);
|
|
Context applicationContext = this.k.getApplicationContext();
|
|
try {
|
|
if (this.f == null) {
|
|
try {
|
|
this.f = new FastKV.Builder(com.mbridge.msdk.foundation.same.b.e.a(com.mbridge.msdk.foundation.same.b.c.MBRIDGE_700_CONFIG), z.a("H+tU+FeXHM==")).build();
|
|
} catch (Exception unused) {
|
|
this.f = null;
|
|
}
|
|
}
|
|
FastKV fastKV = this.f;
|
|
String str3 = "";
|
|
if (fastKV != null) {
|
|
String string = fastKV.getString(z.a("H+tU+bfPhM=="), "");
|
|
String string2 = this.f.getString(z.a("H+tU+Fz8"), "");
|
|
if (TextUtils.isEmpty(com.mbridge.msdk.foundation.same.a.V) && TextUtils.isEmpty(com.mbridge.msdk.foundation.same.a.g)) {
|
|
com.mbridge.msdk.foundation.same.a.V = com.mbridge.msdk.foundation.a.a.a.a().a(DownloadCommon.DOWNLOAD_REPORT_FIND_FILE_RESULT_VALUE_B);
|
|
com.mbridge.msdk.foundation.same.a.g = com.mbridge.msdk.foundation.a.a.a.a().a("c");
|
|
}
|
|
if (TextUtils.isEmpty(string) && TextUtils.isEmpty(string2)) {
|
|
if (!TextUtils.isEmpty(com.mbridge.msdk.foundation.same.a.V) || !TextUtils.isEmpty(com.mbridge.msdk.foundation.same.a.g)) {
|
|
this.f.putString(z.a("H+tU+bfPhM=="), com.mbridge.msdk.foundation.same.a.V);
|
|
this.f.putString(z.a("H+tU+Fz8"), com.mbridge.msdk.foundation.same.a.g);
|
|
}
|
|
} else {
|
|
com.mbridge.msdk.foundation.same.a.V = string;
|
|
com.mbridge.msdk.foundation.same.a.g = string2;
|
|
com.mbridge.msdk.foundation.a.a.a.a().a(DownloadCommon.DOWNLOAD_REPORT_FIND_FILE_RESULT_VALUE_B, com.mbridge.msdk.foundation.same.a.V);
|
|
com.mbridge.msdk.foundation.a.a.a.a().a("c", com.mbridge.msdk.foundation.same.a.g);
|
|
}
|
|
} else {
|
|
SharedPreferences sharedPreferences = applicationContext.getSharedPreferences(z.a("H+tU+FeXHM=="), 0);
|
|
if (sharedPreferences != null) {
|
|
str3 = sharedPreferences.getString(z.a("H+tU+bfPhM=="), "");
|
|
str = sharedPreferences.getString(z.a("H+tU+Fz8"), "");
|
|
} else {
|
|
str = "";
|
|
}
|
|
if (TextUtils.isEmpty(com.mbridge.msdk.foundation.same.a.V) && TextUtils.isEmpty(com.mbridge.msdk.foundation.same.a.g)) {
|
|
com.mbridge.msdk.foundation.same.a.V = com.mbridge.msdk.foundation.a.a.a.a().a(DownloadCommon.DOWNLOAD_REPORT_FIND_FILE_RESULT_VALUE_B);
|
|
com.mbridge.msdk.foundation.same.a.g = com.mbridge.msdk.foundation.a.a.a.a().a("c");
|
|
}
|
|
if (TextUtils.isEmpty(str3) && TextUtils.isEmpty(str)) {
|
|
if ((!TextUtils.isEmpty(com.mbridge.msdk.foundation.same.a.V) || !TextUtils.isEmpty(com.mbridge.msdk.foundation.same.a.g)) && sharedPreferences != null) {
|
|
SharedPreferences.Editor edit = sharedPreferences.edit();
|
|
edit.putString(z.a("H+tU+bfPhM=="), com.mbridge.msdk.foundation.same.a.V);
|
|
edit.putString(z.a("H+tU+Fz8"), com.mbridge.msdk.foundation.same.a.g);
|
|
edit.apply();
|
|
}
|
|
} else {
|
|
com.mbridge.msdk.foundation.same.a.V = str3;
|
|
com.mbridge.msdk.foundation.same.a.g = str;
|
|
com.mbridge.msdk.foundation.a.a.a.a().a(DownloadCommon.DOWNLOAD_REPORT_FIND_FILE_RESULT_VALUE_B, com.mbridge.msdk.foundation.same.a.V);
|
|
com.mbridge.msdk.foundation.a.a.a.a().a("c", com.mbridge.msdk.foundation.same.a.g);
|
|
}
|
|
}
|
|
} catch (Throwable th2) {
|
|
af.b("SDKController", th2.getMessage(), th2);
|
|
}
|
|
try {
|
|
com.mbridge.msdk.foundation.same.f.a.b().execute(new Runnable() { // from class: com.mbridge.msdk.foundation.controller.d.2
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
Looper.prepare();
|
|
d.a(d.this);
|
|
d.b(d.this);
|
|
Looper.loop();
|
|
}
|
|
});
|
|
com.mbridge.msdk.foundation.same.f.a.b().execute(new Runnable() { // from class: com.mbridge.msdk.foundation.controller.d.3
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
d dVar = d.this;
|
|
d.a(dVar, dVar.h);
|
|
if (!TextUtils.isEmpty(d.this.h)) {
|
|
com.mbridge.msdk.foundation.a.a.a.a().a(MBridgeConstans.SDK_APP_ID, d.this.h);
|
|
}
|
|
new h(d.this.k).a();
|
|
d.this.b();
|
|
}
|
|
});
|
|
i.c();
|
|
} catch (Exception unused2) {
|
|
af.b("SDKController", "get app setting failed");
|
|
}
|
|
this.g = true;
|
|
ab.g(context);
|
|
long aA = com.mbridge.msdk.c.h.a().a(this.h).aA();
|
|
if (aA != 1300) {
|
|
this.b.postDelayed(new Runnable() { // from class: com.mbridge.msdk.foundation.controller.d.1
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
ab.e(context);
|
|
}
|
|
}, aA);
|
|
}
|
|
}
|
|
}
|
|
|
|
public final void b() {
|
|
List<l> a;
|
|
if (this.k == null || this.b == null) {
|
|
return;
|
|
}
|
|
try {
|
|
int i = ah.a().a("e_r_r_c_t_r_l", false) ? 5 : 1;
|
|
com.mbridge.msdk.foundation.same.report.c.a.a();
|
|
Context context = this.k;
|
|
if (context != null && com.mbridge.msdk.foundation.db.l.a(com.mbridge.msdk.foundation.db.g.a(context)).a() > 0) {
|
|
a = com.mbridge.msdk.foundation.db.l.a(com.mbridge.msdk.foundation.db.g.a(context)).a(i);
|
|
if (a != null || a.size() <= 0) {
|
|
}
|
|
Message obtainMessage = this.b.obtainMessage();
|
|
obtainMessage.what = 2;
|
|
obtainMessage.obj = a;
|
|
this.b.sendMessage(obtainMessage);
|
|
return;
|
|
}
|
|
a = null;
|
|
if (a != null) {
|
|
}
|
|
} catch (Exception unused) {
|
|
if (MBridgeConstans.DEBUG) {
|
|
af.b("SDKController", "report netstate error !");
|
|
}
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:31:0x0087 -> B:28:0x008a). Please report as a decompilation issue!!! */
|
|
public final void a(Map<String, Object> map, int i) {
|
|
if (MBridgeSDKFactory.getMBridgeSDK().getStatus() != MBridgeSDK.PLUGIN_LOAD_STATUS.COMPLETED) {
|
|
af.b("SDKController", "preloaad failed,sdk do not inited");
|
|
return;
|
|
}
|
|
this.e = map;
|
|
this.d = i;
|
|
c.m().k();
|
|
if (map != null) {
|
|
if (this.m == null) {
|
|
this.m = new com.mbridge.msdk.b.a();
|
|
}
|
|
try {
|
|
Map<String, Object> map2 = this.e;
|
|
if (map2 != null && map2.size() > 0 && this.e.containsKey(MBridgeConstans.PROPERTIES_LAYOUT_TYPE)) {
|
|
int intValue = ((Integer) this.e.get(MBridgeConstans.PROPERTIES_LAYOUT_TYPE)).intValue();
|
|
if (intValue == 0) {
|
|
Map<String, Object> map3 = this.e;
|
|
int i2 = this.d;
|
|
try {
|
|
com.mbridge.msdk.mbnative.f.a.class.getMethod("preload", Map.class, Integer.TYPE).invoke(com.mbridge.msdk.mbnative.f.a.class.newInstance(), map3, Integer.valueOf(i2));
|
|
} catch (Exception unused) {
|
|
}
|
|
} else if (1 != intValue && 2 != intValue) {
|
|
af.b("SDKController", "unknow layout type in preload");
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
|
|
public final void c() {
|
|
Handler handler = this.b;
|
|
if (handler != null) {
|
|
handler.removeCallbacksAndMessages(null);
|
|
}
|
|
}
|
|
|
|
public static /* synthetic */ void a(d dVar) {
|
|
try {
|
|
com.mbridge.msdk.d.b.class.getDeclaredMethod("start", new Class[0]).invoke(com.mbridge.msdk.d.b.class.getMethod("getInstance", new Class[0]).invoke(null, new Object[0]), new Object[0]);
|
|
} catch (Throwable th) {
|
|
af.b("SDKController", th.getMessage(), th);
|
|
}
|
|
}
|
|
|
|
public static /* synthetic */ void b(d dVar) {
|
|
List<com.mbridge.msdk.foundation.entity.a> n;
|
|
Object newInstance;
|
|
Object newInstance2;
|
|
try {
|
|
g b = com.mbridge.msdk.c.h.a().b(c.m().k());
|
|
if (b == null || (n = b.n()) == null || n.size() <= 0) {
|
|
return;
|
|
}
|
|
for (com.mbridge.msdk.foundation.entity.a aVar : n) {
|
|
if (aVar.a() == 287) {
|
|
if (dVar.k != null && (newInstance = MBInterstitialVideoHandler.class.getConstructor(String.class, String.class).newInstance("", aVar.b())) != null) {
|
|
MBInterstitialVideoHandler.class.getMethod("loadFormSelfFilling", new Class[0]).invoke(newInstance, new Object[0]);
|
|
}
|
|
} else if (aVar.a() == 94 && (newInstance2 = MBRewardVideoHandler.class.getConstructor(String.class, String.class).newInstance("", aVar.b())) != null) {
|
|
MBRewardVideoHandler.class.getMethod("loadFormSelfFilling", new Class[0]).invoke(newInstance2, new Object[0]);
|
|
}
|
|
}
|
|
} catch (Throwable th) {
|
|
if (MBridgeConstans.DEBUG) {
|
|
th.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
|
|
public static /* synthetic */ void a(d dVar, final String str) {
|
|
if (com.mbridge.msdk.c.h.a() == null) {
|
|
return;
|
|
}
|
|
com.mbridge.msdk.c.h a = com.mbridge.msdk.c.h.a();
|
|
if (a != null) {
|
|
g b = a.b(str);
|
|
if (b != null) {
|
|
MBridgeConstans.OMID_JS_SERVICE_URL = b.X();
|
|
MBridgeConstans.OMID_JS_H5_URL = b.W();
|
|
if (!TextUtils.isEmpty(b.B())) {
|
|
com.mbridge.msdk.foundation.same.net.e.d.f().h = b.B();
|
|
com.mbridge.msdk.foundation.same.net.e.d.f().b();
|
|
}
|
|
if (!TextUtils.isEmpty(b.C())) {
|
|
com.mbridge.msdk.foundation.same.net.e.d.f().l = b.C();
|
|
com.mbridge.msdk.foundation.same.net.e.d.f().c();
|
|
}
|
|
} else {
|
|
MBridgeConstans.OMID_JS_SERVICE_URL = com.mbridge.msdk.c.a.b.b;
|
|
MBridgeConstans.OMID_JS_H5_URL = com.mbridge.msdk.c.a.b.a;
|
|
}
|
|
}
|
|
if (com.mbridge.msdk.c.h.a().d(str) && com.mbridge.msdk.c.h.a().a(str, 1, (String) null)) {
|
|
if (com.mbridge.msdk.foundation.a.a.a.a().a("is_first_init", 0) == 0) {
|
|
try {
|
|
com.mbridge.msdk.foundation.a.a.a.a().b("is_first_init", 1);
|
|
if (TextUtils.isEmpty(f.c())) {
|
|
dVar.b.postDelayed(new Runnable() { // from class: com.mbridge.msdk.foundation.controller.d.5
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
new j().b(d.this.k, str, d.this.i);
|
|
}
|
|
}, 350L);
|
|
} else {
|
|
new j().b(dVar.k, str, dVar.i);
|
|
}
|
|
return;
|
|
} catch (Throwable unused) {
|
|
new j().b(dVar.k, str, dVar.i);
|
|
return;
|
|
}
|
|
}
|
|
new j().b(dVar.k, str, dVar.i);
|
|
}
|
|
}
|
|
}
|