正在查看: 万能钥匙 v1.1.23 应用的 RemoteDebugManager.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 万能钥匙 v1.1.23 应用的 RemoteDebugManager.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.finogeeks.lib.applet.debugger.client;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Handler;
import android.os.Process;
import android.os.RemoteException;
import com.finogeeks.lib.applet.R;
import com.finogeeks.lib.applet.debugger.j.e;
import com.finogeeks.lib.applet.f.c.a0;
import com.finogeeks.lib.applet.f.c.c0;
import com.finogeeks.lib.applet.f.c.d0;
import com.finogeeks.lib.applet.f.c.g0;
import com.finogeeks.lib.applet.f.c.h0;
import com.finogeeks.lib.applet.f.c.x;
import com.finogeeks.lib.applet.main.FinAppEnv;
import com.finogeeks.lib.applet.main.host.Host;
import com.finogeeks.lib.applet.main.host.HostBase;
import com.finogeeks.lib.applet.modules.callback.FinSimpleCallback;
import com.finogeeks.lib.applet.modules.ext.s;
import com.finogeeks.lib.applet.modules.log.FLog;
import com.finogeeks.lib.applet.utils.FinFileResourceUtil;
import com.finogeeks.lib.applet.utils.d1;
import com.finogeeks.lib.applet.webview.WebView;
import com.finogeeks.lib.applet.widget.c;
import java.io.EOFException;
import java.io.IOException;
import java.net.Proxy;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.TimeUnit;
import javax.net.SocketFactory;
import kotlin.Metadata;
import kotlin.jvm.internal.y;
import lg0.e0;
import org.json.JSONArray;
import org.json.JSONObject;
import tj0.t;
@Metadata(d1 = {"\u0000\u0090\u0001\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u000e\n\u0002\b\u000b\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010 \n\u0002\b\u0006\n\u0002\u0010\b\n\u0002\b\u0007\n\u0002\u0010!\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\n\n\u0002\u0018\u0002\n\u0002\b\u0015\bÇ\u0002\u0018\u00002\u00020\u0001:\u0001xB\t\b\u0002¢\u0006\u0004\b\u0002\u0010\u0003J\u000f\u0010\u0005\u001a\u00020\u0004H\u0002¢\u0006\u0004\b\u0005\u0010\u0003J\u000f\u0010\u0006\u001a\u00020\u0004H\u0002¢\u0006\u0004\b\u0006\u0010\u0003J\u000f\u0010\u0007\u001a\u00020\u0004H\u0002¢\u0006\u0004\b\u0007\u0010\u0003J\u000f\u0010\b\u001a\u00020\u0004H\u0002¢\u0006\u0004\b\b\u0010\u0003J\u0015\u0010\u000b\u001a\u00020\u00042\u0006\u0010\n\u001a\u00020\t¢\u0006\u0004\b\u000b\u0010\fJ\u000f\u0010\r\u001a\u00020\u0004H\u0002¢\u0006\u0004\b\r\u0010\u0003J\u0015\u0010\u000e\u001a\u00020\u00042\u0006\u0010\n\u001a\u00020\t¢\u0006\u0004\b\u000e\u0010\fJ\u0017\u0010\u0010\u001a\u00020\u00042\u0006\u0010\u000f\u001a\u00020\tH\u0002¢\u0006\u0004\b\u0010\u0010\fJ'\u0010\u0013\u001a\u00020\u00042\u0006\u0010\u0011\u001a\u00020\t2\u0006\u0010\n\u001a\u00020\t2\u0006\u0010\u0012\u001a\u00020\tH\u0002¢\u0006\u0004\b\u0013\u0010\u0014J\u0017\u0010\u0018\u001a\u00020\u00172\u0006\u0010\u0016\u001a\u00020\u0015H\u0002¢\u0006\u0004\b\u0018\u0010\u0019J\u001d\u0010\u001c\u001a\u00020\u00042\f\u0010\u001b\u001a\b\u0012\u0004\u0012\u00020\t0\u001aH\u0002¢\u0006\u0004\b\u001c\u0010\u001dJ\u0011\u0010\u001e\u001a\u0004\u0018\u00010\u0015H\u0002¢\u0006\u0004\b\u001e\u0010\u001fJ\u0017\u0010!\u001a\u00020\u00042\u0006\u0010 \u001a\u00020\tH\u0002¢\u0006\u0004\b!\u0010\fJ\u0017\u0010$\u001a\u00020\u00042\u0006\u0010#\u001a\u00020\"H\u0002¢\u0006\u0004\b$\u0010%J\u000f\u0010&\u001a\u00020\u0004H\u0002¢\u0006\u0004\b&\u0010\u0003J\u001f\u0010)\u001a\u00020\u00042\u0006\u0010\u0011\u001a\u00020'2\u0006\u0010(\u001a\u00020\tH\u0002¢\u0006\u0004\b)\u0010*J\u0017\u0010+\u001a\u00020\u00042\u0006\u0010\u0011\u001a\u00020'H\u0002¢\u0006\u0004\b+\u0010,J\u0015\u0010/\u001a\u00020\u00042\u0006\u0010.\u001a\u00020-¢\u0006\u0004\b/\u00100J7\u00108\u001a\u00020\u00042\u0006\u00102\u001a\u0002012\u0006\u00104\u001a\u0002032\b\u00105\u001a\u0004\u0018\u00010\t2\u000e\u00107\u001a\n\u0012\u0004\u0012\u00020\t\u0018\u000106¢\u0006\u0004\b8\u00109J\r\u0010:\u001a\u00020\u0004¢\u0006\u0004\b:\u0010\u0003J\u000f\u0010;\u001a\u00020\u0004H\u0002¢\u0006\u0004\b;\u0010\u0003J\u000f\u0010<\u001a\u00020\u0004H\u0002¢\u0006\u0004\b<\u0010\u0003J\u0017\u0010?\u001a\u00020\u00042\u0006\u0010>\u001a\u00020=H\u0002¢\u0006\u0004\b?\u0010@J\u000f\u0010A\u001a\u00020\u0004H\u0002¢\u0006\u0004\bA\u0010\u0003R\u0014\u0010B\u001a\u00020\t8\u0002X\u0082T¢\u0006\u0006\n\u0004\bB\u0010CR\u0018\u00102\u001a\u0004\u0018\u0001018\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b2\u0010DR\u0016\u00105\u001a\u00020\t8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b5\u0010CR\u001a\u0010F\u001a\b\u0012\u0004\u0012\u00020\"0E8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\bF\u0010GR\u0018\u0010H\u001a\u0004\u0018\u00010\t8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bH\u0010CR\u0014\u0010I\u001a\u00020\u00018\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\bI\u0010JR\u0018\u0010K\u001a\u0004\u0018\u00010\"8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bK\u0010LR\u0018\u0010N\u001a\u0004\u0018\u00010M8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bN\u0010OR\u0018\u00104\u001a\u0004\u0018\u0001038\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b4\u0010PR\u0016\u0010R\u001a\u00020Q8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bR\u0010SR\u0018\u0010T\u001a\u0004\u0018\u00010-8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bT\u0010UR\u0014\u0010V\u001a\u00020\u00018\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\bV\u0010JR\u0018\u0010W\u001a\u0004\u0018\u00010\"8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bW\u0010LR\u0016\u0010X\u001a\u00020Q8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bX\u0010SR\u001b\u0010^\u001a\u00020Y8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\bZ\u0010[\u001a\u0004\b\\\u0010]R#\u0010c\u001a\n _*\u0004\u0018\u00010\u00170\u00178BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b`\u0010[\u001a\u0004\ba\u0010bR!\u0010h\u001a\b\u0012\u0004\u0012\u00020\t0d8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\be\u0010[\u001a\u0004\bf\u0010gR!\u0010k\u001a\b\u0012\u0004\u0012\u00020\t0d8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\bi\u0010[\u001a\u0004\bj\u0010gR!\u0010n\u001a\b\u0012\u0004\u0012\u00020\t0d8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\bl\u0010[\u001a\u0004\bm\u0010gR\u0014\u0010o\u001a\u00020\u00018\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\bo\u0010JR\u0018\u0010p\u001a\u0004\u0018\u00010\"8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bp\u0010LR\u0016\u0010q\u001a\u00020Q8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bq\u0010SR\u0018\u0010r\u001a\u0004\u0018\u00010\"8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\br\u0010LR\u001c\u00107\u001a\b\u0012\u0004\u0012\u00020\t068\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b7\u0010GR\u0016\u0010s\u001a\u00020Q8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bs\u0010SR\u0016\u0010t\u001a\u00020Q8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bt\u0010SR\u0016\u0010u\u001a\u00020Q8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bu\u0010SR\u0018\u0010v\u001a\u0004\u0018\u00010\u00158\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bv\u0010w¨\u0006y"}, d2 = {"Lcom/finogeeks/lib/applet/debugger/client/RemoteDebugManager;", "", "<init>", "()V", "Llg0/e0;", "closeDomSocket", "closeNetworkSocket", "closeRuntimeSocket", "closeServerSocket", "", "webViewId", "connectToDomSocket", "(Ljava/lang/String;)V", "connectToNetworkSocket", "connectToRuntimeSocket", "serverUrl", "connectToServerSocket", "target", "pageId", "connectToSocket", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", "Lcom/finogeeks/lib/applet/debugger/client/UnixSocketFactory;", "socketFactory", "Lcom/finogeeks/lib/applet/externallib/okhttp3/OkHttpClient;", "createOkHttpClientForUnixSocket", "(Lcom/finogeeks/lib/applet/debugger/client/UnixSocketFactory;)Lcom/finogeeks/lib/applet/externallib/okhttp3/OkHttpClient;", "Lcom/finogeeks/lib/applet/modules/callback/FinSimpleCallback;", "callback", "getDebugPageList", "(Lcom/finogeeks/lib/applet/modules/callback/FinSimpleCallback;)V", "getUnixSocketFactory", "()Lcom/finogeeks/lib/applet/debugger/client/UnixSocketFactory;", "text", "handleServerOnMessage", "Lcom/finogeeks/lib/applet/externallib/okhttp3/WebSocket;", "webSocket", "handleServerOnOpen", "(Lcom/finogeeks/lib/applet/externallib/okhttp3/WebSocket;)V", "notifyDomDocumentUpdated", "Lcom/finogeeks/lib/applet/debugger/client/RemoteDebugManager$Target;", "cdp", "pendingMessage", "(Lcom/finogeeks/lib/applet/debugger/client/RemoteDebugManager$Target;Ljava/lang/String;)V", "sentPendingMessage", "(Lcom/finogeeks/lib/applet/debugger/client/RemoteDebugManager$Target;)V", "Landroid/os/Handler;", "handler", "setJ2V8DebuggerHandler", "(Landroid/os/Handler;)V", "Landroid/app/Activity;", "activity", "Lcom/finogeeks/lib/applet/main/host/Host;", "host", "channelId", "", "serverUrls", "start", "(Landroid/app/Activity;Lcom/finogeeks/lib/applet/main/host/Host;Ljava/lang/String;Ljava/util/List;)V", "stop", "stopAndShowConnectFailureDialog", "stopAndShowDisconnectedDialog", "", "resId", "stopAndShowExitDialog", "(I)V", "stopAndShowIllegalArgumentDialog", "TAG", "Ljava/lang/String;", "Landroid/app/Activity;", "", "connectingServerSockets", "Ljava/util/List;", "currentDomWebViewId", "domLock", "Ljava/lang/Object;", "domSocket", "Lcom/finogeeks/lib/applet/externallib/okhttp3/WebSocket;", "Landroid/app/Dialog;", "exitDialog", "Landroid/app/Dialog;", "Lcom/finogeeks/lib/applet/main/host/Host;", "", "isJ2V8Debug", "Z", "j2v8DebuggerHandler", "Landroid/os/Handler;", "networkLock", "networkSocket", "networkSocketHasOpened", "Lcom/finogeeks/lib/applet/debugger/json/ObjectMapper;", "objectMapper$delegate", "Llg0/h;", "getObjectMapper", "()Lcom/finogeeks/lib/applet/debugger/json/ObjectMapper;", "objectMapper", "kotlin.jvm.PlatformType", "okHttpClient$delegate", "getOkHttpClient", "()Lcom/finogeeks/lib/applet/externallib/okhttp3/OkHttpClient;", "okHttpClient", "Ljava/util/concurrent/CopyOnWriteArrayList;", "pendingDomMessages$delegate", "getPendingDomMessages", "()Ljava/util/concurrent/CopyOnWriteArrayList;", "pendingDomMessages", "pendingNetworkMessages$delegate", "getPendingNetworkMessages", "pendingNetworkMessages", "pendingRuntimeMessages$delegate", "getPendingRuntimeMessages", "pendingRuntimeMessages", "runtimeLock", "runtimeSocket", "runtimeSocketHasOpened", "serverSocket", "started", "stethoServerSocketBound", "stethoStarted", "unixSocketFactory", "Lcom/finogeeks/lib/applet/debugger/client/UnixSocketFactory;", "Target", "finapplet_release"}, k = 1, mv = {1, 4, 0})
@SuppressLint({"StaticFieldLeak"})
public final class RemoteDebugManager {
private static Dialog A;
private static Activity b;
private static Host c;
private static String d;
private static volatile boolean e;
private static boolean f;
private static boolean g;
private static Handler h;
private static boolean i;
private static com.finogeeks.lib.applet.debugger.client.c r;
private static g0 t;
private static g0 u;
private static g0 v;
private static g0 w;
private static volatile boolean x;
private static volatile boolean f73y;
private static volatile String f74z;
static final hh0.l[] a = {kotlin.jvm.internal.g0.j(new y(kotlin.jvm.internal.g0.b(RemoteDebugManager.class), "pendingNetworkMessages", "getPendingNetworkMessages()Ljava/util/concurrent/CopyOnWriteArrayList;")), kotlin.jvm.internal.g0.j(new y(kotlin.jvm.internal.g0.b(RemoteDebugManager.class), "pendingRuntimeMessages", "getPendingRuntimeMessages()Ljava/util/concurrent/CopyOnWriteArrayList;")), kotlin.jvm.internal.g0.j(new y(kotlin.jvm.internal.g0.b(RemoteDebugManager.class), "pendingDomMessages", "getPendingDomMessages()Ljava/util/concurrent/CopyOnWriteArrayList;")), kotlin.jvm.internal.g0.j(new y(kotlin.jvm.internal.g0.b(RemoteDebugManager.class), "objectMapper", "getObjectMapper()Lcom/finogeeks/lib/applet/debugger/json/ObjectMapper;")), kotlin.jvm.internal.g0.j(new y(kotlin.jvm.internal.g0.b(RemoteDebugManager.class), "okHttpClient", "getOkHttpClient()Lcom/finogeeks/lib/applet/externallib/okhttp3/OkHttpClient;"))};
public static final RemoteDebugManager B = new RemoteDebugManager();
private static final lg0.h j = lg0.i.a(m.a);
private static final lg0.h k = lg0.i.a(n.a);
private static final lg0.h l = lg0.i.a(l.a);
private static final Object m = new Object();
private static final Object n = new Object();
private static final Object o = new Object();
private static final lg0.h p = lg0.i.a(j.a);
private static final lg0.h q = lg0.i.a(k.a);
private static final List<g0> s = new ArrayList();
public enum a {
NETWORK,
RUNTIME,
DOM
}
@Metadata(d1 = {"\u0000\u0017\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003*\u0001\u0000\b\n\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u0001J\u0017\u0010\u0005\u001a\u00020\u00042\u0006\u0010\u0003\u001a\u00020\u0002H\u0016¢\u0006\u0004\b\u0005\u0010\u0006¨\u0006\u0007"}, d2 = {"com/finogeeks/lib/applet/debugger/client/RemoteDebugManager$connectToDomSocket$1", "Lcom/finogeeks/lib/applet/modules/callback/FinSimpleCallback;", "", "result", "Llg0/e0;", "onSuccess", "(Ljava/lang/String;)V", "finapplet_release"}, k = 1, mv = {1, 4, 0})
public static final class b extends FinSimpleCallback<String> {
final String a;
public static final class a extends kotlin.jvm.internal.p implements ah0.a<e0> {
final JSONObject b;
public a(JSONObject jSONObject) {
super(0);
this.b = jSONObject;
}
public Object invoke() {
m232invoke();
return e0.a;
}
public final void m232invoke() {
RemoteDebugManager remoteDebugManager = RemoteDebugManager.B;
String str = b.this.a;
String optString = this.b.optString("id");
kotlin.jvm.internal.n.e(optString, "jsonObject.optString(\"id\")");
remoteDebugManager.a("dom", str, optString);
}
}
public b(String str) {
this.a = str;
}
@Override
public void onSuccess(String str) {
kotlin.jvm.internal.n.j(str, "result");
JSONArray jSONArray = new JSONArray(str);
int length = jSONArray.length();
for (int i = 0; i < length; i++) {
JSONObject optJSONObject = jSONArray.optJSONObject(i);
if (kotlin.jvm.internal.n.d(optJSONObject != null ? optJSONObject.optString("title") : null, this.a)) {
d1.a(new a(optJSONObject));
return;
}
}
}
}
public static final class c extends h0 {
@Override
public void a(g0 g0Var, int i, String str) {
kotlin.jvm.internal.n.j(g0Var, "webSocket");
kotlin.jvm.internal.n.j(str, "reason");
FLog.i$default("RemoteDebugManager", "networkSocket onClosed code:" + i + ", reason:" + str, null, 4, null);
}
@Override
public void a(g0 g0Var, c0 c0Var) {
kotlin.jvm.internal.n.j(g0Var, "webSocket");
kotlin.jvm.internal.n.j(c0Var, "response");
FLog.i$default("RemoteDebugManager", "networkSocket onOpen", null, 4, null);
RemoteDebugManager remoteDebugManager = RemoteDebugManager.B;
RemoteDebugManager.x = true;
remoteDebugManager.a(a.NETWORK);
}
@Override
public void a(g0 g0Var, com.finogeeks.lib.applet.f.d.f fVar) {
kotlin.jvm.internal.n.j(g0Var, "webSocket");
kotlin.jvm.internal.n.j(fVar, "bytes");
FLog.i$default("RemoteDebugManager", "networkSocket onMessage bytes:" + fVar, null, 4, null);
}
@Override
public void a(g0 g0Var, String str) {
kotlin.jvm.internal.n.j(g0Var, "webSocket");
kotlin.jvm.internal.n.j(str, "text");
FLog.i$default("RemoteDebugManager", "networkSocket onMessage:" + str, null, 4, null);
com.finogeeks.lib.applet.debugger.client.d.c cVar = new com.finogeeks.lib.applet.debugger.client.d.c(new com.finogeeks.lib.applet.debugger.client.d.a("network", new JSONObject(str)));
RemoteDebugManager remoteDebugManager = RemoteDebugManager.B;
String jSONObject = ((JSONObject) remoteDebugManager.g().a(cVar, JSONObject.class)).toString();
kotlin.jvm.internal.n.e(jSONObject, "objectMapper.convertValu…t::class.java).toString()");
g0 e = RemoteDebugManager.e(remoteDebugManager);
FLog.i$default("RemoteDebugManager", "sent to server:" + jSONObject + " \n" + (e != null ? Boolean.valueOf(e.a(jSONObject)) : null), null, 4, null);
}
@Override
public void a(g0 g0Var, Throwable th2, c0 c0Var) {
kotlin.jvm.internal.n.j(g0Var, "webSocket");
kotlin.jvm.internal.n.j(th2, "t");
FLog.e$default("RemoteDebugManager", "networkSocket onFailure error:" + th2 + ", response:" + c0Var, null, 4, null);
}
@Override
public void b(g0 g0Var, int i, String str) {
kotlin.jvm.internal.n.j(g0Var, "webSocket");
kotlin.jvm.internal.n.j(str, "reason");
FLog.i$default("RemoteDebugManager", "networkSocket onClosing code:" + i + ", reason:" + str, null, 4, null);
}
}
@Metadata(d1 = {"\u0000\u0017\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003*\u0001\u0000\b\n\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u0001J\u0017\u0010\u0005\u001a\u00020\u00042\u0006\u0010\u0003\u001a\u00020\u0002H\u0016¢\u0006\u0004\b\u0005\u0010\u0006¨\u0006\u0007"}, d2 = {"com/finogeeks/lib/applet/debugger/client/RemoteDebugManager$connectToRuntimeSocket$1", "Lcom/finogeeks/lib/applet/modules/callback/FinSimpleCallback;", "", "result", "Llg0/e0;", "onSuccess", "(Ljava/lang/String;)V", "finapplet_release"}, k = 1, mv = {1, 4, 0})
public static final class d extends FinSimpleCallback<String> {
final String a;
public static final class a extends kotlin.jvm.internal.p implements ah0.a<e0> {
final JSONObject b;
public a(JSONObject jSONObject) {
super(0);
this.b = jSONObject;
}
public Object invoke() {
m233invoke();
return e0.a;
}
public final void m233invoke() {
RemoteDebugManager remoteDebugManager = RemoteDebugManager.B;
String str = d.this.a;
String optString = this.b.optString("id");
kotlin.jvm.internal.n.e(optString, "jsonObject.optString(\"id\")");
remoteDebugManager.a("runtime", str, optString);
}
}
public d(String str) {
this.a = str;
}
@Override
public void onSuccess(String str) {
kotlin.jvm.internal.n.j(str, "result");
JSONArray jSONArray = new JSONArray(str);
int length = jSONArray.length();
for (int i = 0; i < length; i++) {
JSONObject optJSONObject = jSONArray.optJSONObject(i);
if (kotlin.jvm.internal.n.d(optJSONObject != null ? optJSONObject.optString("title") : null, this.a)) {
d1.a(new a(optJSONObject));
return;
}
}
}
}
public static final class e implements Runnable {
public static final e a = new e();
@Override
public final void run() {
RemoteDebugManager remoteDebugManager = RemoteDebugManager.B;
if (RemoteDebugManager.c(remoteDebugManager).isEmpty()) {
remoteDebugManager.n();
}
}
}
@Metadata(d1 = {"\u00009\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u0003\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\b*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J'\u0010\t\u001a\u00020\b2\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u0005\u001a\u00020\u00042\u0006\u0010\u0007\u001a\u00020\u0006H\u0016¢\u0006\u0004\b\t\u0010\nJ'\u0010\u000b\u001a\u00020\b2\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u0005\u001a\u00020\u00042\u0006\u0010\u0007\u001a\u00020\u0006H\u0016¢\u0006\u0004\b\u000b\u0010\nJ)\u0010\u0010\u001a\u00020\b2\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\r\u001a\u00020\f2\b\u0010\u000f\u001a\u0004\u0018\u00010\u000eH\u0016¢\u0006\u0004\b\u0010\u0010\u0011J\u001f\u0010\u0014\u001a\u00020\b2\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u0013\u001a\u00020\u0012H\u0016¢\u0006\u0004\b\u0014\u0010\u0015J\u001f\u0010\u0014\u001a\u00020\b2\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u0016\u001a\u00020\u0006H\u0016¢\u0006\u0004\b\u0014\u0010\u0017J\u001f\u0010\u0018\u001a\u00020\b2\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u000f\u001a\u00020\u000eH\u0016¢\u0006\u0004\b\u0018\u0010\u0019¨\u0006\u001a"}, d2 = {"com/finogeeks/lib/applet/debugger/client/RemoteDebugManager$connectToServerSocket$socket$1", "Lcom/finogeeks/lib/applet/externallib/okhttp3/WebSocketListener;", "Lcom/finogeeks/lib/applet/externallib/okhttp3/WebSocket;", "webSocket", "", "code", "", "reason", "Llg0/e0;", "onClosed", "(Lcom/finogeeks/lib/applet/externallib/okhttp3/WebSocket;ILjava/lang/String;)V", "onClosing", "", "t", "Lcom/finogeeks/lib/applet/externallib/okhttp3/Response;", "response", "onFailure", "(Lcom/finogeeks/lib/applet/externallib/okhttp3/WebSocket;Ljava/lang/Throwable;Lcom/finogeeks/lib/applet/externallib/okhttp3/Response;)V", "Lcom/finogeeks/lib/applet/externallib/okio/ByteString;", "bytes", "onMessage", "(Lcom/finogeeks/lib/applet/externallib/okhttp3/WebSocket;Lcom/finogeeks/lib/applet/externallib/okio/ByteString;)V", "text", "(Lcom/finogeeks/lib/applet/externallib/okhttp3/WebSocket;Ljava/lang/String;)V", "onOpen", "(Lcom/finogeeks/lib/applet/externallib/okhttp3/WebSocket;Lcom/finogeeks/lib/applet/externallib/okhttp3/Response;)V", "finapplet_release"}, k = 1, mv = {1, 4, 0})
public static final class f extends h0 {
final String a;
public static final class a extends kotlin.jvm.internal.p implements ah0.a<e0> {
public static final a a = new a();
public a() {
super(0);
}
public Object invoke() {
m234invoke();
return e0.a;
}
public final void m234invoke() {
RemoteDebugManager remoteDebugManager = RemoteDebugManager.B;
remoteDebugManager.e();
remoteDebugManager.o();
}
}
public static final class b extends kotlin.jvm.internal.p implements ah0.a<e0> {
public static final b a = new b();
public b() {
super(0);
}
public Object invoke() {
m235invoke();
return e0.a;
}
public final void m235invoke() {
RemoteDebugManager remoteDebugManager = RemoteDebugManager.B;
remoteDebugManager.e();
remoteDebugManager.o();
}
}
public static final class c extends kotlin.jvm.internal.p implements ah0.a<e0> {
final g0 a;
public c(g0 g0Var) {
super(0);
this.a = g0Var;
}
public Object invoke() {
m236invoke();
return e0.a;
}
public final void m236invoke() {
RemoteDebugManager remoteDebugManager = RemoteDebugManager.B;
if (RemoteDebugManager.e(remoteDebugManager) == null) {
RemoteDebugManager.c(remoteDebugManager).remove(this.a);
if (RemoteDebugManager.c(remoteDebugManager).isEmpty()) {
remoteDebugManager.n();
return;
}
return;
}
if (kotlin.jvm.internal.n.d(this.a, RemoteDebugManager.e(remoteDebugManager))) {
remoteDebugManager.e();
remoteDebugManager.o();
}
}
}
public static final class d extends kotlin.jvm.internal.p implements ah0.a<e0> {
final g0 a;
public d(g0 g0Var) {
super(0);
this.a = g0Var;
}
public Object invoke() {
m237invoke();
return e0.a;
}
public final void m237invoke() {
RemoteDebugManager.B.a(this.a);
}
}
public f(String str) {
this.a = str;
}
@Override
public void a(g0 g0Var, int i, String str) {
kotlin.jvm.internal.n.j(g0Var, "webSocket");
kotlin.jvm.internal.n.j(str, "reason");
FLog.i$default("RemoteDebugManager", "serverSocket:" + this.a + " onClosed code:" + i + ", reason:" + str, null, 4, null);
if (i == 4000) {
return;
}
d1.a(a.a);
}
@Override
public void a(g0 g0Var, c0 c0Var) {
kotlin.jvm.internal.n.j(g0Var, "webSocket");
kotlin.jvm.internal.n.j(c0Var, "response");
FLog.i$default("RemoteDebugManager", "serverSocket:" + this.a + " onOpen", null, 4, null);
d1.a(new d(g0Var));
}
@Override
public void a(g0 g0Var, com.finogeeks.lib.applet.f.d.f fVar) {
kotlin.jvm.internal.n.j(g0Var, "webSocket");
kotlin.jvm.internal.n.j(fVar, "bytes");
FLog.i$default("RemoteDebugManager", "serverSocket onMessage bytes:" + fVar, null, 4, null);
}
@Override
public void a(g0 g0Var, String str) {
kotlin.jvm.internal.n.j(g0Var, "webSocket");
kotlin.jvm.internal.n.j(str, "text");
FLog.i$default("RemoteDebugManager", "serverSocket onMessage:" + str, null, 4, null);
RemoteDebugManager.B.d(str);
}
@Override
public void a(g0 g0Var, Throwable th2, c0 c0Var) {
kotlin.jvm.internal.n.j(g0Var, "webSocket");
kotlin.jvm.internal.n.j(th2, "t");
FLog.e$default("RemoteDebugManager", "serverSocket:" + this.a + " onFailure error:" + th2 + ", response:" + c0Var, null, 4, null);
d1.a(new c(g0Var));
}
@Override
public void b(g0 g0Var, int i, String str) {
kotlin.jvm.internal.n.j(g0Var, "webSocket");
kotlin.jvm.internal.n.j(str, "reason");
FLog.i$default("RemoteDebugManager", "serverSocket:" + this.a + " onClosing code:" + i + ", reason:" + str, null, 4, null);
if (i == 4000) {
return;
}
d1.a(b.a);
}
}
public static final class g extends h0 {
final String a;
final String b;
final String c;
public g(String str, String str2, String str3) {
this.a = str;
this.b = str2;
this.c = str3;
}
@Override
public void a(g0 g0Var, int i, String str) {
kotlin.jvm.internal.n.j(g0Var, "webSocket");
kotlin.jvm.internal.n.j(str, "reason");
FLog.i$default("RemoteDebugManager", this.a + " onClosed code:" + i + ", reason:" + str, null, 4, null);
}
@Override
public void a(g0 g0Var, c0 c0Var) {
kotlin.jvm.internal.n.j(g0Var, "webSocket");
kotlin.jvm.internal.n.j(c0Var, "response");
FLog.i$default("RemoteDebugManager", this.a + " onOpen", null, 4, null);
if (kotlin.jvm.internal.n.d(this.b, "runtime")) {
RemoteDebugManager remoteDebugManager = RemoteDebugManager.B;
RemoteDebugManager.f73y = true;
remoteDebugManager.a(a.RUNTIME);
} else {
RemoteDebugManager remoteDebugManager2 = RemoteDebugManager.B;
RemoteDebugManager.f74z = this.c;
remoteDebugManager2.a(a.DOM);
remoteDebugManager2.m();
}
}
@Override
public void a(g0 g0Var, com.finogeeks.lib.applet.f.d.f fVar) {
kotlin.jvm.internal.n.j(g0Var, "webSocket");
kotlin.jvm.internal.n.j(fVar, "bytes");
FLog.i$default("RemoteDebugManager", this.a + " onMessage bytes:" + fVar, null, 4, null);
}
@Override
public void a(g0 g0Var, String str) {
kotlin.jvm.internal.n.j(g0Var, "webSocket");
kotlin.jvm.internal.n.j(str, "text");
FLog.i$default("RemoteDebugManager", this.a + " onMessage:" + str, null, 4, null);
JSONObject jSONObject = new JSONObject(str);
String optString = jSONObject.optString("method");
kotlin.jvm.internal.n.e(optString, "method");
if (t.L(optString, "Network.", false, 2, (Object) null)) {
return;
}
com.finogeeks.lib.applet.debugger.client.d.c cVar = new com.finogeeks.lib.applet.debugger.client.d.c(new com.finogeeks.lib.applet.debugger.client.d.a(this.b, jSONObject));
RemoteDebugManager remoteDebugManager = RemoteDebugManager.B;
String jSONObject2 = ((JSONObject) remoteDebugManager.g().a(cVar, JSONObject.class)).toString();
kotlin.jvm.internal.n.e(jSONObject2, "objectMapper.convertValu… .toString()");
g0 e = RemoteDebugManager.e(remoteDebugManager);
FLog.i$default("RemoteDebugManager", "sent to server:" + jSONObject2 + " \n" + (e != null ? Boolean.valueOf(e.a(jSONObject2)) : null), null, 4, null);
}
@Override
public void a(g0 g0Var, Throwable th2, c0 c0Var) {
kotlin.jvm.internal.n.j(g0Var, "webSocket");
kotlin.jvm.internal.n.j(th2, "t");
if (th2 instanceof EOFException) {
FLog.i$default("RemoteDebugManager", this.a + " onFailure(EOF close)", null, 4, null);
return;
}
FLog.e$default("RemoteDebugManager", this.a + " onFailure error:" + th2 + ", response:" + c0Var, null, 4, null);
}
@Override
public void b(g0 g0Var, int i, String str) {
kotlin.jvm.internal.n.j(g0Var, "webSocket");
kotlin.jvm.internal.n.j(str, "reason");
FLog.i$default("RemoteDebugManager", this.a + " onClosing code:" + i + ", reason:" + str, null, 4, null);
}
}
public static final class h implements com.finogeeks.lib.applet.f.c.f {
final FinSimpleCallback a;
public h(FinSimpleCallback finSimpleCallback) {
this.a = finSimpleCallback;
}
@Override
public void onFailure(com.finogeeks.lib.applet.f.c.e eVar, IOException iOException) {
kotlin.jvm.internal.n.j(eVar, "call");
kotlin.jvm.internal.n.j(iOException, "e");
FLog.e$default("RemoteDebugManager", "getDebugPageList onFailure error:" + iOException, null, 4, null);
this.a.onError(0, iOException.toString());
}
@Override
public void onResponse(com.finogeeks.lib.applet.f.c.e eVar, c0 c0Var) {
kotlin.jvm.internal.n.j(eVar, "call");
kotlin.jvm.internal.n.j(c0Var, "response");
d0 a = c0Var.a();
String r = a != null ? a.r() : null;
if (r == null || r.length() == 0) {
this.a.onError(0, "json is null or empty");
} else {
this.a.onSuccess(r);
}
}
}
public static final class i extends kotlin.jvm.internal.p implements ah0.a<e0> {
public static final i a = new i();
public i() {
super(0);
}
public Object invoke() {
m238invoke();
return e0.a;
}
public final void m238invoke() {
RemoteDebugManager.B.o();
}
}
public static final class j extends kotlin.jvm.internal.p implements ah0.a<com.finogeeks.lib.applet.debugger.h.a> {
public static final j a = new j();
public j() {
super(0);
}
public final com.finogeeks.lib.applet.debugger.h.a m239invoke() {
return new com.finogeeks.lib.applet.debugger.h.a();
}
}
public static final class k extends kotlin.jvm.internal.p implements ah0.a<x> {
public static final k a = new k();
public k() {
super(0);
}
public final x m240invoke() {
x.b bVar = new x.b();
TimeUnit timeUnit = TimeUnit.SECONDS;
return bVar.d(10L, timeUnit).c(10L, timeUnit).a(10L, timeUnit).b(20L, timeUnit).a();
}
}
public static final class l extends kotlin.jvm.internal.p implements ah0.a<CopyOnWriteArrayList<String>> {
public static final l a = new l();
public l() {
super(0);
}
public final CopyOnWriteArrayList<String> invoke() {
return new CopyOnWriteArrayList<>();
}
}
public static final class m extends kotlin.jvm.internal.p implements ah0.a<CopyOnWriteArrayList<String>> {
public static final m a = new m();
public m() {
super(0);
}
public final CopyOnWriteArrayList<String> invoke() {
return new CopyOnWriteArrayList<>();
}
}
public static final class n extends kotlin.jvm.internal.p implements ah0.a<CopyOnWriteArrayList<String>> {
public static final n a = new n();
public n() {
super(0);
}
public final CopyOnWriteArrayList<String> invoke() {
return new CopyOnWriteArrayList<>();
}
}
@Metadata(d1 = {"\u0000\b\n\u0002\u0018\u0002\n\u0002\b\u0003\u0010\u0003\u001a\u00020\u0000H\n¢\u0006\u0004\b\u0001\u0010\u0002"}, d2 = {"Llg0/e0;", "onBind", "()V", "<anonymous>"}, k = 3, mv = {1, 4, 0})
public static final class o implements e.a {
public static final o a = new o();
public static final class a extends kotlin.jvm.internal.p implements ah0.a<e0> {
public static final a a = new a();
public a() {
super(0);
}
public Object invoke() {
m244invoke();
return e0.a;
}
public final void m244invoke() {
RemoteDebugManager remoteDebugManager = RemoteDebugManager.B;
RemoteDebugManager.g = true;
if (RemoteDebugManager.f(remoteDebugManager)) {
remoteDebugManager.f();
}
}
}
@Override
public final void a() {
d1.a(a.a);
}
}
@Metadata(d1 = {"\u0000\u0016\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\u0010\b\u001a\u00020\u00052\u000e\u0010\u0002\u001a\n \u0001*\u0004\u0018\u00010\u00000\u00002\u0006\u0010\u0004\u001a\u00020\u0003H\n¢\u0006\u0004\b\u0006\u0010\u0007"}, d2 = {"", "kotlin.jvm.PlatformType", "<anonymous parameter 0>", "", "<anonymous parameter 1>", "Llg0/e0;", "onConfirm", "(Ljava/lang/String;Z)V", "<anonymous>"}, k = 3, mv = {1, 4, 0})
public static final class p implements c.f {
final Host a;
@Metadata(d1 = {"\u0000\b\n\u0002\u0018\u0002\n\u0002\b\u0003\u0010\u0003\u001a\u00020\u0000H\n¢\u0006\u0004\b\u0001\u0010\u0002"}, d2 = {"Llg0/e0;", "run", "()V", "<anonymous>"}, k = 3, mv = {1, 4, 0})
public static final class a implements Runnable {
@Metadata(d1 = {"\u0000\b\n\u0002\u0018\u0002\n\u0002\b\u0003\u0010\u0003\u001a\u00020\u0000H\n¢\u0006\u0004\b\u0001\u0010\u0002"}, d2 = {"Llg0/e0;", "run", "()V", "<anonymous>"}, k = 3, mv = {1, 4, 0})
public static final class RunnableC0090a implements Runnable {
public static final class C0091a extends kotlin.jvm.internal.p implements ah0.l<com.finogeeks.lib.applet.ipc.h, e0> {
public C0091a() {
super(1);
}
public final void a(com.finogeeks.lib.applet.ipc.h hVar) {
kotlin.jvm.internal.n.j(hVar, "$receiver");
try {
hVar.finishRunningApplet(p.this.a.getAppId());
} catch (RemoteException e) {
e.printStackTrace();
}
}
public Object invoke(Object obj) {
a((com.finogeeks.lib.applet.ipc.h) obj);
return e0.a;
}
}
public RunnableC0090a() {
}
@Override
public final void run() {
p.this.a.a("finishRunningApplet", new C0091a());
}
}
public a() {
}
@Override
public final void run() {
HostBase.a((HostBase) p.this.a, false, 1, (Object) null);
d1.a().postDelayed(new RunnableC0090a(), 1000L);
}
}
public p(Host host) {
this.a = host;
}
@Override
public final void a(String str, boolean z10) {
d1.a().postDelayed(new a(), 250L);
}
}
public static final class q implements DialogInterface.OnDismissListener {
public static final q a = new q();
@Override
public final void onDismiss(DialogInterface dialogInterface) {
RemoteDebugManager remoteDebugManager = RemoteDebugManager.B;
RemoteDebugManager.A = null;
}
}
private RemoteDebugManager() {
}
private final x a(com.finogeeks.lib.applet.debugger.client.c cVar) {
x a2 = new x.b().a((SocketFactory) cVar).a((com.finogeeks.lib.applet.f.c.o) cVar).a(Proxy.NO_PROXY).a();
kotlin.jvm.internal.n.e(a2, "OkHttpClient.Builder()\n …OXY)\n .build()");
return a2;
}
private final void a(int i2) {
Host host;
Activity activity = b;
if (activity == null || (host = c) == null) {
return;
}
Dialog dialog = A;
if (kotlin.jvm.internal.n.d(dialog != null ? Boolean.valueOf(dialog.isShowing()) : null, Boolean.TRUE)) {
return;
}
a();
String string = activity.getString(R.string.fin_applet_remote_debug_confirm_exit);
kotlin.jvm.internal.n.e(string, "activity.getString(R.str…emote_debug_confirm_exit)");
String b2 = s.b(string, FinAppEnv.INSTANCE.getFinAppConfig().getAppletText());
?? cVar = new com.finogeeks.lib.applet.widget.c(activity);
A = cVar;
cVar.a(Integer.MAX_VALUE);
cVar.setTitle(i2);
cVar.a(b2);
cVar.a(R.string.fin_applet_confirm, new p(host));
cVar.a(R.string.fin_applet_cancel, null);
cVar.setOnDismissListener(q.a);
cVar.setCancelable(false);
cVar.show();
}
public final void a(a aVar) {
int i2 = com.finogeeks.lib.applet.debugger.client.b.b[aVar.ordinal()];
if (i2 == 1) {
synchronized (m) {
for (String str : B.j()) {
g0 g0Var = u;
FLog.i$default("RemoteDebugManager", "write pending to networkSocket:" + str + " \n" + (g0Var != null ? Boolean.valueOf(g0Var.a(str)) : null), null, 4, null);
}
B.j().clear();
e0 e0Var = e0.a;
}
return;
}
if (i2 != 2) {
synchronized (o) {
for (String str2 : B.i()) {
g0 g0Var2 = w;
FLog.i$default("RemoteDebugManager", "write pending to domSocket:" + str2 + " \n" + (g0Var2 != null ? Boolean.valueOf(g0Var2.a(str2)) : null), null, 4, null);
}
B.i().clear();
e0 e0Var2 = e0.a;
}
return;
}
synchronized (n) {
for (String str3 : B.k()) {
g0 g0Var3 = v;
FLog.i$default("RemoteDebugManager", "write pending to runtimeSocket:" + str3 + " \n" + (g0Var3 != null ? Boolean.valueOf(g0Var3.a(str3)) : null), null, 4, null);
}
B.k().clear();
e0 e0Var3 = e0.a;
}
}
private final void a(a aVar, String str) {
int i2 = com.finogeeks.lib.applet.debugger.client.b.a[aVar.ordinal()];
if (i2 == 1) {
synchronized (m) {
FLog.i$default("RemoteDebugManager", "pending network message:" + str, null, 4, null);
B.j().add(str);
}
return;
}
if (i2 != 2) {
synchronized (o) {
FLog.i$default("RemoteDebugManager", "pending dom message:" + str, null, 4, null);
B.i().add(str);
}
return;
}
synchronized (n) {
FLog.i$default("RemoteDebugManager", "pending runtime message:" + str, null, 4, null);
B.k().add(str);
}
}
public final void a(g0 g0Var) {
if (t != null) {
return;
}
for (g0 g0Var2 : s) {
if (!kotlin.jvm.internal.n.d(g0Var2, g0Var)) {
FLog.i$default("RemoteDebugManager", "close connecting serverSocket:" + g0Var2.a().g(), null, 4, null);
g0Var2.a(4000, "close connecting serverSocket");
}
}
s.clear();
com.finogeeks.lib.applet.debugger.client.e.a aVar = com.finogeeks.lib.applet.debugger.client.e.a.a;
String str = d;
if (str == null) {
kotlin.jvm.internal.n.z("channelId");
}
String a2 = aVar.a(str);
boolean a3 = g0Var.a(a2);
FLog.i$default("RemoteDebugManager", "serverSocket send:" + a2 + " \n" + a3, null, 4, null);
if (!a3) {
n();
return;
}
t = g0Var;
Handler handler = h;
if (handler != null) {
com.finogeeks.lib.applet.debugger.j2v8.k.i.a(g0Var);
handler.sendMessage(handler.obtainMessage(3));
}
}
private final void a(FinSimpleCallback<String> finSimpleCallback) {
String str = "webview_devtools_remote_" + Process.myPid();
com.finogeeks.lib.applet.debugger.client.c l2 = l();
if (l2 != null) {
a(l2).a(new a0.a().a(l2.a(str, "json", null, null)).a("Host", "").a()).a(new h(finSimpleCallback));
}
}
public final void a(String str, String str2, String str3) {
if (e) {
String str4 = kotlin.jvm.internal.n.d(str, "runtime") ? "runtimeSocket" : "domSocket";
String str5 = "webview_devtools_remote_" + Process.myPid();
com.finogeeks.lib.applet.debugger.client.c l2 = l();
if (l2 != null) {
com.finogeeks.lib.applet.f.c.t a2 = l2.a(str5, "devtools", "page", str3);
FLog.i$default("RemoteDebugManager", "connectToSocket(" + str + ") pageId=" + str3, null, 4, null);
g0 a3 = a(l2).a(new a0.a().a(a2).a(), new g(str4, str, str2));
if (kotlin.jvm.internal.n.d(str, "runtime")) {
v = a3;
} else {
w = a3;
}
}
}
}
private final void b() {
g0 g0Var = w;
if (g0Var != null) {
g0Var.a(4000, "close");
}
w = null;
}
public static final List c(RemoteDebugManager remoteDebugManager) {
return s;
}
private final void c() {
x = false;
g0 g0Var = u;
if (g0Var != null) {
g0Var.a(4000, "close");
}
u = null;
}
private final void c(String str) {
if (e) {
e();
FLog.i$default("RemoteDebugManager", "connectToServerSocket url:" + str, null, 4, null);
try {
a0 a2 = new a0.a().b(str).a();
kotlin.jvm.internal.n.e(a2, "Request.Builder()\n …\n .build()");
g0 a3 = h().a(a2, new f(str));
List<g0> list = s;
kotlin.jvm.internal.n.e(a3, "socket");
list.add(a3);
} catch (Exception e2) {
e2.printStackTrace();
FLog.e$default("RemoteDebugManager", "connectToServerSocket error:" + e2, null, 4, null);
d1.a().post(e.a);
}
}
}
private final void d() {
f73y = false;
g0 g0Var = v;
if (g0Var != null) {
g0Var.a(4000, "close");
}
v = null;
}
public final void d(String str) {
JSONObject optJSONObject;
JSONObject optJSONObject2;
JSONObject optJSONObject3;
JSONObject jSONObject = new JSONObject(str);
int optInt = jSONObject.optInt("type", -1);
if (optInt != 0) {
if (optInt != 2 || (optJSONObject = jSONObject.optJSONObject("data")) == null || !kotlin.jvm.internal.n.d(optJSONObject.optString(FinFileResourceUtil.KEY_EVENT), "peerSocketClosed") || (optJSONObject2 = optJSONObject.optJSONObject("data")) == null) {
return;
}
String optString = optJSONObject2.optString("channelId");
String str2 = d;
if (str2 == null) {
kotlin.jvm.internal.n.z("channelId");
}
if (kotlin.jvm.internal.n.d(optString, str2)) {
d1.a(i.a);
return;
}
return;
}
JSONObject optJSONObject4 = jSONObject.optJSONObject("data");
if (optJSONObject4 == null || (optJSONObject3 = optJSONObject4.optJSONObject("data")) == null) {
return;
}
String jSONObject2 = optJSONObject3.toString();
kotlin.jvm.internal.n.e(jSONObject2, "cdpJsonObject.toString()");
String optString2 = optJSONObject4.optString("target");
if (optString2 == null) {
return;
}
int hashCode = optString2.hashCode();
if (hashCode == 99650) {
if (optString2.equals("dom")) {
String optString3 = optJSONObject3.optString("method");
kotlin.jvm.internal.n.e(optString3, "method");
if (t.L(optString3, "Network.", false, 2, (Object) null)) {
return;
}
if (f74z == null) {
a(a.DOM, jSONObject2);
return;
}
synchronized (o) {
try {
RemoteDebugManager remoteDebugManager = B;
if (!remoteDebugManager.i().isEmpty()) {
remoteDebugManager.a(a.DOM);
}
g0 g0Var = w;
FLog.i$default("RemoteDebugManager", "write to domSocket:" + jSONObject2 + " \n" + (g0Var != null ? Boolean.valueOf(g0Var.a(jSONObject2)) : null), null, 4, null);
e0 e0Var = e0.a;
} catch (Throwable th2) {
throw th2;
}
}
return;
}
return;
}
if (hashCode != 1550962648) {
if (hashCode == 1843485230 && optString2.equals("network")) {
if (!x) {
a(a.NETWORK, jSONObject2);
return;
}
synchronized (m) {
try {
RemoteDebugManager remoteDebugManager2 = B;
if (!remoteDebugManager2.j().isEmpty()) {
remoteDebugManager2.a(a.NETWORK);
}
g0 g0Var2 = u;
FLog.i$default("RemoteDebugManager", "write to networkSocket:" + jSONObject2 + " \n" + (g0Var2 != null ? Boolean.valueOf(g0Var2.a(jSONObject2)) : null), null, 4, null);
e0 e0Var2 = e0.a;
} finally {
}
}
return;
}
return;
}
if (optString2.equals("runtime")) {
if (i) {
Handler handler = h;
if (handler != null) {
handler.sendMessage(handler.obtainMessage(1, jSONObject2));
JSONObject optJSONObject5 = optJSONObject4.optJSONObject("data");
if (kotlin.jvm.internal.n.d(optJSONObject5 != null ? optJSONObject5.optString("method") : null, com.finogeeks.lib.applet.debugger.j2v8.c.j.b())) {
handler.sendMessage(handler.obtainMessage(4, jSONObject2));
return;
}
return;
}
return;
}
String optString4 = optJSONObject3.optString("method");
kotlin.jvm.internal.n.e(optString4, "method");
if (t.L(optString4, "Network.", false, 2, (Object) null)) {
return;
}
if (!f73y) {
a(a.RUNTIME, jSONObject2);
return;
}
synchronized (n) {
try {
RemoteDebugManager remoteDebugManager3 = B;
if (!remoteDebugManager3.k().isEmpty()) {
remoteDebugManager3.a(a.RUNTIME);
}
g0 g0Var3 = v;
FLog.i$default("RemoteDebugManager", "write to runtimeSocket:" + jSONObject2 + " \n" + (g0Var3 != null ? Boolean.valueOf(g0Var3.a(jSONObject2)) : null), null, 4, null);
e0 e0Var3 = e0.a;
} catch (Throwable th3) {
throw th3;
}
}
}
}
public static final g0 e(RemoteDebugManager remoteDebugManager) {
return t;
}
public final void e() {
g0 g0Var = t;
if (g0Var != null) {
g0Var.a(4000, "close");
}
t = null;
}
public final void f() {
c();
String a2 = com.finogeeks.lib.applet.debugger.j.a.a("_ide_remote");
com.finogeeks.lib.applet.debugger.client.c l2 = l();
if (l2 != null) {
com.finogeeks.lib.applet.f.c.t a3 = l2.a(a2, "inspector", null, null);
FLog.i$default("RemoteDebugManager", "connectToNetworkSocket", null, 4, null);
u = a(l2).a(new a0.a().a(a3).a(), new c());
}
}
public static final boolean f(RemoteDebugManager remoteDebugManager) {
return e;
}
public final com.finogeeks.lib.applet.debugger.h.a g() {
lg0.h hVar = p;
hh0.l lVar = a[3];
return (com.finogeeks.lib.applet.debugger.h.a) hVar.getValue();
}
private final x h() {
lg0.h hVar = q;
hh0.l lVar = a[4];
return (x) hVar.getValue();
}
private final CopyOnWriteArrayList<String> i() {
lg0.h hVar = l;
hh0.l lVar = a[2];
return (CopyOnWriteArrayList) hVar.getValue();
}
private final CopyOnWriteArrayList<String> j() {
lg0.h hVar = j;
hh0.l lVar = a[0];
return (CopyOnWriteArrayList) hVar.getValue();
}
private final CopyOnWriteArrayList<String> k() {
lg0.h hVar = k;
hh0.l lVar = a[1];
return (CopyOnWriteArrayList) hVar.getValue();
}
private final com.finogeeks.lib.applet.debugger.client.c l() {
return r;
}
public final void m() {
FLog.i$default("RemoteDebugManager", "notifyDomDocumentUpdated", null, 4, null);
String jSONObject = ((JSONObject) g().a(new com.finogeeks.lib.applet.debugger.client.d.c(new com.finogeeks.lib.applet.debugger.client.d.a("dom", new com.finogeeks.lib.applet.debugger.f.i.g.b(null, "DOM.documentUpdated", null))), JSONObject.class)).toString();
kotlin.jvm.internal.n.e(jSONObject, "objectMapper.convertValu…t::class.java).toString()");
g0 g0Var = t;
FLog.i$default("RemoteDebugManager", "sent to server:" + jSONObject + " \n" + (g0Var != null ? Boolean.valueOf(g0Var.a(jSONObject)) : null), null, 4, null);
}
public final void n() {
a(R.string.fin_applet_remote_debug_connect_failure);
}
public final void o() {
a(R.string.fin_applet_remote_debug_disconnected);
}
private final void p() {
a(R.string.fin_applet_remote_debug_illegal_argument);
}
public final void a() {
RemoteDebugManager remoteDebugManager;
if (e) {
Dialog dialog = A;
if (dialog != null) {
dialog.dismiss();
}
A = null;
b = null;
c = null;
r = null;
for (g0 g0Var : s) {
FLog.i$default("RemoteDebugManager", "close connecting serverSocket:" + g0Var.a().g(), null, 4, null);
g0Var.a(4000, "close connecting serverSocket");
}
s.clear();
e();
c();
b();
d();
Handler handler = h;
if (handler != null) {
handler.sendMessage(handler.obtainMessage(5));
}
h = null;
com.finogeeks.lib.applet.debugger.j2v8.k.i.d();
f74z = null;
synchronized (m) {
remoteDebugManager = B;
remoteDebugManager.j().clear();
e0 e0Var = e0.a;
}
synchronized (n) {
remoteDebugManager.k().clear();
}
synchronized (o) {
remoteDebugManager.i().clear();
}
e = false;
}
}
public final void a(Activity activity, Host host, String str, List<String> list) {
kotlin.jvm.internal.n.j(activity, "activity");
kotlin.jvm.internal.n.j(host, "host");
b = activity;
c = host;
if (str == null) {
FLog.e$default("RemoteDebugManager", "channelId is null!", null, 4, null);
p();
return;
}
if (list == null || list.isEmpty()) {
FLog.e$default("RemoteDebugManager", "serverUrls is null or empty!", null, 4, null);
p();
return;
}
e = true;
j().clear();
k().clear();
i().clear();
i = false;
d = str;
r = new com.finogeeks.lib.applet.debugger.client.c();
if (!f) {
WebView.INSTANCE.a(true);
com.finogeeks.lib.applet.debugger.a.a(activity.getApplicationContext(), o.a);
f = true;
}
if (g && u == null) {
f();
}
Iterator<T> it = list.iterator();
while (it.hasNext()) {
B.c((String) it.next());
}
}
public final void a(Handler handler) {
kotlin.jvm.internal.n.j(handler, "handler");
i = true;
h = handler;
}
public final void a(String str) {
kotlin.jvm.internal.n.j(str, "webViewId");
if (e && !kotlin.jvm.internal.n.d(str, f74z)) {
b();
a(new b(str));
}
}
public final void b(String str) {
kotlin.jvm.internal.n.j(str, "webViewId");
if (e) {
d();
a(new d(str));
}
}
}