- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2148 lines
93 KiB
Java
2148 lines
93 KiB
Java
package com.mbridge.msdk.mbnative.controller;
|
|
|
|
import android.content.Context;
|
|
import android.graphics.Bitmap;
|
|
import android.graphics.drawable.BitmapDrawable;
|
|
import android.os.Handler;
|
|
import android.os.Looper;
|
|
import android.os.Message;
|
|
import android.text.TextUtils;
|
|
import android.util.Log;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.view.ViewTreeObserver;
|
|
import android.widget.FrameLayout;
|
|
import android.widget.ImageView;
|
|
import androidx.room.RoomMasterTable;
|
|
import androidx.work.WorkRequest;
|
|
import com.facebook.appevents.UserDataStore;
|
|
import com.iab.omid.library.mmadbridge.adsession.AdEvents;
|
|
import com.iab.omid.library.mmadbridge.adsession.AdSession;
|
|
import com.mbridge.msdk.MBridgeConstans;
|
|
import com.mbridge.msdk.c.j;
|
|
import com.mbridge.msdk.c.k;
|
|
import com.mbridge.msdk.foundation.db.i;
|
|
import com.mbridge.msdk.foundation.db.o;
|
|
import com.mbridge.msdk.foundation.download.download.H5DownLoadManager;
|
|
import com.mbridge.msdk.foundation.download.download.HTMLResourceManager;
|
|
import com.mbridge.msdk.foundation.download.download.ResourceManager;
|
|
import com.mbridge.msdk.foundation.entity.CampaignEx;
|
|
import com.mbridge.msdk.foundation.entity.CampaignUnit;
|
|
import com.mbridge.msdk.foundation.entity.n;
|
|
import com.mbridge.msdk.foundation.same.c;
|
|
import com.mbridge.msdk.foundation.same.e.a;
|
|
import com.mbridge.msdk.foundation.same.report.h;
|
|
import com.mbridge.msdk.foundation.tools.SameMD5;
|
|
import com.mbridge.msdk.foundation.tools.ab;
|
|
import com.mbridge.msdk.foundation.tools.ad;
|
|
import com.mbridge.msdk.foundation.tools.af;
|
|
import com.mbridge.msdk.foundation.tools.ak;
|
|
import com.mbridge.msdk.foundation.tools.z;
|
|
import com.mbridge.msdk.interstitial.view.MBInterstitialActivity;
|
|
import com.mbridge.msdk.mbbid.common.BidResponsedEx;
|
|
import com.mbridge.msdk.mbnative.controller.c;
|
|
import com.mbridge.msdk.nativex.view.MBMediaView;
|
|
import com.mbridge.msdk.out.Campaign;
|
|
import com.mbridge.msdk.out.Frame;
|
|
import com.mbridge.msdk.out.NativeListener;
|
|
import com.mbridge.msdk.playercommon.exoplayer2.source.chunk.ChunkedTrackBlacklistUtil;
|
|
import com.mbridge.msdk.playercommon.exoplayer2.text.ttml.TtmlNode;
|
|
import java.lang.ref.WeakReference;
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.Hashtable;
|
|
import java.util.Iterator;
|
|
import java.util.LinkedList;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Queue;
|
|
import java.util.Timer;
|
|
import java.util.TimerTask;
|
|
import java.util.concurrent.CopyOnWriteArrayList;
|
|
import org.json.JSONArray;
|
|
import org.json.JSONException;
|
|
import org.json.JSONObject;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public class NativeController extends com.mbridge.msdk.mbnative.controller.a {
|
|
public static Map<String, Long> b = new HashMap();
|
|
private static final String f = "NativeController";
|
|
private static boolean g;
|
|
private boolean A;
|
|
private int B;
|
|
private int C;
|
|
private int D;
|
|
private int E;
|
|
private com.mbridge.msdk.foundation.same.e.b F;
|
|
private List<com.mbridge.msdk.mbnative.controller.c> G;
|
|
private List<c.a> H;
|
|
private CopyOnWriteArrayList<com.mbridge.msdk.foundation.same.e.a> I;
|
|
private Hashtable<String, AdSession> J;
|
|
private int K;
|
|
private int L;
|
|
private a M;
|
|
private boolean N;
|
|
private boolean O;
|
|
private Timer P;
|
|
private String Q;
|
|
private String R;
|
|
private ViewTreeObserver.OnGlobalLayoutListener S;
|
|
private k T;
|
|
private long U;
|
|
private int V;
|
|
private int W;
|
|
private boolean X;
|
|
private int Y;
|
|
private int Z;
|
|
private boolean aa;
|
|
private List<Campaign> ab;
|
|
private String ac;
|
|
private AdEvents ad;
|
|
protected List<Integer> c;
|
|
protected List<Integer> d;
|
|
Map<String, Object> e;
|
|
private j h;
|
|
private com.mbridge.msdk.mbnative.d.a i;
|
|
private NativeListener.NativeTrackingListener j;
|
|
private Context k;
|
|
private String l;
|
|
private String m;
|
|
private Queue<Integer> n;
|
|
private Queue<Long> o;
|
|
private String p;
|
|
private h q;
|
|
private String r;
|
|
private com.mbridge.msdk.click.a s;
|
|
private int t;
|
|
private int u;
|
|
private int v;
|
|
private int w;
|
|
private String x;
|
|
private boolean y;
|
|
private boolean z;
|
|
|
|
public interface b {
|
|
void a();
|
|
}
|
|
|
|
public final String b() {
|
|
return this.R;
|
|
}
|
|
|
|
public NativeController(com.mbridge.msdk.mbnative.d.a aVar, NativeListener.NativeTrackingListener nativeTrackingListener, Map<String, Object> map, Context context) {
|
|
com.mbridge.msdk.mbnative.a.b<String, List<Campaign>> a2;
|
|
int i;
|
|
Object obj;
|
|
this.t = 1;
|
|
this.u = 1;
|
|
this.v = -1;
|
|
this.w = 0;
|
|
this.y = false;
|
|
this.z = false;
|
|
this.A = false;
|
|
this.B = 0;
|
|
this.C = 0;
|
|
this.D = 0;
|
|
this.E = 0;
|
|
this.I = new CopyOnWriteArrayList<>();
|
|
this.J = new Hashtable<>();
|
|
this.K = 1;
|
|
this.L = 2;
|
|
this.Q = "";
|
|
this.R = "";
|
|
this.ac = "";
|
|
this.k = context;
|
|
this.e = map;
|
|
this.h = new j();
|
|
this.i = aVar;
|
|
this.j = nativeTrackingListener;
|
|
this.G = new ArrayList();
|
|
this.H = new ArrayList();
|
|
String str = (String) map.get(MBridgeConstans.PROPERTIES_UNIT_ID);
|
|
this.l = str;
|
|
if (TextUtils.isEmpty(str)) {
|
|
return;
|
|
}
|
|
if (!map.containsKey(MBridgeConstans.PLACEMENT_ID) || map.get(MBridgeConstans.PLACEMENT_ID) == null) {
|
|
this.m = "";
|
|
} else {
|
|
this.m = (String) map.get(MBridgeConstans.PLACEMENT_ID);
|
|
}
|
|
if (map.containsKey(MBridgeConstans.PREIMAGE) && (obj = map.get(MBridgeConstans.PREIMAGE)) != null) {
|
|
g = ((Boolean) obj).booleanValue();
|
|
}
|
|
this.n = new LinkedList();
|
|
this.o = new LinkedList();
|
|
this.F = new com.mbridge.msdk.foundation.same.e.b(this.k);
|
|
if (Looper.myLooper() == null) {
|
|
Looper.prepare();
|
|
}
|
|
this.a = new e(this);
|
|
if (map.containsKey(MBridgeConstans.PROPERTIES_API_REUQEST_CATEGORY)) {
|
|
this.x = (String) map.get(MBridgeConstans.PROPERTIES_API_REUQEST_CATEGORY);
|
|
}
|
|
try {
|
|
boolean equals = com.mbridge.msdk.mbnative.controller.d.b().containsKey(this.l) ? Boolean.TRUE.equals(com.mbridge.msdk.mbnative.controller.d.b().get(this.l)) : false;
|
|
Object obj2 = map.get("ad_num");
|
|
Object obj3 = map.get(MBridgeConstans.PROPERTIES_AD_FRAME_NUM);
|
|
if (!equals) {
|
|
if (map.containsKey("ad_num") && obj2 != null) {
|
|
try {
|
|
i = ((Integer) obj2).intValue();
|
|
} catch (Exception e2) {
|
|
if (MBridgeConstans.DEBUG) {
|
|
af.b(f, e2.getMessage());
|
|
}
|
|
i = 1;
|
|
}
|
|
i = i < 1 ? 1 : i;
|
|
i = i > 10 ? 10 : i;
|
|
this.u = i;
|
|
this.t = i;
|
|
}
|
|
if (map.containsKey(MBridgeConstans.PROPERTIES_AD_FRAME_NUM) && obj3 != null) {
|
|
try {
|
|
this.D = ((Integer) obj3).intValue();
|
|
} catch (Exception e3) {
|
|
if (MBridgeConstans.DEBUG) {
|
|
af.b(f, e3.getMessage());
|
|
}
|
|
}
|
|
}
|
|
} else if (com.mbridge.msdk.mbnative.controller.d.d().containsKey(this.l)) {
|
|
Integer num = com.mbridge.msdk.mbnative.controller.d.d().get(this.l);
|
|
if (num != null) {
|
|
this.u = num.intValue();
|
|
}
|
|
if (map.containsKey("ad_num") && obj2 != null) {
|
|
int intValue = ((Integer) obj2).intValue();
|
|
this.B = intValue;
|
|
this.t = intValue;
|
|
}
|
|
if (map.containsKey(MBridgeConstans.PROPERTIES_AD_FRAME_NUM) && obj3 != null) {
|
|
int intValue2 = ((Integer) obj3).intValue();
|
|
this.C = intValue2;
|
|
this.D = intValue2;
|
|
}
|
|
}
|
|
} catch (Exception e4) {
|
|
af.b(f, com.mbridge.msdk.mbnative.b.a.a(e4));
|
|
}
|
|
this.q = new h(this.k);
|
|
this.s = new com.mbridge.msdk.click.a(this.k, this.l);
|
|
try {
|
|
int i2 = MBMediaView.$r8$clinit;
|
|
this.O = true;
|
|
Map<String, Object> map2 = this.e;
|
|
if (map2 != null && (map2.containsKey(MBridgeConstans.NATIVE_VIDEO_WIDTH) || this.e.containsKey(MBridgeConstans.NATIVE_VIDEO_HEIGHT) || map.containsKey(MBridgeConstans.NATIVE_VIDEO_SUPPORT))) {
|
|
this.N = true;
|
|
}
|
|
com.mbridge.msdk.mbnative.controller.e.a(this.k, this.l);
|
|
ad.a();
|
|
if (TextUtils.isEmpty(this.l)) {
|
|
return;
|
|
}
|
|
com.mbridge.msdk.foundation.db.e.a(com.mbridge.msdk.foundation.db.g.a(this.k)).a();
|
|
int a3 = a(map.containsKey(MBridgeConstans.NATIVE_INFO) ? (String) map.get(MBridgeConstans.NATIVE_INFO) : null);
|
|
String str2 = this.l;
|
|
a3 = a3 <= 0 ? this.t : a3;
|
|
k d2 = com.mbridge.msdk.c.h.a().d("", str2);
|
|
this.T = d2;
|
|
if (d2 == null) {
|
|
this.T = k.d(str2);
|
|
}
|
|
List<Integer> b2 = this.T.b();
|
|
this.c = b2;
|
|
List<Campaign> b3 = (b2 == null || b2.size() <= 0 || !this.c.contains(1) || (a2 = com.mbridge.msdk.mbnative.a.c.a(1)) == null) ? null : a2.b(str2, a3);
|
|
if (b3 != null) {
|
|
ArrayList arrayList = new ArrayList();
|
|
for (int i3 = 0; i3 < b3.size(); i3++) {
|
|
CampaignEx campaignEx = (CampaignEx) b3.get(i3);
|
|
if (!TextUtils.isEmpty(campaignEx.getVideoUrlEncode())) {
|
|
arrayList.add(campaignEx);
|
|
}
|
|
}
|
|
if (arrayList.size() > 0) {
|
|
Object invoke = com.mbridge.msdk.videocommon.download.b.class.getMethod("getInstance", new Class[0]).invoke(null, new Object[0]);
|
|
com.mbridge.msdk.videocommon.download.b.class.getMethod("createUnitCache", Context.class, String.class, CopyOnWriteArrayList.class, Integer.TYPE, com.mbridge.msdk.videocommon.listener.a.class).invoke(invoke, context, this.l, new CopyOnWriteArrayList(arrayList), 1, null);
|
|
com.mbridge.msdk.videocommon.download.b.class.getMethod("load", String.class).invoke(invoke, this.l);
|
|
}
|
|
}
|
|
} catch (Throwable unused) {
|
|
af.b(f, "please import the nativex aar");
|
|
}
|
|
}
|
|
|
|
public NativeController() {
|
|
this.t = 1;
|
|
this.u = 1;
|
|
this.v = -1;
|
|
this.w = 0;
|
|
this.y = false;
|
|
this.z = false;
|
|
this.A = false;
|
|
this.B = 0;
|
|
this.C = 0;
|
|
this.D = 0;
|
|
this.E = 0;
|
|
this.I = new CopyOnWriteArrayList<>();
|
|
this.J = new Hashtable<>();
|
|
this.K = 1;
|
|
this.L = 2;
|
|
this.Q = "";
|
|
this.R = "";
|
|
this.ac = "";
|
|
}
|
|
|
|
public static boolean a(Map<String, Object> map) {
|
|
if (map == null) {
|
|
return false;
|
|
}
|
|
try {
|
|
if (map.containsKey("app_id") && map.containsKey(MBridgeConstans.APP_KEY) && map.containsKey(MBridgeConstans.KEY_WORD)) {
|
|
return map.get(MBridgeConstans.KEY_WORD) != null;
|
|
}
|
|
return false;
|
|
} catch (Exception e2) {
|
|
af.b(f, com.mbridge.msdk.mbnative.b.a.a(e2));
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public static List<String> b(Map<String, Object> map) {
|
|
ArrayList arrayList = null;
|
|
try {
|
|
if (!(map.get(MBridgeConstans.KEY_WORD) instanceof String)) {
|
|
return null;
|
|
}
|
|
String str = (String) map.get(MBridgeConstans.KEY_WORD);
|
|
if (TextUtils.isEmpty(str)) {
|
|
return null;
|
|
}
|
|
JSONArray jSONArray = new JSONArray(str);
|
|
if (jSONArray.length() == 0) {
|
|
return null;
|
|
}
|
|
ArrayList arrayList2 = new ArrayList();
|
|
for (int i = 0; i < jSONArray.length(); i++) {
|
|
try {
|
|
JSONObject optJSONObject = jSONArray.optJSONObject(i);
|
|
if (optJSONObject != null) {
|
|
String optString = optJSONObject.optString(TtmlNode.TAG_P);
|
|
if (!TextUtils.isEmpty(optString)) {
|
|
arrayList2.add(optString);
|
|
}
|
|
}
|
|
} catch (Exception e2) {
|
|
e = e2;
|
|
arrayList = arrayList2;
|
|
af.b(f, com.mbridge.msdk.mbnative.b.a.a(e));
|
|
return arrayList;
|
|
}
|
|
}
|
|
return arrayList2;
|
|
} catch (Exception e3) {
|
|
e = e3;
|
|
}
|
|
}
|
|
|
|
public static void insertExcludeId(String str, CampaignEx campaignEx) {
|
|
if (TextUtils.isEmpty(str) || campaignEx == null || com.mbridge.msdk.foundation.controller.c.m().c() == null) {
|
|
return;
|
|
}
|
|
i a2 = i.a(com.mbridge.msdk.foundation.db.g.a(com.mbridge.msdk.foundation.controller.c.m().c()));
|
|
com.mbridge.msdk.foundation.entity.f fVar = new com.mbridge.msdk.foundation.entity.f();
|
|
fVar.a(System.currentTimeMillis());
|
|
fVar.b(str);
|
|
fVar.a(campaignEx.getId());
|
|
a2.a(fVar);
|
|
}
|
|
|
|
private int a(String str) {
|
|
if (str == null) {
|
|
return 0;
|
|
}
|
|
try {
|
|
JSONArray jSONArray = new JSONArray(str);
|
|
if (jSONArray.length() > 0) {
|
|
for (int i = 0; i < jSONArray.length(); i++) {
|
|
JSONObject jSONObject = (JSONObject) jSONArray.opt(i);
|
|
if (2 == jSONObject.optInt("id", 0)) {
|
|
return jSONObject.optInt("ad_num");
|
|
}
|
|
}
|
|
}
|
|
} catch (Exception e2) {
|
|
af.b(f, com.mbridge.msdk.mbnative.b.a.a(e2));
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
public final void a(int i, String str) {
|
|
this.y = false;
|
|
this.z = false;
|
|
this.A = false;
|
|
this.X = false;
|
|
this.Q = str;
|
|
this.i.a(!TextUtils.isEmpty(str));
|
|
this.M = null;
|
|
Map<String, Long> map = b;
|
|
if (map != null && map.size() > 0) {
|
|
b.clear();
|
|
}
|
|
if (com.mbridge.msdk.mbnative.controller.d.b() != null && com.mbridge.msdk.mbnative.controller.d.b().containsKey(this.l) && Boolean.TRUE.equals(com.mbridge.msdk.mbnative.controller.d.b().get(this.l)) && i == 1 && a(i)) {
|
|
return;
|
|
}
|
|
String k = com.mbridge.msdk.foundation.controller.c.m().k();
|
|
String b2 = com.mbridge.msdk.foundation.controller.c.m().b();
|
|
if (this.e.containsKey("app_id") && this.e.containsKey(MBridgeConstans.APP_KEY) && this.e.containsKey(MBridgeConstans.KEY_WORD)) {
|
|
k = (String) this.e.get("app_id");
|
|
b2 = (String) this.e.get(MBridgeConstans.APP_KEY);
|
|
}
|
|
this.h.a(this.k, k, b2, this.l);
|
|
k d2 = com.mbridge.msdk.c.h.a().d(k, this.l);
|
|
this.T = d2;
|
|
if (d2 == null) {
|
|
this.T = k.d(this.l);
|
|
}
|
|
com.mbridge.msdk.mbnative.controller.d.e().put(this.l, Integer.valueOf(this.T.w() * this.u));
|
|
this.c = this.T.b();
|
|
this.d = this.T.c();
|
|
this.W = this.T.e();
|
|
this.V = this.T.d();
|
|
this.u = this.t;
|
|
List<Integer> list = this.c;
|
|
if (list == null || list.size() == 0) {
|
|
com.mbridge.msdk.mbnative.d.a aVar = this.i;
|
|
if (aVar != null) {
|
|
this.y = true;
|
|
aVar.onAdLoadError("do not have sorceList");
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
try {
|
|
if (com.mbridge.msdk.mbsignalcommon.webEnvCheck.a.a(com.mbridge.msdk.foundation.controller.c.m().c())) {
|
|
if (this.e.containsKey(MBridgeConstans.NATIVE_INFO) && this.p == null) {
|
|
String str2 = (String) this.e.get(MBridgeConstans.NATIVE_INFO);
|
|
this.p = str2;
|
|
if (str2 != null) {
|
|
try {
|
|
JSONArray jSONArray = new JSONArray(this.p);
|
|
if (jSONArray.length() > 0) {
|
|
for (int i2 = 0; i2 < jSONArray.length(); i2++) {
|
|
JSONObject jSONObject = (JSONObject) jSONArray.opt(i2);
|
|
int optInt = jSONObject.optInt("id", 0);
|
|
if (2 == optInt) {
|
|
this.Y = jSONObject.optInt("ad_num");
|
|
if (this.W > 0) {
|
|
jSONObject.remove("ad_num");
|
|
jSONObject.put("ad_num", this.W);
|
|
}
|
|
} else if (3 == optInt) {
|
|
this.Z = jSONObject.optInt("ad_num");
|
|
if (this.W > 0) {
|
|
jSONObject.remove("ad_num");
|
|
jSONObject.put("ad_num", this.W);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this.K = Math.max(this.Y, this.Z);
|
|
this.p = jSONArray.toString();
|
|
} catch (JSONException e2) {
|
|
af.b(f, com.mbridge.msdk.mbnative.b.a.a(e2));
|
|
}
|
|
}
|
|
}
|
|
if ((!this.c.contains(1) || this.c.get(0).intValue() == 1) && i == 0 && a(a(this.l, this.u, this.Q))) {
|
|
return;
|
|
}
|
|
this.aa = true;
|
|
if (this.c.contains(1) && i == 0 && this.c.get(0).intValue() != 1) {
|
|
int intValue = this.c.get(0).intValue();
|
|
com.mbridge.msdk.mbnative.a.b<String, List<Campaign>> a2 = com.mbridge.msdk.mbnative.a.c.a(intValue);
|
|
if (intValue == 2 && this.e.containsKey(MBridgeConstans.NATIVE_INFO)) {
|
|
this.u = this.K;
|
|
} else {
|
|
this.u = this.t;
|
|
}
|
|
if (a2 != null && a(a(intValue, d(a2.b(this.l, this.u))))) {
|
|
return;
|
|
}
|
|
this.aa = false;
|
|
try {
|
|
a(this.d.get(this.c.indexOf(1)).intValue() * 1000, i, false, this.l, this.Q);
|
|
} catch (Exception unused) {
|
|
}
|
|
}
|
|
this.a.sendEmptyMessageDelayed(1, this.T.u() * 1000);
|
|
List<Integer> list2 = this.c;
|
|
if (list2 != null && list2.size() > 0) {
|
|
Queue<Integer> queue = this.n;
|
|
if (queue != null && queue.size() > 0) {
|
|
this.n.clear();
|
|
}
|
|
for (Integer num : this.c) {
|
|
Queue<Integer> queue2 = this.n;
|
|
if (queue2 != null) {
|
|
queue2.add(num);
|
|
}
|
|
}
|
|
}
|
|
List<Integer> list3 = this.d;
|
|
if (list3 != null && list3.size() > 0) {
|
|
Queue<Long> queue3 = this.o;
|
|
if (queue3 != null && queue3.size() > 0) {
|
|
this.o.clear();
|
|
}
|
|
for (Integer num2 : this.d) {
|
|
Queue<Long> queue4 = this.o;
|
|
if (queue4 != null) {
|
|
queue4.add(Long.valueOf(num2.intValue() * 1000));
|
|
}
|
|
}
|
|
}
|
|
b(i, this.Q);
|
|
return;
|
|
}
|
|
} catch (Exception unused2) {
|
|
}
|
|
com.mbridge.msdk.mbnative.d.a aVar2 = this.i;
|
|
if (aVar2 != null) {
|
|
aVar2.onAdLoadError("webview is not available");
|
|
}
|
|
}
|
|
|
|
private boolean a(int i) {
|
|
int i2;
|
|
int i3;
|
|
int i4;
|
|
com.mbridge.msdk.mbnative.d.a aVar;
|
|
int i5 = 0;
|
|
if (com.mbridge.msdk.mbnative.controller.d.b().containsKey(this.l) && Boolean.TRUE.equals(com.mbridge.msdk.mbnative.controller.d.b().get(this.l))) {
|
|
Map<String, Map<Long, Object>> a2 = com.mbridge.msdk.mbnative.controller.d.a();
|
|
Map<Long, Object> map = a2.get(i + "_" + this.l);
|
|
Integer num = com.mbridge.msdk.mbnative.controller.d.d().get(this.l);
|
|
com.mbridge.msdk.c.g b2 = com.mbridge.msdk.c.h.a().b(com.mbridge.msdk.foundation.controller.c.m().k());
|
|
if (num != null) {
|
|
this.u = num.intValue();
|
|
}
|
|
if (map != null && map.size() > 0) {
|
|
Long next = map.keySet().iterator().next();
|
|
long currentTimeMillis = System.currentTimeMillis();
|
|
if (b2 == null) {
|
|
com.mbridge.msdk.c.h.a();
|
|
b2 = com.mbridge.msdk.c.i.a();
|
|
}
|
|
if (currentTimeMillis - next.longValue() >= b2.ac() * 1000) {
|
|
a2.remove(i + "_" + this.l);
|
|
} else {
|
|
if (i == 1) {
|
|
List<Frame> list = (List) map.get(next);
|
|
if (list == null || list.size() <= 0 || (aVar = this.i) == null) {
|
|
return false;
|
|
}
|
|
if (this.D >= list.size()) {
|
|
a2.remove(i + "_" + this.l);
|
|
aVar.onAdFramesLoaded(list);
|
|
return true;
|
|
}
|
|
if (this.D == 0) {
|
|
return false;
|
|
}
|
|
List<Frame> subList = list.subList(0, this.C);
|
|
aVar.onAdFramesLoaded(list);
|
|
list.removeAll(subList);
|
|
map.put(next, subList);
|
|
ArrayList arrayList = new ArrayList();
|
|
for (Frame frame : list) {
|
|
if (i5 >= this.D) {
|
|
arrayList.add(frame);
|
|
}
|
|
i5++;
|
|
}
|
|
map.put(next, arrayList);
|
|
a2.put(i + "_" + this.l, map);
|
|
aVar.onAdFramesLoaded(subList);
|
|
return true;
|
|
}
|
|
List list2 = (List) map.get(next);
|
|
if (list2 != null && list2.size() > 0) {
|
|
List<Campaign> arrayList2 = new ArrayList<>();
|
|
if (((CampaignEx) list2.get(0)).getType() == 1) {
|
|
if (TextUtils.isEmpty(this.p)) {
|
|
i2 = Math.min(this.B, list2.size());
|
|
} else {
|
|
try {
|
|
JSONArray jSONArray = new JSONArray(this.p);
|
|
if (jSONArray.length() > 0) {
|
|
i3 = 0;
|
|
i4 = 0;
|
|
for (int i6 = 0; i6 < jSONArray.length(); i6++) {
|
|
JSONObject jSONObject = (JSONObject) jSONArray.opt(i6);
|
|
int optInt = jSONObject.optInt("id", 0);
|
|
if (2 == optInt) {
|
|
i3 = jSONObject.optInt("ad_num");
|
|
} else if (3 == optInt) {
|
|
i4 = jSONObject.optInt("ad_num");
|
|
}
|
|
}
|
|
} else {
|
|
i3 = 0;
|
|
i4 = 0;
|
|
}
|
|
if (3 == ((CampaignEx) list2.get(0)).getTemplate()) {
|
|
i2 = Math.min(i4, list2.size());
|
|
} else {
|
|
i2 = Math.min(i3, list2.size());
|
|
}
|
|
} catch (Exception unused) {
|
|
af.b(f, "load from catch error in get nativeinfo adnum");
|
|
i2 = 0;
|
|
}
|
|
}
|
|
if (i2 <= 0) {
|
|
return false;
|
|
}
|
|
Iterator it = list2.iterator();
|
|
while (it.hasNext() && i5 != i2) {
|
|
CampaignEx campaignEx = (CampaignEx) it.next();
|
|
campaignEx.getTemplate();
|
|
arrayList2.add(campaignEx);
|
|
it.remove();
|
|
i5++;
|
|
}
|
|
} else {
|
|
int min = Math.min(this.B, list2.size());
|
|
if (min > 0) {
|
|
Iterator it2 = list2.iterator();
|
|
while (it2.hasNext() && i5 != min) {
|
|
CampaignEx campaignEx2 = (CampaignEx) it2.next();
|
|
campaignEx2.getTemplate();
|
|
arrayList2.add(campaignEx2);
|
|
it2.remove();
|
|
i5++;
|
|
}
|
|
}
|
|
}
|
|
a(arrayList2);
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
private void b(int i, String str) {
|
|
com.mbridge.msdk.mbnative.d.a aVar;
|
|
Long poll;
|
|
Queue<Integer> queue = this.n;
|
|
if (queue == null || queue.size() <= 0) {
|
|
if (this.y || (aVar = this.i) == null) {
|
|
return;
|
|
}
|
|
this.y = true;
|
|
aVar.onAdLoadError("no ad source");
|
|
return;
|
|
}
|
|
Integer poll2 = this.n.poll();
|
|
int intValue = poll2 != null ? poll2.intValue() : 1;
|
|
this.U = MBridgeConstans.REQUEST_TIME_OUT;
|
|
Queue<Long> queue2 = this.o;
|
|
if (queue2 != null && queue2.size() > 0 && (poll = this.o.poll()) != null) {
|
|
this.U = poll.longValue();
|
|
}
|
|
b(intValue, this.U, i, str);
|
|
}
|
|
|
|
private void b(int i, long j, int i2, String str) {
|
|
com.mbridge.msdk.mbnative.a.b<String, List<Campaign>> a2;
|
|
if (i2 == 0 && (a2 = com.mbridge.msdk.mbnative.a.c.a(i)) != null) {
|
|
if ((i == 1 || i == 2) && this.e.containsKey(MBridgeConstans.NATIVE_INFO)) {
|
|
this.u = this.K;
|
|
} else {
|
|
this.u = this.t;
|
|
}
|
|
if (a(a(i, d(a2.b(this.l, this.u))))) {
|
|
return;
|
|
}
|
|
}
|
|
if (i == 1) {
|
|
a(j, i2, true, this.l, str);
|
|
} else if (i == 2) {
|
|
a(2, j, i2, str);
|
|
} else {
|
|
a(i, j, i2, str);
|
|
}
|
|
}
|
|
|
|
public final void a(String str, int i, String str2, CampaignEx campaignEx) {
|
|
Queue<Integer> queue = this.n;
|
|
if ((queue == null || queue.size() > 0) && this.n != null) {
|
|
b(i, str2);
|
|
return;
|
|
}
|
|
com.mbridge.msdk.mbnative.d.a aVar = this.i;
|
|
if (aVar == null || this.y) {
|
|
return;
|
|
}
|
|
this.y = true;
|
|
aVar.a(campaignEx, str);
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.mbnative.controller.a
|
|
public final synchronized void a(int i, long j, int i2, String str) {
|
|
a aVar;
|
|
com.mbridge.msdk.foundation.same.net.f.e eVar;
|
|
com.mbridge.msdk.mbnative.f.a.a aVar2;
|
|
c cVar;
|
|
int i3;
|
|
com.mbridge.msdk.foundation.entity.k kVar;
|
|
try {
|
|
try {
|
|
if (this.e.containsKey(MBridgeConstans.NATIVE_INFO)) {
|
|
this.u = Math.max(this.Y, this.Z);
|
|
}
|
|
if (i2 == 0) {
|
|
com.mbridge.msdk.mbnative.a.b<String, List<Campaign>> a2 = com.mbridge.msdk.mbnative.a.c.a(i);
|
|
if (a2 != null && a(a(1, d(a2.b(this.l, this.u))))) {
|
|
return;
|
|
}
|
|
a aVar3 = this.M;
|
|
if (aVar3 != null && !this.X) {
|
|
aVar3.b(true);
|
|
}
|
|
if (this.X && !this.y) {
|
|
a("mb load failed", i2, str, (CampaignEx) null);
|
|
}
|
|
if (!this.aa) {
|
|
return;
|
|
}
|
|
}
|
|
int i4 = this.v;
|
|
if (i4 == -1) {
|
|
this.v = i;
|
|
} else if (i4 != i) {
|
|
this.w = 0;
|
|
}
|
|
com.mbridge.msdk.foundation.db.e.a(com.mbridge.msdk.foundation.db.g.a(this.k)).a();
|
|
com.mbridge.msdk.mbnative.f.a.a aVar4 = new com.mbridge.msdk.mbnative.f.a.a(this.k);
|
|
com.mbridge.msdk.foundation.same.net.f.e eVar2 = new com.mbridge.msdk.foundation.same.net.f.e();
|
|
String k = com.mbridge.msdk.foundation.controller.c.m().k();
|
|
String b2 = com.mbridge.msdk.foundation.controller.c.m().b();
|
|
Map<String, Object> map = this.e;
|
|
if (map != null && map.containsKey("app_id") && this.e.containsKey(MBridgeConstans.APP_KEY) && this.e.containsKey(MBridgeConstans.KEY_WORD) && this.e.get(MBridgeConstans.KEY_WORD) != null) {
|
|
if (this.e.get("app_id") instanceof String) {
|
|
k = (String) this.e.get("app_id");
|
|
}
|
|
if (this.e.get(MBridgeConstans.APP_KEY) instanceof String) {
|
|
b2 = (String) this.e.get(MBridgeConstans.APP_KEY);
|
|
}
|
|
String str2 = this.e.get(MBridgeConstans.KEY_WORD) instanceof String ? (String) this.e.get(MBridgeConstans.KEY_WORD) : null;
|
|
if (!TextUtils.isEmpty(str2)) {
|
|
eVar2.a("smart", z.b(str2));
|
|
}
|
|
}
|
|
eVar2.a("app_id", k);
|
|
eVar2.a(MBridgeConstans.PROPERTIES_UNIT_ID, this.l);
|
|
if (!TextUtils.isEmpty(this.m)) {
|
|
eVar2.a(MBridgeConstans.PLACEMENT_ID, this.m);
|
|
}
|
|
eVar2.a("req_type", "2");
|
|
if (!TextUtils.isEmpty(this.x)) {
|
|
eVar2.a("category", this.x);
|
|
}
|
|
eVar2.a("sign", SameMD5.getMD5(k + b2));
|
|
if (this.W > 0 && i2 == 0) {
|
|
eVar2.a("ad_num", this.W + "");
|
|
} else {
|
|
eVar2.a("ad_num", this.t + "");
|
|
}
|
|
String d2 = ak.d(this.l);
|
|
if (!TextUtils.isEmpty(d2)) {
|
|
eVar2.a("j", d2);
|
|
}
|
|
eVar2.a("only_impression", "1");
|
|
eVar2.a("ping_mode", "1");
|
|
if (this.D != 0) {
|
|
eVar2.a("frame_num", this.D + "");
|
|
}
|
|
if (!TextUtils.isEmpty(this.p)) {
|
|
eVar2.a(MBridgeConstans.NATIVE_INFO, this.p);
|
|
if (i == 1) {
|
|
eVar2.a("tnum", this.K + "");
|
|
}
|
|
} else if (i == 1) {
|
|
eVar2.a("tnum", this.t + "");
|
|
}
|
|
String a3 = com.mbridge.msdk.foundation.same.a.b.a(this.l, "native");
|
|
if (!TextUtils.isEmpty(a3)) {
|
|
eVar2.a(com.mbridge.msdk.foundation.same.net.f.e.d, a3);
|
|
}
|
|
if (this.e.containsKey(MBridgeConstans.NATIVE_VIDEO_WIDTH) && (this.e.get(MBridgeConstans.NATIVE_VIDEO_WIDTH) instanceof Integer)) {
|
|
eVar2.a("video_width", ((Integer) this.e.get(MBridgeConstans.NATIVE_VIDEO_WIDTH)).intValue() + "");
|
|
}
|
|
if (this.e.containsKey(MBridgeConstans.NATIVE_VIDEO_HEIGHT) && (this.e.get(MBridgeConstans.NATIVE_VIDEO_HEIGHT) instanceof Integer)) {
|
|
eVar2.a("video_height", ((Integer) this.e.get(MBridgeConstans.NATIVE_VIDEO_HEIGHT)).intValue() + "");
|
|
}
|
|
if (this.e.containsKey(MBridgeConstans.NATIVE_VIDEO_SUPPORT) && (this.e.get(MBridgeConstans.NATIVE_VIDEO_SUPPORT) instanceof Boolean)) {
|
|
((Boolean) this.e.get(MBridgeConstans.NATIVE_VIDEO_SUPPORT)).booleanValue();
|
|
}
|
|
eVar2.a("video_version", "2.0");
|
|
if (com.mbridge.msdk.c.h.a().b(com.mbridge.msdk.foundation.controller.c.m().k()) == null) {
|
|
com.mbridge.msdk.c.h.a();
|
|
com.mbridge.msdk.c.i.a();
|
|
}
|
|
if (!a(this.e)) {
|
|
JSONArray b3 = ak.b(this.k, this.l);
|
|
if (b3.length() > 0) {
|
|
eVar2.a(com.mbridge.msdk.foundation.same.net.f.e.e, ak.a(b3));
|
|
}
|
|
}
|
|
if (com.mbridge.msdk.mbnative.controller.d.b().containsKey(this.l) && com.mbridge.msdk.mbnative.controller.d.b().get(this.l).booleanValue() && com.mbridge.msdk.mbnative.controller.d.c().get(this.l) != null && (kVar = com.mbridge.msdk.mbnative.controller.d.c().get(this.l)) != null) {
|
|
if (i == 1) {
|
|
this.w = kVar.a();
|
|
} else if (i == 2) {
|
|
this.w = kVar.b();
|
|
}
|
|
}
|
|
eVar2.a("offset", this.w + "");
|
|
eVar2.a("ad_type", RoomMasterTable.DEFAULT_ID);
|
|
eVar2.a(CampaignEx.JSON_KEY_AD_SOURCE_ID, i + "");
|
|
if (!TextUtils.isEmpty(this.r)) {
|
|
eVar2.a(com.mbridge.msdk.foundation.same.net.f.e.f, this.r);
|
|
}
|
|
a aVar5 = new a();
|
|
aVar5.a(b(this.e));
|
|
aVar5.setUnitId(this.l);
|
|
aVar5.setPlacementId(this.m);
|
|
aVar5.setAdType(42);
|
|
aVar5.b(true);
|
|
c cVar2 = new c(1, aVar5, i2, str);
|
|
aVar5.a(cVar2);
|
|
aVar5.e(i2);
|
|
aVar5.a(str);
|
|
if (i2 == 0) {
|
|
if (!TextUtils.isEmpty(str)) {
|
|
eVar2.a("token", str);
|
|
}
|
|
aVar = aVar5;
|
|
eVar = eVar2;
|
|
aVar2 = aVar4;
|
|
cVar = cVar2;
|
|
i3 = 1;
|
|
aVar4.choiceV3OrV5BySetting(1, eVar, aVar, str, com.mbridge.msdk.foundation.same.c.a(j, WorkRequest.DEFAULT_BACKOFF_DELAY_MILLIS));
|
|
} else {
|
|
aVar = aVar5;
|
|
eVar = eVar2;
|
|
aVar2 = aVar4;
|
|
cVar = cVar2;
|
|
i3 = 1;
|
|
}
|
|
if (i2 == i3) {
|
|
aVar2.getLoadOrSetting(1, com.mbridge.msdk.foundation.same.net.e.d.f().N, eVar, aVar, MBInterstitialActivity.INTENT_CAMAPIGN, com.mbridge.msdk.foundation.same.c.a(j, WorkRequest.DEFAULT_BACKOFF_DELAY_MILLIS));
|
|
}
|
|
this.a.postDelayed(cVar, j);
|
|
} catch (Exception e2) {
|
|
String str3 = f;
|
|
af.b(str3, com.mbridge.msdk.mbnative.b.a.a(e2));
|
|
af.b(str3, e2.getMessage());
|
|
}
|
|
} catch (Throwable th) {
|
|
throw th;
|
|
}
|
|
}
|
|
|
|
private void a(final View view, CampaignEx campaignEx) {
|
|
BitmapDrawable a2;
|
|
final ImageView imageView;
|
|
if (!(view instanceof FrameLayout) || (a2 = com.mbridge.msdk.foundation.controller.c.m().a(this.l, campaignEx.getAdType())) == null) {
|
|
return;
|
|
}
|
|
try {
|
|
int childCount = ((ViewGroup) view).getChildCount();
|
|
int i = 0;
|
|
while (true) {
|
|
if (i >= childCount) {
|
|
imageView = null;
|
|
break;
|
|
}
|
|
View childAt = ((ViewGroup) view).getChildAt(i);
|
|
if ((childAt instanceof ImageView) && childAt.getTag() != null && "mb_wm".equals((String) childAt.getTag())) {
|
|
((ImageView) childAt).setLayoutParams(new FrameLayout.LayoutParams(view.getWidth(), view.getHeight()));
|
|
imageView = (ImageView) childAt;
|
|
break;
|
|
}
|
|
i++;
|
|
}
|
|
if (imageView == null) {
|
|
imageView = new ImageView(com.mbridge.msdk.foundation.controller.c.m().c());
|
|
imageView.setTag("mb_wm");
|
|
ak.a(imageView, a2, view.getResources().getDisplayMetrics());
|
|
if (imageView.getParent() == null) {
|
|
((FrameLayout) view).addView(imageView, new FrameLayout.LayoutParams(view.getWidth(), view.getHeight()));
|
|
}
|
|
}
|
|
this.S = new ViewTreeObserver.OnGlobalLayoutListener() { // from class: com.mbridge.msdk.mbnative.controller.NativeController.1
|
|
@Override // android.view.ViewTreeObserver.OnGlobalLayoutListener
|
|
public final void onGlobalLayout() {
|
|
if (imageView != null) {
|
|
imageView.setLayoutParams(new FrameLayout.LayoutParams(view.getWidth(), view.getHeight()));
|
|
}
|
|
}
|
|
};
|
|
view.getViewTreeObserver().addOnGlobalLayoutListener(this.S);
|
|
} catch (Exception e2) {
|
|
e2.printStackTrace();
|
|
}
|
|
}
|
|
|
|
public final void a(Campaign campaign, View view, List<View> list) {
|
|
Class<MBMediaView> cls;
|
|
try {
|
|
a(view, (CampaignEx) campaign);
|
|
NativeListener.NativeTrackingListener nativeTrackingListener = this.j;
|
|
if (nativeTrackingListener != null) {
|
|
this.s.a(nativeTrackingListener);
|
|
}
|
|
com.mbridge.msdk.mbnative.a.c.a(campaign.getType()).a(this.l, campaign, this.Q);
|
|
final CampaignEx campaignEx = (CampaignEx) campaign;
|
|
try {
|
|
cls = MBMediaView.class;
|
|
int i = MBMediaView.$r8$clinit;
|
|
} catch (Throwable unused) {
|
|
cls = null;
|
|
}
|
|
com.mbridge.msdk.foundation.same.a.b.a(this.l, campaignEx, "native");
|
|
if (view != null) {
|
|
if (cls != null && cls.isInstance(view)) {
|
|
return;
|
|
} else {
|
|
view.setOnClickListener(new com.mbridge.msdk.widget.a() { // from class: com.mbridge.msdk.mbnative.controller.NativeController.6
|
|
@Override // com.mbridge.msdk.widget.a
|
|
public final void onNoDoubleClick(View view2) {
|
|
NativeController.a(NativeController.this, view2.getContext(), campaignEx);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
if (list != null && list.size() > 0) {
|
|
for (View view2 : list) {
|
|
if (cls != null && cls.isInstance(view2)) {
|
|
break;
|
|
} else {
|
|
view2.setOnClickListener(new com.mbridge.msdk.widget.a() { // from class: com.mbridge.msdk.mbnative.controller.NativeController.7
|
|
@Override // com.mbridge.msdk.widget.a
|
|
public final void onNoDoubleClick(View view3) {
|
|
NativeController.a(NativeController.this, view3.getContext(), campaignEx);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
if (campaignEx.isReport()) {
|
|
return;
|
|
}
|
|
a(campaignEx, view, list);
|
|
Log.e(f, "sendImpression" + campaignEx);
|
|
} catch (Exception unused2) {
|
|
af.b(f, "registerview exception!");
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void a(CampaignEx campaignEx) {
|
|
if (campaignEx == null || campaignEx.isReportClick()) {
|
|
return;
|
|
}
|
|
campaignEx.setReportClick(true);
|
|
if (campaignEx.getNativeVideoTracking() == null || campaignEx.getNativeVideoTracking().l() == null) {
|
|
return;
|
|
}
|
|
com.mbridge.msdk.click.a.a(this.k, campaignEx, campaignEx.getCampaignUnitId(), campaignEx.getNativeVideoTracking().l(), false, false);
|
|
}
|
|
|
|
public final void a(Campaign campaign, View view) {
|
|
try {
|
|
NativeListener.NativeTrackingListener nativeTrackingListener = this.j;
|
|
if (nativeTrackingListener != null) {
|
|
this.s.a(nativeTrackingListener);
|
|
}
|
|
com.mbridge.msdk.mbnative.a.c.a(campaign.getType()).a(this.l, campaign, this.Q);
|
|
final CampaignEx campaignEx = (CampaignEx) campaign;
|
|
com.mbridge.msdk.foundation.same.a.b.a(this.l, campaignEx, "native");
|
|
com.mbridge.msdk.widget.a aVar = new com.mbridge.msdk.widget.a() { // from class: com.mbridge.msdk.mbnative.controller.NativeController.9
|
|
@Override // com.mbridge.msdk.widget.a
|
|
public final void onNoDoubleClick(View view2) {
|
|
NativeController.a(NativeController.this, view2.getContext(), campaignEx);
|
|
}
|
|
};
|
|
try {
|
|
int i = MBMediaView.$r8$clinit;
|
|
a(view, aVar, MBMediaView.class);
|
|
} catch (Throwable unused) {
|
|
a(view, aVar, (Class) null);
|
|
}
|
|
if (!com.mbridge.msdk.e.b.a()) {
|
|
a(view, (CampaignEx) campaign);
|
|
}
|
|
if (campaignEx.isReport()) {
|
|
return;
|
|
}
|
|
ArrayList arrayList = new ArrayList();
|
|
arrayList.add(view);
|
|
a(campaignEx, view, (List<View>) arrayList);
|
|
af.c(f, "sendImpression" + campaignEx);
|
|
} catch (Exception unused2) {
|
|
af.b(f, "registerview exception!");
|
|
}
|
|
}
|
|
|
|
private AdSession b(CampaignEx campaignEx) {
|
|
if (this.J == null) {
|
|
this.J = new Hashtable<>();
|
|
}
|
|
String requestIdNotice = campaignEx.getRequestIdNotice();
|
|
AdSession adSession = this.J.get(requestIdNotice);
|
|
if (adSession == null && campaignEx.isActiveOm() && TextUtils.isEmpty(campaignEx.getVideoUrlEncode())) {
|
|
adSession = com.mbridge.msdk.a.b.a(this.k, true, campaignEx.getOmid(), campaignEx.getRequestId(), campaignEx.getId(), this.l, "", campaignEx.getRequestIdNotice());
|
|
}
|
|
if (adSession != null) {
|
|
this.J.put(requestIdNotice, adSession);
|
|
}
|
|
return adSession;
|
|
}
|
|
|
|
private void a(CampaignEx campaignEx, View view, List<View> list) {
|
|
AdSession adSession;
|
|
try {
|
|
if (this.k == null || campaignEx == null) {
|
|
adSession = null;
|
|
} else {
|
|
adSession = b(campaignEx);
|
|
if (adSession != null) {
|
|
adSession.registerAdView(view);
|
|
adSession.start();
|
|
}
|
|
}
|
|
AdSession adSession2 = adSession;
|
|
k kVar = this.T;
|
|
int l = kVar != null ? kVar.l() : 0;
|
|
if (campaignEx != null && campaignEx.getImpReportType() == 1) {
|
|
l = 0;
|
|
}
|
|
final f fVar = new f(campaignEx, view, list, this, adSession2);
|
|
if (this.I == null) {
|
|
this.I = new CopyOnWriteArrayList<>();
|
|
}
|
|
this.I.add(fVar);
|
|
fVar.setOnStateChangeListener(new a.InterfaceC0199a() { // from class: com.mbridge.msdk.mbnative.controller.NativeController.10
|
|
@Override // com.mbridge.msdk.foundation.same.e.a.InterfaceC0199a
|
|
public final void a(a.b bVar) {
|
|
if (bVar != a.b.FINISH || NativeController.this.I == null || NativeController.this.I.size() <= 0 || !NativeController.this.I.contains(fVar)) {
|
|
return;
|
|
}
|
|
NativeController.this.I.remove(fVar);
|
|
}
|
|
});
|
|
Handler handler = this.a;
|
|
if (handler != null) {
|
|
handler.postDelayed(fVar, l * 1000);
|
|
}
|
|
} catch (Exception e2) {
|
|
af.b(f, com.mbridge.msdk.mbnative.b.a.a(e2));
|
|
}
|
|
}
|
|
|
|
private void a(View view, View.OnClickListener onClickListener, Class cls) {
|
|
if (view == null || onClickListener == null) {
|
|
return;
|
|
}
|
|
if (cls != null) {
|
|
try {
|
|
if (cls.isInstance(view)) {
|
|
return;
|
|
}
|
|
} catch (Throwable unused) {
|
|
return;
|
|
}
|
|
}
|
|
view.setOnClickListener(onClickListener);
|
|
if (view instanceof ViewGroup) {
|
|
ViewGroup viewGroup = (ViewGroup) view;
|
|
for (int i = 0; i < viewGroup.getChildCount(); i++) {
|
|
a(viewGroup.getChildAt(i), onClickListener, cls);
|
|
}
|
|
}
|
|
}
|
|
|
|
public final void b(Campaign campaign, View view) {
|
|
b(campaign, view, null);
|
|
}
|
|
|
|
public final void b(Campaign campaign, View view, List<View> list) {
|
|
Class<MBMediaView> cls;
|
|
if (view != null && this.S != null) {
|
|
try {
|
|
view.getViewTreeObserver().removeOnGlobalLayoutListener(this.S);
|
|
} catch (Exception e2) {
|
|
e2.printStackTrace();
|
|
}
|
|
}
|
|
if (campaign != null) {
|
|
int type = campaign.getType();
|
|
if (type == 1 || type == 2) {
|
|
try {
|
|
cls = MBMediaView.class;
|
|
int i = MBMediaView.$r8$clinit;
|
|
} catch (Throwable unused) {
|
|
cls = null;
|
|
}
|
|
if (list == null || list.size() <= 0) {
|
|
if (view != null) {
|
|
a(view, cls);
|
|
}
|
|
} else {
|
|
Iterator<View> it = list.iterator();
|
|
while (it.hasNext()) {
|
|
a(it.next(), cls);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private void a(View view, Class cls) {
|
|
if (view == null) {
|
|
return;
|
|
}
|
|
if (cls != null) {
|
|
try {
|
|
if (cls.isInstance(view)) {
|
|
return;
|
|
}
|
|
} catch (Throwable unused) {
|
|
return;
|
|
}
|
|
}
|
|
view.setOnClickListener(null);
|
|
if (view instanceof ViewGroup) {
|
|
ViewGroup viewGroup = (ViewGroup) view;
|
|
for (int i = 0; i < viewGroup.getChildCount(); i++) {
|
|
a(viewGroup.getChildAt(i), cls);
|
|
}
|
|
}
|
|
}
|
|
|
|
public final void a() {
|
|
com.mbridge.msdk.foundation.same.e.a next;
|
|
com.mbridge.msdk.foundation.same.e.b bVar = this.F;
|
|
if (bVar != null) {
|
|
bVar.a();
|
|
this.F = null;
|
|
}
|
|
Hashtable<String, AdSession> hashtable = this.J;
|
|
if (hashtable != null) {
|
|
for (AdSession adSession : hashtable.values()) {
|
|
if (adSession != null) {
|
|
adSession.finish();
|
|
}
|
|
}
|
|
this.J.clear();
|
|
}
|
|
Handler handler = this.a;
|
|
if (handler != null) {
|
|
handler.removeCallbacksAndMessages(null);
|
|
}
|
|
this.j = null;
|
|
this.s.a();
|
|
try {
|
|
Context context = this.k;
|
|
if (context != null) {
|
|
com.mbridge.msdk.foundation.same.c.b.a(context);
|
|
}
|
|
List<com.mbridge.msdk.mbnative.controller.c> list = this.G;
|
|
if (list != null && list.size() > 0) {
|
|
Iterator<com.mbridge.msdk.mbnative.controller.c> it = this.G.iterator();
|
|
while (it.hasNext()) {
|
|
it.next().a();
|
|
}
|
|
this.G.clear();
|
|
this.G = null;
|
|
}
|
|
List<c.a> list2 = this.H;
|
|
if (list2 != null && list2.size() > 0) {
|
|
for (c.a aVar : this.H) {
|
|
}
|
|
this.H.clear();
|
|
this.H = null;
|
|
}
|
|
CopyOnWriteArrayList<com.mbridge.msdk.foundation.same.e.a> copyOnWriteArrayList = this.I;
|
|
if (copyOnWriteArrayList == null || copyOnWriteArrayList.size() <= 0) {
|
|
return;
|
|
}
|
|
Iterator<com.mbridge.msdk.foundation.same.e.a> it2 = this.I.iterator();
|
|
if (it2.hasNext() && (next = it2.next()) != null) {
|
|
next.cancel();
|
|
this.a.removeCallbacks(next);
|
|
}
|
|
this.I.clear();
|
|
} catch (Exception unused) {
|
|
}
|
|
}
|
|
|
|
public final List<Campaign> a(String str, int i, String str2) {
|
|
List<Campaign> list = null;
|
|
if (this.c != null) {
|
|
ArrayList arrayList = new ArrayList(this.c);
|
|
for (int i2 = 0; i2 < arrayList.size(); i2++) {
|
|
com.mbridge.msdk.mbnative.a.b<String, List<Campaign>> a2 = com.mbridge.msdk.mbnative.a.c.a(((Integer) arrayList.get(i2)).intValue());
|
|
if (a2 != null) {
|
|
list = a(((Integer) arrayList.get(i2)).intValue(), a2.b(str, ((((Integer) arrayList.get(i2)).intValue() == 1 || ((Integer) arrayList.get(i2)).intValue() == 2) && this.e.containsKey(MBridgeConstans.NATIVE_INFO)) ? this.K : this.t));
|
|
if (list != null) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
if (list == null) {
|
|
for (int i3 = 0; i3 < arrayList.size(); i3++) {
|
|
list = a(((Integer) arrayList.get(i3)).intValue(), com.mbridge.msdk.mbnative.a.c.a(((Integer) arrayList.get(i3)).intValue()).a((com.mbridge.msdk.mbnative.a.b<String, List<Campaign>>) str, ((((Integer) arrayList.get(i3)).intValue() == 1 || ((Integer) arrayList.get(i3)).intValue() == 2) && this.e.containsKey(MBridgeConstans.NATIVE_INFO)) ? this.K : this.t));
|
|
if (list != null) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return d(list);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public boolean a(final List<Campaign> list) {
|
|
AdSession b2;
|
|
if ((!TextUtils.isEmpty(this.Q) && list != null && list.size() == 0) || list == null || list.size() <= 0) {
|
|
return false;
|
|
}
|
|
final com.mbridge.msdk.mbnative.d.a aVar = this.i;
|
|
if (aVar == null) {
|
|
return true;
|
|
}
|
|
CampaignEx campaignEx = (CampaignEx) list.get(0);
|
|
if (campaignEx != null && campaignEx.isActiveOm() && (b2 = b(campaignEx)) != null) {
|
|
b2.start();
|
|
AdEvents createAdEvents = AdEvents.createAdEvents(b2);
|
|
this.ad = createAdEvents;
|
|
createAdEvents.loaded();
|
|
}
|
|
final int template = campaignEx != null ? campaignEx.getTemplate() : 2;
|
|
com.mbridge.msdk.foundation.db.j a2 = com.mbridge.msdk.foundation.db.j.a(com.mbridge.msdk.foundation.db.g.a(this.k));
|
|
a2.a();
|
|
for (int i = 0; i < list.size(); i++) {
|
|
CampaignEx campaignEx2 = (CampaignEx) list.get(i);
|
|
if (!a2.b(campaignEx2.getId())) {
|
|
com.mbridge.msdk.foundation.entity.g gVar = new com.mbridge.msdk.foundation.entity.g();
|
|
gVar.a(campaignEx2.getId());
|
|
gVar.b(campaignEx2.getFca());
|
|
gVar.c(campaignEx2.getFcb());
|
|
gVar.a(0);
|
|
gVar.d(0);
|
|
gVar.a(System.currentTimeMillis());
|
|
a2.a(gVar);
|
|
}
|
|
}
|
|
if (this.O && this.N) {
|
|
if (f().h() == 3) {
|
|
final List<Campaign> b3 = b(list);
|
|
if (list.size() > 0) {
|
|
a(list, new b() { // from class: com.mbridge.msdk.mbnative.controller.NativeController.12
|
|
@Override // com.mbridge.msdk.mbnative.controller.NativeController.b
|
|
public final void a() {
|
|
List a3 = NativeController.a(NativeController.this, b3, true);
|
|
if (a3 == null || a3.size() <= 0) {
|
|
NativeController.this.a(aVar, "has no ads", (CampaignEx) list.get(0));
|
|
} else {
|
|
NativeController.this.a((List<Campaign>) a3, template, aVar);
|
|
}
|
|
}
|
|
});
|
|
return true;
|
|
}
|
|
a(aVar, "has no ads", (CampaignEx) null);
|
|
return true;
|
|
}
|
|
List<Campaign> c2 = c(list);
|
|
if (c2 != null && c2.size() > 0) {
|
|
a(c2, new b() { // from class: com.mbridge.msdk.mbnative.controller.NativeController.13
|
|
@Override // com.mbridge.msdk.mbnative.controller.NativeController.b
|
|
public final void a() {
|
|
List a3 = NativeController.a(NativeController.this, list, false);
|
|
if (a3 == null || a3.size() <= 0) {
|
|
NativeController.this.a(aVar, "has no ads", (CampaignEx) null);
|
|
} else {
|
|
NativeController.this.a((List<Campaign>) a3, template, aVar);
|
|
}
|
|
}
|
|
});
|
|
return true;
|
|
}
|
|
a(list, template, aVar);
|
|
return true;
|
|
}
|
|
if (list.size() > 0) {
|
|
Iterator<Campaign> it = list.iterator();
|
|
while (it.hasNext()) {
|
|
it.next().setVideoLength(0);
|
|
}
|
|
a(list, template, aVar);
|
|
return true;
|
|
}
|
|
a(aVar, "has no ads", (CampaignEx) null);
|
|
return true;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void a(final List<Campaign> list, final int i, final NativeListener.NativeAdListener nativeAdListener) {
|
|
this.a.post(new Runnable() { // from class: com.mbridge.msdk.mbnative.controller.NativeController.2
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
List list2 = list;
|
|
if (list2 != null && list2.size() > 0) {
|
|
CampaignEx campaignEx = (CampaignEx) list.get(0);
|
|
NativeController.this.R = campaignEx.getRequestId();
|
|
NativeController.this.ab = list;
|
|
}
|
|
NativeController.this.y = true;
|
|
nativeAdListener.onAdLoaded(list, i);
|
|
Context context = NativeController.this.k;
|
|
List list3 = list;
|
|
String str = NativeController.this.l;
|
|
if (context == null || list3 == null) {
|
|
return;
|
|
}
|
|
try {
|
|
if (list3.isEmpty() || TextUtils.isEmpty(str)) {
|
|
return;
|
|
}
|
|
JSONObject jSONObject = new JSONObject();
|
|
jSONObject.put("key", "2000048");
|
|
jSONObject.put(UserDataStore.STATE, System.currentTimeMillis());
|
|
CampaignEx campaignEx2 = (CampaignEx) list3.get(0);
|
|
jSONObject.put(BidResponsedEx.KEY_CID, campaignEx2.getId());
|
|
jSONObject.put("network_type", ab.m(context));
|
|
jSONObject.put(MBridgeConstans.PROPERTIES_UNIT_ID, str);
|
|
jSONObject.put("hb", "1");
|
|
if (ak.c(campaignEx2)) {
|
|
jSONObject.put(CampaignEx.JSON_KEY_RETARGET_TYPE, campaignEx2.getRtinsType());
|
|
}
|
|
jSONObject.put("rid", campaignEx2.getRequestId());
|
|
jSONObject.put("rid_n", campaignEx2.getRequestIdNotice());
|
|
com.mbridge.msdk.foundation.same.report.d.d.a().a(jSONObject);
|
|
} catch (Throwable th) {
|
|
af.b("NativeReport", th.getMessage());
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void a(final com.mbridge.msdk.mbnative.d.a aVar, final String str, final CampaignEx campaignEx) {
|
|
this.a.post(new Runnable() { // from class: com.mbridge.msdk.mbnative.controller.NativeController.3
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
aVar.a(campaignEx, str);
|
|
}
|
|
});
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public List<Campaign> a(int i, List<Campaign> list) {
|
|
if (i != 1 || !this.e.containsKey(MBridgeConstans.NATIVE_INFO) || list == null || list.size() <= 0) {
|
|
return list;
|
|
}
|
|
CampaignEx campaignEx = (CampaignEx) list.get(0);
|
|
int template = campaignEx != null ? campaignEx.getTemplate() : 1;
|
|
if (template == 2) {
|
|
int size = list.size();
|
|
int i2 = this.Y;
|
|
return size >= i2 ? list.subList(0, i2) : list;
|
|
}
|
|
if (template != 3) {
|
|
return list;
|
|
}
|
|
int size2 = list.size();
|
|
int i3 = this.Z;
|
|
return size2 >= i3 ? list.subList(0, i3) : list;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public k f() {
|
|
k d2 = com.mbridge.msdk.c.h.a().d("", this.l);
|
|
this.T = d2;
|
|
if (d2 == null) {
|
|
this.T = k.d(this.l);
|
|
}
|
|
return this.T;
|
|
}
|
|
|
|
private List<Campaign> b(List<Campaign> list) {
|
|
if (list != null) {
|
|
CampaignEx campaignEx = null;
|
|
for (int size = list.size() - 1; size >= 0; size--) {
|
|
try {
|
|
campaignEx = (CampaignEx) list.get(size);
|
|
} catch (Throwable th) {
|
|
th.printStackTrace();
|
|
}
|
|
if (campaignEx != null && TextUtils.isEmpty(campaignEx.getVideoUrlEncode())) {
|
|
Campaign remove = list.remove(size);
|
|
com.mbridge.msdk.mbnative.a.c.a(campaignEx.getType()).a(this.l, remove, this.Q);
|
|
af.a(f, "remove no videoURL ads:" + remove);
|
|
}
|
|
}
|
|
}
|
|
return list;
|
|
}
|
|
|
|
private List<Campaign> c(List<Campaign> list) {
|
|
ArrayList arrayList = null;
|
|
if (list != null) {
|
|
for (Campaign campaign : list) {
|
|
if (campaign instanceof CampaignEx) {
|
|
CampaignEx campaignEx = (CampaignEx) campaign;
|
|
if (TextUtils.isEmpty(campaignEx.getImageUrl()) && !TextUtils.isEmpty(campaignEx.getVideoUrlEncode())) {
|
|
if (arrayList == null) {
|
|
arrayList = new ArrayList();
|
|
}
|
|
arrayList.add(campaign);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return arrayList;
|
|
}
|
|
|
|
private void a(final List<Campaign> list, final b bVar) {
|
|
g();
|
|
final long currentTimeMillis = System.currentTimeMillis();
|
|
Timer timer = new Timer();
|
|
this.P = timer;
|
|
timer.schedule(new TimerTask() { // from class: com.mbridge.msdk.mbnative.controller.NativeController.5
|
|
@Override // java.util.TimerTask, java.lang.Runnable
|
|
public final void run() {
|
|
boolean z;
|
|
if (System.currentTimeMillis() - currentTimeMillis < ChunkedTrackBlacklistUtil.DEFAULT_TRACK_BLACKLIST_MS) {
|
|
int m = ab.m(NativeController.this.k);
|
|
int k = NativeController.this.f().k();
|
|
if (m != 9 && k == 2) {
|
|
bVar.a();
|
|
NativeController.this.g();
|
|
return;
|
|
}
|
|
if (k == 3) {
|
|
bVar.a();
|
|
NativeController.this.g();
|
|
return;
|
|
}
|
|
loop0: while (true) {
|
|
z = false;
|
|
for (Campaign campaign : list) {
|
|
String id = campaign.getId();
|
|
if (campaign instanceof CampaignEx) {
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(id);
|
|
CampaignEx campaignEx = (CampaignEx) campaign;
|
|
sb.append(campaignEx.getVideoUrlEncode());
|
|
sb.append(campaignEx.getBidToken());
|
|
id = sb.toString();
|
|
}
|
|
com.mbridge.msdk.videocommon.download.a a2 = com.mbridge.msdk.videocommon.download.b.getInstance().a(NativeController.this.l, id);
|
|
if (a2 != null && com.mbridge.msdk.videocommon.download.j.a(a2, NativeController.this.f().p())) {
|
|
z = true;
|
|
}
|
|
}
|
|
break loop0;
|
|
}
|
|
if (z) {
|
|
bVar.a();
|
|
NativeController.this.g();
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
bVar.a();
|
|
NativeController.this.g();
|
|
}
|
|
}, 0L, 1000L);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void g() {
|
|
Timer timer = this.P;
|
|
if (timer != null) {
|
|
timer.cancel();
|
|
this.P = null;
|
|
}
|
|
}
|
|
|
|
public final String c() {
|
|
ArrayList arrayList = new ArrayList();
|
|
List<Campaign> list = this.ab;
|
|
if (list != null) {
|
|
for (Campaign campaign : list) {
|
|
CampaignEx campaignEx = new CampaignEx();
|
|
campaignEx.setCreativeId(campaign.getCreativeId());
|
|
arrayList.add(campaignEx);
|
|
}
|
|
}
|
|
return com.mbridge.msdk.foundation.same.c.a(arrayList);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public List<Campaign> d(List<Campaign> list) {
|
|
if (list == null) {
|
|
return null;
|
|
}
|
|
ArrayList arrayList = new ArrayList(list.size());
|
|
ArrayList arrayList2 = new ArrayList(list.size());
|
|
for (Campaign campaign : list) {
|
|
if (campaign instanceof CampaignEx) {
|
|
CampaignEx campaignEx = (CampaignEx) campaign;
|
|
if (TextUtils.isEmpty(this.Q) && TextUtils.isEmpty(campaignEx.getBidToken()) && !campaignEx.isBidCampaign()) {
|
|
arrayList2.add(campaignEx);
|
|
} else if (!TextUtils.isEmpty(this.Q) && TextUtils.equals(campaignEx.getBidToken(), this.Q)) {
|
|
arrayList.add(campaign);
|
|
}
|
|
} else {
|
|
arrayList2.add(campaign);
|
|
}
|
|
}
|
|
return TextUtils.isEmpty(this.Q) ? arrayList2 : arrayList;
|
|
}
|
|
|
|
public static class e extends Handler {
|
|
private WeakReference<NativeController> a;
|
|
|
|
public e(NativeController nativeController) {
|
|
this.a = new WeakReference<>(nativeController);
|
|
}
|
|
|
|
@Override // android.os.Handler
|
|
public final void handleMessage(Message message) {
|
|
WeakReference<NativeController> weakReference;
|
|
NativeController nativeController;
|
|
super.handleMessage(message);
|
|
try {
|
|
NativeController nativeController2 = null;
|
|
if (message.what == 0 && (weakReference = this.a) != null && (nativeController = weakReference.get()) != null) {
|
|
h unused = nativeController.q;
|
|
int i = message.arg1;
|
|
com.mbridge.msdk.foundation.same.report.d.d.a().a(com.mbridge.msdk.foundation.same.report.i.a((Campaign) null, i, "request"));
|
|
}
|
|
if (message.what == 1) {
|
|
WeakReference<NativeController> weakReference2 = this.a;
|
|
if (weakReference2 != null && weakReference2.get() != null) {
|
|
nativeController2 = this.a.get();
|
|
}
|
|
if (nativeController2 != null) {
|
|
nativeController2.z = true;
|
|
List<Campaign> a = nativeController2.a(nativeController2.l, nativeController2.u, nativeController2.Q);
|
|
if (nativeController2.y) {
|
|
return;
|
|
}
|
|
nativeController2.a(a);
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
af.b(NativeController.f, com.mbridge.msdk.mbnative.b.a.a(e));
|
|
}
|
|
}
|
|
}
|
|
|
|
public static class f extends com.mbridge.msdk.foundation.same.e.a {
|
|
private CampaignEx a;
|
|
private WeakReference<View> b;
|
|
private WeakReference<List<View>> c;
|
|
private WeakReference<NativeController> d;
|
|
private WeakReference<AdSession> e;
|
|
|
|
@Override // com.mbridge.msdk.foundation.same.e.a
|
|
public final void cancelTask() {
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.foundation.same.e.a
|
|
public final void pauseTask(boolean z) {
|
|
}
|
|
|
|
public f(CampaignEx campaignEx, View view, List<View> list, NativeController nativeController, AdSession adSession) {
|
|
this.a = campaignEx;
|
|
this.b = new WeakReference<>(view);
|
|
this.c = new WeakReference<>(list);
|
|
this.d = new WeakReference<>(nativeController);
|
|
this.e = new WeakReference<>(adSession);
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.foundation.same.e.a
|
|
public final void runTask() {
|
|
WeakReference<View> weakReference;
|
|
try {
|
|
if (this.d == null || (weakReference = this.b) == null || this.c == null) {
|
|
return;
|
|
}
|
|
View view = weakReference.get();
|
|
List<View> list = this.c.get();
|
|
NativeController nativeController = this.d.get();
|
|
WeakReference<AdSession> weakReference2 = this.e;
|
|
AdSession adSession = weakReference2 != null ? weakReference2.get() : null;
|
|
if (view == null || nativeController == null) {
|
|
return;
|
|
}
|
|
NativeController.a(nativeController, this.a, view, list, adSession);
|
|
} catch (Exception e) {
|
|
af.b(NativeController.f, com.mbridge.msdk.mbnative.b.a.a(e));
|
|
}
|
|
}
|
|
}
|
|
|
|
public static class d implements H5DownLoadManager.IH5SourceDownloadListener {
|
|
private String a;
|
|
private CampaignEx b;
|
|
private long c = System.currentTimeMillis();
|
|
private boolean d;
|
|
|
|
public d(String str, CampaignEx campaignEx, boolean z) {
|
|
this.d = true;
|
|
this.a = str;
|
|
this.b = campaignEx;
|
|
this.d = z;
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.foundation.download.download.H5DownLoadManager.H5ResDownloadListerInter
|
|
public final void onSuccess(String str, String str2, boolean z) {
|
|
try {
|
|
if (this.d) {
|
|
long currentTimeMillis = System.currentTimeMillis() - this.c;
|
|
o.a(com.mbridge.msdk.foundation.db.g.a(com.mbridge.msdk.foundation.controller.c.m().c()));
|
|
n nVar = new n("2000043", 1, currentTimeMillis + "", str, this.b.getId(), this.a, "", "2");
|
|
CampaignEx campaignEx = this.b;
|
|
if (campaignEx != null && !TextUtils.isEmpty(campaignEx.getId())) {
|
|
nVar.e(this.b.getId());
|
|
}
|
|
CampaignEx campaignEx2 = this.b;
|
|
if (campaignEx2 != null) {
|
|
nVar.f(campaignEx2.getRequestId());
|
|
nVar.g(this.b.getRequestIdNotice());
|
|
nVar.s(this.b.getCurrentLocalRid());
|
|
nVar.c(this.b.getAdSpaceT());
|
|
}
|
|
if (!TextUtils.isEmpty(str2)) {
|
|
nVar.t(str2);
|
|
}
|
|
nVar.d("1");
|
|
com.mbridge.msdk.foundation.same.report.g.a(nVar, this.a, this.b);
|
|
}
|
|
} catch (Exception e) {
|
|
af.b(NativeController.f, com.mbridge.msdk.mbnative.b.a.a(e));
|
|
}
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.foundation.download.download.H5DownLoadManager.H5ResDownloadListerInter
|
|
public final void onFailed(String str, String str2) {
|
|
try {
|
|
if (this.d) {
|
|
long currentTimeMillis = System.currentTimeMillis() - this.c;
|
|
o.a(com.mbridge.msdk.foundation.db.g.a(com.mbridge.msdk.foundation.controller.c.m().c()));
|
|
n nVar = new n("2000043", 3, currentTimeMillis + "", str, this.b.getId(), this.a, str2, "2");
|
|
nVar.f(this.b.getRequestId());
|
|
nVar.s(this.b.getCurrentLocalRid());
|
|
nVar.g(this.b.getRequestIdNotice());
|
|
CampaignEx campaignEx = this.b;
|
|
if (campaignEx != null && !TextUtils.isEmpty(campaignEx.getId())) {
|
|
nVar.e(this.b.getId());
|
|
}
|
|
CampaignEx campaignEx2 = this.b;
|
|
if (campaignEx2 != null) {
|
|
nVar.c(campaignEx2.getAdSpaceT());
|
|
}
|
|
nVar.d("1");
|
|
com.mbridge.msdk.foundation.same.report.g.a(nVar, this.a, this.b);
|
|
}
|
|
} catch (Exception e) {
|
|
af.b(NativeController.f, com.mbridge.msdk.mbnative.b.a.a(e));
|
|
}
|
|
}
|
|
}
|
|
|
|
public static final class g implements H5DownLoadManager.ZipDownloadListener {
|
|
String a;
|
|
CampaignEx b;
|
|
private long c = System.currentTimeMillis();
|
|
private boolean d;
|
|
|
|
public g(String str, CampaignEx campaignEx, boolean z) {
|
|
this.d = true;
|
|
this.a = str;
|
|
this.b = campaignEx;
|
|
this.d = z;
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.foundation.download.download.H5DownLoadManager.H5ResDownloadListerInter
|
|
public final void onSuccess(String str, String str2, boolean z) {
|
|
try {
|
|
if (this.d) {
|
|
long currentTimeMillis = System.currentTimeMillis() - this.c;
|
|
o.a(com.mbridge.msdk.foundation.db.g.a(com.mbridge.msdk.foundation.controller.c.m().c()));
|
|
n nVar = new n("2000043", 1, currentTimeMillis + "", str, this.b.getId(), this.a, "", "1");
|
|
CampaignEx campaignEx = this.b;
|
|
if (campaignEx != null && !TextUtils.isEmpty(campaignEx.getId())) {
|
|
nVar.e(this.b.getId());
|
|
}
|
|
CampaignEx campaignEx2 = this.b;
|
|
if (campaignEx2 != null) {
|
|
nVar.f(campaignEx2.getRequestId());
|
|
nVar.s(this.b.getCurrentLocalRid());
|
|
nVar.g(this.b.getRequestIdNotice());
|
|
nVar.c(this.b.getAdSpaceT());
|
|
}
|
|
if (!TextUtils.isEmpty(str2)) {
|
|
nVar.t(str2);
|
|
}
|
|
nVar.d("2");
|
|
com.mbridge.msdk.foundation.same.report.g.a(nVar, this.a, this.b);
|
|
}
|
|
} catch (Exception e) {
|
|
af.b(NativeController.f, com.mbridge.msdk.mbnative.b.a.a(e));
|
|
}
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.foundation.download.download.H5DownLoadManager.H5ResDownloadListerInter
|
|
public final void onFailed(String str, String str2) {
|
|
try {
|
|
if (this.d) {
|
|
long currentTimeMillis = System.currentTimeMillis() - this.c;
|
|
o.a(com.mbridge.msdk.foundation.db.g.a(com.mbridge.msdk.foundation.controller.c.m().c()));
|
|
n nVar = new n("2000043", 3, currentTimeMillis + "", str2, this.b.getId(), this.a, str, "1");
|
|
CampaignEx campaignEx = this.b;
|
|
if (campaignEx != null && !TextUtils.isEmpty(campaignEx.getId())) {
|
|
nVar.e(this.b.getId());
|
|
}
|
|
CampaignEx campaignEx2 = this.b;
|
|
if (campaignEx2 != null) {
|
|
nVar.f(campaignEx2.getRequestId());
|
|
nVar.s(this.b.getCurrentLocalRid());
|
|
nVar.g(this.b.getRequestIdNotice());
|
|
nVar.c(this.b.getAdSpaceT());
|
|
}
|
|
nVar.d("2");
|
|
com.mbridge.msdk.foundation.same.report.g.a(nVar, this.a, this.b);
|
|
}
|
|
} catch (Exception e) {
|
|
af.b(NativeController.f, com.mbridge.msdk.mbnative.b.a.a(e));
|
|
}
|
|
}
|
|
}
|
|
|
|
public class c implements Runnable {
|
|
private int b;
|
|
private com.mbridge.msdk.foundation.same.e.d c;
|
|
private int d;
|
|
private String e;
|
|
|
|
public c(int i, com.mbridge.msdk.foundation.same.e.d dVar, int i2, String str) {
|
|
this.b = i;
|
|
this.c = dVar;
|
|
this.d = i2;
|
|
this.e = str;
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
this.c.a(true);
|
|
int i = this.b;
|
|
if (i == 1) {
|
|
NativeController.this.X = true;
|
|
NativeController.this.a("REQUEST_TIMEOUT", this.d, this.e, (CampaignEx) null);
|
|
} else {
|
|
if (i != 2) {
|
|
return;
|
|
}
|
|
if (!NativeController.this.y || this.d == 1) {
|
|
NativeController.this.a("REQUEST_TIMEOUT", this.d, this.e, (CampaignEx) null);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public class a extends com.mbridge.msdk.mbnative.f.a.b implements com.mbridge.msdk.foundation.same.e.d {
|
|
private Runnable c;
|
|
private boolean b = false;
|
|
private boolean d = true;
|
|
private List<String> e = null;
|
|
|
|
public final void a(Runnable runnable) {
|
|
this.c = runnable;
|
|
}
|
|
|
|
public final void a(List<String> list) {
|
|
this.e = list;
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.foundation.same.e.d
|
|
public final void a(boolean z) {
|
|
this.b = z;
|
|
}
|
|
|
|
public final void b(boolean z) {
|
|
this.d = z;
|
|
}
|
|
|
|
public a() {
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.mbnative.f.a.b
|
|
public final void a(List<com.mbridge.msdk.tracker.network.h> list, CampaignUnit campaignUnit) {
|
|
Integer num;
|
|
int i = 1;
|
|
NativeController.this.X = true;
|
|
com.mbridge.msdk.foundation.db.j a = com.mbridge.msdk.foundation.db.j.a(com.mbridge.msdk.foundation.db.g.a(NativeController.this.k));
|
|
a.a();
|
|
Runnable runnable = this.c;
|
|
if (runnable != null) {
|
|
NativeController.this.a.removeCallbacks(runnable);
|
|
}
|
|
com.mbridge.msdk.e.b.a();
|
|
if (campaignUnit != null && campaignUnit.getAds() != null && campaignUnit.getAds().size() > 0) {
|
|
NativeController.this.r = campaignUnit.getSessionId();
|
|
ArrayList arrayList = new ArrayList();
|
|
ArrayList arrayList2 = new ArrayList();
|
|
ArrayList arrayList3 = new ArrayList();
|
|
if (NativeController.this.V <= 0) {
|
|
if (NativeController.this.V == -3) {
|
|
NativeController.this.V = campaignUnit.getAds().size();
|
|
} else {
|
|
NativeController nativeController = NativeController.this;
|
|
nativeController.V = nativeController.u;
|
|
}
|
|
if (NativeController.this.Y != 0 && campaignUnit.getTemplate() == 2) {
|
|
NativeController nativeController2 = NativeController.this;
|
|
nativeController2.V = nativeController2.Y;
|
|
}
|
|
if (NativeController.this.Z != 0 && campaignUnit.getTemplate() == 3) {
|
|
NativeController nativeController3 = NativeController.this;
|
|
nativeController3.V = nativeController3.Z;
|
|
}
|
|
}
|
|
for (int i2 = 0; i2 < campaignUnit.getAds().size(); i2++) {
|
|
final CampaignEx campaignEx = campaignUnit.getAds().get(i2);
|
|
campaignEx.setCampaignUnitId(this.unitId);
|
|
if (!TextUtils.isEmpty(NativeController.this.Q)) {
|
|
campaignEx.setBidToken(NativeController.this.Q);
|
|
campaignEx.setIsBidCampaign(true);
|
|
}
|
|
final com.mbridge.msdk.foundation.same.report.d.a.a aVar = null;
|
|
if (NativeController.g) {
|
|
campaignEx.loadIconUrlAsyncWithBlock(null);
|
|
campaignEx.loadImageUrlAsyncWithBlock(null);
|
|
}
|
|
boolean c = ak.c(NativeController.this.k, campaignEx.getPackageName());
|
|
Context unused = NativeController.this.k;
|
|
if (i2 < NativeController.this.u && campaignEx.getOfferType() != 99) {
|
|
if (ak.c(campaignEx)) {
|
|
campaignEx.setRtinsType(c ? 1 : 2);
|
|
}
|
|
if (com.mbridge.msdk.foundation.same.c.a(NativeController.this.k, campaignEx)) {
|
|
arrayList.add(campaignEx);
|
|
if (!TextUtils.isEmpty(campaignEx.getVideoUrlEncode())) {
|
|
arrayList3.add(campaignEx);
|
|
}
|
|
} else {
|
|
ak.a(this.unitId, campaignEx, com.mbridge.msdk.foundation.same.a.x);
|
|
NativeController.this.ac = "APP ALREADY INSTALLED";
|
|
}
|
|
try {
|
|
com.mbridge.msdk.foundation.same.c.a(campaignEx, NativeController.this.k, null, new c.a() { // from class: com.mbridge.msdk.mbnative.controller.NativeController.a.1
|
|
@Override // com.mbridge.msdk.foundation.same.c.a
|
|
public final void a(String str, com.mbridge.msdk.foundation.same.report.d.c cVar) {
|
|
com.mbridge.msdk.mbnative.e.a.a(str, cVar, campaignEx, NativeController.this.k, aVar);
|
|
}
|
|
});
|
|
} catch (Exception e) {
|
|
if (MBridgeConstans.DEBUG) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
if (i2 < NativeController.this.V && campaignEx.getOfferType() != 99) {
|
|
if (ak.c(campaignEx)) {
|
|
campaignEx.setRtinsType(c ? 1 : 2);
|
|
}
|
|
if (!c) {
|
|
arrayList2.add(campaignEx);
|
|
} else if (ak.c(campaignEx)) {
|
|
arrayList2.add(campaignEx);
|
|
}
|
|
}
|
|
if (!a.b(campaignEx.getId())) {
|
|
com.mbridge.msdk.foundation.entity.g gVar = new com.mbridge.msdk.foundation.entity.g();
|
|
gVar.a(campaignEx.getId());
|
|
gVar.b(campaignEx.getFca());
|
|
gVar.c(campaignEx.getFcb());
|
|
gVar.a(0);
|
|
gVar.d(0);
|
|
gVar.a(System.currentTimeMillis());
|
|
a.a(gVar);
|
|
}
|
|
com.mbridge.msdk.click.c.a(NativeController.this.k, campaignEx.getMaitve(), campaignEx.getMaitve_src());
|
|
}
|
|
NativeController.c(NativeController.this, arrayList3);
|
|
int type = campaignUnit.getAds().get(0) != null ? campaignUnit.getAds().get(0).getType() : 1;
|
|
com.mbridge.msdk.mbnative.a.b<String, List<Campaign>> a2 = com.mbridge.msdk.mbnative.a.c.a(type);
|
|
if (a2 != null) {
|
|
a2.a((com.mbridge.msdk.mbnative.a.b<String, List<Campaign>>) this.unitId, (String) arrayList2, NativeController.this.Q);
|
|
}
|
|
if (arrayList.size() == 0) {
|
|
if (NativeController.this.ac.contains("INSTALLED")) {
|
|
NativeController.this.a("APP ALREADY INSTALLED", b(), a(), campaignUnit.getAds().get(0));
|
|
new com.mbridge.msdk.foundation.c.b(880021, "APP ALREADY INSTALLED");
|
|
return;
|
|
} else {
|
|
NativeController.this.a("v3 response error", b(), a(), campaignUnit.getAds().get(0));
|
|
new com.mbridge.msdk.foundation.c.b(880003);
|
|
return;
|
|
}
|
|
}
|
|
NativeController nativeController4 = NativeController.this;
|
|
nativeController4.a((List<Campaign>) nativeController4.a(type, (List<Campaign>) nativeController4.d(arrayList)));
|
|
if (com.mbridge.msdk.mbnative.controller.d.b().containsKey(this.unitId) && Boolean.TRUE.equals(com.mbridge.msdk.mbnative.controller.d.b().get(this.unitId))) {
|
|
com.mbridge.msdk.mbnative.controller.d.a(NativeController.this.v, this.unitId);
|
|
return;
|
|
}
|
|
if (com.mbridge.msdk.mbnative.controller.d.e().containsKey(this.unitId) && (num = com.mbridge.msdk.mbnative.controller.d.e().get(this.unitId)) != null) {
|
|
i = num.intValue();
|
|
}
|
|
int i3 = NativeController.this.u + NativeController.this.w;
|
|
NativeController.this.w = i3 <= i ? i3 : 0;
|
|
return;
|
|
}
|
|
this.unitId = "0_" + this.unitId;
|
|
com.mbridge.msdk.mbnative.controller.d.b(NativeController.this.v, this.unitId);
|
|
NativeController.this.w = 0;
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.mbnative.f.a.b
|
|
public final void a(int i, String str) {
|
|
NativeController.this.X = true;
|
|
if (!this.b) {
|
|
if (i == -1) {
|
|
com.mbridge.msdk.mbnative.controller.d.b(NativeController.this.v, this.unitId);
|
|
NativeController.this.w = 0;
|
|
}
|
|
Runnable runnable = this.c;
|
|
if (runnable != null) {
|
|
NativeController.this.a.removeCallbacks(runnable);
|
|
}
|
|
if (NativeController.this.y) {
|
|
return;
|
|
}
|
|
if (b() == 1 || this.d) {
|
|
NativeController.this.a(str, b(), a(), (CampaignEx) null);
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
if (NativeController.this.y || !this.d) {
|
|
return;
|
|
}
|
|
NativeController.this.a(str, b(), a(), (CampaignEx) null);
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.mbnative.f.a.b
|
|
public final void b(List<Frame> list) {
|
|
if (this.b) {
|
|
return;
|
|
}
|
|
Runnable runnable = this.c;
|
|
if (runnable != null) {
|
|
NativeController.this.a.removeCallbacks(runnable);
|
|
}
|
|
if (list == null || list.size() == 0) {
|
|
if (NativeController.this.i != null) {
|
|
NativeController.this.y = true;
|
|
NativeController.this.i.onAdLoadError("frame is empty");
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
Iterator<Frame> it = list.iterator();
|
|
while (it.hasNext()) {
|
|
List<CampaignEx> campaigns = it.next().getCampaigns();
|
|
if (campaigns == null || campaigns.size() == 0) {
|
|
if (NativeController.this.i != null) {
|
|
NativeController.this.y = true;
|
|
NativeController.this.i.onAdLoadError("ads in frame is empty");
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
for (CampaignEx campaignEx : campaigns) {
|
|
if (NativeController.g) {
|
|
campaignEx.loadImageUrlAsyncWithBlock(null);
|
|
campaignEx.loadIconUrlAsyncWithBlock(null);
|
|
}
|
|
}
|
|
}
|
|
if (NativeController.this.i != null) {
|
|
NativeController.this.i.onAdFramesLoaded(list);
|
|
}
|
|
}
|
|
}
|
|
|
|
public static /* synthetic */ void a(NativeController nativeController, Context context, final CampaignEx campaignEx) {
|
|
if (campaignEx != null) {
|
|
try {
|
|
if (campaignEx.needShowIDialog() && com.mbridge.msdk.e.b.a()) {
|
|
new com.mbridge.msdk.widget.dialog.a() { // from class: com.mbridge.msdk.mbnative.controller.NativeController.8
|
|
@Override // com.mbridge.msdk.widget.dialog.a
|
|
public final void b() {
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.widget.dialog.a
|
|
public final void c() {
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.widget.dialog.a
|
|
public final void a() {
|
|
NativeController.this.s.a(campaignEx, NativeController.this.i);
|
|
NativeController.this.a(campaignEx);
|
|
}
|
|
};
|
|
if (com.mbridge.msdk.click.c.a(campaignEx) && campaignEx.needShowIDialog()) {
|
|
com.mbridge.msdk.click.a aVar = nativeController.s;
|
|
nativeController.a(campaignEx);
|
|
nativeController.i.onAdClick(campaignEx);
|
|
return;
|
|
}
|
|
}
|
|
} catch (Throwable th) {
|
|
af.a(f, th.getMessage());
|
|
}
|
|
}
|
|
nativeController.s.a(campaignEx, nativeController.i);
|
|
nativeController.a(campaignEx);
|
|
}
|
|
|
|
public static /* synthetic */ List a(NativeController nativeController, List list, boolean z) {
|
|
if (list != null) {
|
|
for (int size = list.size() - 1; size >= 0; size--) {
|
|
Campaign campaign = (Campaign) list.get(size);
|
|
String id = campaign.getId();
|
|
boolean z2 = campaign instanceof CampaignEx;
|
|
if (z2) {
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(id);
|
|
CampaignEx campaignEx = (CampaignEx) campaign;
|
|
sb.append(campaignEx.getVideoUrlEncode());
|
|
sb.append(campaignEx.getBidToken());
|
|
id = sb.toString();
|
|
}
|
|
com.mbridge.msdk.videocommon.download.a a2 = com.mbridge.msdk.videocommon.download.b.getInstance().a(nativeController.l, id);
|
|
if (z) {
|
|
if (a2 == null || !com.mbridge.msdk.videocommon.download.j.a(a2, nativeController.f().p())) {
|
|
com.mbridge.msdk.mbnative.a.c.a(campaign.getType()).a(nativeController.l, (Campaign) list.remove(size), nativeController.Q);
|
|
}
|
|
} else if (z2) {
|
|
CampaignEx campaignEx2 = (CampaignEx) campaign;
|
|
if (TextUtils.isEmpty(campaignEx2.getImageUrl()) && !TextUtils.isEmpty(campaignEx2.getVideoUrlEncode()) && (a2 == null || !com.mbridge.msdk.videocommon.download.j.a(a2, nativeController.f().p()))) {
|
|
com.mbridge.msdk.mbnative.a.c.a(campaign.getType()).a(nativeController.l, (Campaign) list.remove(size), nativeController.Q);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return list;
|
|
}
|
|
|
|
public static /* synthetic */ void a(NativeController nativeController, final CampaignEx campaignEx, View view, List list, AdSession adSession) {
|
|
try {
|
|
c.a aVar = new c.a() { // from class: com.mbridge.msdk.mbnative.controller.NativeController.11
|
|
@Override // com.mbridge.msdk.mbnative.controller.c.a
|
|
public final void a(ArrayList<View> arrayList, ArrayList<View> arrayList2) {
|
|
if (arrayList == null || arrayList.size() <= 0) {
|
|
return;
|
|
}
|
|
com.mbridge.msdk.mbnative.e.b.a(campaignEx, NativeController.this.k, NativeController.this.l, NativeController.this.i);
|
|
}
|
|
};
|
|
com.mbridge.msdk.mbnative.controller.c cVar = new com.mbridge.msdk.mbnative.controller.c(list, aVar, new Handler(Looper.getMainLooper()), campaignEx.getImpReportType());
|
|
cVar.a(view);
|
|
List<com.mbridge.msdk.mbnative.controller.c> list2 = nativeController.G;
|
|
if (list2 != null) {
|
|
list2.add(cVar);
|
|
}
|
|
List<c.a> list3 = nativeController.H;
|
|
if (list3 != null) {
|
|
list3.add(aVar);
|
|
}
|
|
AdEvents adEvents = nativeController.ad;
|
|
if (adEvents != null) {
|
|
adEvents.impressionOccurred();
|
|
}
|
|
} catch (Exception unused) {
|
|
}
|
|
}
|
|
|
|
public static /* synthetic */ void c(NativeController nativeController, List list) {
|
|
if (list != null) {
|
|
try {
|
|
if (list.size() > 0) {
|
|
try {
|
|
int i = MBMediaView.$r8$clinit;
|
|
Object invoke = com.mbridge.msdk.videocommon.download.b.class.getMethod("getInstance", new Class[0]).invoke(null, new Object[0]);
|
|
if (invoke != null) {
|
|
com.mbridge.msdk.videocommon.download.b.class.getMethod("createUnitCache", Context.class, String.class, CopyOnWriteArrayList.class, Integer.TYPE, com.mbridge.msdk.videocommon.listener.a.class).invoke(invoke, nativeController.k, nativeController.l, new CopyOnWriteArrayList(list), 1, null);
|
|
com.mbridge.msdk.videocommon.download.b.class.getMethod("load", String.class).invoke(invoke, nativeController.l);
|
|
}
|
|
Iterator it = list.iterator();
|
|
while (it.hasNext()) {
|
|
CampaignEx campaignEx = (CampaignEx) it.next();
|
|
if (campaignEx != null && !TextUtils.isEmpty(campaignEx.getImageUrl())) {
|
|
com.mbridge.msdk.foundation.same.c.b.a(com.mbridge.msdk.foundation.controller.c.m().c()).a(campaignEx.getImageUrl(), new com.mbridge.msdk.foundation.same.c.c() { // from class: com.mbridge.msdk.mbnative.controller.NativeController.4
|
|
@Override // com.mbridge.msdk.foundation.same.c.c
|
|
public final void onFailedLoad(String str, String str2) {
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.foundation.same.c.c
|
|
public final void onSuccessLoad(Bitmap bitmap, String str) {
|
|
}
|
|
});
|
|
}
|
|
String str = "";
|
|
if (campaignEx != null) {
|
|
try {
|
|
str = campaignEx.getendcard_url();
|
|
} catch (Exception unused) {
|
|
}
|
|
}
|
|
com.mbridge.msdk.foundation.same.report.d.c cVar = new com.mbridge.msdk.foundation.same.report.d.c();
|
|
cVar.a(campaignEx);
|
|
if (!TextUtils.isEmpty(str)) {
|
|
cVar.c((campaignEx == null || campaignEx.getAabEntity() == null) ? 0 : campaignEx.getAabEntity().h3c);
|
|
if (str.contains(".zip") && str.contains(ResourceManager.KEY_MD5FILENAME)) {
|
|
H5DownLoadManager.getInstance().downloadH5Res(cVar, str, new g(nativeController.l, campaignEx, TextUtils.isEmpty(H5DownLoadManager.getInstance().getH5ResAddress(str))));
|
|
} else {
|
|
H5DownLoadManager.getInstance().downloadH5Res(cVar, str, new d(nativeController.l, campaignEx, TextUtils.isEmpty(HTMLResourceManager.getInstance().getHtmlContentFromUrl(str))));
|
|
}
|
|
}
|
|
}
|
|
} catch (Throwable unused2) {
|
|
af.b(f, "please import the videocommon and nativex aar");
|
|
}
|
|
}
|
|
} catch (Throwable th) {
|
|
if (MBridgeConstans.DEBUG) {
|
|
th.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|