FLIX VISION v2.8.2版本的 MD5 值为:4d33b143293b36f23ce5a6a5834e6993

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


package io.netas;

import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.os.Build;
import android.os.IBinder;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.Keep;
import io.netas.service.NetasService;
import java.util.concurrent.TimeUnit;
import org.apache.commons.lang3.time.DateUtils;

public class Netas extends BroadcastReceiver {

    @SuppressLint({"StaticFieldLeak"})
    public static volatile Netas f13867p;

    public static AlertDialog f13868q;

    public static final String f13869r = String.format("/?pub=%s&uid=%s&local_ip=%s&ver=%s&in=%s", "{publisher}", "{uid}", "{localip}", "{ver}", "{init}");

    public final Context f13870a;

    public final jc.a f13871b;

    public final fc.a f13872c;

    public final c f13873d = new c();

    public final String f13874e;

    public final String f13875f;

    public final String f13876g;

    public final long f13877h;

    public final boolean f13878i;

    public String f13879j;

    public String f13880k;

    public final boolean f13881l;

    public String f13882m;

    public String f13883n;

    public String f13884o;

    @Keep
    public static class Builder {
        private boolean enableNetasclientLogging;
        private boolean loggable;
        private boolean mobileForeground;
        private String publisher;
        private String userId;
        private String category = "888";
        private String regUrl = "https://lb.sklstech.com:443/devicereg";
        private String regEndpoint = Netas.f13869r;
        private long delayMillis = DateUtils.MILLIS_PER_MINUTE;
        private boolean foregroundService = false;

        public Netas build(Context context) {
            String str = this.publisher;
            if (str == null || str.trim().length() == 0) {
                throw new IllegalArgumentException("The publisher cannot be <null> or empty, you have to specify one");
            }
            return Netas.a(context, this);
        }

        public Netas build(Context context, String str, String str2, int i10) {
            return build(context, str, str2, i10, "io.netas.service.NetasService");
        }

        public Netas build(Context context, String str, String str2, int i10, String str3) {
            String str4 = this.publisher;
            if (str4 == null || str4.trim().length() == 0) {
                throw new IllegalArgumentException("The publisher cannot be <null> or empty, you have to specify one");
            }
            if (str == null || str.trim().length() == 0) {
                throw new IllegalArgumentException("The Appname cannot be <null> or empty, you have to specify one");
            }
            if (str2 == null || str2.trim().length() == 0) {
                throw new IllegalArgumentException("The message cannot be <null> or empty, you have to specify one");
            }
            if (i10 == 0) {
                throw new IllegalArgumentException("The icon cannot be <null> or empty, you have to specify one");
            }
            if (str3 == null || str3.trim().length() == 0) {
                throw new IllegalArgumentException("The className cannot be <null> or empty, you have to specify one");
            }
            fc.a aVar = new fc.a(context);
            withForegroundService(Boolean.TRUE);
            aVar.b("APPNAME", str);
            aVar.b("PUBLISHER_PACKAGE", context.getPackageName());
            aVar.b("ICON", i10);
            aVar.b("MESSAGE", str2);
            aVar.b("CLASS_NAME", str3);
            return Netas.a(context, this);
        }

        public Builder enableNetasclientLogging() {
            this.enableNetasclientLogging = true;
            return this;
        }

        public Builder loggable() {
            this.loggable = true;
            return this;
        }

        public Builder withCategory(String str) {
            this.category = str;
            return this;
        }

        public Builder withDelayInMillis(long j10) {
            this.delayMillis = j10;
            return this;
        }

        public Builder withForegroundService(Boolean bool) {
            this.foregroundService = bool.booleanValue();
            ic.a.a("netas", "withForegroundService: %s", Boolean.toString(bool.booleanValue()));
            return this;
        }

        public Builder withMobileForeground(Boolean bool) {
            this.mobileForeground = bool.booleanValue();
            ic.a.a("netas", "withMobileForeground: %s", Boolean.toString(bool.booleanValue()));
            return this;
        }

        public Builder withPublisher(String str) {
            this.publisher = str;
            ic.a.a("netas", "withPublisher: %s", str);
            return this;
        }

        public Builder withRegEndpoint(String str) {
            this.regEndpoint = str;
            return this;
        }

        public Builder withRegUrl(String str) {
            this.regUrl = str;
            return this;
        }
    }

    public class a implements DialogInterface.OnClickListener {

        public final int[] f13885b;

        public a(int[] iArr) {
            this.f13885b = iArr;
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i10) {
            if (i10 == -1) {
                Log.d("Netas", "On button click");
            }
            int i11 = this.f13885b[0];
            Netas netas = Netas.this;
            if (i11 == 0) {
                netas.f13872c.a(netas.f13870a.getString(R.string.netas_user_permission), true);
                Netas netas2 = Netas.f13867p;
                netas.start();
            } else {
                if (i11 != 1) {
                    return;
                }
                netas.stop();
                netas.f13872c.a(netas.f13870a.getString(R.string.netas_user_permission), false);
            }
        }
    }

    public class b implements DialogInterface.OnClickListener {

        public final int[] f13887b;

        public b(int[] iArr) {
            this.f13887b = iArr;
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i10) {
            this.f13887b[0] = i10;
        }
    }

    public class c implements ServiceConnection {

        public NetasService f13888a;

        public boolean f13889b = false;

        public NetasService a() {
            return this.f13888a;
        }

        public boolean b() {
            return this.f13889b;
        }

        @Override
        public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
            this.f13888a = ((NetasService.b) iBinder).a();
            this.f13889b = true;
        }

        @Override
        public void onServiceDisconnected(ComponentName componentName) {
            this.f13889b = false;
        }
    }

    public Netas(Context context, Builder builder) {
        this.f13870a = context;
        fc.a aVar = new fc.a(context);
        this.f13872c = aVar;
        this.f13871b = new jc.a(context);
        new kc.a(context).a(builder.enableNetasclientLogging);
        String unused = builder.category;
        int i10 = R.string.netas_publisher_key;
        String a5 = aVar.a(context.getString(i10));
        if (TextUtils.isEmpty(builder.publisher)) {
            builder.withPublisher(a5);
            this.f13874e = a5;
        } else {
            String str = builder.publisher;
            this.f13874e = str;
            aVar.b(context.getString(i10), str);
        }
        String a10 = aVar.a(context.getString(R.string.netas_country_key));
        this.f13879j = a10;
        if (a10 == null) {
            this.f13879j = "CC";
        }
        this.f13880k = aVar.a(context.getString(R.string.netas_state_key));
        this.f13882m = aVar.a(context.getString(R.string.netas_city_key));
        this.f13883n = aVar.a(context.getString(R.string.netas_asn_key));
        this.f13884o = aVar.a(context.getString(R.string.netas_extra_info_key));
        aVar.a(context.getString(R.string.netas_uid_key));
        this.f13875f = builder.regUrl;
        this.f13876g = builder.regEndpoint;
        this.f13877h = builder.delayMillis;
        this.f13878i = builder.loggable;
        boolean z10 = builder.foregroundService;
        this.f13881l = z10;
        aVar.a(context.getString(R.string.netas_is_foreground), z10);
        boolean unused2 = builder.mobileForeground;
        f1.a.getInstance(context).registerReceiver(this, new IntentFilter(Netas.class.getCanonicalName()));
    }

    public static Netas a(Context context, Builder builder) {
        if (f13867p == null) {
            synchronized (Netas.class) {
                if (f13867p == null) {
                    if (context == null) {
                        throw new NullPointerException("Context cannot be null");
                    }
                    if (context.getApplicationContext() != null) {
                        context = context.getApplicationContext();
                    }
                    f13867p = new Netas(context, builder);
                }
            }
        }
        return f13867p;
    }

    public static Netas a(boolean z10) {
        if (f13867p == null) {
            synchronized (Netas.class) {
                if (f13867p == null && !z10) {
                    throw new IllegalStateException("You need to call create() at least once to create the singleton");
                }
            }
        }
        return f13867p;
    }

    @Keep
    public static Builder builder() {
        return new Builder();
    }

    @Keep
    public static Netas getInstance() {
        return a(false);
    }

    @Keep
    public static Netas getInstance(Context context) {
        if (f13867p == null) {
            synchronized (Netas.class) {
                if (f13867p == null) {
                    fc.a aVar = new fc.a(context);
                    boolean b5 = aVar.b(context.getString(R.string.netas_is_foreground));
                    String a5 = aVar.a(context.getString(R.string.netas_publisher_key));
                    if (TextUtils.isEmpty(a5)) {
                        return null;
                    }
                    f13867p = new Builder().withPublisher(a5).withForegroundService(Boolean.valueOf(b5)).loggable().build(context);
                    ic.a.a("netas", "call getInstance while instase equal null - netas self initiation with pub=%s", a5);
                }
            }
        }
        return f13867p;
    }

    public void a(String str) {
        this.f13883n = str;
    }

    public final void b(Context context) {
        AlertDialog alertDialog = f13868q;
        if (alertDialog == null || !alertDialog.isShowing()) {
            fc.a aVar = this.f13872c;
            String a5 = aVar.a("APPNAME", "Netas");
            int i10 = R.string.netas_alert_message;
            Context context2 = this.f13870a;
            String.format(context2.getString(i10), a5);
            int a10 = aVar.a("ICON", R.drawable.ic_android_notify);
            int[] iArr = {0};
            CharSequence[] charSequenceArr = {String.format(context2.getString(R.string.netas_ads_free_message), a5), String.format(context2.getString(R.string.netas_ads_in_message), a5)};
            a aVar2 = new a(iArr);
            AlertDialog.Builder builder = new AlertDialog.Builder(context);
            builder.setTitle(context2.getString(R.string.netas_ads_in_title)).setIcon(a10).setCancelable(false);
            builder.setSingleChoiceItems(charSequenceArr, iArr[0], new b(iArr));
            builder.setPositiveButton(context2.getString(R.string.netas_alert_startapp), aVar2);
            AlertDialog create = builder.create();
            f13868q = create;
            create.show();
        }
    }

    public void b(String str) {
        this.f13882m = str;
    }

    public String c() {
        return this.f13883n;
    }

    public void c(String str) {
    }

    public String d() {
        return this.f13882m;
    }

    public void d(String str) {
        this.f13879j = str;
    }

    @Keep
    public void disallowNetas(Context context) {
        b(context);
    }

    public String e() {
        return this.f13879j;
    }

    public void e(String str) {
        this.f13884o = str;
    }

    public fc.a f() {
        return this.f13872c;
    }

    public void f(String str) {
        this.f13880k = str;
    }

    public long g() {
        return this.f13877h;
    }

    public void g(String str) {
    }

    @Keep
    public int getActiveTunnels() {
        c cVar = this.f13873d;
        if (cVar.b()) {
            return cVar.a().b();
        }
        return 0;
    }

    @Keep
    public long getUpTime() {
        c cVar = this.f13873d;
        if (cVar.b()) {
            return cVar.a().a(TimeUnit.MILLISECONDS);
        }
        return 0L;
    }

    public String h() {
        return this.f13884o;
    }

    public jc.a i() {
        return this.f13871b;
    }

    @Keep
    public boolean isConnected() {
        c cVar = this.f13873d;
        return cVar.b() && cVar.a().c();
    }

    @Keep
    public boolean isRunning() {
        c cVar = this.f13873d;
        return cVar.b() && cVar.a().d();
    }

    public String j() {
        return this.f13874e;
    }

    public String k() {
        return this.f13876g;
    }

    public String l() {
        return this.f13875f;
    }

    public String m() {
        return this.f13880k;
    }

    public boolean n() {
        return this.f13881l && Build.VERSION.SDK_INT >= 26;
    }

    public boolean o() {
        return this.f13878i;
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        ic.a.a("receiver", a.b.k("Got message: ", intent.getStringExtra("message")), new Object[0]);
        if (intent.getBooleanExtra("need_restart", false)) {
            try {
                ic.a.d("receiver", "Restarting Netas Service", new Object[0]);
                start();
            } catch (Exception unused) {
                ic.a.d("receiver", "Failed To restart Netas Service", new Object[0]);
            }
        }
    }

    @Keep
    public void start() {
        Intent intent = new Intent();
        Context context = this.f13870a;
        intent.setClass(context, NetasService.class);
        this.f13871b.b();
        try {
            if (!n() || Build.VERSION.SDK_INT < 26) {
                context.startService(intent);
            } else {
                intent.putExtra("need_forground", true);
                context.startForegroundService(intent);
            }
        } catch (Exception unused) {
            ic.a.b("netas", "start() failed on startService() with sdk " + Build.VERSION.SDK_INT, new Object[0]);
        }
        context.bindService(intent, this.f13873d, 1);
    }

    @Keep
    public void startAlert(Context context) {
        if (this.f13872c.b(this.f13870a.getString(R.string.netas_user_permission))) {
            start();
        } else {
            b(context);
        }
    }

    @Keep
    public void stop() {
        c cVar = this.f13873d;
        boolean b5 = cVar.b();
        Context context = this.f13870a;
        if (b5) {
            context.unbindService(cVar);
        }
        context.stopService(new Intent(context, (Class<?>) NetasService.class));
    }
}