CONECTA PRO v4.2.8版本的 MD5 值为:ad88cf9e66d8cdaae8c40233e50eb389

以下内容为反编译后的 OpenVPNService.java 源代码,内容仅作参考


package de.blinkt.openvpn.core;

import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.VpnService;
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.os.PowerManager;
import android.os.StrictMode;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.IconCompat;
import com.bumptech.glide.f;
import da.m;
import f.g0;
import fa.e0;
import go.libv2ray.gojni.R;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.ArrayList;
import java.util.Vector;
import q2.d;
import r4.e;
import s.k0;
import s.t;
import u4.l;
import v8.g;
import v8.n;
import v8.r;
import x8.a;
import x8.b;
import x8.c;
import z8.b1;
public final class OpenVPNService extends VpnService {
    public static final int L = 0;
    public a A;
    public r C;
    public String D;
    public n E;
    public g0 F;
    public g G;
    public w8.a H;
    public t I;
    public NotificationManager J;
    public PowerManager.WakeLock K;
    public boolean f3252x;
    public Thread f3253y;
    public u8.a f3254z;
    public final Vector f3246r = new Vector();
    public final c f3247s = new c();
    public final c f3248t = new c();
    public final Object f3249u = new Object();
    public final p2.a f3250v = new p2.a();
    public final d f3251w = new d();
    public int B = 1500;

    public final void a(String str, String str2, String str3, String str4) {
        boolean z10;
        b1.o("dest", str);
        b1.o("mask", str2);
        b1.o("gateway", str3);
        a aVar = new a(str, str2);
        boolean z11 = true;
        if (str4 != null && (m.M0(str4, "tun", false) || b1.g("(null)", str4) || b1.g("vpn-service-tun", str4))) {
            z10 = true;
        } else {
            z10 = false;
        }
        b bVar = new b(new a(str3, 32), false);
        a aVar2 = this.A;
        if (aVar2 == null) {
            return;
        }
        if (new b(aVar2, true).a(bVar)) {
            z10 = true;
        }
        if (!b1.g(str3, "255.255.255.255") && !b1.g(str3, this.D)) {
            z11 = z10;
        }
        aVar.a();
        this.f3247s.f10521a.add(new b(aVar, z11));
    }

    public final void b() {
        e.j();
        NotificationChannel t3 = e.t();
        t3.setLightColor(-16776961);
        t3.setLockscreenVisibility(0);
        Object systemService = getSystemService("notification");
        b1.m("null cannot be cast to non-null type android.app.NotificationManager", systemService);
        NotificationManager notificationManager = (NotificationManager) systemService;
        this.J = notificationManager;
        notificationManager.createNotificationChannel(t3);
    }

    public final void c() {
        synchronized (this.f3249u) {
            this.f3253y = null;
        }
        f();
        this.E = null;
        stopForeground(true);
        stopSelf();
        this.f3252x = false;
    }

    public final void d() {
        r rVar = this.C;
        if (rVar != null) {
            n nVar = this.E;
            boolean z10 = true;
            if (nVar != null) {
                nVar.f10184x = true;
            }
            if ((rVar == null || !rVar.e()) ? false : false) {
                try {
                    Thread.sleep(1000L);
                } catch (InterruptedException unused) {
                }
            }
        }
        synchronized (this.f3249u) {
            Thread thread = this.f3253y;
            if (thread != null) {
                thread.interrupt();
                try {
                    Thread.sleep(1000L);
                } catch (InterruptedException unused2) {
                }
            }
        }
    }

    public final void e() {
        o2.a.D.b(this, "");
        this.f3250v.c("LBL_STATE_STOPPING", new Object[0]);
        r rVar = this.C;
        if (rVar != null) {
            rVar.e();
        }
        this.f3252x = false;
    }

    public final synchronized void f() {
        try {
            g gVar = this.G;
            if (gVar != null) {
                unregisterReceiver(gVar);
                this.G = null;
            }
        } finally {
        }
    }

    public final void g(String str, boolean z10) {
        Notification notification;
        int i10;
        b1.o("message", str);
        t tVar = this.I;
        if (tVar != null) {
            if (z10) {
                i10 = R.drawable.ic_rocket_on;
            } else {
                i10 = R.drawable.ic_rocket_off;
            }
            tVar.f8926u.icon = i10;
        }
        if (tVar != null) {
            tVar.f8911f = t.c(str);
        }
        t tVar2 = this.I;
        if (tVar2 != null) {
            tVar2.f8917l = z10;
        }
        if (tVar2 != null) {
            tVar2.f8926u.when = System.currentTimeMillis();
        }
        t tVar3 = this.I;
        if (tVar3 != null) {
            notification = tVar3.b();
        } else {
            notification = null;
        }
        if (this.J == null) {
            Object systemService = getSystemService("notification");
            b1.m("null cannot be cast to non-null type android.app.NotificationManager", systemService);
            this.J = (NotificationManager) systemService;
        }
        NotificationManager notificationManager = this.J;
        if (notificationManager != null) {
            notificationManager.notify(1662, notification);
        }
    }

    @Override
    public final IBinder onBind(Intent intent) {
        b1.o("intent", intent);
        return null;
    }

    @Override
    public final void onCreate() {
        super.onCreate();
        StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().permitAll().build());
        Object systemService = getSystemService("power");
        b1.m("null cannot be cast to non-null type android.os.PowerManager", systemService);
        PowerManager.WakeLock newWakeLock = ((PowerManager) systemService).newWakeLock(1, "DTunnelVPN:tag");
        b1.n("newWakeLock(...)", newWakeLock);
        this.K = newWakeLock;
        newWakeLock.acquire();
        if (this.F == null) {
            this.F = new g0(5, this);
        }
        IntentFilter intentFilter = new IntentFilter("DT_ACTION_SERVICE");
        if (Build.VERSION.SDK_INT >= 34) {
            ContextCompat.c(this, this.F, intentFilter, 2);
        } else {
            registerReceiver(this.F, intentFilter);
        }
    }

    @Override
    public final void onDestroy() {
        PowerManager.WakeLock wakeLock = this.K;
        if (wakeLock == null) {
            b1.V("wakeLock");
            throw null;
        }
        if (wakeLock.isHeld()) {
            PowerManager.WakeLock wakeLock2 = this.K;
            if (wakeLock2 == null) {
                b1.V("wakeLock");
                throw null;
            }
            wakeLock2.release();
        }
        synchronized (this.f3249u) {
            r rVar = this.C;
            if (rVar != null) {
                rVar.e();
            }
        }
        this.C = null;
        g0 g0Var = this.F;
        if (g0Var != null) {
            unregisterReceiver(g0Var);
            this.F = null;
        }
        o2.a.E.b(this, "");
        this.f3250v.c("LBL_DISCONNECTED", new Object[0]);
    }

    @Override
    public final void onRevoke() {
        e();
    }

    @Override
    public final int onStartCommand(Intent intent, int i10, int i11) {
        String str;
        String str2;
        String str3;
        boolean z10;
        t tVar;
        int i12;
        Notification b10;
        t tVar2;
        k0[] k0VarArr;
        k0[] k0VarArr2;
        k0[] k0VarArr3;
        k0[] k0VarArr4;
        if (intent != null) {
            str = intent.getAction();
        } else {
            str = null;
        }
        if (b1.g(str, "STOP_VPN_SERVICE")) {
            e();
            return 2;
        }
        if (intent != null) {
            str2 = intent.getAction();
        } else {
            str2 = null;
        }
        if (!b1.g(str2, "RESTART_VPN_SERVICE")) {
            o2.a.f7839w.b(this, "");
            if (intent != null) {
                str3 = intent.getStringExtra("config");
            } else {
                str3 = null;
            }
            if (intent != null && intent.getBooleanExtra("ping", false)) {
                z10 = true;
            } else {
                z10 = false;
            }
            this.H = com.bumptech.glide.c.u(str3, z10);
            if (l.C == null) {
                l.C = new l();
                try {
                    ObjectInputStream objectInputStream = new ObjectInputStream(openFileInput("vpnProfile.vp"));
                    Object readObject = objectInputStream.readObject();
                    b1.m("null cannot be cast to non-null type de.blinkt.openvpn.VpnProfile", readObject);
                    l.B = (u8.a) readObject;
                    objectInputStream.close();
                } catch (IOException e10) {
                    throw new RuntimeException(e10);
                } catch (ClassNotFoundException e11) {
                    throw new RuntimeException(e11);
                }
            }
            u8.a aVar = l.B;
            if (aVar != null) {
                this.f3254z = aVar;
                int i13 = Build.VERSION.SDK_INT;
                if (i13 >= 26) {
                    b();
                    tVar = new t(this, "DTUNNEL_OPVNVPN_ID");
                } else {
                    tVar = new t(this, "default");
                }
                this.I = tVar;
                w8.a aVar2 = this.H;
                if (aVar2 != null) {
                    tVar.d(aVar2.f10425a);
                    tVar.e(8, true);
                    tVar.e(2, true);
                    tVar.f8915j = 2;
                    tVar.f8920o = "service";
                    tVar.f8923r = 1;
                    tVar.e(16, false);
                    w8.a aVar3 = this.H;
                    if (aVar3 != null) {
                        tVar.f8926u.tickerText = t.c(aVar3.f10425a);
                        t tVar3 = this.I;
                        int i14 = 268435456;
                        if (i13 >= 23) {
                            i12 = 335544320;
                        } else {
                            i12 = 268435456;
                        }
                        Intent intent2 = new Intent(this, OpenVPNService.class);
                        intent2.setAction("RESTART_VPN_SERVICE");
                        PendingIntent service = PendingIntent.getService(this, 0, intent2, i12);
                        if (tVar3 != null) {
                            String string = getString(R.string.reconnect);
                            IconCompat b11 = IconCompat.b(R.drawable.ic_autorenew);
                            Bundle bundle = new Bundle();
                            CharSequence c10 = t.c(string);
                            ArrayList arrayList = new ArrayList();
                            ArrayList arrayList2 = new ArrayList();
                            if (arrayList.isEmpty()) {
                                k0VarArr3 = null;
                            } else {
                                k0VarArr3 = (k0[]) arrayList.toArray(new k0[arrayList.size()]);
                            }
                            if (arrayList2.isEmpty()) {
                                k0VarArr4 = null;
                            } else {
                                k0VarArr4 = (k0[]) arrayList2.toArray(new k0[arrayList2.size()]);
                            }
                            tVar3.f8907b.add(new s.l(b11, c10, service, bundle, k0VarArr4, k0VarArr3, true, 0, true, false, false));
                        }
                        Intent intent3 = new Intent(this, OpenVPNService.class);
                        intent3.setAction("STOP_VPN_SERVICE");
                        PendingIntent service2 = PendingIntent.getService(this, 1, intent3, i12);
                        if (tVar3 != null) {
                            String string2 = getString(R.string.stop);
                            IconCompat b12 = IconCompat.b(R.drawable.ic_stop);
                            Bundle bundle2 = new Bundle();
                            CharSequence c11 = t.c(string2);
                            ArrayList arrayList3 = new ArrayList();
                            ArrayList arrayList4 = new ArrayList();
                            if (arrayList3.isEmpty()) {
                                k0VarArr = null;
                            } else {
                                k0VarArr = (k0[]) arrayList3.toArray(new k0[arrayList3.size()]);
                            }
                            if (arrayList4.isEmpty()) {
                                k0VarArr2 = null;
                            } else {
                                k0VarArr2 = (k0[]) arrayList4.toArray(new k0[arrayList4.size()]);
                            }
                            tVar3.f8907b.add(new s.l(b12, c11, service2, bundle2, k0VarArr2, k0VarArr, true, 0, true, false, false));
                        }
                        if (i13 >= 23) {
                            i14 = 67108864;
                        }
                        Intent intent4 = new Intent();
                        intent4.setClassName(this, "com.dtunnel.presenter.MainActivity");
                        Intent addFlags = intent4.addFlags(268468224);
                        b1.n("let(...)", addFlags);
                        t tVar4 = this.I;
                        if (tVar4 != null) {
                            tVar4.f8926u.icon = R.drawable.ic_rocket_off;
                        }
                        if (tVar4 != null) {
                            tVar4.f8912g = PendingIntent.getActivity(this, 0, addFlags, i14);
                        }
                        if (i13 >= 26 && (tVar2 = this.I) != null) {
                            b();
                            tVar2.f8924s = "DTUNNEL_OPVNVPN_ID";
                        }
                        t tVar5 = this.I;
                        if (tVar5 != null && (b10 = tVar5.b()) != null) {
                            if (i13 >= 34) {
                                startForeground(1662, b10, 1073741824);
                            } else {
                                startForeground(1662, b10);
                            }
                        }
                        f.q(com.bumptech.glide.e.a(e0.f4188a), null, new v8.l(this, null), 3);
                        return 1;
                    }
                    b1.V("config");
                    throw null;
                }
                b1.V("config");
                throw null;
            }
            b1.V("profile");
            throw null;
        }
        r rVar = this.C;
        if (rVar != null) {
            rVar.c();
            if (rVar.A) {
                rVar.f10195w.removeCallbacks(rVar.G);
                rVar.A = false;
                rVar.a("hold release\n");
                rVar.a("state on\n");
            }
        }
        return 1;
    }
}