Apk Done v1.0版本的 MD5 值为:44cfb8e1ce639995aa7f0de6a3a6388b
以下内容为反编译后的 z.java 源代码,内容仅作参考
package com.bytedance.sdk.component.a;
import android.content.Context;
import android.os.Build;
import android.os.Looper;
import android.text.TextUtils;
import android.util.Base64;
import android.webkit.JavascriptInterface;
import android.webkit.WebView;
public class z extends a {
static final boolean j = !z.class.desiredAssertionStatus();
protected String h;
protected WebView i;
@Override
protected Context a(j jVar) {
if (jVar.e != null) {
return jVar.e;
}
if (jVar.a != null) {
return jVar.a.getContext();
}
throw new IllegalStateException("WebView cannot be null!");
}
@Override
protected String a() {
return this.i.getUrl();
}
@Override
protected void b(j jVar) {
this.i = jVar.a;
this.h = jVar.c;
if (Build.VERSION.SDK_INT < 17 || jVar.n) {
return;
}
c();
}
protected void c() {
if (!j && this.i == null) {
throw new AssertionError();
}
this.i.addJavascriptInterface(this, this.h);
}
@Override
@JavascriptInterface
public void invokeMethod(String str) {
super.invokeMethod(str);
}
@Override
public void b() {
super.b();
d();
}
protected void d() {
this.i.removeJavascriptInterface(this.h);
}
@Override
public void a(String str, q qVar) {
if (qVar != null && !TextUtils.isEmpty(qVar.h)) {
String str2 = qVar.h;
a(str, String.format("javascript:(function(){ const iframe = document.querySelector(atob('%s')); if (iframe && iframe.contentWindow) { iframe.contentWindow.postMessage(%s, atob('%s')); }})()", Base64.encodeToString(String.format("iframe[src=\"%s\"", str2).getBytes(), 2), str, Base64.encodeToString(str2.getBytes(), 2)));
return;
}
super.a(str, qVar);
}
@Override
protected void a(String str) {
a(str, "javascript:" + this.h + "._handleMessageFromToutiao(" + str + ")");
}
private void a(String str, final String str2) {
if (this.f || TextUtils.isEmpty(str2)) {
return;
}
Runnable runnable = new Runnable() {
@Override
public void run() {
if (z.this.f) {
return;
}
if (Build.VERSION.SDK_INT >= 19) {
i.a("Invoking Jsb using evaluateJavascript: " + str2);
z.this.i.evaluateJavascript(str2, null);
return;
}
i.a("Invoking Jsb using loadUrl: " + str2);
z.this.i.loadUrl(str2);
}
};
if (Looper.myLooper() != Looper.getMainLooper()) {
i.a("Received call on sub-thread, posting to main thread: " + str2);
this.d.post(runnable);
return;
}
runnable.run();
}
}