MyRecorder v1.01.90.0219版本的 MD5 值为:c361f51174a0bf833abfa72929caf8d3
以下内容为反编译后的 h.java 源代码,内容仅作参考
package com.bytedance.sdk.openadsdk.l;
import android.content.Context;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.provider.MediaStore;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewTreeObserver;
import android.webkit.ValueCallback;
import android.webkit.WebView;
import com.facebook.appevents.AppEventsConstants;
import com.smaato.sdk.richmedia.mraid.bridge.MraidJsMethods;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import org.json.JSONException;
import org.json.JSONObject;
public class h {
private JSONObject aB;
private float aE;
private int aF;
private int aG;
private int aH;
private int aI;
private int aJ;
private int aK;
private int aL;
private int aM;
private int aN;
private int aO;
private String aP;
private boolean aQ;
private boolean aR;
private boolean aT;
private boolean aU;
private String aW;
private String aX;
private String aY;
private String aZ;
private JSONObject f16952af;
private int f16953ag;
private a f16955ai;
private Context f16956aj;
private WebView f16957ak;
private WeakReference<View> f16958al;
private f f16959am;
private com.bytedance.sdk.openadsdk.l.a f16960an;
private c f16961ao;
private String as;
private String at;
private String au;
private String ax;
private String ay;
private String az;
private Runnable f16976i;
private Runnable f16977j;
private Runnable f16978k;
private Runnable f16980m;
private Runnable f16981n;
private b f16982o;
private final String f16973f = "playable_stuck_check_ping";
private final String f16974g = "playable_apply_media_permission_callback";
private final Handler f16975h = new Handler(Looper.getMainLooper());
private final Handler f16979l = new Handler(Looper.getMainLooper());
private boolean f16983p = true;
private boolean f16984q = true;
private boolean f16985r = true;
public final String f16946a = "PL_sdk_playable_global_viewable";
public final String f16963b = "PL_sdk_page_screen_blank";
public final String f16970c = "PL_sdk_playable_destroy_analyze_summary";
public final String f16971d = "PL_sdk_playable_hardware_dialog_cancel";
public final String f16972e = "PL_sdk_playable_hardware_dialog_setting";
private Set<String> f16986s = new HashSet(Arrays.asList("adInfo", "appInfo", "subscribe_app_ad", "download_app_ad"));
private String f16987t = null;
private String f16988u = "embeded_ad";
private boolean f16989v = true;
private boolean f16990w = true;
private boolean f16991x = false;
private String f16992y = "";
private long f16993z = 10;
private long A = 10;
private int B = 700;
private long C = 0;
private long D = 0;
private long E = -1;
private long F = -1;
private long G = -1;
private long H = -1;
private long I = -1;
private long J = -1;
private long K = -1;
private String L = "";
private String M = "";
private String N = "";
private String O = "";
private int P = 0;
private int Q = 0;
private boolean R = false;
private int S = 0;
private int T = -1;
private int U = 0;
private int V = 0;
private int W = 0;
private String X = null;
private boolean Y = false;
private int Z = 0;
private int f16947aa = 0;
private int f16948ab = 0;
private int f16949ac = 0;
private long f16950ad = 0;
private long f16951ae = 0;
private int f16954ah = 0;
private int f16962ap = 0;
private int aq = 0;
private JSONObject ar = new JSONObject();
private Map<String, String> av = new HashMap();
private JSONObject aw = new JSONObject();
private String aA = "";
private float aC = 0.0f;
private float aD = 0.0f;
private boolean aS = false;
private boolean aV = false;
private boolean f16964ba = false;
private List<JSONObject> f16965bb = new ArrayList();
private boolean f16966bc = true;
private volatile boolean f16967bd = true;
private volatile boolean f16968be = true;
private ViewTreeObserver.OnGlobalLayoutListener f16969bf = new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
try {
View view = (View) h.this.f16958al.get();
if (view == null) {
return;
}
h.this.b(view);
} catch (Throwable th2) {
g.a("PlayablePlugin", "onSizeChanged error", th2);
}
}
};
public enum a {
LAND_PAGE,
FEED,
OTHER,
FEED_AWEME
}
private h(Context context, WebView webView, c cVar, com.bytedance.sdk.openadsdk.l.a aVar, a aVar2) {
this.f16953ag = -2;
this.f16953ag = 0;
this.f16955ai = aVar2;
this.f16957ak = webView;
i.a(webView);
a(webView);
a(context, cVar, aVar);
}
private void O() {
this.f16982o = new b(this, this.B);
this.f16976i = new Runnable() {
@Override
public void run() {
if (h.this.f16989v) {
h.this.f16989v = false;
h.this.f16975h.removeCallbacks(h.this.f16977j);
h.this.a(2, "ContainerLoadTimeOut");
}
}
};
this.f16977j = new Runnable() {
@Override
public void run() {
if (h.this.f16989v) {
h.this.f16989v = false;
h.this.f16967bd = false;
h.this.f16975h.removeCallbacks(h.this.f16976i);
h.this.a(3, "JSSDKLoadTimeOut");
}
}
};
this.f16980m = new Runnable() {
@Override
public void run() {
g.a("mCheckJSRunnable", " ====Scheduled Task=== " + System.currentTimeMillis());
if (h.this.f16957ak != null) {
h.this.f16957ak.evaluateJavascript("javascript:typeof playable_callJS === 'function' && playable_callJS()", new ValueCallback<String>() {
@Override
public void onReceiveValue(String str) {
if (h.this.f16982o != null) {
h.this.f16982o.a(System.currentTimeMillis());
}
}
});
}
if (h.this.f16979l != null) {
h.this.f16979l.postDelayed(this, 500L);
}
}
};
this.f16981n = new Runnable() {
@Override
public void run() {
g.a("mCheckJSRunnable", " ====Lynx detect scheduled tasks=== " + System.currentTimeMillis());
h.this.a("playable_stuck_check_ping", new JSONObject());
if (h.this.f16979l != null) {
h.this.f16979l.postDelayed(this, 500L);
}
}
};
this.f16978k = new Runnable() {
@Override
public void run() {
if (h.this.f16951ae <= 0) {
h.this.b(1, "Clicking on the hot zone causes the program to freeze.");
} else if (h.this.f16951ae - h.this.f16950ad > h.this.B) {
h.this.b(1, "Clicking on the hot zone causes the program to freeze.");
} else {
h.this.J();
h.this.f16950ad = 0L;
h.this.f16951ae = 0L;
}
}
};
}
private void P() {
String str;
if (this.aw == null || (str = this.ax) == null || str.contains("/cid_")) {
return;
}
String optString = this.aw.optString("cid");
if (TextUtils.isEmpty(optString)) {
return;
}
String host = Uri.parse(this.ax).getHost();
if (TextUtils.isEmpty(host)) {
this.ax += "/cid_" + optString;
return;
}
this.ax = this.ax.replace(host, host + "/cid_" + optString);
}
private void Q() {
Runnable runnable;
Runnable runnable2;
this.f16982o.a(System.currentTimeMillis());
Handler handler = this.f16979l;
if (handler != null) {
int i10 = this.f16953ag;
if (i10 == 0 && (runnable2 = this.f16980m) != null) {
handler.post(runnable2);
} else if ((i10 == 1 || i10 == 2) && (runnable = this.f16981n) != null) {
handler.post(runnable);
}
this.f16982o.a(500);
}
}
public static h a(Context context, WebView webView, c cVar, com.bytedance.sdk.openadsdk.l.a aVar) {
if (webView == null || cVar == null || aVar == null) {
return null;
}
return new h(context, webView, cVar, aVar, a.LAND_PAGE);
}
private void a(Context context, c cVar, com.bytedance.sdk.openadsdk.l.a aVar) {
this.f16987t = UUID.randomUUID().toString();
this.f16956aj = context;
this.f16960an = aVar;
this.f16961ao = cVar;
j.a(aVar);
this.f16959am = new f(this);
O();
}
public void b(View view) {
if (view == null) {
return;
}
try {
if (this.f16962ap == view.getWidth() && this.aq == view.getHeight()) {
return;
}
this.f16962ap = view.getWidth();
this.aq = view.getHeight();
JSONObject jSONObject = new JSONObject();
jSONObject.put("width", this.f16962ap);
jSONObject.put("height", this.aq);
a(MraidJsMethods.RESIZE, jSONObject);
this.ar = jSONObject;
} catch (Throwable th2) {
g.a("PlayablePlugin", "resetViewDataJsonByView error", th2);
}
}
private void c(int i10, String str) {
com.bytedance.sdk.openadsdk.l.a aVar = this.f16960an;
if (aVar != null) {
aVar.a(i10, str);
}
}
private String d(String str, String str2) {
String queryParameter;
if (TextUtils.isEmpty(this.az) && !TextUtils.isEmpty(this.aA)) {
Uri parse = Uri.parse(this.aA);
String host = parse.getHost();
String str3 = "";
if ("lynxview".equalsIgnoreCase(host) || (host != null && host.contains("lynxview"))) {
str3 = parse.getQueryParameter("surl");
queryParameter = parse.getQueryParameter("playable_hash");
} else {
queryParameter = "";
}
Uri.Builder appendQueryParameter = new Uri.Builder().scheme(parse.getScheme()).authority(host).appendQueryParameter("surl", str3);
if (!TextUtils.isEmpty(queryParameter)) {
appendQueryParameter.appendQueryParameter("playable_hash", queryParameter);
}
this.az = appendQueryParameter.toString();
}
return this.az;
}
private String e(String str, String str2) {
String format = String.format("rubeex://playable-minigamelite?id=%1s&schema=%2s", str, Uri.encode(str2));
this.ax = format;
return format;
}
private void e(String str, JSONObject jSONObject) {
try {
int i10 = this.f16953ag;
if (i10 == 0) {
if (this.f16955ai != a.LAND_PAGE && !k(this.ax)) {
P();
}
jSONObject.put("playable_url", this.ax);
} else {
if (i10 != 3 && i10 != 4) {
if (i10 == 1 || i10 == 2) {
jSONObject.put("playable_url", d(this.aW, this.aX));
}
}
jSONObject.put("playable_url", e(this.aY, this.aZ));
}
jSONObject.put("playable_render_type", this.f16953ag);
if (this.f16960an != null) {
if (this.f16953ag == 0 && (this.f16955ai != a.LAND_PAGE || k(this.ax))) {
g.a("PlayablePlugin", "reportJSSDKEvent by ActionProxy");
this.f16960an.a(jSONObject);
} else if (this.f16953ag == 0) {
g.a("PlayablePlugin", "reportJSSDKEvent error no not playable url");
} else {
g.a("PlayablePlugin", "reportJSSDKEvent by ActionProxy");
this.f16960an.a(jSONObject);
}
}
} catch (JSONException unused) {
}
}
private boolean k(String str) {
if (TextUtils.isEmpty(str)) {
return false;
}
return str.contains("/union-fe/playable/") || str.contains("/union-fe-sg/playable/") || str.contains("/union-fe-i18n/playable/");
}
public static int l(h hVar) {
int i10 = hVar.P;
hVar.P = i10 + 1;
return i10;
}
public static int m(h hVar) {
int i10 = hVar.Q;
hVar.Q = i10 + 1;
return i10;
}
public void A() {
com.bytedance.sdk.openadsdk.l.a aVar = this.f16960an;
if (aVar != null) {
aVar.g();
}
}
public void B() {
try {
JSONObject jSONObject = new JSONObject();
if (this.I > 0) {
jSONObject.put("playable_material_first_frame_show_duration", System.currentTimeMillis() - this.I);
} else {
jSONObject.put("playable_material_first_frame_show_duration", 0L);
}
if (this.G > 0) {
jSONObject.put("playable_material_first_frame_load_duration", System.currentTimeMillis() - this.G);
} else {
jSONObject.put("playable_material_first_frame_load_duration", 0L);
}
c("PL_sdk_material_first_frame_show", jSONObject);
} catch (JSONException unused) {
}
}
public void C() {
com.bytedance.sdk.openadsdk.l.a aVar = this.f16960an;
if (aVar != null) {
aVar.i();
}
}
public void D() {
com.bytedance.sdk.openadsdk.l.a aVar = this.f16960an;
if (aVar != null) {
aVar.j();
}
}
public void E() {
b bVar;
this.f16951ae = System.currentTimeMillis();
int i10 = this.f16953ag;
if ((i10 == 1 || i10 == 2) && (bVar = this.f16982o) != null) {
bVar.a(System.currentTimeMillis());
}
}
public void F() {
}
public void G() {
}
public void H() {
int i10;
int i11 = this.f16953ag;
if (i11 == 0 || i11 == 1 || i11 == 2) {
if (this.f16967bd) {
this.f16975h.postDelayed(this.f16976i, this.f16993z * 1000);
}
if ((this.f16968be && k(this.ax)) || (i10 = this.f16953ag) == 1 || i10 == 2) {
this.f16975h.postDelayed(this.f16977j, this.A * 1000);
}
}
}
public void I() {
this.f16967bd = false;
this.f16968be = false;
this.f16975h.removeCallbacks(this.f16976i);
this.f16975h.removeCallbacks(this.f16977j);
try {
JSONObject jSONObject = new JSONObject();
if (this.G > 0) {
jSONObject.put("playable_jssdk_load_success_duration", System.currentTimeMillis() - this.G);
} else {
jSONObject.put("playable_jssdk_load_success_duration", 0L);
}
c("PL_sdk_jssdk_load_success", jSONObject);
} catch (JSONException e10) {
e10.printStackTrace();
}
com.bytedance.sdk.openadsdk.l.a aVar = this.f16960an;
if (aVar != null) {
aVar.c();
}
}
public void J() {
if (this.f16990w) {
this.J = System.currentTimeMillis();
if (this.f16955ai == a.FEED_AWEME) {
if (this.aR && this.f16954ah == 3) {
b bVar = this.f16982o;
if (bVar != null && bVar.b()) {
Q();
} else if (this.f16982o == null) {
this.f16982o = new b(this, this.B);
Q();
}
}
} else if (this.aR && this.f16954ah == 2) {
b bVar2 = this.f16982o;
if (bVar2 != null && bVar2.b()) {
Q();
} else if (this.f16982o == null) {
this.f16982o = new b(this, this.B);
Q();
}
}
}
}
public void K() {
try {
b bVar = this.f16982o;
if (bVar != null) {
bVar.a();
}
Handler handler = this.f16979l;
if (handler != null) {
handler.removeCallbacksAndMessages(null);
}
} catch (Throwable th2) {
g.a("Playable_CrashMonitor", "The stuttering detection has been paused due to a crash.-- " + th2);
}
}
public void L() {
this.f16962ap = 0;
this.aq = 0;
this.aE = 0.0f;
this.aF = 0;
this.aG = 0;
this.aH = 0;
this.aI = 0;
this.aJ = 0;
this.aK = 0;
this.aL = 0;
this.aM = 0;
this.aN = 0;
this.aO = 0;
}
public void M() {
if (this.f16964ba) {
return;
}
this.f16964ba = true;
this.D = 0L;
this.f16984q = true;
L();
try {
View view = this.f16958al.get();
if (view != null) {
view.getViewTreeObserver().removeOnGlobalLayoutListener(this.f16969bf);
}
} catch (Throwable unused) {
}
try {
this.f16959am.b();
} catch (Throwable unused2) {
}
try {
b bVar = this.f16982o;
if (bVar != null) {
bVar.a();
this.f16982o = null;
}
Handler handler = this.f16979l;
if (handler != null) {
handler.removeCallbacksAndMessages(null);
}
} catch (Throwable th2) {
g.a("Playable_CrashMonitor", "crash -- " + th2);
}
try {
if (!TextUtils.isEmpty(this.ax)) {
JSONObject jSONObject = new JSONObject();
jSONObject.put("playable_all_times", this.P);
jSONObject.put("playable_hit_times", this.Q);
int i10 = this.P;
if (i10 > 0) {
jSONObject.put("playable_hit_ratio", this.Q / (i10 * 1.0d));
} else {
jSONObject.put("playable_hit_ratio", 0);
}
c("PL_sdk_preload_times", jSONObject);
}
} catch (Throwable unused3) {
}
try {
if (!TextUtils.isEmpty(this.ax)) {
if (this.E != -1) {
long currentTimeMillis = System.currentTimeMillis() - this.E;
g.a("PlayablePlugin", "playable show time +" + currentTimeMillis);
this.C = this.C + currentTimeMillis;
this.E = -1L;
}
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("playable_user_play_duration", this.C);
c("PL_sdk_user_play_duration", jSONObject2);
}
} catch (Throwable unused4) {
}
this.f16967bd = false;
this.f16968be = false;
this.f16975h.removeCallbacks(this.f16976i);
this.f16975h.removeCallbacks(this.f16977j);
this.f16975h.removeCallbacksAndMessages(null);
}
public String N() {
return "function playable_callJS(){return \"Android call the JS method is callJS\";}";
}
public Context a() {
return this.f16956aj;
}
public h a(int i10) {
this.f16953ag = i10;
return this;
}
public h a(long j10) {
if (j10 <= 0) {
this.f16993z = 10L;
} else {
this.f16993z = j10;
}
return this;
}
public h a(String str) {
this.as = str;
return this;
}
public h a(String str, String str2) {
this.av.put(str, str2);
return this;
}
public h a(boolean z7) {
this.aQ = z7;
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("endcard_mute", this.aQ);
a("volumeChange", jSONObject);
} catch (Throwable th2) {
g.a("PlayablePlugin", "setIsMute error", th2);
}
return this;
}
public void a(int i10, String str) {
K();
c(i10, str);
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("playable_code", i10);
jSONObject.put("playable_msg", str);
} catch (Throwable th2) {
g.a("PlayablePlugin", "reportRenderFatal error", th2);
}
c("PL_sdk_global_faild", jSONObject);
}
public void a(int i10, String str, String str2) {
this.f16954ah = -1;
this.ay = str2;
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("playable_code", i10);
jSONObject.put("playable_msg", str);
jSONObject.put("playable_fail_url", str2);
} catch (Throwable th2) {
g.a("PlayablePlugin", "onWebReceivedError error", th2);
}
c("PL_sdk_html_load_error", jSONObject);
if (this.f16989v) {
this.f16989v = false;
this.f16967bd = false;
this.f16968be = false;
this.f16975h.removeCallbacks(this.f16976i);
this.f16975h.removeCallbacks(this.f16977j);
a(1, "ContainerLoadFail");
}
}
public void a(View view) {
if (view == null) {
return;
}
try {
this.f16958al = new WeakReference<>(view);
b(view);
view.getViewTreeObserver().addOnGlobalLayoutListener(this.f16969bf);
} catch (Throwable th2) {
g.a("PlayablePlugin", "setViewForScreenSize error", th2);
}
}
public void a(String str, JSONObject jSONObject) {
if (g.a()) {
StringBuilder sb2 = new StringBuilder();
sb2.append("CALL JS [");
sb2.append(str);
sb2.append("] ");
sb2.append(jSONObject != null ? jSONObject.toString() : "");
g.a("PlayablePlugin", sb2.toString());
}
c cVar = this.f16961ao;
if (cVar != null) {
cVar.a(str, jSONObject);
}
}
public void a(JSONObject jSONObject) {
}
public void a(boolean z7, String str, int i10) {
if (z7) {
this.f16954ah = -1;
this.ay = str;
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("playable_code", i10);
jSONObject.put("playable_msg", "url load error");
jSONObject.put("playable_fail_url", str);
} catch (Throwable th2) {
g.a("PlayablePlugin", "onWebReceivedHttpError error", th2);
}
c("PL_sdk_html_load_error", jSONObject);
if (this.f16989v) {
this.f16989v = false;
this.f16967bd = false;
this.f16968be = false;
this.f16975h.removeCallbacks(this.f16976i);
this.f16975h.removeCallbacks(this.f16977j);
a(1, "ContainerLoadFail");
}
}
}
public h b(long j10) {
if (j10 <= 0) {
this.A = 10L;
} else {
this.A = j10;
}
return this;
}
public h b(String str) {
this.at = str;
return this;
}
public h b(boolean z7) {
int i10;
int i11;
if (this.aR == z7) {
return this;
}
this.aR = z7;
JSONObject jSONObject = new JSONObject();
try {
if (!this.aR) {
jSONObject.put("playable_background_show_type", this.f16947aa);
}
} catch (JSONException e10) {
e10.printStackTrace();
}
c(this.aR ? "PL_sdk_viewable_true" : "PL_sdk_viewable_false", jSONObject);
if (this.F == -1 && this.aR) {
this.F = System.currentTimeMillis();
JSONObject jSONObject2 = new JSONObject();
try {
jSONObject2.put("render_type", 1);
} catch (JSONException unused) {
}
c("PL_sdk_page_show", jSONObject2);
com.bytedance.sdk.openadsdk.l.a aVar = this.f16960an;
if (aVar != null && (((i11 = this.f16953ag) == 0 || i11 == 1 || i11 == 2) && this.f16991x)) {
aVar.a(0);
}
}
if (this.F != -1 && !this.aR && !this.aS) {
this.aS = true;
com.bytedance.sdk.openadsdk.l.a aVar2 = this.f16960an;
if (aVar2 != null && (((i10 = this.f16953ag) == 0 || i10 == 1 || i10 == 2) && this.f16991x)) {
aVar2.a(1);
}
}
if (this.aR) {
this.E = System.currentTimeMillis();
} else if (this.E != -1) {
long currentTimeMillis = System.currentTimeMillis() - this.E;
g.a("PlayablePlugin", "playable show time +" + currentTimeMillis);
this.C = this.C + currentTimeMillis;
this.E = -1L;
}
try {
JSONObject jSONObject3 = new JSONObject();
jSONObject3.put("viewStatus", this.aR);
a("viewableChange", jSONObject3);
} catch (Throwable th2) {
g.a("PlayablePlugin", "setViewable error", th2);
}
if (this.aR) {
J();
} else {
K();
}
return this;
}
public Map<String, String> b() {
return this.av;
}
public void b(int i10, String str) {
g.a("Playable_CrashMonitor", "-- Detected that the page is stuck for more than 2s and needs to be reported " + i10);
this.T = i10;
if (this.f16952af == null) {
this.f16952af = new JSONObject();
}
try {
this.f16952af.put("playable_stuck_type", i10);
this.f16952af.put("playable_stuck_reason", str);
if (this.J > 0) {
this.f16952af.put("playable_stuck_duration", System.currentTimeMillis() - this.J);
} else {
this.f16952af.put("playable_stuck_duration", 0L);
}
} catch (Throwable unused) {
}
c("PL_sdk_page_stuck", this.f16952af);
K();
if (this.f16960an != null) {
if (i10 == 2) {
this.f16952af = new JSONObject();
}
this.f16960an.h(this.f16952af);
}
}
public void b(String str, String str2) {
Bitmap a10;
if (TextUtils.isEmpty(str2) || (a10 = e.a(str2)) == null) {
return;
}
MediaStore.Images.Media.insertImage(this.f16956aj.getContentResolver(), a10, str, "");
}
public void b(String str, JSONObject jSONObject) {
if (TextUtils.isEmpty(str)) {
return;
}
e(str, jSONObject);
}
public void b(JSONObject jSONObject) {
}
public h c(String str) {
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("playable_style", str);
this.aB = jSONObject;
} catch (Throwable th2) {
g.a("PlayablePlugin", "setPlayableStyle error", th2);
}
return this;
}
public h c(boolean z7) {
this.aT = z7;
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("send_click", this.aT);
a("change_playable_click", jSONObject);
} catch (Throwable th2) {
g.a("PlayablePlugin", "setPlayableClick error", th2);
}
return this;
}
public JSONObject c() {
return this.aB;
}
public void c(String str, String str2) {
}
public void c(String str, JSONObject jSONObject) {
if (TextUtils.isEmpty(str)) {
return;
}
if (jSONObject == null) {
jSONObject = new JSONObject();
}
try {
if (!this.R && this.Q > 0) {
this.R = true;
}
jSONObject.put("playable_event", str);
jSONObject.put("playable_ts", System.currentTimeMillis());
jSONObject.put("playable_viewable", this.aR);
jSONObject.put("playable_session_id", this.f16987t);
int i10 = this.f16953ag;
if (i10 == 0) {
if (this.f16955ai != a.LAND_PAGE && !k(this.ax)) {
P();
}
jSONObject.put("playable_url", this.ax);
} else {
if (i10 != 3 && i10 != 4) {
if (i10 == 1 || i10 == 2) {
jSONObject.put("playable_url", d(this.aW, this.aX));
}
}
jSONObject.put("playable_url", e(this.aY, this.aZ));
}
jSONObject.put("playable_full_url", this.aA);
jSONObject.put("playable_replay_count", this.S);
jSONObject.put("playable_is_prerender", this.aU);
jSONObject.put("playable_is_preload", this.R);
jSONObject.put("playable_render_type", this.f16953ag);
jSONObject.put("playable_scenes_type", this.f16955ai.ordinal());
String str2 = "";
jSONObject.put("playable_gecko_key", TextUtils.isEmpty(this.aW) ? "" : this.aW);
if (!TextUtils.isEmpty(this.aX)) {
str2 = this.aX;
}
jSONObject.put("playable_gecko_channel", str2);
jSONObject.put("playable_sdk_version", "6.6.0");
jSONObject.put("playable_minigamelite_id", this.aY);
jSONObject.put("playable_minigamelite_schema", this.aZ);
jSONObject.put("playable_is_debug", this.aV);
jSONObject.put("playable_retry_count", this.U);
jSONObject.put("playable_enter_from", this.V);
jSONObject.put("playable_sequence", this.W);
jSONObject.put("playable_current_section", this.X);
jSONObject.put("is_playable_finish", this.Y);
jSONObject.put("playable_card_session", this.L);
jSONObject.put("playable_video_session", this.M);
jSONObject.put("playable_network_type", p());
jSONObject.put("playable_lynx_version", this.f16992y);
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("ad_extra_data", jSONObject);
jSONObject2.put("tag", this.f16988u);
jSONObject2.put("nt", 4);
jSONObject2.put("category", "umeng");
jSONObject2.put("is_ad_event", "1");
jSONObject2.put("refer", "playable");
jSONObject2.put("value", this.aw.opt("cid"));
jSONObject2.put("log_extra", this.aw.opt("log_extra"));
int i11 = this.f16953ag;
if (i11 != -1 && i11 != -2) {
if (this.f16960an == null) {
g.a("PlayablePlugin", "reportEvent error no impl");
return;
}
List<JSONObject> list = this.f16965bb;
if (list != null && !list.isEmpty()) {
for (JSONObject jSONObject3 : this.f16965bb) {
JSONObject optJSONObject = jSONObject3.optJSONObject("ad_extra_data");
if (optJSONObject != null) {
optJSONObject.put("playable_render_type", this.f16953ag);
optJSONObject.put("playable_url", this.ax);
}
this.f16960an.a(optJSONObject);
}
this.f16965bb.clear();
}
if (this.f16953ag == 0 && (this.f16955ai != a.LAND_PAGE || k(this.ax))) {
g.a("PlayablePlugin", "reportEvent by ActionProxy");
this.f16960an.a(jSONObject);
return;
} else if (this.f16953ag == 0) {
g.a("PlayablePlugin", "reportEvent error no not playable url");
return;
} else {
g.a("PlayablePlugin", "reportEvent by ActionProxy");
this.f16960an.a(jSONObject);
return;
}
}
if (this.f16965bb == null) {
this.f16965bb = new ArrayList();
}
this.f16965bb.add(jSONObject2);
} catch (Throwable th2) {
g.a("PlayablePlugin", "reportEvent error", th2);
}
}
public void c(JSONObject jSONObject) {
com.bytedance.sdk.openadsdk.l.a aVar = this.f16960an;
if (aVar == null || aVar.g(jSONObject) || jSONObject == null) {
return;
}
String optString = jSONObject.optString("resource_base64");
if (TextUtils.isEmpty(optString)) {
return;
}
int optInt = jSONObject.optInt("resource_type", -1);
String optString2 = jSONObject.optString("resource_name", "playable_media");
if (optInt == 1) {
b(optString2, optString);
} else if (optInt == 2) {
c(optString2, optString);
}
}
public h d(String str) {
this.au = str;
return this;
}
public h d(boolean z7) {
this.f16966bc = z7;
return this;
}
public String d() {
return this.at;
}
public JSONObject d(String str, JSONObject jSONObject) {
long currentTimeMillis = System.currentTimeMillis();
if (g.a()) {
StringBuilder sb2 = new StringBuilder();
sb2.append("PlayablePlugin JSB-REQ [");
sb2.append(str);
sb2.append("] ");
sb2.append(jSONObject != null ? jSONObject.toString() : "");
g.a("PlayablePlugin", sb2.toString());
}
JSONObject a10 = this.f16959am.a(str, jSONObject);
if (g.a()) {
StringBuilder sb3 = new StringBuilder();
sb3.append("PlayablePlugin JSB-RSP [");
sb3.append(str);
sb3.append("] time:");
sb3.append(System.currentTimeMillis() - currentTimeMillis);
sb3.append(" ");
sb3.append(a10 != null ? a10.toString() : "");
g.a("PlayablePlugin", sb3.toString());
}
return a10;
}
public void d(JSONObject jSONObject) {
if (this.f16960an != null) {
try {
this.f16960an.a(jSONObject.optBoolean("isPrevent", false));
} catch (Exception e10) {
e10.printStackTrace();
}
}
}
public h e(String str) {
this.aP = str;
return this;
}
public h e(JSONObject jSONObject) {
this.aw = jSONObject;
return this;
}
public String e() {
return this.as;
}
public h f(String str) {
Uri parse;
String scheme;
int indexOf;
String decode;
this.aA = str;
try {
parse = Uri.parse(str);
scheme = parse.getScheme();
} catch (Throwable unused) {
}
if (!"http".equalsIgnoreCase(scheme) && !"https".equalsIgnoreCase(scheme)) {
String host = parse.getHost();
if (!"webview".equalsIgnoreCase(host) && (host == null || !host.contains("webview"))) {
if ("lynxview".equalsIgnoreCase(host) || (host != null && host.contains("lynxview"))) {
if (this.f16953ag == -1) {
a(2);
} else {
a(1);
}
}
this.ax = str;
return this;
}
a(0);
String queryParameter = parse.getQueryParameter("url");
if (!TextUtils.isEmpty(queryParameter) && (decode = Uri.decode(queryParameter)) != null) {
int indexOf2 = decode.indexOf("?");
str = indexOf2 != -1 ? decode.substring(0, indexOf2) : decode;
}
this.ax = str;
return this;
}
a(0);
if (str != null && (indexOf = str.indexOf("?")) != -1) {
str = str.substring(0, indexOf);
}
this.ax = str;
return this;
}
public String f() {
return this.au;
}
public void f(JSONObject jSONObject) {
if (jSONObject != null) {
this.X = jSONObject.optString("section");
}
com.bytedance.sdk.openadsdk.l.a aVar = this.f16960an;
if (aVar != null) {
aVar.i(jSONObject);
}
}
public String g() {
return this.aP;
}
public void g(String str) {
this.f16954ah = 1;
JSONObject jSONObject = new JSONObject();
try {
long currentTimeMillis = System.currentTimeMillis();
this.G = currentTimeMillis;
long j10 = this.F;
jSONObject.put("playable_page_show_duration", j10 != -1 ? currentTimeMillis - j10 : 0L);
} catch (Throwable th2) {
g.a("PlayablePlugin", "reportUrlLoadStart error", th2);
}
c("PL_sdk_html_load_start", jSONObject);
this.f16967bd = true;
this.f16968be = true;
if (this.f16966bc) {
H();
this.f16967bd = false;
this.f16968be = false;
}
if (this.f16984q) {
try {
StringBuffer stringBuffer = new StringBuffer();
StringBuffer stringBuffer2 = new StringBuffer();
StringBuffer stringBuffer3 = new StringBuffer();
if (e.a(this.f16956aj, e.f16874l)) {
stringBuffer.append("Microphone_");
stringBuffer2.append("1");
if (e.b(this.f16956aj, "android.permission.RECORD_AUDIO")) {
stringBuffer3.append("1");
} else {
stringBuffer3.append(AppEventsConstants.EVENT_PARAM_VALUE_NO);
}
} else {
stringBuffer2.append(AppEventsConstants.EVENT_PARAM_VALUE_NO);
stringBuffer3.append(AppEventsConstants.EVENT_PARAM_VALUE_NO);
}
if (e.a(this.f16956aj, e.f16873k)) {
stringBuffer.append("Magetometer_");
stringBuffer2.append("1");
stringBuffer3.append("1");
} else {
stringBuffer2.append(AppEventsConstants.EVENT_PARAM_VALUE_NO);
stringBuffer3.append(AppEventsConstants.EVENT_PARAM_VALUE_NO);
}
if (e.a(this.f16956aj, e.f16872j)) {
stringBuffer.append("Accelerometer_");
stringBuffer2.append("1");
stringBuffer3.append("1");
} else {
stringBuffer2.append(AppEventsConstants.EVENT_PARAM_VALUE_NO);
stringBuffer3.append(AppEventsConstants.EVENT_PARAM_VALUE_NO);
}
if (e.a(this.f16956aj, e.f16871i)) {
stringBuffer.append("Gyro_");
stringBuffer2.append("1");
stringBuffer3.append("1");
} else {
stringBuffer2.append(AppEventsConstants.EVENT_PARAM_VALUE_NO);
stringBuffer3.append(AppEventsConstants.EVENT_PARAM_VALUE_NO);
}
if (e.a(this.f16956aj, e.f16870h)) {
stringBuffer.append("Camera_");
stringBuffer2.append("1");
if (e.b(this.f16956aj, "android.permission.CAMERA")) {
stringBuffer3.append("1");
} else {
stringBuffer3.append(AppEventsConstants.EVENT_PARAM_VALUE_NO);
}
} else {
stringBuffer2.append(AppEventsConstants.EVENT_PARAM_VALUE_NO);
stringBuffer3.append(AppEventsConstants.EVENT_PARAM_VALUE_NO);
}
if (e.a(this.f16956aj, e.f16869g)) {
stringBuffer.append("Photo");
stringBuffer2.append("1");
if (e.a(this.f16956aj)) {
stringBuffer3.append("1");
} else {
stringBuffer3.append(AppEventsConstants.EVENT_PARAM_VALUE_NO);
}
} else {
stringBuffer2.append(AppEventsConstants.EVENT_PARAM_VALUE_NO);
stringBuffer3.append(AppEventsConstants.EVENT_PARAM_VALUE_NO);
}
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("playable_available_hardware_name", stringBuffer.toString());
jSONObject2.put("playable_available_hardware_code", stringBuffer2.toString());
jSONObject2.put("playable_available_hardware_auth_code", stringBuffer3.toString());
c("PL_sdk_hardware_detect", jSONObject2);
this.f16984q = false;
} catch (Throwable th3) {
g.a("PlayablePlugin", "Hardware detect error", th3);
}
}
}
public void g(JSONObject jSONObject) {
com.bytedance.sdk.openadsdk.l.a aVar = this.f16960an;
if (aVar != null) {
aVar.j(jSONObject);
}
}
public void h(String str) {
WebView webView;
this.f16954ah = 2;
this.ay = str;
JSONObject jSONObject = new JSONObject();
try {
long currentTimeMillis = System.currentTimeMillis();
this.H = currentTimeMillis;
long j10 = this.G;
jSONObject.put("playable_html_load_start_duration", j10 != -1 ? currentTimeMillis - j10 : 0L);
} catch (Throwable th2) {
g.a("PlayablePlugin", "reportUrlLoadFinish error", th2);
}
c("PL_sdk_html_load_finish", jSONObject);
this.f16967bd = false;
this.f16975h.removeCallbacks(this.f16976i);
try {
if (this.f16953ag == 0) {
if (this.f16983p && (webView = this.f16957ak) != null) {
this.f16983p = false;
webView.evaluateJavascript(N(), new ValueCallback<String>() {
@Override
public void onReceiveValue(String str2) {
g.a("Playable_CrashMonitor", "load inject js=" + str2);
}
});
}
J();
}
} catch (Throwable th3) {
g.a("PlayablePlugin", "crashMonitor error", th3);
}
}
public void h(JSONObject jSONObject) {
this.f16952af = jSONObject;
this.W++;
com.bytedance.sdk.openadsdk.l.a aVar = this.f16960an;
if (aVar != null) {
aVar.k(jSONObject);
}
K();
this.f16975h.removeCallbacks(this.f16978k);
if (this.f16990w) {
this.J = System.currentTimeMillis();
this.f16950ad = System.currentTimeMillis();
this.f16951ae = 0L;
int i10 = this.f16953ag;
if (i10 == 0) {
WebView webView = this.f16957ak;
if (webView != null) {
webView.evaluateJavascript("javascript:typeof playable_callJS === 'function' && playable_callJS()", new ValueCallback<String>() {
@Override
public void onReceiveValue(String str) {
h.this.f16951ae = System.currentTimeMillis();
}
});
}
} else if (i10 == 1 || i10 == 2) {
a("playable_stuck_check_ping", new JSONObject());
}
this.f16975h.postDelayed(this.f16978k, this.B);
}
}
public boolean h() {
return this.aQ;
}
public void i(String str) {
this.f16975h.post(new Runnable() {
@Override
public void run() {
h.l(h.this);
}
});
}
public void i(JSONObject jSONObject) {
b(2, jSONObject != null ? jSONObject.optString("error_msg", "The material directly invokes the exception pocket mask on the client") : "The material directly invokes the exception pocket mask on the client");
}
public boolean i() {
return this.aR;
}
public JSONObject j() {
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("send_click", this.aT);
return jSONObject;
} catch (Throwable th2) {
g.a("PlayablePlugin", "getPlayableClickStatus error", th2);
return new JSONObject();
}
}
public void j(String str) {
this.f16975h.post(new Runnable() {
@Override
public void run() {
h.m(h.this);
}
});
}
public void j(JSONObject jSONObject) {
com.bytedance.sdk.openadsdk.l.a aVar = this.f16960an;
if (aVar != null) {
aVar.l(jSONObject);
}
}
public Set<String> k() {
return this.f16959am.a();
}
public void k(JSONObject jSONObject) {
com.bytedance.sdk.openadsdk.l.a aVar = this.f16960an;
if (aVar != null) {
aVar.m(jSONObject);
}
}
public JSONObject l() {
try {
boolean a10 = e.a(this.f16956aj, "android.permission.RECORD_AUDIO");
JSONObject jSONObject = new JSONObject();
jSONObject.put("result", a10);
return jSONObject;
} catch (Throwable th2) {
g.a("PlayablePlugin", "getCameraPermission error", th2);
return new JSONObject();
}
}
public JSONObject l(JSONObject jSONObject) {
if (jSONObject == null) {
return new JSONObject();
}
int optInt = jSONObject.optInt("type", 0);
return optInt != 1 ? optInt != 2 ? optInt != 3 ? new JSONObject() : n() : m() : l();
}
public JSONObject m() {
try {
boolean a10 = e.a(this.f16956aj, "android.permission.CAMERA");
JSONObject jSONObject = new JSONObject();
jSONObject.put("result", a10);
return jSONObject;
} catch (Throwable th2) {
g.a("PlayablePlugin", "getCameraPermission error", th2);
return new JSONObject();
}
}
public JSONObject m(JSONObject jSONObject) {
if (jSONObject == null) {
return new JSONObject();
}
int optInt = jSONObject.optInt("type", 0);
JSONObject jSONObject2 = new JSONObject();
if (optInt != 1) {
if (optInt != 2) {
if (optInt == 3) {
if (Build.VERSION.SDK_INT >= 23) {
jSONObject2.put("result", e.a(this.f16956aj));
} else {
jSONObject2.put("result", false);
}
}
return jSONObject2;
} else if (Build.VERSION.SDK_INT >= 23) {
jSONObject2.put("result", e.b(this.f16956aj, "android.permission.CAMERA"));
} else {
jSONObject2.put("result", false);
}
} else if (Build.VERSION.SDK_INT >= 23) {
jSONObject2.put("result", e.b(this.f16956aj, "android.permission.RECORD_AUDIO"));
} else {
jSONObject2.put("result", false);
}
return jSONObject2;
}
public JSONObject n() {
boolean a10;
boolean a11;
try {
boolean z7 = true;
if (Build.VERSION.SDK_INT >= 33) {
a10 = e.a(this.f16956aj, "android.permission.READ_MEDIA_IMAGES");
a11 = true;
} else {
a10 = e.a(this.f16956aj, "android.permission.READ_EXTERNAL_STORAGE");
a11 = e.a(this.f16956aj, "android.permission.WRITE_EXTERNAL_STORAGE");
}
JSONObject jSONObject = new JSONObject();
jSONObject.put("isHasRead", a10);
jSONObject.put("isHasWrite", a11);
if (!a10 || !a11) {
z7 = false;
}
jSONObject.put("result", z7);
return jSONObject;
} catch (Throwable th2) {
g.a("PlayablePlugin", "getCameraPermission error", th2);
return new JSONObject();
}
}
public void n(JSONObject jSONObject) {
if (jSONObject != null) {
boolean optBoolean = jSONObject.optBoolean("success", true);
if (optBoolean) {
this.f16954ah = 3;
J();
} else {
this.f16954ah = -2;
com.bytedance.sdk.openadsdk.l.a aVar = this.f16960an;
if (aVar != null) {
aVar.b(false);
}
}
if (optBoolean || !this.f16989v) {
return;
}
this.f16989v = false;
this.f16967bd = false;
this.f16968be = false;
this.f16975h.removeCallbacks(this.f16976i);
this.f16975h.removeCallbacks(this.f16977j);
a(4, "CaseRenderFail");
}
}
public JSONObject o() {
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("scene_type", this.f16955ai.ordinal());
jSONObject.put("safe_area_top_height", this.aC);
jSONObject.put("safe_area_bottom_height", this.aD);
jSONObject.put("playable_enter_from", this.V);
jSONObject.put("playable_retry_count", this.U);
jSONObject.put("playable_card_session", this.L);
jSONObject.put("playable_video_session", this.M);
jSONObject.put("playable_network_type", p());
jSONObject.put("aweme_id", this.O);
return jSONObject;
} catch (Throwable th2) {
g.a("PlayablePlugin", "playableInfo error", th2);
return new JSONObject();
}
}
public void o(JSONObject jSONObject) {
com.bytedance.sdk.openadsdk.l.a aVar = this.f16960an;
if (aVar != null) {
aVar.d(jSONObject);
}
}
public String p() {
com.bytedance.sdk.openadsdk.l.a aVar;
if (TextUtils.isEmpty(this.N) && (aVar = this.f16960an) != null) {
this.N = aVar.a().toString();
}
return this.N;
}
public void p(JSONObject jSONObject) {
com.bytedance.sdk.openadsdk.l.a aVar = this.f16960an;
if (aVar != null) {
aVar.e(jSONObject);
}
}
public com.bytedance.sdk.openadsdk.l.a q() {
return this.f16960an;
}
public void q(JSONObject jSONObject) {
com.bytedance.sdk.openadsdk.l.a aVar = this.f16960an;
if (aVar != null) {
aVar.f(jSONObject);
}
}
public JSONObject r() {
if (this.ar.isNull("width")) {
View view = this.f16958al.get();
if (view == null) {
return this.ar;
}
b(view);
}
return this.ar;
}
public JSONObject s() {
return this.aw;
}
public JSONObject t() {
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("devicePixelRatio", this.aE);
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("width", this.aF);
jSONObject2.put("height", this.aG);
jSONObject.put("screen", jSONObject2);
JSONObject jSONObject3 = new JSONObject();
jSONObject3.put("x", this.aI);
jSONObject3.put("y", this.aH);
jSONObject3.put("width", this.aJ);
jSONObject3.put("height", this.aK);
jSONObject.put("webview", jSONObject3);
JSONObject jSONObject4 = new JSONObject();
jSONObject4.put("x", this.aM);
jSONObject4.put("y", this.aL);
jSONObject4.put("width", this.aN);
jSONObject4.put("height", this.aO);
jSONObject.put("visible", jSONObject4);
} catch (Throwable th2) {
g.a("PlayablePlugin", "getViewport error", th2);
}
return jSONObject;
}
public void u() {
com.bytedance.sdk.openadsdk.l.a aVar = this.f16960an;
if (aVar != null) {
aVar.b();
}
}
public void v() {
com.bytedance.sdk.openadsdk.l.a aVar = this.f16960an;
if (aVar != null) {
aVar.b(true);
}
try {
JSONObject jSONObject = new JSONObject();
if (this.I > 0) {
jSONObject.put("playable_material_interactable_duration", System.currentTimeMillis() - this.I);
} else {
jSONObject.put("playable_material_interactable_duration", 0L);
}
if (this.G > 0) {
long currentTimeMillis = System.currentTimeMillis() - this.G;
this.K = currentTimeMillis;
jSONObject.put("playable_material_interactable_load_duration", currentTimeMillis);
} else {
jSONObject.put("playable_material_interactable_load_duration", 0L);
}
c("PL_sdk_material_interactable", jSONObject);
} catch (JSONException unused) {
}
}
public void w() {
com.bytedance.sdk.openadsdk.l.a aVar = this.f16960an;
if (aVar != null) {
aVar.d();
}
this.T = 2;
}
public void x() {
this.Y = true;
}
public void y() {
com.bytedance.sdk.openadsdk.l.a aVar = this.f16960an;
if (aVar != null) {
if (this.f16955ai != a.FEED_AWEME) {
aVar.e();
return;
}
int i10 = this.T;
if (i10 == 0 || i10 == 1) {
return;
}
aVar.e();
}
}
public void z() {
com.bytedance.sdk.openadsdk.l.a aVar = this.f16960an;
if (aVar != null) {
if (this.f16955ai != a.FEED_AWEME) {
aVar.f();
return;
}
int i10 = this.T;
if (i10 == 0 || i10 == 1) {
return;
}
aVar.f();
}
}
}