Apk Done v1.0版本的 MD5 值为:44cfb8e1ce639995aa7f0de6a3a6388b
以下内容为反编译后的 f.java 源代码,内容仅作参考
package com.bytedance.sdk.component.adexpress.dynamic.c;
import android.content.Context;
import android.os.Build;
import android.text.TextUtils;
import android.webkit.JavascriptInterface;
import android.webkit.ValueCallback;
import com.amazon.aps.shared.APSAnalytics;
import com.bytedance.sdk.component.widget.SSWebView;
import io.bidmachine.utils.IabUtils;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import org.json.JSONObject;
public class f implements i {
private static String e;
private static final Set<String> f = Collections.unmodifiableSet(new HashSet(Arrays.asList("dislike", "close", "close-fill")));
private Context a;
private SSWebView b;
private String c;
private com.bytedance.sdk.component.adexpress.dynamic.d.b d;
public f(Context context, String str) {
this.a = context;
this.c = str;
SSWebView sSWebView = new SSWebView(this.a);
this.b = sSWebView;
sSWebView.setJavaScriptEnabled(true);
if (Build.VERSION.SDK_INT >= 17) {
this.b.a(new a(), "JS_DYNAMIC_LAYOUT_OBJ");
}
this.b.a("about:blank");
a();
}
public static void a(String str) {
e = str;
}
private void a() {
if (i() && Build.VERSION.SDK_INT >= 19) {
c();
} else {
b();
}
b();
}
private void b() {
SSWebView sSWebView;
String e2 = e();
if (TextUtils.isEmpty(e2) || (sSWebView = this.b) == null) {
return;
}
com.bytedance.sdk.component.utils.k.a(sSWebView.getWebView(), e2);
}
private void c() {
try {
String f2 = f();
String h = h();
if (TextUtils.isEmpty(h)) {
b();
} else {
SSWebView sSWebView = this.b;
sSWebView.a(f2 + h, (ValueCallback<String>) null);
}
} catch (Throwable unused) {
b();
}
}
@Override
public void a(com.bytedance.sdk.component.adexpress.dynamic.d.b bVar) {
this.d = bVar;
}
@Override
public void a(com.bytedance.sdk.component.adexpress.b.l lVar) {
com.bytedance.sdk.component.adexpress.dynamic.d.b bVar;
if (TextUtils.isEmpty(e) && (bVar = this.d) != null) {
bVar.a(null);
g();
}
d();
}
private void d() {
String str = "javascript:var res = getLayoutInfo(" + this.c + ");window.JS_DYNAMIC_LAYOUT_OBJ.calculateResult(JSON.stringify(res));";
SSWebView sSWebView = this.b;
if (sSWebView != null) {
com.bytedance.sdk.component.utils.k.a(sSWebView.getWebView(), str);
}
}
private static String e() {
String str;
if (TextUtils.isEmpty(e)) {
return null;
}
String f2 = f();
if (i()) {
str = "(function () {var se = document.createElement('script');se.type = 'text/javascript';se.src = '" + ("file//" + com.bytedance.sdk.component.adexpress.a.b.b.f() + "/" + com.bytedance.sdk.component.utils.e.a(e)) + "';document.body.appendChild(se);})();";
} else {
str = "(function () {var JS_TTDYNAMIC_URL = '" + e + "';var xhrObj = new XMLHttpRequest();xhrObj.open('GET', JS_TTDYNAMIC_URL, false);xhrObj.send('');var se = document.createElement('script');se.type = 'text/javascript';se.text = xhrObj.responseText;document.getElementsByTagName('head')[0].appendChild(se);})();";
}
return "javascript:" + f2 + str;
}
private static String f() {
return "var global = Function('return this')();global.jsCoreGlobal = {width:" + com.bytedance.sdk.component.adexpress.c.b.b(com.bytedance.sdk.component.adexpress.a.a.a.a().c().b(), com.bytedance.sdk.component.adexpress.c.b.a(com.bytedance.sdk.component.adexpress.a.a.a.a().c().b())) + ",height:" + com.bytedance.sdk.component.adexpress.c.b.b(com.bytedance.sdk.component.adexpress.a.a.a.a().c().b(), com.bytedance.sdk.component.adexpress.c.b.b(com.bytedance.sdk.component.adexpress.a.a.a.a().c().b())) + ",os:'Android'};global.systemFontSizeRatioNative = 1.2;";
}
private class a {
@JavascriptInterface
public double systemFontSizeRatioNative() {
return 1.2d;
}
private a() {
}
@JavascriptInterface
public String jsCoreGlobal() {
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put(IabUtils.KEY_WIDTH, com.bytedance.sdk.component.adexpress.c.b.b(f.this.a, com.bytedance.sdk.component.adexpress.c.b.a(f.this.a)));
jSONObject.put(IabUtils.KEY_HEIGHT, com.bytedance.sdk.component.adexpress.c.b.b(f.this.a, com.bytedance.sdk.component.adexpress.c.b.b(f.this.a)));
jSONObject.put("os", APSAnalytics.OS_NAME);
} catch (Exception unused) {
}
return jSONObject.toString();
}
@JavascriptInterface
public String getDomSizeFromNative(String str, String str2, String str3, boolean z, boolean z2, int i) {
return l.b(str, str2, str3, z, z2, i);
}
@JavascriptInterface
public void calculateResult(String str) {
f.this.b(str);
}
}
public void b(String str) {
com.bytedance.sdk.component.adexpress.dynamic.b.h hVar = new com.bytedance.sdk.component.adexpress.dynamic.b.h();
try {
com.bytedance.sdk.component.adexpress.dynamic.b.h.a(new JSONObject(str), hVar, null);
} catch (Exception unused) {
hVar = null;
}
com.bytedance.sdk.component.adexpress.dynamic.d.b bVar = this.d;
if (bVar != null) {
bVar.a(hVar);
}
g();
}
private void g() {
com.bytedance.sdk.component.utils.h.b().post(new Runnable() {
@Override
public void run() {
if (f.this.b != null) {
f.this.b.h();
}
f.this.b = null;
}
});
}
private String h() {
try {
return a(new FileInputStream(com.bytedance.sdk.component.adexpress.a.b.b.f() + "/" + com.bytedance.sdk.component.utils.e.a(e)));
} catch (IOException e2) {
e2.printStackTrace();
return "";
}
}
private static boolean i() {
if (TextUtils.isEmpty(e)) {
return false;
}
String a2 = com.bytedance.sdk.component.utils.e.a(e);
if (TextUtils.isEmpty(a2)) {
return false;
}
return new File(com.bytedance.sdk.component.adexpress.a.b.b.f(), a2).exists();
}
public String a(InputStream inputStream) {
BufferedReader bufferedReader;
try {
StringBuilder sb = new StringBuilder();
bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
while (true) {
try {
String readLine = bufferedReader.readLine();
if (readLine == null) {
break;
}
sb.append(readLine);
} catch (Throwable th) {
th = th;
try {
com.bytedance.sdk.component.utils.l.a("TemplateToModelParser", "readStream error", th);
return null;
} finally {
if (bufferedReader != null) {
try {
bufferedReader.close();
} catch (Throwable th2) {
com.bytedance.sdk.component.utils.l.a("TemplateToModelParser", "br error", th2);
}
}
if (inputStream != null) {
try {
inputStream.close();
} catch (Throwable th3) {
com.bytedance.sdk.component.utils.l.a("TemplateToModelParser", "is error", th3);
}
}
}
}
}
String sb2 = sb.toString();
try {
bufferedReader.close();
} catch (Throwable th4) {
com.bytedance.sdk.component.utils.l.a("TemplateToModelParser", "br error", th4);
}
if (inputStream != null) {
try {
inputStream.close();
} catch (Throwable th5) {
com.bytedance.sdk.component.utils.l.a("TemplateToModelParser", "is error", th5);
}
}
return sb2;
} catch (Throwable th6) {
th = th6;
bufferedReader = null;
}
}
}