小红书.apk(点击下载) / e.java


package wu2;

import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.IBinder;
import android.os.Message;
import android.os.Process;
import android.os.RemoteException;
import android.os.SystemClock;
import bv2.a;
import bv2.b;
import bv2.c;
import com.tencent.matrix.plugin.PluginShareConstants;
import com.xingin.entities.HashTagListBean;
import com.xingin.xynetcore.common.AccountInfo;
import com.xingin.xynetcore.common.DeviceInfo;
import com.xingin.xynetcore.common.LogConfig;
import com.xingin.xynetcore.common.LonglinkConfig;
import com.xingin.xynetcore.common.NetworkDetectConfig;
import com.xingin.xynetcore.common.TaskProperties;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import kotlin.Metadata;
import kotlin.TypeCastException;
import kotlin.Unit;
import kotlin.collections.ArraysKt___ArraysKt;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Ref;
import kotlin.text.StringsKt__StringsJVMKt;
import wu2.c;
import x9.y0;
import x9.z0;
import xylonglink.com.google.protobuf.InvalidProtocolBufferException;

@Metadata(bv = {}, d1 = {"\u0000¤\u0001\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\b\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0010\u0012\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\t\bÆ\u0002\u0018\u00002\u00020\u0001:\u0002HIB\t\b\u0002¢\u0006\u0004\bF\u0010GJ\b\u0010\u0003\u001a\u00020\u0002H\u0002J\b\u0010\u0004\u001a\u00020\u0002H\u0002J\u0010\u0010\u0007\u001a\u00020\u00022\u0006\u0010\u0006\u001a\u00020\u0005H\u0002J\u0012\u0010\n\u001a\u00020\u00022\b\u0010\t\u001a\u0004\u0018\u00010\bH\u0002J\u0012\u0010\f\u001a\u00020\u00022\b\u0010\t\u001a\u0004\u0018\u00010\u000bH\u0002J\u0012\u0010\u000e\u001a\u00020\u00022\b\u0010\t\u001a\u0004\u0018\u00010\rH\u0002J\u0018\u0010\u0013\u001a\u00020\u00022\u0006\u0010\u0010\u001a\u00020\u000f2\u0006\u0010\u0012\u001a\u00020\u0011H\u0002JN\u0010!\u001a\u00020\u00022\u0006\u0010\u0015\u001a\u00020\u00142\u0006\u0010\u0016\u001a\u00020\u000f2\u0006\u0010\u0017\u001a\u00020\u000f2\u0006\u0010\u0018\u001a\u00020\u000f2\u0006\u0010\u0019\u001a\u00020\u000f2\u0006\u0010\u001b\u001a\u00020\u001a2\u0006\u0010\u001d\u001a\u00020\u001c2\u0006\u0010\u001f\u001a\u00020\u001e2\u0006\u0010\u0012\u001a\u00020 J\u000e\u0010$\u001a\u00020\u00022\u0006\u0010#\u001a\u00020\"J\u0006\u0010%\u001a\u00020\u0002J\u0006\u0010&\u001a\u00020\u0002J\u0006\u0010'\u001a\u00020\u0002J\u0010\u0010)\u001a\u00020\u00022\b\b\u0002\u0010(\u001a\u00020\"J\u0006\u0010*\u001a\u00020\u0002J\u0006\u0010,\u001a\u00020+J\u0016\u00101\u001a\u00020\u00022\u0006\u0010.\u001a\u00020-2\u0006\u00100\u001a\u00020/J\u000e\u00104\u001a\u00020\u00022\u0006\u00103\u001a\u000202J\b\u00105\u001a\u0004\u0018\u00010\u000fJ\f\u00108\u001a\b\u0012\u0004\u0012\u00020706J\f\u00109\u001a\b\u0012\u0004\u0012\u00020706J\f\u0010;\u001a\b\u0012\u0004\u0012\u00020:06J\u0014\u0010=\u001a\b\u0012\u0004\u0012\u00020<062\u0006\u0010\u0010\u001a\u00020\u000fJ\u000e\u0010>\u001a\u00020\u00022\u0006\u0010\u0010\u001a\u00020\u000fJ\u0006\u0010?\u001a\u00020\u0002R\u001d\u0010B\u001a\b\u0012\u0004\u0012\u00020A0@8\u0006¢\u0006\f\n\u0004\bB\u0010C\u001a\u0004\bD\u0010E¨\u0006J"}, d2 = {"Lwu2/e;", "", "", "w", "C", "Lwu2/e$a;", "r", "H", "Lwu2/a;", "cb", "L", "Lwu2/d;", "N", "Lwu2/b;", "M", "", HashTagListBean.HashTag.TYPE_TOPIC, "Lwu2/c;", "callback", "I", "Landroid/content/Context;", "appContext", "appVersion", "deviceId", "deviceName", "fingerPrint", "Lcom/xingin/xynetcore/common/LonglinkConfig;", "config", "Lcom/xingin/xynetcore/common/NetworkDetectConfig;", "networkDetectConfig", "Lcom/xingin/xynetcore/common/LogConfig;", "logConfig", "Lwu2/e$b;", "B", "", "foreground", "G", "E", "F", "x", "transformProcess", "y", "J", "", "A", "Lcom/xingin/xynetcore/common/AccountInfo;", "accountInfo", "Lcom/xingin/xynetcore/common/DeviceInfo;", "deviceInfo", "D", "Lyu2/a;", "task", "K", "v", "Ldw2/r;", "", "O", "R", "Lx9/y0;", "P", "Lwu2/c$a;", "Q", "T", "S", "Ldx2/d;", "Lxu2/c;", "longlinkEventSubject", "Ldx2/d;", "z", "()Ldx2/d;", "<init>", "()V", "a", "b", "xynetcore_android_release"}, k = 1, mv = {1, 4, 0})
/* compiled from: XyLonglink.kt */
public final class e {

    /* renamed from: a  reason: collision with root package name */
    public static final dx2.d<xu2.c> f151413a;

    /* renamed from: b  reason: collision with root package name */
    public static final bv2.a f151414b = new j();

    /* renamed from: c  reason: collision with root package name */
    public static b f151415c = null;

    /* renamed from: d  reason: collision with root package name */
    public static Context f151416d = null;

    /* renamed from: e  reason: collision with root package name */
    public static String f151417e = "";

    /* renamed from: f  reason: collision with root package name */
    public static String f151418f = "";

    /* renamed from: g  reason: collision with root package name */
    public static String f151419g = "";

    /* renamed from: h  reason: collision with root package name */
    public static String f151420h = "";

    /* renamed from: i  reason: collision with root package name */
    public static int f151421i = 0;

    /* renamed from: j  reason: collision with root package name */
    public static WeakReference<HandlerThread> f151422j = null;

    /* renamed from: k  reason: collision with root package name */
    public static Handler f151423k = null;

    /* renamed from: l  reason: collision with root package name */
    public static final List<a> f151424l = new LinkedList();

    /* renamed from: m  reason: collision with root package name */
    public static final Handler.Callback f151425m = r.f151451a;

    /* renamed from: n  reason: collision with root package name */
    public static final String f151426n = f151426n;

    /* renamed from: o  reason: collision with root package name */
    public static com.xingin.xynetcore.c f151427o;

    /* renamed from: p  reason: collision with root package name */
    public static bv2.b f151428p;

    /* renamed from: q  reason: collision with root package name */
    public static LonglinkConfig f151429q;

    /* renamed from: r  reason: collision with root package name */
    public static LogConfig f151430r;

    /* renamed from: s  reason: collision with root package name */
    public static NetworkDetectConfig f151431s;

    /* renamed from: t  reason: collision with root package name */
    public static final ServiceConnection f151432t = new k();

    /* renamed from: u  reason: collision with root package name */
    public static a f151433u;

    /* renamed from: v  reason: collision with root package name */
    public static d f151434v;

    /* renamed from: w  reason: collision with root package name */
    public static final LinkedHashMap<String, c> f151435w = new LinkedHashMap<>();

    /* renamed from: x  reason: collision with root package name */
    public static b f151436x;

    /* renamed from: y  reason: collision with root package name */
    public static final e f151437y = new e();

    @Metadata(bv = {}, d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0004\b\"\u0018\u00002\u00020\u0001B\u000f\u0012\u0006\u0010\u0006\u001a\u00020\u0005¢\u0006\u0004\b\u0007\u0010\bJ\u0006\u0010\u0003\u001a\u00020\u0002J\b\u0010\u0004\u001a\u00020\u0002H&¨\u0006\t"}, d2 = {"Lwu2/e$a;", "", "", "b", "a", "", "name", "<init>", "(Ljava/lang/String;)V", "xynetcore_android_release"}, k = 1, mv = {1, 4, 0})
    /* compiled from: XyLonglink.kt */
    public static abstract class a {

        /* renamed from: a  reason: collision with root package name */
        public final String f151438a;

        public a(String str) {
            Intrinsics.checkParameterIsNotNull(str, "name");
            this.f151438a = str;
        }

        public abstract void a();

        public final void b() {
            long elapsedRealtime = SystemClock.elapsedRealtime();
            a();
            f fVar = f.f151453b;
            fVar.c("XyLonglink", "Action:[" + this.f151438a + "] costs: " + (SystemClock.elapsedRealtime() - elapsedRealtime));
        }
    }

    @Metadata(bv = {}, d1 = {"\u0000D\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\u0011\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\b\u0004\n\u0002\u0010\u0012\n\u0002\b\b\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\bf\u0018\u00002\u00020\u0001J\u001f\u0010\u0005\u001a\b\u0012\u0004\u0012\u00020\u00020\u00042\b\u0010\u0003\u001a\u0004\u0018\u00010\u0002H&¢\u0006\u0004\b\u0005\u0010\u0006J\u0018\u0010\u000b\u001a\u00020\n2\u0006\u0010\b\u001a\u00020\u00072\u0006\u0010\t\u001a\u00020\u0002H&J\u0012\u0010\r\u001a\u00020\n2\b\u0010\f\u001a\u0004\u0018\u00010\u0002H&J\u0018\u0010\u000e\u001a\u00020\n2\u0006\u0010\b\u001a\u00020\u00072\u0006\u0010\t\u001a\u00020\u0002H&J\u0012\u0010\u0011\u001a\u00020\n2\b\u0010\u0010\u001a\u0004\u0018\u00010\u000fH&J\u0012\u0010\u0013\u001a\u00020\n2\b\u0010\u0012\u001a\u0004\u0018\u00010\u000fH&J\u0012\u0010\u0015\u001a\u00020\n2\b\u0010\u0014\u001a\u0004\u0018\u00010\u000fH&J\u0012\u0010\u0017\u001a\u00020\n2\b\u0010\u0016\u001a\u0004\u0018\u00010\u000fH&J\u0010\u0010\u001a\u001a\u00020\n2\u0006\u0010\u0019\u001a\u00020\u0018H&J\b\u0010\u001b\u001a\u00020\u0018H&J\u0018\u0010 \u001a\u00020\u00182\u0006\u0010\u001d\u001a\u00020\u001c2\u0006\u0010\u001f\u001a\u00020\u001eH&¨\u0006!"}, d2 = {"Lwu2/e$b;", "", "", com.alipay.sdk.cons.c.f18128f, "", "onNewDns", "(Ljava/lang/String;)[Ljava/lang/String;", "", "status", "desc", "", "onSessionStatusChanged", "uid", "onKicked", "onLongLinkStatusChange", "", "connectProfilePb", "reportConnectProfile", "taskProfilePb", "reportTaskProfile", "noopProfilePb", "reportNoopProfile", "dnsProfilePb", "reportDnsProfile", "", PluginShareConstants.MemoryCanaryShareKeys.AVAILABLE, "reportNetworkDetectResult", "isAppForeground", "Lcom/xingin/xynetcore/common/AccountInfo;", "accountInfo", "Lcom/xingin/xynetcore/common/DeviceInfo;", "deviceInfo", "requestLogin", "xynetcore_android_release"}, k = 1, mv = {1, 4, 0})
    /* compiled from: XyLonglink.kt */
    public interface b {
        boolean isAppForeground();

        void onKicked(String str);

        void onLongLinkStatusChange(int i10, String str);

        String[] onNewDns(String str);

        void onSessionStatusChanged(int i10, String str);

        void reportConnectProfile(byte[] bArr);

        void reportDnsProfile(byte[] bArr);

        void reportNetworkDetectResult(boolean z14);

        void reportNoopProfile(byte[] bArr);

        void reportTaskProfile(byte[] bArr);

        boolean requestLogin(AccountInfo accountInfo, DeviceInfo deviceInfo);
    }

    @Metadata(bv = {}, d1 = {"\u0000\u0011\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\b\u0002*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\b\u0010\u0003\u001a\u00020\u0002H\u0016¨\u0006\u0004"}, d2 = {"wu2/e$c", "Lwu2/e$a;", "", "a", "xynetcore_android_release"}, k = 1, mv = {1, 4, 0})
    /* compiled from: XyLonglink.kt */
    public static final class c extends a {
        public c(String str) {
            super(str);
        }

        @Override // wu2.e.a
        public void a() {
            e eVar = e.f151437y;
            synchronized (e.f151426n) {
                try {
                    LonglinkConfig longlinkConfig = e.f151429q;
                    if (longlinkConfig == null || !longlinkConfig.d()) {
                        bv2.b bVar = e.f151428p;
                        if (bVar != null) {
                            bVar.b0();
                            Unit unit = Unit.INSTANCE;
                        }
                    } else {
                        com.xingin.xynetcore.c cVar = e.f151427o;
                        if (cVar != null) {
                            cVar.d();
                            Unit unit2 = Unit.INSTANCE;
                        }
                    }
                } catch (RemoteException e14) {
                    e14.printStackTrace();
                    Unit unit3 = Unit.INSTANCE;
                }
            }
            return;
        }
    }

    @Metadata(bv = {}, d1 = {"\u0000\u0011\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\b\u0002*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\b\u0010\u0003\u001a\u00020\u0002H\u0016¨\u0006\u0004"}, d2 = {"wu2/e$d", "Lwu2/e$a;", "", "a", "xynetcore_android_release"}, k = 1, mv = {1, 4, 0})
    /* compiled from: XyLonglink.kt */
    public static final class d extends a {

        /* renamed from: b  reason: collision with root package name */
        public final /* synthetic */ boolean f151439b;

        /* JADX INFO: super call moved to the top of the method (can break code semantics) */
        public d(boolean z14, String str) {
            super(str);
            this.f151439b = z14;
        }

        @Override // wu2.e.a
        public void a() {
            e eVar = e.f151437y;
            synchronized (e.f151426n) {
                try {
                    LonglinkConfig longlinkConfig = e.f151429q;
                    boolean z14 = false;
                    if (longlinkConfig == null || !longlinkConfig.d()) {
                        bv2.b bVar = e.f151428p;
                        if (bVar != null) {
                            bVar.deinit();
                        }
                        if (this.f151439b) {
                            LonglinkConfig longlinkConfig2 = e.f151429q;
                            if (longlinkConfig2 != null) {
                                if (!longlinkConfig2.d()) {
                                    z14 = true;
                                }
                                longlinkConfig2.j(z14);
                            }
                            eVar.J();
                        }
                        Unit unit = Unit.INSTANCE;
                    } else {
                        com.xingin.xynetcore.c cVar = e.f151427o;
                        if (cVar != null) {
                            cVar.e();
                        }
                        if (this.f151439b) {
                            LonglinkConfig longlinkConfig3 = e.f151429q;
                            if (longlinkConfig3 != null) {
                                if (!longlinkConfig3.d()) {
                                    z14 = true;
                                }
                                longlinkConfig3.j(z14);
                            }
                            eVar.J();
                        }
                        Unit unit2 = Unit.INSTANCE;
                    }
                } catch (RemoteException e14) {
                    e14.printStackTrace();
                }
            }
        }
    }

    @Metadata(bv = {}, d1 = {"\u0000\u0011\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\b\u0002*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\b\u0010\u0003\u001a\u00020\u0002H\u0016¨\u0006\u0004"}, d2 = {"wu2/e$e", "Lwu2/e$a;", "", "a", "xynetcore_android_release"}, k = 1, mv = {1, 4, 0})
    /* renamed from: wu2.e$e  reason: collision with other inner class name */
    /* compiled from: XyLonglink.kt */
    public static final class C2441e extends a {

        /* renamed from: b  reason: collision with root package name */
        public final /* synthetic */ AccountInfo f151440b;

        /* renamed from: c  reason: collision with root package name */
        public final /* synthetic */ DeviceInfo f151441c;

        /* JADX INFO: super call moved to the top of the method (can break code semantics) */
        public C2441e(AccountInfo accountInfo, DeviceInfo deviceInfo, String str) {
            super(str);
            this.f151440b = accountInfo;
            this.f151441c = deviceInfo;
        }

        @Override // wu2.e.a
        public void a() {
            Message obtainMessage;
            f fVar = f.f151453b;
            fVar.c("XyLonglink", "call netcoreService?.login: " + this.f151440b.f65779c + ": " + this.f151440b.f65779c + ", " + this.f151440b.f65778b);
            e eVar = e.f151437y;
            synchronized (e.f151426n) {
                try {
                    LonglinkConfig longlinkConfig = e.f151429q;
                    if (longlinkConfig == null || !longlinkConfig.d()) {
                        bv2.b bVar = e.f151428p;
                        if (bVar != null) {
                            bVar.x(this.f151440b, this.f151441c);
                            Unit unit = Unit.INSTANCE;
                        }
                    } else {
                        com.xingin.xynetcore.c cVar = e.f151427o;
                        if (cVar != null) {
                            cVar.i(this.f151440b, this.f151441c);
                            Unit unit2 = Unit.INSTANCE;
                        }
                    }
                } catch (RemoteException e14) {
                    e eVar2 = e.f151437y;
                    Handler handler = e.f151423k;
                    if (!(handler == null || (obtainMessage = handler.obtainMessage(3)) == null)) {
                        obtainMessage.sendToTarget();
                    }
                    e14.printStackTrace();
                    f fVar2 = f.f151453b;
                    fVar2.b("XyLonglink", "RemoteException while calling netcoreService?.login: " + this.f151440b.f65779c + ": " + this.f151440b.f65779c + ", " + this.f151440b.f65778b, e14);
                    Unit unit3 = Unit.INSTANCE;
                }
            }
        }
    }

    @Metadata(bv = {}, d1 = {"\u0000\u0011\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\b\u0002*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\b\u0010\u0003\u001a\u00020\u0002H\u0016¨\u0006\u0004"}, d2 = {"wu2/e$f", "Lwu2/e$a;", "", "a", "xynetcore_android_release"}, k = 1, mv = {1, 4, 0})
    /* compiled from: XyLonglink.kt */
    public static final class f extends a {
        public f(String str) {
            super(str);
        }

        @Override // wu2.e.a
        public void a() {
            Message obtainMessage;
            f.f151453b.c("XyLonglink", "call netcoreService?.makeSureConnected");
            e eVar = e.f151437y;
            synchronized (e.f151426n) {
                try {
                    LonglinkConfig longlinkConfig = e.f151429q;
                    if (longlinkConfig == null || !longlinkConfig.d()) {
                        bv2.b bVar = e.f151428p;
                        if (bVar != null) {
                            bVar.Z();
                            Unit unit = Unit.INSTANCE;
                        }
                    } else {
                        com.xingin.xynetcore.c cVar = e.f151427o;
                        if (cVar != null) {
                            cVar.j();
                            Unit unit2 = Unit.INSTANCE;
                        }
                    }
                } catch (RemoteException e14) {
                    e eVar2 = e.f151437y;
                    Handler handler = e.f151423k;
                    if (!(handler == null || (obtainMessage = handler.obtainMessage(3)) == null)) {
                        obtainMessage.sendToTarget();
                    }
                    e14.printStackTrace();
                    f.f151453b.b("XyLonglink", "RemoteException while calling netcoreService?.makeSureConnected", e14);
                    Unit unit3 = Unit.INSTANCE;
                }
            }
        }
    }

    @Metadata(bv = {}, d1 = {"\u0000\u0011\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\b\u0002*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\b\u0010\u0003\u001a\u00020\u0002H\u0016¨\u0006\u0004"}, d2 = {"wu2/e$g", "Lwu2/e$a;", "", "a", "xynetcore_android_release"}, k = 1, mv = {1, 4, 0})
    /* compiled from: XyLonglink.kt */
    public static final class g extends a {
        public g(String str) {
            super(str);
        }

        @Override // wu2.e.a
        public void a() {
            Message obtainMessage;
            f.f151453b.c("XyLonglink", "call netcoreService?.manualPingPong");
            e eVar = e.f151437y;
            synchronized (e.f151426n) {
                try {
                    LonglinkConfig longlinkConfig = e.f151429q;
                    if (longlinkConfig == null || !longlinkConfig.d()) {
                        bv2.b bVar = e.f151428p;
                        if (bVar != null) {
                            bVar.P0();
                            Unit unit = Unit.INSTANCE;
                        }
                    } else {
                        com.xingin.xynetcore.c cVar = e.f151427o;
                        if (cVar != null) {
                            cVar.k();
                            Unit unit2 = Unit.INSTANCE;
                        }
                    }
                } catch (RemoteException e14) {
                    e eVar2 = e.f151437y;
                    Handler handler = e.f151423k;
                    if (!(handler == null || (obtainMessage = handler.obtainMessage(3)) == null)) {
                        obtainMessage.sendToTarget();
                    }
                    e14.printStackTrace();
                    f.f151453b.b("XyLonglink", "RemoteException while calling netcoreService?.manualPingPong", e14);
                    Unit unit3 = Unit.INSTANCE;
                }
            }
        }
    }

    @Metadata(bv = {}, d1 = {"\u0000\u0011\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\b\u0002*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\b\u0010\u0003\u001a\u00020\u0002H\u0016¨\u0006\u0004"}, d2 = {"wu2/e$h", "Lwu2/e$a;", "", "a", "xynetcore_android_release"}, k = 1, mv = {1, 4, 0})
    /* compiled from: XyLonglink.kt */
    public static final class h extends a {

        /* renamed from: b  reason: collision with root package name */
        public final /* synthetic */ boolean f151442b;

        /* JADX INFO: super call moved to the top of the method (can break code semantics) */
        public h(boolean z14, String str) {
            super(str);
            this.f151442b = z14;
        }

        @Override // wu2.e.a
        public void a() {
            Message obtainMessage;
            f fVar = f.f151453b;
            fVar.c("XyLonglink", "call netcoreService?.onForeground: " + this.f151442b);
            e eVar = e.f151437y;
            synchronized (e.f151426n) {
                try {
                    LonglinkConfig longlinkConfig = e.f151429q;
                    if (longlinkConfig == null || !longlinkConfig.d()) {
                        bv2.b bVar = e.f151428p;
                        if (bVar != null) {
                            bVar.onForeground(this.f151442b);
                            Unit unit = Unit.INSTANCE;
                        }
                    } else {
                        com.xingin.xynetcore.c cVar = e.f151427o;
                        if (cVar != null) {
                            cVar.l(this.f151442b);
                            Unit unit2 = Unit.INSTANCE;
                        }
                    }
                } catch (RemoteException e14) {
                    e eVar2 = e.f151437y;
                    Handler handler = e.f151423k;
                    if (!(handler == null || (obtainMessage = handler.obtainMessage(3)) == null)) {
                        obtainMessage.sendToTarget();
                    }
                    e14.printStackTrace();
                    f fVar2 = f.f151453b;
                    fVar2.b("XyLonglink", "RemoteException while calling netcoreService?.onForeground: " + this.f151442b, e14);
                    Unit unit3 = Unit.INSTANCE;
                }
            }
        }
    }

    @Metadata(bv = {}, d1 = {"\u0000\u0011\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\b\u0002*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\b\u0010\u0003\u001a\u00020\u0002H\u0016¨\u0006\u0004"}, d2 = {"wu2/e$i", "Lwu2/e$a;", "", "a", "xynetcore_android_release"}, k = 1, mv = {1, 4, 0})
    /* compiled from: XyLonglink.kt */
    public static final class i extends a {
        public i(String str) {
            super(str);
        }

        @Override // wu2.e.a
        public void a() {
            NetworkDetectConfig networkDetectConfig;
            LogConfig logConfig;
            com.xingin.xynetcore.c cVar;
            e eVar = e.f151437y;
            synchronized (e.f151426n) {
                try {
                    LonglinkConfig longlinkConfig = e.f151429q;
                    if (longlinkConfig == null || !longlinkConfig.d()) {
                        bv2.b bVar = e.f151428p;
                        if (bVar != null) {
                            bVar.U(e.f151429q, e.f151431s, e.f151430r, e.f151414b);
                            Unit unit = Unit.INSTANCE;
                        }
                    } else {
                        LonglinkConfig longlinkConfig2 = e.f151429q;
                        if (!(longlinkConfig2 == null || (networkDetectConfig = e.f151431s) == null || (logConfig = e.f151430r) == null || (cVar = e.f151427o) == null)) {
                            cVar.h(longlinkConfig2, networkDetectConfig, logConfig, e.f151414b);
                            Unit unit2 = Unit.INSTANCE;
                        }
                    }
                } catch (RemoteException e14) {
                    e14.printStackTrace();
                    Unit unit3 = Unit.INSTANCE;
                }
            }
            return;
        }
    }

    @Metadata(bv = {}, d1 = {"\u0000C\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\u0011\n\u0002\b\u0002\n\u0002\u0010\u0012\n\u0000\n\u0002\u0010\b\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0002\b\f\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\u001f\u0010\u0005\u001a\b\u0012\u0004\u0012\u00020\u00020\u00042\b\u0010\u0003\u001a\u0004\u0018\u00010\u0002H\u0016¢\u0006\u0004\b\u0005\u0010\u0006J\u0012\u0010\n\u001a\u00020\t2\b\u0010\b\u001a\u0004\u0018\u00010\u0007H\u0016J\u0012\u0010\u000b\u001a\u00020\t2\b\u0010\b\u001a\u0004\u0018\u00010\u0007H\u0016J\u0012\u0010\f\u001a\u00020\t2\b\u0010\b\u001a\u0004\u0018\u00010\u0007H\u0016J\u0012\u0010\r\u001a\u00020\t2\b\u0010\b\u001a\u0004\u0018\u00010\u0007H\u0016J\u0010\u0010\u0010\u001a\u00020\u000f2\u0006\u0010\u000e\u001a\u00020\tH\u0016J\u0012\u0010\u0012\u001a\u00020\u000f2\b\u0010\u0011\u001a\u0004\u0018\u00010\u0002H\u0016J\u0010\u0010\u0013\u001a\u00020\u000f2\u0006\u0010\u000e\u001a\u00020\tH\u0016J\u0012\u0010\u0015\u001a\u00020\u000f2\b\u0010\u0014\u001a\u0004\u0018\u00010\u0007H\u0016J\u0012\u0010\u0017\u001a\u00020\u000f2\b\u0010\u0016\u001a\u0004\u0018\u00010\u0007H\u0016J\u0012\u0010\u0019\u001a\u00020\u000f2\b\u0010\u0018\u001a\u0004\u0018\u00010\u0007H\u0016J\u0012\u0010\u001b\u001a\u00020\u000f2\b\u0010\u001a\u001a\u0004\u0018\u00010\u0007H\u0016J\u0010\u0010\u001e\u001a\u00020\u000f2\u0006\u0010\u001d\u001a\u00020\u001cH\u0016J\b\u0010\u001f\u001a\u00020\u001cH\u0016J\u0018\u0010$\u001a\u00020\u001c2\u0006\u0010!\u001a\u00020 2\u0006\u0010#\u001a\u00020\"H\u0016¨\u0006%"}, d2 = {"wu2/e$j", "Lbv2/a$a;", "", com.alipay.sdk.cons.c.f18128f, "", "onNewDns", "(Ljava/lang/String;)[Ljava/lang/String;", "", "buf", "", "l", "g", "G0", "a", "status", "", "S", "uid", "onKicked", "k0", "connectProfilePb", "reportConnectProfile", "taskProfilePb", "reportTaskProfile", "noopProfilePb", "reportNoopProfile", "dnsProfilePb", "reportDnsProfile", "", PluginShareConstants.MemoryCanaryShareKeys.AVAILABLE, "reportNetworkDetectResult", "isAppForeground", "Lcom/xingin/xynetcore/common/AccountInfo;", "accountInfo", "Lcom/xingin/xynetcore/common/DeviceInfo;", "deviceInfo", "requestLogin", "xynetcore_android_release"}, k = 1, mv = {1, 4, 0})
    /* compiled from: XyLonglink.kt */
    public static final class j extends a.AbstractBinderC0145a {
        @Override // bv2.a
        public int G0(byte[] bArr) {
            Ref.ObjectRef objectRef = new Ref.ObjectRef();
            synchronized (e.f151437y) {
                objectRef.element = (T) e.f151433u;
                Unit unit = Unit.INSTANCE;
            }
            f fVar = f.f151453b;
            fVar.c("XyLonglink", "onSignal recvd, chatCallback= " + ((Object) objectRef.element));
            T t14 = objectRef.element;
            if (t14 == null) {
                return 0;
            }
            t14.g(bArr);
            return 0;
        }

        @Override // bv2.a
        public void S(int i10) {
            String str = i10 != -5 ? i10 != -4 ? i10 != -3 ? i10 != -2 ? i10 != -1 ? "unknown" : "EIdle" : "ELoggingIn" : "ELoggedIn" : "ELoggingOut" : "EEnd";
            f fVar = f.f151453b;
            fVar.c("XyLonglink", "onSessionStatusChanged: " + i10);
            e eVar = e.f151437y;
            b bVar = e.f151415c;
            if (bVar != null) {
                bVar.onSessionStatusChanged(i10, str);
            }
            eVar.z().a(new xu2.e(xu2.e.f156079b.a(i10)));
        }

        @Override // bv2.a
        public int a(byte[] bArr) {
            Ref.ObjectRef objectRef = new Ref.ObjectRef();
            synchronized (e.f151437y) {
                objectRef.element = (T) e.f151434v;
                Unit unit = Unit.INSTANCE;
            }
            f fVar = f.f151453b;
            fVar.c("XyLonglink", "onRoom recvd, roomCallback= " + ((Object) objectRef.element));
            T t14 = objectRef.element;
            if (t14 == null) {
                return 0;
            }
            t14.a(bArr);
            return 0;
        }

        @Override // bv2.a
        public int g(byte[] bArr) {
            Ref.ObjectRef objectRef = new Ref.ObjectRef();
            synchronized (e.f151437y) {
                objectRef.element = (T) e.f151433u;
                Unit unit = Unit.INSTANCE;
            }
            f fVar = f.f151453b;
            fVar.c("XyLonglink", "onChat recvd, chatCallback= " + ((Object) objectRef.element));
            T t14 = objectRef.element;
            if (t14 != null) {
                t14.g(bArr);
            }
            return zu2.a.EOK.value();
        }

        @Override // bv2.a
        public boolean isAppForeground() {
            e eVar = e.f151437y;
            b bVar = e.f151415c;
            if (bVar != null) {
                return bVar.isAppForeground();
            }
            return false;
        }

        @Override // bv2.a
        public void k0(int i10) {
            String str = i10 != 0 ? i10 != 1 ? i10 != 2 ? i10 != 3 ? i10 != 4 ? "unknown" : "kConnectFailed" : "kDisConnected" : "kConnected" : "kConnecting" : "kConnectIdle";
            f fVar = f.f151453b;
            fVar.c("XyLonglink", "onLongLinkStatusChange: " + i10);
            e eVar = e.f151437y;
            b bVar = e.f151415c;
            if (bVar != null) {
                bVar.onLongLinkStatusChange(i10, str);
            }
            eVar.z().a(new xu2.b(xu2.b.f156077b.a(i10)));
        }

        /* JADX WARNING: Code restructure failed: missing block: B:24:0x0068, code lost:
            if ((r2 == null || (kotlin.text.StringsKt__StringsJVMKt.isBlank(r2))) == false) goto L_0x006c;
         */
        @Override // bv2.a
        public int l(byte[] bArr) {
            z0 z0Var;
            f.f151453b.c("XyLonglink", "onPush recvd");
            if (bArr != null) {
                y0 y0Var = null;
                try {
                    z0Var = z0.d(bArr);
                } catch (InvalidProtocolBufferException unused) {
                    z0Var = null;
                }
                y0 c14 = z0Var != null ? z0Var.c() : null;
                if (c14 != null) {
                    f.f151453b.c("XyLonglink", "recvd push: " + c14.f() + ", " + c14.d());
                    String f14 = c14.f();
                    boolean z14 = true;
                    if (!(f14 == null || (StringsKt__StringsJVMKt.isBlank(f14)))) {
                        String d14 = c14.d();
                    }
                    z14 = false;
                    if (z14) {
                        y0Var = c14;
                    }
                    if (y0Var != null) {
                        ArrayList<c> arrayList = new ArrayList();
                        e eVar = e.f151437y;
                        synchronized (e.f151435w) {
                            for (Map.Entry entry : e.f151435w.entrySet()) {
                                if (Intrinsics.areEqual((String) entry.getKey(), y0Var.f())) {
                                    arrayList.add(entry.getValue());
                                }
                            }
                            Unit unit = Unit.INSTANCE;
                        }
                        if (arrayList.isEmpty()) {
                            f.f151453b.a("XyLonglink", "no callback for topic:" + y0Var.f());
                        }
                        long g10 = y0Var.g();
                        long e14 = y0Var.e();
                        String d15 = y0Var.d();
                        Intrinsics.checkExpressionValueIsNotNull(d15, "it.payload");
                        c.a aVar = new c.a(g10, e14, d15);
                        f.f151453b.c("XyLonglink", "pushData: ts:" + y0Var.g() + ", pushId:" + y0Var.e() + ", payload:" + y0Var.d());
                        for (c cVar : arrayList) {
                            f.f151453b.c("XyLonglink", "callback push: callback= " + cVar);
                            cVar.a(aVar);
                        }
                        e eVar2 = e.f151437y;
                        b bVar = e.f151436x;
                        if (bVar != null) {
                            bVar.a(y0Var);
                        }
                    }
                }
            }
            return 0;
        }

        @Override // bv2.a
        public void onKicked(String str) {
            f fVar = f.f151453b;
            fVar.c("XyLonglink", "onKicked: " + str);
            e eVar = e.f151437y;
            b bVar = e.f151415c;
            if (bVar != null) {
                bVar.onKicked(str);
            }
        }

        @Override // bv2.a
        public String[] onNewDns(String str) {
            String[] strArr;
            long elapsedRealtime = SystemClock.elapsedRealtime();
            e eVar = e.f151437y;
            b bVar = e.f151415c;
            if (bVar == null || (strArr = bVar.onNewDns(str)) == null) {
                strArr = new String[0];
            }
            f fVar = f.f151453b;
            fVar.c("XyLonglink", "onNewDns: " + str + ": " + ArraysKt___ArraysKt.joinToString$default(strArr, (CharSequence) null, "[", "]", 0, (CharSequence) null, (Function1) null, 57, (Object) null) + ", costs:" + (SystemClock.elapsedRealtime() - elapsedRealtime));
            return strArr;
        }

        @Override // bv2.a
        public void reportConnectProfile(byte[] bArr) {
            e eVar = e.f151437y;
            b bVar = e.f151415c;
            if (bVar != null) {
                bVar.reportConnectProfile(bArr);
            }
        }

        @Override // bv2.a
        public void reportDnsProfile(byte[] bArr) {
            e eVar = e.f151437y;
            b bVar = e.f151415c;
            if (bVar != null) {
                bVar.reportDnsProfile(bArr);
            }
        }

        @Override // bv2.a
        public void reportNetworkDetectResult(boolean z14) {
            e eVar = e.f151437y;
            b bVar = e.f151415c;
            if (bVar != null) {
                bVar.reportNetworkDetectResult(z14);
            }
        }

        @Override // bv2.a
        public void reportNoopProfile(byte[] bArr) {
            e eVar = e.f151437y;
            b bVar = e.f151415c;
            if (bVar != null) {
                bVar.reportNoopProfile(bArr);
            }
        }

        @Override // bv2.a
        public void reportTaskProfile(byte[] bArr) {
            e eVar = e.f151437y;
            b bVar = e.f151415c;
            if (bVar != null) {
                bVar.reportTaskProfile(bArr);
            }
        }

        @Override // bv2.a
        public boolean requestLogin(AccountInfo accountInfo, DeviceInfo deviceInfo) {
            Intrinsics.checkParameterIsNotNull(accountInfo, "accountInfo");
            Intrinsics.checkParameterIsNotNull(deviceInfo, "deviceInfo");
            f fVar = f.f151453b;
            StringBuilder sb3 = new StringBuilder();
            sb3.append("requestLogin: clientCallback = ");
            e eVar = e.f151437y;
            sb3.append(e.f151415c);
            fVar.c("XyLonglink", sb3.toString());
            b bVar = e.f151415c;
            if (bVar != null) {
                return bVar.requestLogin(accountInfo, deviceInfo);
            }
            return false;
        }
    }

    @Metadata(bv = {}, d1 = {"\u0000\u001d\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0003*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\u0018\u0010\u0007\u001a\u00020\u00062\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u0005\u001a\u00020\u0004H\u0016J\u0010\u0010\b\u001a\u00020\u00062\u0006\u0010\u0003\u001a\u00020\u0002H\u0016¨\u0006\t"}, d2 = {"wu2/e$k", "Landroid/content/ServiceConnection;", "Landroid/content/ComponentName;", "name", "Landroid/os/IBinder;", "service", "", "onServiceConnected", "onServiceDisconnected", "xynetcore_android_release"}, k = 1, mv = {1, 4, 0})
    /* compiled from: XyLonglink.kt */
    public static final class k implements ServiceConnection {
        public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
            Message obtainMessage;
            Intrinsics.checkParameterIsNotNull(componentName, "name");
            Intrinsics.checkParameterIsNotNull(iBinder, "service");
            e eVar = e.f151437y;
            Handler handler = e.f151423k;
            if (handler != null && (obtainMessage = handler.obtainMessage(5, iBinder)) != null) {
                obtainMessage.sendToTarget();
            }
        }

        public void onServiceDisconnected(ComponentName componentName) {
            Message obtainMessage;
            Intrinsics.checkParameterIsNotNull(componentName, "name");
            f fVar = f.f151453b;
            fVar.a("XyLonglink", "onServiceDisconnected: " + componentName);
            e eVar = e.f151437y;
            synchronized (e.f151426n) {
                e.f151428p = null;
                Unit unit = Unit.INSTANCE;
            }
            Handler handler = e.f151423k;
            if (handler != null && (obtainMessage = handler.obtainMessage(1)) != null) {
                obtainMessage.sendToTarget();
            }
        }
    }

    @Metadata(bv = {}, d1 = {"\u0000\u0011\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\b\u0002*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\b\u0010\u0003\u001a\u00020\u0002H\u0016¨\u0006\u0004"}, d2 = {"wu2/e$l", "Lwu2/e$a;", "", "a", "xynetcore_android_release"}, k = 1, mv = {1, 4, 0})
    /* compiled from: XyLonglink.kt */
    public static final class l extends a {

        /* renamed from: b  reason: collision with root package name */
        public final /* synthetic */ yu2.a f151443b;

        @Metadata(bv = {}, d1 = {"\u0000\u001f\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0012\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0004*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\n\u0010\u0003\u001a\u0004\u0018\u00010\u0002H\u0016J\u0012\u0010\u0006\u001a\u00020\u00052\b\u0010\u0004\u001a\u0004\u0018\u00010\u0002H\u0016J\u0018\u0010\n\u001a\u00020\u00052\u0006\u0010\b\u001a\u00020\u00072\u0006\u0010\t\u001a\u00020\u0007H\u0016¨\u0006\u000b"}, d2 = {"wu2/e$l$a", "Lbv2/c$a;", "", "E", "buf", "", "S0", "", "errType", "errCode", "p0", "xynetcore_android_release"}, k = 1, mv = {1, 4, 0})
        /* compiled from: XyLonglink.kt */
        public static final class a extends c.a {

            /* renamed from: a  reason: collision with root package name */
            public final /* synthetic */ l f151444a;

            /* JADX WARN: Incorrect args count in method signature: ()V */
            public a(l lVar) {
                this.f151444a = lVar;
            }

            @Override // bv2.c
            public byte[] E() throws RemoteException {
                return this.f151444a.f151443b.f();
            }

            @Override // bv2.c
            public void S0(byte[] bArr) throws RemoteException {
                this.f151444a.f151443b.a(bArr);
            }

            @Override // bv2.c
            public void p0(int i10, int i14) throws RemoteException {
                Message obtainMessage;
                this.f151444a.f151443b.e(i10, i14);
                e eVar = e.f151437y;
                LonglinkConfig longlinkConfig = e.f151429q;
                if ((longlinkConfig != null ? longlinkConfig.e() : 0) <= 0) {
                    return;
                }
                if (i14 == 0) {
                    e.f151421i = 0;
                } else if (this.f151444a.f151443b.b().f65807a == 1) {
                    e.f151421i++;
                    Handler handler = e.f151423k;
                    if (handler != null && (obtainMessage = handler.obtainMessage(4)) != null) {
                        obtainMessage.sendToTarget();
                    }
                }
            }
        }

        /* JADX INFO: super call moved to the top of the method (can break code semantics) */
        public l(yu2.a aVar, String str) {
            super(str);
            this.f151443b = aVar;
        }

        @Override // wu2.e.a
        public void a() {
            Message obtainMessage;
            Message obtainMessage2;
            Message obtainMessage3;
            Message obtainMessage4;
            f fVar = f.f151453b;
            fVar.c("XyLonglink", "call netcoreService?.sendTask: buziId: " + this.f151443b.b().f65807a);
            a aVar = new a(this);
            try {
                e eVar = e.f151437y;
                synchronized (e.f151426n) {
                    LonglinkConfig longlinkConfig = e.f151429q;
                    int i10 = -1;
                    if (longlinkConfig == null || !longlinkConfig.d()) {
                        if (e.f151428p != null) {
                            TaskProperties b14 = this.f151443b.b();
                            bv2.b bVar = e.f151428p;
                            if (bVar != null) {
                                i10 = bVar.N(aVar, this.f151443b.b());
                            }
                            b14.b(i10);
                            fVar.c("XyLonglink", "call netcoreService?.sendTask: buziId: " + this.f151443b.b().f65807a + ", taskid:" + this.f151443b.b().a());
                        } else {
                            Handler handler = e.f151423k;
                            if (!(handler == null || (obtainMessage3 = handler.obtainMessage(3)) == null)) {
                                obtainMessage3.sendToTarget();
                            }
                            fVar.a("XyLonglink", "call netcoreService?.sendTask: netcoreService is null");
                            this.f151443b.e(100, 101);
                            if (this.f151443b.b().f65807a == 1) {
                                e.f151421i++;
                                Handler handler2 = e.f151423k;
                                if (!(handler2 == null || (obtainMessage2 = handler2.obtainMessage(4)) == null)) {
                                    obtainMessage2.sendToTarget();
                                }
                            }
                        }
                    } else if (e.f151427o != null) {
                        TaskProperties b15 = this.f151443b.b();
                        com.xingin.xynetcore.c cVar = e.f151427o;
                        if (cVar != null) {
                            i10 = cVar.o(aVar, this.f151443b.b());
                        }
                        b15.b(i10);
                        fVar.c("XyLonglink", "call netcoreServiceProxy?.sendTask: buziId: " + this.f151443b.b().f65807a + ", taskid:" + this.f151443b.b().a());
                    } else {
                        Handler handler3 = e.f151423k;
                        if (!(handler3 == null || (obtainMessage4 = handler3.obtainMessage(3)) == null)) {
                            obtainMessage4.sendToTarget();
                        }
                        fVar.a("XyLonglink", "call netcoreServiceProxy?.sendTask: netcoreServiceProxy is null");
                        this.f151443b.e(100, 101);
                    }
                    Unit unit = Unit.INSTANCE;
                }
            } catch (RemoteException e14) {
                e14.printStackTrace();
                f.f151453b.b("XyLonglink", "call netcoreService?.sendTask", e14);
                this.f151443b.e(100, 102);
                if (this.f151443b.b().f65807a == 1) {
                    e eVar2 = e.f151437y;
                    e.f151421i++;
                    Handler handler4 = e.f151423k;
                    if (handler4 != null && (obtainMessage = handler4.obtainMessage(4)) != null) {
                        obtainMessage.sendToTarget();
                    }
                }
            }
        }
    }

    @Metadata(bv = {}, d1 = {"\u0000\u0017\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0012\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\u0012\u0010\u0005\u001a\u00020\u00042\b\u0010\u0003\u001a\u0004\u0018\u00010\u0002H\u0016¨\u0006\u0006"}, d2 = {"wu2/e$m", "Lwu2/a;", "", "buf", "", "g", "xynetcore_android_release"}, k = 1, mv = {1, 4, 0})
    /* compiled from: XyLonglink.kt */
    public static final class m implements a {

        /* renamed from: a  reason: collision with root package name */
        public final /* synthetic */ dx2.d f151445a;

        public m(dx2.d dVar) {
            this.f151445a = dVar;
        }

        @Override // wu2.a
        public void g(byte[] bArr) {
            f.f151453b.c("XyLonglink", "publish onChat");
            if (bArr != null) {
                this.f151445a.a(bArr);
            }
        }
    }

    @Metadata(bv = {}, d1 = {"\u0000\u0017\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\u0012\u0010\u0005\u001a\u00020\u00042\b\u0010\u0003\u001a\u0004\u0018\u00010\u0002H\u0016¨\u0006\u0006"}, d2 = {"wu2/e$n", "Lwu2/b;", "Lx9/y0;", "msg", "", "a", "xynetcore_android_release"}, k = 1, mv = {1, 4, 0})
    /* compiled from: XyLonglink.kt */
    public static final class n implements b {

        /* renamed from: a  reason: collision with root package name */
        public final /* synthetic */ dx2.d f151446a;

        public n(dx2.d dVar) {
            this.f151446a = dVar;
        }

        @Override // wu2.b
        public void a(y0 y0Var) {
            f.f151453b.c("XyLonglink", "inner onPush");
            if (y0Var != null) {
                this.f151446a.a(y0Var);
            }
        }
    }

    @Metadata(bv = {}, d1 = {"\u0000\u0017\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\u0010\u0010\u0005\u001a\u00020\u00042\u0006\u0010\u0003\u001a\u00020\u0002H\u0016¨\u0006\u0006"}, d2 = {"wu2/e$o", "Lwu2/c;", "Lwu2/c$a;", "pushData", "", "a", "xynetcore_android_release"}, k = 1, mv = {1, 4, 0})
    /* compiled from: XyLonglink.kt */
    public static final class o implements c {

        /* renamed from: a  reason: collision with root package name */
        public final /* synthetic */ String f151447a;

        /* renamed from: b  reason: collision with root package name */
        public final /* synthetic */ dx2.d f151448b;

        public o(String str, dx2.d dVar) {
            this.f151447a = str;
            this.f151448b = dVar;
        }

        @Override // wu2.c
        public void a(c.a aVar) {
            Intrinsics.checkParameterIsNotNull(aVar, "pushData");
            f fVar = f.f151453b;
            fVar.c("XyLonglink", "publish push: " + this.f151447a);
            this.f151448b.a(aVar);
        }
    }

    @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\b\n\u0000\n\u0002\u0010\u0002\n\u0000\u0010\u0000\u001a\u00020\u0001H\n¢\u0006\u0002\b\u0002"}, d2 = {"<anonymous>", "", "run"}, k = 3, mv = {1, 1, 15})
    /* compiled from: XyLonglink.kt */
    public static final class p implements iw2.a {

        /* renamed from: a  reason: collision with root package name */
        public final /* synthetic */ String f151449a;

        public p(String str) {
            this.f151449a = str;
        }

        @Override // iw2.a
        public final void run() {
            e.f151437y.T(this.f151449a);
        }
    }

    @Metadata(bv = {}, d1 = {"\u0000\u0017\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0012\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\u0012\u0010\u0005\u001a\u00020\u00042\b\u0010\u0003\u001a\u0004\u0018\u00010\u0002H\u0016¨\u0006\u0006"}, d2 = {"wu2/e$q", "Lwu2/d;", "", "buf", "", "a", "xynetcore_android_release"}, k = 1, mv = {1, 4, 0})
    /* compiled from: XyLonglink.kt */
    public static final class q implements d {

        /* renamed from: a  reason: collision with root package name */
        public final /* synthetic */ dx2.d f151450a;

        public q(dx2.d dVar) {
            this.f151450a = dVar;
        }

        @Override // wu2.d
        public void a(byte[] bArr) {
            f.f151453b.c("XyLonglink", "publish onRoom");
            if (bArr != null) {
                this.f151450a.a(bArr);
            }
        }
    }

    @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u000e\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0000\u0010\u0000\u001a\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0003H\n¢\u0006\u0002\b\u0004"}, d2 = {"<anonymous>", "", "msg", "Landroid/os/Message;", "handleMessage"}, k = 3, mv = {1, 1, 15})
    /* compiled from: XyLonglink.kt */
    public static final class r implements Handler.Callback {

        /* renamed from: a  reason: collision with root package name */
        public static final r f151451a = new r();

        /* JADX WARNING: Code restructure failed: missing block: B:119:0x0226, code lost:
            r12 = r12.what;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:120:0x0228, code lost:
            if (2 != r12) goto L_0x0263;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:121:0x022a, code lost:
            wu2.f.f151453b.c("XyLonglink", "handleMessage: handle pending runnables");
            r12 = new java.util.LinkedList();
            r1 = wu2.e.f151424l;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:122:0x023c, code lost:
            monitor-enter(r1);
         */
        /* JADX WARNING: Code restructure failed: missing block: B:124:?, code lost:
            r12.addAll(wu2.e.f151424l);
            wu2.e.f151424l.clear();
         */
        /* JADX WARNING: Code restructure failed: missing block: B:125:0x024b, code lost:
            monitor-exit(r1);
         */
        /* JADX WARNING: Code restructure failed: missing block: B:126:0x024c, code lost:
            r12 = r12.iterator();
         */
        /* JADX WARNING: Code restructure failed: missing block: B:128:0x0254, code lost:
            if (r12.hasNext() == false) goto L_0x0311;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:129:0x0256, code lost:
            ((wu2.e.a) r12.next()).b();
         */
        /* JADX WARNING: Code restructure failed: missing block: B:133:0x0263, code lost:
            if (3 != r12) goto L_0x0273;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:134:0x0265, code lost:
            wu2.f.f151453b.c("XyLonglink", "handleMessage: checkingServiceAlive");
            r0.w();
         */
        /* JADX WARNING: Code restructure failed: missing block: B:135:0x0273, code lost:
            if (4 != r12) goto L_0x0311;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:136:0x0275, code lost:
            r12 = wu2.e.f151429q;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:137:0x0279, code lost:
            if (r12 == null) goto L_0x0280;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:138:0x027b, code lost:
            r12 = r12.e();
         */
        /* JADX WARNING: Code restructure failed: missing block: B:139:0x0280, code lost:
            r12 = 0;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:141:0x0285, code lost:
            if (wu2.e.f151421i < r12) goto L_0x0311;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:142:0x0287, code lost:
            wu2.e.f151421i = 0;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:144:?, code lost:
            r12 = wu2.e.f151416d;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:145:0x028e, code lost:
            if (r12 == null) goto L_0x0297;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:146:0x0290, code lost:
            r12 = r12.getSystemService("activity");
         */
        /* JADX WARNING: Code restructure failed: missing block: B:147:0x0297, code lost:
            r12 = null;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:148:0x0298, code lost:
            if (r12 == null) goto L_0x0305;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:149:0x029a, code lost:
            r12 = ((android.app.ActivityManager) r12).getRunningAppProcesses();
            kotlin.jvm.internal.Intrinsics.checkExpressionValueIsNotNull(r12, "activityManager.runningAppProcesses");
            r0 = new java.util.ArrayList();
            r12 = r12.iterator();
         */
        /* JADX WARNING: Code restructure failed: missing block: B:151:0x02b2, code lost:
            if (r12.hasNext() == false) goto L_0x02e6;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:152:0x02b4, code lost:
            r1 = r12.next();
            r2 = ((android.app.ActivityManager.RunningAppProcessInfo) r1).processName;
            r3 = new java.lang.StringBuilder();
            r4 = wu2.e.f151437y;
            r4 = wu2.e.f151416d;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:153:0x02c8, code lost:
            if (r4 == null) goto L_0x02cf;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:154:0x02ca, code lost:
            r4 = r4.getPackageName();
         */
        /* JADX WARNING: Code restructure failed: missing block: B:155:0x02cf, code lost:
            r4 = null;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:156:0x02d0, code lost:
            r3.append(r4);
            r3.append(":longlink");
         */
        /* JADX WARNING: Code restructure failed: missing block: B:157:0x02e0, code lost:
            if (kotlin.jvm.internal.Intrinsics.areEqual(r2, r3.toString()) == false) goto L_0x02ae;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:158:0x02e2, code lost:
            r0.add(r1);
         */
        /* JADX WARNING: Code restructure failed: missing block: B:159:0x02e6, code lost:
            r12 = r0.iterator();
         */
        /* JADX WARNING: Code restructure failed: missing block: B:161:0x02ee, code lost:
            if (r12.hasNext() == false) goto L_0x0311;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:162:0x02f0, code lost:
            wu2.f.f151453b.c("XyLonglink", "handleMessage: kill longlink process");
            io.sentry.core.SentryKillProcessMonitor.killProcess(((android.app.ActivityManager.RunningAppProcessInfo) r12.next()).pid);
         */
        /* JADX WARNING: Code restructure failed: missing block: B:164:0x030c, code lost:
            throw new kotlin.TypeCastException("null cannot be cast to non-null type android.app.ActivityManager");
         */
        /* JADX WARNING: Code restructure failed: missing block: B:165:0x030d, code lost:
            r12 = move-exception;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:166:0x030e, code lost:
            r12.printStackTrace();
         */
        /* JADX WARNING: Code restructure failed: missing block: B:33:0x009c, code lost:
            r12 = r12.what;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:34:0x009e, code lost:
            if (2 != r12) goto L_0x00d9;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:35:0x00a0, code lost:
            wu2.f.f151453b.c("XyLonglink", "handleMessage: handle pending runnables");
            r12 = new java.util.LinkedList();
            r1 = wu2.e.f151424l;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:36:0x00b2, code lost:
            monitor-enter(r1);
         */
        /* JADX WARNING: Code restructure failed: missing block: B:38:?, code lost:
            r12.addAll(wu2.e.f151424l);
            wu2.e.f151424l.clear();
         */
        /* JADX WARNING: Code restructure failed: missing block: B:39:0x00c1, code lost:
            monitor-exit(r1);
         */
        /* JADX WARNING: Code restructure failed: missing block: B:40:0x00c2, code lost:
            r12 = r12.iterator();
         */
        /* JADX WARNING: Code restructure failed: missing block: B:42:0x00ca, code lost:
            if (r12.hasNext() == false) goto L_0x0311;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:43:0x00cc, code lost:
            ((wu2.e.a) r12.next()).b();
         */
        /* JADX WARNING: Code restructure failed: missing block: B:47:0x00d9, code lost:
            if (3 != r12) goto L_0x00e9;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:48:0x00db, code lost:
            wu2.f.f151453b.c("XyLonglink", "handleMessage: checkingServiceAlive");
            r0.w();
         */
        /* JADX WARNING: Code restructure failed: missing block: B:49:0x00e9, code lost:
            if (4 != r12) goto L_0x0311;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:50:0x00eb, code lost:
            r12 = wu2.e.f151429q;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:51:0x00ef, code lost:
            if (r12 == null) goto L_0x00f6;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:52:0x00f1, code lost:
            r12 = r12.e();
         */
        /* JADX WARNING: Code restructure failed: missing block: B:53:0x00f6, code lost:
            r12 = 0;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:55:0x00fb, code lost:
            if (wu2.e.f151421i < r12) goto L_0x0311;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:56:0x00fd, code lost:
            wu2.e.f151421i = 0;
         */
        public final boolean handleMessage(Message message) {
            Message obtainMessage;
            Handler handler;
            String str;
            Message obtainMessage2;
            Handler handler2;
            NetworkDetectConfig networkDetectConfig;
            LogConfig logConfig;
            Intrinsics.checkParameterIsNotNull(message, "msg");
            e eVar = e.f151437y;
            LonglinkConfig longlinkConfig = e.f151429q;
            if (longlinkConfig == null || !longlinkConfig.d()) {
                String str2 = null;
                if (5 == message.what) {
                    f fVar = f.f151453b;
                    StringBuilder sb3 = new StringBuilder();
                    sb3.append("onServiceConnected: pid: ");
                    sb3.append(Process.myPid());
                    sb3.append(", packageName: ");
                    Context context = e.f151416d;
                    if (context != null) {
                        str2 = context.getPackageName();
                    }
                    sb3.append(str2);
                    fVar.c("XyLonglink", sb3.toString());
                    synchronized (e.f151426n) {
                        Object obj = message.obj;
                        if (obj != null) {
                            e.f151428p = b.a.T((IBinder) obj);
                            try {
                                long elapsedRealtime = SystemClock.elapsedRealtime();
                                bv2.b bVar = e.f151428p;
                                if (bVar != null) {
                                    bVar.U(e.f151429q, e.f151431s, e.f151430r, e.f151414b);
                                    Unit unit = Unit.INSTANCE;
                                }
                                fVar.c("XyLonglink", "netcoreService?.init costs:" + (SystemClock.elapsedRealtime() - elapsedRealtime));
                            } catch (RemoteException e14) {
                                e14.printStackTrace();
                                f.f151453b.b("XyLonglink", "RemoteException while calling netcoreService?.init", e14);
                            } catch (SecurityException e15) {
                                e15.printStackTrace();
                                f.f151453b.b("XyLonglink", "SecurityException while calling netcoreService?.init", e15);
                            }
                            Unit unit2 = Unit.INSTANCE;
                        } else {
                            throw new TypeCastException("null cannot be cast to non-null type android.os.IBinder");
                        }
                    }
                    return true;
                }
                synchronized (e.f151426n) {
                    if (e.f151428p == null) {
                        f.f151453b.e("XyLonglink", "handleMessage: netcoreService is null, bind service now");
                        if (e.f151416d != null) {
                            try {
                                Intent intent = new Intent();
                                Context context2 = e.f151416d;
                                if (context2 == null || (str = context2.getPackageName()) == null) {
                                    str = "";
                                }
                                Intent className = intent.setClassName(str, "com.xingin.xynetcore.NetcoreService");
                                Intrinsics.checkExpressionValueIsNotNull(className, "Intent().setClassName(sA…ynetcore.NetcoreService\")");
                                Context context3 = e.f151416d;
                                if (context3 != null) {
                                    context3.bindService(className, e.f151432t, 1);
                                }
                            } catch (Exception e16) {
                                e16.printStackTrace();
                                f.f151453b.b("XyLonglink", "Exception while sAppContext.bindService", e16);
                            }
                            Unit unit3 = Unit.INSTANCE;
                        }
                        e eVar2 = e.f151437y;
                        Handler handler3 = e.f151423k;
                        if (!(handler3 == null || (obtainMessage = handler3.obtainMessage(message.what)) == null || (handler = e.f151423k) == null)) {
                            handler.sendMessageDelayed(obtainMessage, com.igexin.push.config.c.f25230t);
                        }
                        return true;
                    }
                    Unit unit4 = Unit.INSTANCE;
                }
            } else {
                synchronized (e.f151426n) {
                    if (e.f151427o == null) {
                        f fVar2 = f.f151453b;
                        fVar2.e("XyLonglink", "handleMessage: netcoreServiceProxy is null, init service now");
                        Context context4 = e.f151416d;
                        if (context4 != null) {
                            e.f151427o = new com.xingin.xynetcore.c(context4);
                            long elapsedRealtime2 = SystemClock.elapsedRealtime();
                            LonglinkConfig longlinkConfig2 = e.f151429q;
                            if (!(longlinkConfig2 == null || (networkDetectConfig = e.f151431s) == null || (logConfig = e.f151430r) == null)) {
                                com.xingin.xynetcore.c cVar = e.f151427o;
                                if (cVar != null) {
                                    cVar.h(longlinkConfig2, networkDetectConfig, logConfig, e.f151414b);
                                    Unit unit5 = Unit.INSTANCE;
                                }
                                fVar2.c("XyLonglink", "netcoreServiceProxy?.init costs:" + (SystemClock.elapsedRealtime() - elapsedRealtime2));
                                Unit unit6 = Unit.INSTANCE;
                            }
                            Unit unit7 = Unit.INSTANCE;
                        }
                        Handler handler4 = e.f151423k;
                        if (!(handler4 == null || (obtainMessage2 = handler4.obtainMessage(message.what)) == null || (handler2 = e.f151423k) == null)) {
                            handler2.sendMessageDelayed(obtainMessage2, 500);
                        }
                        return true;
                    }
                    Unit unit8 = Unit.INSTANCE;
                }
            }
            return true;
        }
    }

    static {
        dx2.d<xu2.c> b24 = dx2.d.b2();
        Intrinsics.checkExpressionValueIsNotNull(b24, "PublishSubject.create()");
        f151413a = b24;
    }

    public final long A() {
        long j14;
        Message obtainMessage;
        synchronized (f151426n) {
            LonglinkConfig longlinkConfig = f151429q;
            if (longlinkConfig == null || !longlinkConfig.d()) {
                bv2.b bVar = f151428p;
                j14 = bVar != null ? bVar.I() : System.currentTimeMillis();
            } else {
                com.xingin.xynetcore.c cVar = f151427o;
                j14 = cVar != null ? cVar.g() : System.currentTimeMillis();
            }
            try {
            } catch (RemoteException e14) {
                Handler handler = f151423k;
                if (!(handler == null || (obtainMessage = handler.obtainMessage(3)) == null)) {
                    obtainMessage.sendToTarget();
                }
                e14.printStackTrace();
                f.f151453b.b("XyLonglink", "calling netcoreService?.serverTime", e14);
                Unit unit = Unit.INSTANCE;
                return System.currentTimeMillis();
            }
        }
        return j14;
    }

    public final void B(Context context, String str, String str2, String str3, String str4, LonglinkConfig longlinkConfig, NetworkDetectConfig networkDetectConfig, LogConfig logConfig, b bVar) {
        Message obtainMessage;
        Message obtainMessage2;
        Intrinsics.checkParameterIsNotNull(context, "appContext");
        Intrinsics.checkParameterIsNotNull(str, "appVersion");
        Intrinsics.checkParameterIsNotNull(str2, "deviceId");
        Intrinsics.checkParameterIsNotNull(str3, "deviceName");
        Intrinsics.checkParameterIsNotNull(str4, "fingerPrint");
        Intrinsics.checkParameterIsNotNull(longlinkConfig, "config");
        Intrinsics.checkParameterIsNotNull(networkDetectConfig, "networkDetectConfig");
        Intrinsics.checkParameterIsNotNull(logConfig, "logConfig");
        Intrinsics.checkParameterIsNotNull(bVar, "callback");
        f fVar = f.f151453b;
        fVar.d(Intrinsics.areEqual(longlinkConfig.a(), context.getPackageName()));
        fVar.c("XyLonglink", "init: " + str + ", " + str2 + ", " + str3 + ", " + str4);
        f151416d = context.getApplicationContext();
        f151417e = str;
        f151418f = str2;
        f151419g = str3;
        f151420h = str4;
        f151429q = longlinkConfig;
        f151430r = logConfig;
        f151431s = networkDetectConfig;
        f151415c = bVar;
        C();
        Handler handler = f151423k;
        if (!(handler == null || (obtainMessage2 = handler.obtainMessage(1)) == null)) {
            obtainMessage2.sendToTarget();
        }
        Handler handler2 = f151423k;
        if (handler2 != null && (obtainMessage = handler2.obtainMessage(3)) != null) {
            obtainMessage.sendToTarget();
        }
    }

    public final void C() {
        f.f151453b.c("XyLonglink", "init workingHandler");
        HandlerThread handlerThread = new HandlerThread("XyLonglink_workingThread");
        handlerThread.start();
        f151422j = new WeakReference<>(handlerThread);
        f151423k = new Handler(handlerThread.getLooper(), f151425m);
    }

    public final void D(AccountInfo accountInfo, DeviceInfo deviceInfo) {
        Intrinsics.checkParameterIsNotNull(accountInfo, "accountInfo");
        Intrinsics.checkParameterIsNotNull(deviceInfo, "deviceInfo");
        H(new C2441e(accountInfo, deviceInfo, "login" + accountInfo.f65777a + '-' + accountInfo.f65778b));
    }

    public final void E() {
        HandlerThread handlerThread;
        HandlerThread handlerThread2;
        WeakReference<HandlerThread> weakReference = f151422j;
        boolean z14 = true;
        if (weakReference == null || (handlerThread2 = weakReference.get()) == null || !handlerThread2.isAlive()) {
            z14 = false;
        }
        if (!z14) {
            WeakReference<HandlerThread> weakReference2 = f151422j;
            if (!(weakReference2 == null || (handlerThread = weakReference2.get()) == null)) {
                handlerThread.quitSafely();
            }
            Handler handler = f151423k;
            if (handler != null) {
                handler.removeCallbacksAndMessages(null);
            }
            f151423k = null;
            C();
            f.f151453b.c("XyLonglink", "re init thread handler");
        }
        H(new f("makeSureConnected"));
    }

    public final void F() {
        H(new g("manualPingPong"));
    }

    public final void G(boolean z14) {
        H(new h(z14, "onForeground:" + z14));
    }

    public final void H(a aVar) {
        Message obtainMessage;
        List<a> list = f151424l;
        synchronized (list) {
            list.add(aVar);
        }
        Handler handler = f151423k;
        if (handler != null) {
            handler.removeMessages(2);
        }
        Handler handler2 = f151423k;
        if (handler2 != null && (obtainMessage = handler2.obtainMessage(2)) != null) {
            obtainMessage.sendToTarget();
        }
    }

    public final void I(String str, c cVar) {
        LinkedHashMap<String, c> linkedHashMap = f151435w;
        synchronized (linkedHashMap) {
            linkedHashMap.put(str, cVar);
        }
    }

    public final void J() {
        H(new i("reinit"));
    }

    public final void K(yu2.a aVar) {
        Intrinsics.checkParameterIsNotNull(aVar, "task");
        H(new l(aVar, "sendTask:buzi:" + aVar.b().f65807a));
    }

    public final void L(a aVar) {
        synchronized (this) {
            f151433u = aVar;
            Unit unit = Unit.INSTANCE;
        }
    }

    public final void M(b bVar) {
        synchronized (this) {
            f151436x = bVar;
            Unit unit = Unit.INSTANCE;
        }
    }

    public final void N(d dVar) {
        synchronized (this) {
            f151434v = dVar;
            Unit unit = Unit.INSTANCE;
        }
    }

    public final dw2.r<byte[]> O() {
        dx2.d b24 = dx2.d.b2();
        Intrinsics.checkExpressionValueIsNotNull(b24, "PublishSubject.create<ByteArray>()");
        L(new m(b24));
        dw2.r<byte[]> W0 = b24.W0(cx2.a.a());
        Intrinsics.checkExpressionValueIsNotNull(W0, "subject.observeOn(Schedulers.computation())");
        return W0;
    }

    public final dw2.r<y0> P() {
        dx2.d b24 = dx2.d.b2();
        Intrinsics.checkExpressionValueIsNotNull(b24, "PublishSubject.create<PushModel.PushMessage>()");
        M(new n(b24));
        dw2.r<y0> W0 = b24.W0(cx2.a.a());
        Intrinsics.checkExpressionValueIsNotNull(W0, "subject.observeOn(Schedulers.computation())");
        return W0;
    }

    public final dw2.r<c.a> Q(String str) {
        Intrinsics.checkParameterIsNotNull(str, HashTagListBean.HashTag.TYPE_TOPIC);
        dx2.d b24 = dx2.d.b2();
        Intrinsics.checkExpressionValueIsNotNull(b24, "PublishSubject.create<PushCallback.PushData>()");
        I(str, new o(str, b24));
        dw2.r<c.a> W0 = b24.i0(new p(str)).W0(cx2.a.a());
        Intrinsics.checkExpressionValueIsNotNull(W0, "subject.doOnDispose { un…Schedulers.computation())");
        return W0;
    }

    public final dw2.r<byte[]> R() {
        dx2.d b24 = dx2.d.b2();
        Intrinsics.checkExpressionValueIsNotNull(b24, "PublishSubject.create<ByteArray>()");
        N(new q(b24));
        dw2.r<byte[]> W0 = b24.W0(cx2.a.a());
        Intrinsics.checkExpressionValueIsNotNull(W0, "subject.observeOn(Schedulers.computation())");
        return W0;
    }

    public final void S() {
        synchronized (f151426n) {
            f151437y.y(true);
            Unit unit = Unit.INSTANCE;
        }
    }

    public final void T(String str) {
        Intrinsics.checkParameterIsNotNull(str, HashTagListBean.HashTag.TYPE_TOPIC);
        LinkedHashMap<String, c> linkedHashMap = f151435w;
        synchronized (linkedHashMap) {
            linkedHashMap.remove(str);
        }
    }

    public final String v() {
        String str;
        synchronized (f151426n) {
            LonglinkConfig longlinkConfig = f151429q;
            if (longlinkConfig == null || !longlinkConfig.d()) {
                bv2.b bVar = f151428p;
                if (bVar == null || (str = bVar.s()) == null) {
                    str = "";
                }
            } else {
                com.xingin.xynetcore.c cVar = f151427o;
                if (cVar == null || (str = cVar.f()) == null) {
                    str = "";
                }
            }
            try {
            } catch (RemoteException e14) {
                e14.printStackTrace();
                f.f151453b.b("XyLonglink", "netcoreService?.chatToken", e14);
                Unit unit = Unit.INSTANCE;
                return null;
            }
        }
        return str;
    }

    public final void w() {
        Handler handler;
        Message obtainMessage;
        boolean z14;
        Handler handler2 = f151423k;
        if (handler2 != null) {
            handler2.removeMessages(3);
        }
        Ref.BooleanRef booleanRef = new Ref.BooleanRef();
        synchronized (f151426n) {
            LonglinkConfig longlinkConfig = f151429q;
            boolean z15 = false;
            if (longlinkConfig == null || !longlinkConfig.d()) {
                bv2.b bVar = f151428p;
                booleanRef.element = bVar != null;
                if (bVar != null) {
                    try {
                        z14 = bVar.V0();
                    } catch (RemoteException unused) {
                        booleanRef.element = false;
                    }
                } else {
                    z14 = false;
                }
                booleanRef.element = z14;
            } else {
                com.xingin.xynetcore.c cVar = f151427o;
                if (cVar != null) {
                    z15 = cVar.p();
                }
                booleanRef.element = z15;
            }
            Unit unit = Unit.INSTANCE;
        }
        zu2.b.d("XyLonglink", "checkingServiceAlive: " + booleanRef.element);
        Handler handler3 = f151423k;
        if (handler3 != null) {
            handler3.sendEmptyMessageDelayed(3, com.igexin.push.config.c.f25221k);
        }
        if (!booleanRef.element && (handler = f151423k) != null && (obtainMessage = handler.obtainMessage(1)) != null) {
            obtainMessage.sendToTarget();
        }
    }

    public final void x() {
        H(new c("debugNetworkChange"));
    }

    public final void y(boolean z14) {
        H(new d(z14, "deinit"));
    }

    public final dx2.d<xu2.c> z() {
        return f151413a;
    }
}