Souza NET DTunnel v4.2.6版本的 MD5 值为:9c33be9da88136132d2ea8a79815d093

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


package de.blinkt.openvpn.core;

import a9.g;
import a9.l;
import a9.o;
import a9.r;
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 c9.a;
import c9.b;
import c9.c;
import com.bumptech.glide.d;
import com.google.android.gms.internal.measurement.o0;
import com.souzanetssh.pro.R;
import d.f0;
import ia.m;
import j7.e;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.ArrayList;
import java.util.Vector;
import ka.e0;
import q.k0;
import q.t;
public final class OpenVPNService extends VpnService {
    public static final int L = 0;
    public a A;
    public r C;
    public String D;
    public o E;
    public f0 F;
    public g G;
    public b9.a H;
    public t I;
    public NotificationManager J;
    public PowerManager.WakeLock K;
    public boolean f3949x;
    public Thread f3950y;
    public z8.a f3951z;
    public final Vector f3944s = new Vector();
    public final c f3945t = new c();
    public final c f3946u = new c();
    public final Object f3947v = new Object();
    public final p2.a f3948w = new p2.a();
    public int B = 1500;

    public final void a(String str, String str2, String str3, String str4) {
        boolean z10;
        q7.a.e("dest", str);
        q7.a.e("mask", str2);
        q7.a.e("gateway", str3);
        a aVar = new a(str, str2);
        boolean z11 = true;
        if (str4 != null && (m.X(str4, "tun", false) || q7.a.a("(null)", str4) || q7.a.a("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 (!q7.a.a(str3, "255.255.255.255") && !q7.a.a(str3, this.D)) {
            z11 = z10;
        }
        aVar.a();
        this.f3945t.f2422a.add(new b(aVar, z11));
    }

    public final void b() {
        e.k();
        NotificationChannel b8 = l.b();
        b8.setLightColor(-16776961);
        b8.setLockscreenVisibility(0);
        Object systemService = getSystemService("notification");
        q7.a.c("null cannot be cast to non-null type android.app.NotificationManager", systemService);
        NotificationManager notificationManager = (NotificationManager) systemService;
        this.J = notificationManager;
        notificationManager.createNotificationChannel(b8);
    }

    public final void c() {
        synchronized (this.f3947v) {
            this.f3950y = null;
        }
        f();
        this.E = null;
        stopForeground(true);
        stopSelf();
        this.f3949x = false;
    }

    public final void d() {
        r rVar = this.C;
        if (rVar != null) {
            o oVar = this.E;
            boolean z10 = true;
            if (oVar != null) {
                oVar.f868y = true;
            }
            if ((rVar == null || !rVar.e()) ? false : false) {
                try {
                    Thread.sleep(1000L);
                } catch (InterruptedException unused) {
                }
            }
        }
        synchronized (this.f3947v) {
            Thread thread = this.f3950y;
            if (thread != null) {
                thread.interrupt();
                try {
                    Thread.sleep(1000L);
                } catch (InterruptedException unused2) {
                }
            }
        }
    }

    public final void e() {
        o2.a.D.b(this);
        this.f3948w.c("LBL_STATE_STOPPING", new Object[0]);
        r rVar = this.C;
        if (rVar != null) {
            rVar.e();
        }
        this.f3949x = 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;
        q7.a.e("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.f8773u.icon = i10;
        }
        if (tVar != null) {
            tVar.f8758f = t.c(str);
        }
        t tVar2 = this.I;
        if (tVar2 != null) {
            tVar2.f8764l = z10;
        }
        if (tVar2 != null) {
            tVar2.f8773u.when = System.currentTimeMillis();
        }
        t tVar3 = this.I;
        if (tVar3 != null) {
            notification = tVar3.b();
        } else {
            notification = null;
        }
        if (this.J == null) {
            Object systemService = getSystemService("notification");
            q7.a.c("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) {
        q7.a.e("intent", intent);
        return null;
    }

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

    @Override
    public final void onDestroy() {
        PowerManager.WakeLock wakeLock = this.K;
        if (wakeLock == null) {
            q7.a.v("wakeLock");
            throw null;
        }
        if (wakeLock.isHeld()) {
            PowerManager.WakeLock wakeLock2 = this.K;
            if (wakeLock2 == null) {
                q7.a.v("wakeLock");
                throw null;
            }
            wakeLock2.release();
        }
        synchronized (this.f3947v) {
            r rVar = this.C;
            if (rVar != null) {
                rVar.e();
            }
        }
        this.C = null;
        f0 f0Var = this.F;
        if (f0Var != null) {
            unregisterReceiver(f0Var);
            this.F = null;
        }
        o2.a.E.b(this);
        this.f3948w.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;
        t tVar;
        int i12;
        Notification b8;
        t tVar2;
        k0[] k0VarArr;
        k0[] k0VarArr2;
        k0[] k0VarArr3;
        k0[] k0VarArr4;
        if (intent != null) {
            str = intent.getAction();
        } else {
            str = null;
        }
        if (q7.a.a(str, "STOP_VPN_SERVICE")) {
            e();
            return 2;
        }
        if (intent != null) {
            str2 = intent.getAction();
        } else {
            str2 = null;
        }
        if (q7.a.a(str2, "RESTART_VPN_SERVICE")) {
            r rVar = this.C;
            if (rVar != null) {
                rVar.c();
                if (rVar.A) {
                    rVar.f876w.removeCallbacks(rVar.G);
                    rVar.A = false;
                    rVar.a("hold release\n");
                    rVar.a("state on\n");
                }
            }
            return 1;
        }
        o2.a.f8155x.b(this);
        if (intent != null) {
            str3 = intent.getStringExtra("config");
        } else {
            str3 = null;
        }
        this.H = q1.b.g(str3);
        if (o0.f3008t == null) {
            o0.f3008t = new o0();
            try {
                ObjectInputStream objectInputStream = new ObjectInputStream(openFileInput("vpnProfile.vp"));
                Object readObject = objectInputStream.readObject();
                q7.a.c("null cannot be cast to non-null type de.blinkt.openvpn.VpnProfile", readObject);
                o0.f3007s = (z8.a) readObject;
                objectInputStream.close();
            } catch (IOException e10) {
                throw new RuntimeException(e10);
            } catch (ClassNotFoundException e11) {
                throw new RuntimeException(e11);
            }
        }
        z8.a aVar = o0.f3007s;
        if (aVar != null) {
            this.f3951z = 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;
            b9.a aVar2 = this.H;
            if (aVar2 != null) {
                tVar.d(aVar2.f2133a);
                tVar.e(8, true);
                tVar.e(2, true);
                tVar.f8762j = 2;
                tVar.f8767o = "service";
                tVar.f8770r = 1;
                tVar.e(16, false);
                b9.a aVar3 = this.H;
                if (aVar3 != null) {
                    tVar.f8773u.tickerText = t.c(aVar3.f2133a);
                    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 b10 = 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.f8754b.add(new q.l(b10, 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 b11 = 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.f8754b.add(new q.l(b11, 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);
                    q7.a.d("let(...)", addFlags);
                    t tVar4 = this.I;
                    if (tVar4 != null) {
                        tVar4.f8773u.icon = R.drawable.ic_rocket_off;
                    }
                    if (tVar4 != null) {
                        tVar4.f8759g = PendingIntent.getActivity(this, 0, addFlags, i14);
                    }
                    if (i13 >= 26 && (tVar2 = this.I) != null) {
                        b();
                        tVar2.f8771s = "DTUNNEL_OPVNVPN_ID";
                    }
                    t tVar5 = this.I;
                    if (tVar5 != null && (b8 = tVar5.b()) != null) {
                        if (i13 >= 34) {
                            startForeground(1662, b8, 1073741824);
                        } else {
                            startForeground(1662, b8);
                        }
                    }
                    com.bumptech.glide.c.w(d.a(e0.f6998a), null, new a9.m(this, null), 3);
                    return 1;
                }
                q7.a.v("config");
                throw null;
            }
            q7.a.v("config");
            throw null;
        }
        q7.a.v("profile");
        throw null;
    }
}