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

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


package f7;

import android.net.TrafficStats;
import android.text.TextUtils;
import android.util.Log;
import h6.p;
import i.a4;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Pattern;
import org.json.JSONException;
import org.json.JSONObject;
import u5.q;
public final class d implements e {
    public static final Object f4437m = new Object();
    public final b6.g f4438a;
    public final h7.c f4439b;
    public final n4.e f4440c;
    public final k f4441d;
    public final p f4442e;
    public final i f4443f;
    public final Object f4444g;
    public final ExecutorService f4445h;
    public final Executor f4446i;
    public String f4447j;
    public final HashSet f4448k;
    public final ArrayList f4449l;

    static {
        new AtomicInteger(1);
    }

    public d(b6.g gVar, e7.c cVar, ExecutorService executorService, i6.k kVar) {
        gVar.a();
        h7.c cVar2 = new h7.c(gVar.f2108a, cVar);
        n4.e eVar = new n4.e(28, gVar);
        k a6 = k.a();
        p pVar = new p(new h6.e(2, gVar));
        i iVar = new i();
        this.f4444g = new Object();
        this.f4448k = new HashSet();
        this.f4449l = new ArrayList();
        this.f4438a = gVar;
        this.f4439b = cVar2;
        this.f4440c = eVar;
        this.f4441d = a6;
        this.f4442e = pVar;
        this.f4443f = iVar;
        this.f4445h = executorService;
        this.f4446i = kVar;
    }

    public final void a(j jVar) {
        synchronized (this.f4444g) {
            this.f4449l.add(jVar);
        }
    }

    public final void b(boolean z10) {
        g7.a l10;
        boolean z11;
        synchronized (f4437m) {
            b6.g gVar = this.f4438a;
            gVar.a();
            n4.e c10 = n4.e.c(gVar.f2108a);
            l10 = this.f4440c.l();
            g7.c cVar = g7.c.NOT_GENERATED;
            g7.c cVar2 = l10.f5355b;
            if (cVar2 != cVar && cVar2 != g7.c.ATTEMPT_MIGRATION) {
                z11 = false;
                if (z11) {
                    String h10 = h(l10);
                    n4.e eVar = this.f4440c;
                    a4 a4Var = new a4(l10);
                    a4Var.f5988a = h10;
                    a4Var.q(g7.c.UNREGISTERED);
                    l10 = a4Var.g();
                    eVar.h(l10);
                }
                if (c10 != null) {
                    c10.m();
                }
            }
            z11 = true;
            if (z11) {
            }
            if (c10 != null) {
            }
        }
        if (z10) {
            a4 a4Var2 = new a4(l10);
            a4Var2.f5990c = null;
            l10 = a4Var2.g();
        }
        k(l10);
        this.f4446i.execute(new b(this, z10, 0));
    }

    public final g7.a c(g7.a aVar) {
        int responseCode;
        boolean z10;
        h7.b f10;
        z2.c cVar;
        h7.f fVar;
        b6.g gVar = this.f4438a;
        gVar.a();
        String str = gVar.f2110c.f2126a;
        gVar.a();
        String str2 = gVar.f2110c.f2132g;
        String str3 = aVar.f5357d;
        h7.c cVar2 = this.f4439b;
        h7.e eVar = cVar2.f5834c;
        if (eVar.b()) {
            URL a6 = h7.c.a(String.format("projects/%s/installations/%s/authTokens:generate", str2, aVar.f5354a));
            for (int i10 = 0; i10 <= 1; i10++) {
                TrafficStats.setThreadStatsTag(32771);
                HttpURLConnection c10 = cVar2.c(a6, str);
                try {
                    c10.setRequestMethod("POST");
                    c10.addRequestProperty("Authorization", "FIS_v2 " + str3);
                    c10.setDoOutput(true);
                    h7.c.h(c10);
                    responseCode = c10.getResponseCode();
                    eVar.d(responseCode);
                    if (responseCode >= 200 && responseCode < 300) {
                        z10 = true;
                    } else {
                        z10 = false;
                    }
                } catch (IOException | AssertionError unused) {
                } catch (Throwable th) {
                    c10.disconnect();
                    TrafficStats.clearThreadStatsTag();
                    throw th;
                }
                if (z10) {
                    f10 = h7.c.f(c10);
                } else {
                    h7.c.b(c10, null, str, str2);
                    if (responseCode != 401 && responseCode != 404) {
                        if (responseCode != 429) {
                            if (responseCode < 500 || responseCode >= 600) {
                                Log.e("Firebase-Installations", "Firebase Installations can not communicate with Firebase server APIs due to invalid configuration. Please update your Firebase initialization process and set valid Firebase options (API key, Project ID, Application ID) when initializing Firebase.");
                                cVar = new z2.c(6);
                                cVar.f11627t = 0L;
                                fVar = h7.f.BAD_CONFIG;
                                cVar.f11628u = fVar;
                                f10 = cVar.g();
                            } else {
                                c10.disconnect();
                                TrafficStats.clearThreadStatsTag();
                            }
                        } else {
                            throw new f("Firebase servers have received too many requests from this client in a short period of time. Please try again later.");
                        }
                    }
                    cVar = new z2.c(6);
                    cVar.f11627t = 0L;
                    fVar = h7.f.AUTH_ERROR;
                    cVar.f11628u = fVar;
                    f10 = cVar.g();
                }
                c10.disconnect();
                TrafficStats.clearThreadStatsTag();
                int ordinal = f10.f5829c.ordinal();
                if (ordinal != 0) {
                    if (ordinal != 1) {
                        if (ordinal == 2) {
                            l(null);
                            a4 a4Var = new a4(aVar);
                            a4Var.q(g7.c.NOT_GENERATED);
                            return a4Var.g();
                        }
                        throw new f("Firebase Installations Service is unavailable. Please try again later.");
                    }
                    a4 a4Var2 = new a4(aVar);
                    a4Var2.f5994g = "BAD CONFIG";
                    a4Var2.q(g7.c.REGISTER_ERROR);
                    return a4Var2.g();
                }
                k kVar = this.f4441d;
                kVar.getClass();
                TimeUnit timeUnit = TimeUnit.MILLISECONDS;
                kVar.f4458a.getClass();
                long seconds = timeUnit.toSeconds(System.currentTimeMillis());
                a4 a4Var3 = new a4(aVar);
                a4Var3.f5990c = f10.f5827a;
                a4Var3.f5992e = Long.valueOf(f10.f5828b);
                a4Var3.f5993f = Long.valueOf(seconds);
                return a4Var3.g();
            }
            throw new f("Firebase Installations Service is unavailable. Please try again later.");
        }
        throw new f("Firebase Installations Service is unavailable. Please try again later.");
    }

    public final q d() {
        String str;
        g();
        synchronized (this) {
            str = this.f4447j;
        }
        if (str != null) {
            return q1.b.j(str);
        }
        u5.j jVar = new u5.j();
        a(new h(jVar));
        q qVar = jVar.f10366a;
        this.f4445h.execute(new androidx.activity.b(11, this));
        return qVar;
    }

    public final q e() {
        g();
        u5.j jVar = new u5.j();
        a(new g(this.f4441d, jVar));
        this.f4445h.execute(new b(this, false, 1));
        return jVar.f10366a;
    }

    public final void f(g7.a aVar) {
        synchronized (f4437m) {
            b6.g gVar = this.f4438a;
            gVar.a();
            n4.e c10 = n4.e.c(gVar.f2108a);
            this.f4440c.h(aVar);
            if (c10 != null) {
                c10.m();
            }
        }
    }

    public final void g() {
        b6.g gVar = this.f4438a;
        gVar.a();
        com.bumptech.glide.f.h(gVar.f2110c.f2127b, "Please set your Application ID. A valid Firebase App ID is required to communicate with Firebase server APIs: It identifies your application with Firebase.Please refer to https://firebase.google.com/support/privacy/init-options.");
        gVar.a();
        com.bumptech.glide.f.h(gVar.f2110c.f2132g, "Please set your Project ID. A valid Firebase Project ID is required to communicate with Firebase server APIs: It identifies your application with Firebase.Please refer to https://firebase.google.com/support/privacy/init-options.");
        gVar.a();
        com.bumptech.glide.f.h(gVar.f2110c.f2126a, "Please set a valid API key. A Firebase API key is required to communicate with Firebase server APIs: It authenticates your project with Google.Please refer to https://firebase.google.com/support/privacy/init-options.");
        gVar.a();
        String str = gVar.f2110c.f2127b;
        Pattern pattern = k.f4456c;
        com.bumptech.glide.f.b("Please set your Application ID. A valid Firebase App ID is required to communicate with Firebase server APIs: It identifies your application with Firebase.Please refer to https://firebase.google.com/support/privacy/init-options.", str.contains(":"));
        gVar.a();
        com.bumptech.glide.f.b("Please set a valid API key. A Firebase API key is required to communicate with Firebase server APIs: It authenticates your project with Google.Please refer to https://firebase.google.com/support/privacy/init-options.", k.f4456c.matcher(gVar.f2110c.f2126a).matches());
    }

    public final String h(g7.a aVar) {
        boolean z10;
        String a6;
        b6.g gVar = this.f4438a;
        gVar.a();
        if (!gVar.f2109b.equals("CHIME_ANDROID_SDK")) {
            b6.g gVar2 = this.f4438a;
            gVar2.a();
        }
        if (aVar.f5355b == g7.c.ATTEMPT_MIGRATION) {
            z10 = true;
        } else {
            z10 = false;
        }
        if (z10) {
            g7.b bVar = (g7.b) this.f4442e.get();
            synchronized (bVar.f5362a) {
                a6 = bVar.a();
                if (a6 == null) {
                    a6 = bVar.b();
                }
            }
            if (TextUtils.isEmpty(a6)) {
                this.f4443f.getClass();
                return i.a();
            }
            return a6;
        }
        this.f4443f.getClass();
        return i.a();
    }

    public final g7.a i(g7.a aVar) {
        int responseCode;
        boolean z10;
        h7.a e10;
        String str = aVar.f5354a;
        String str2 = null;
        if (str != null && str.length() == 11) {
            g7.b bVar = (g7.b) this.f4442e.get();
            synchronized (bVar.f5362a) {
                String[] strArr = g7.b.f5361c;
                int i10 = 0;
                while (true) {
                    if (i10 >= 4) {
                        break;
                    }
                    String str3 = strArr[i10];
                    String str4 = bVar.f5363b;
                    String string = bVar.f5362a.getString("|T|" + str4 + "|" + str3, null);
                    if (string != null && !string.isEmpty()) {
                        if (string.startsWith("{")) {
                            try {
                                str2 = new JSONObject(string).getString("token");
                            } catch (JSONException unused) {
                            }
                        } else {
                            str2 = string;
                        }
                    } else {
                        i10++;
                    }
                }
            }
        }
        h7.c cVar = this.f4439b;
        b6.g gVar = this.f4438a;
        gVar.a();
        String str5 = gVar.f2110c.f2126a;
        String str6 = aVar.f5354a;
        b6.g gVar2 = this.f4438a;
        gVar2.a();
        String str7 = gVar2.f2110c.f2132g;
        b6.g gVar3 = this.f4438a;
        gVar3.a();
        String str8 = gVar3.f2110c.f2127b;
        h7.e eVar = cVar.f5834c;
        if (eVar.b()) {
            URL a6 = h7.c.a(String.format("projects/%s/installations", str7));
            for (int i11 = 0; i11 <= 1; i11++) {
                TrafficStats.setThreadStatsTag(32769);
                HttpURLConnection c10 = cVar.c(a6, str5);
                try {
                    c10.setRequestMethod("POST");
                    c10.setDoOutput(true);
                    if (str2 != null) {
                        c10.addRequestProperty("x-goog-fis-android-iid-migration-auth", str2);
                    }
                    h7.c.g(c10, str6, str8);
                    responseCode = c10.getResponseCode();
                    eVar.d(responseCode);
                    if (responseCode >= 200 && responseCode < 300) {
                        z10 = true;
                    } else {
                        z10 = false;
                    }
                } catch (IOException | AssertionError unused2) {
                } catch (Throwable th) {
                    c10.disconnect();
                    TrafficStats.clearThreadStatsTag();
                    throw th;
                }
                if (z10) {
                    e10 = h7.c.e(c10);
                } else {
                    h7.c.b(c10, str8, str5, str7);
                    if (responseCode != 429) {
                        if (responseCode < 500 || responseCode >= 600) {
                            Log.e("Firebase-Installations", "Firebase Installations can not communicate with Firebase server APIs due to invalid configuration. Please update your Firebase initialization process and set valid Firebase options (API key, Project ID, Application ID) when initializing Firebase.");
                            e10 = new h7.a(null, null, null, null, h7.d.BAD_CONFIG);
                        } else {
                            c10.disconnect();
                            TrafficStats.clearThreadStatsTag();
                        }
                    } else {
                        throw new f("Firebase servers have received too many requests from this client in a short period of time. Please try again later.");
                    }
                }
                c10.disconnect();
                TrafficStats.clearThreadStatsTag();
                int ordinal = e10.f5826e.ordinal();
                if (ordinal != 0) {
                    if (ordinal == 1) {
                        a4 a4Var = new a4(aVar);
                        a4Var.f5994g = "BAD CONFIG";
                        a4Var.q(g7.c.REGISTER_ERROR);
                        return a4Var.g();
                    }
                    throw new f("Firebase Installations Service is unavailable. Please try again later.");
                }
                String str9 = e10.f5823b;
                String str10 = e10.f5824c;
                k kVar = this.f4441d;
                kVar.getClass();
                TimeUnit timeUnit = TimeUnit.MILLISECONDS;
                kVar.f4458a.getClass();
                long seconds = timeUnit.toSeconds(System.currentTimeMillis());
                h7.b bVar2 = e10.f5825d;
                String str11 = bVar2.f5827a;
                long j10 = bVar2.f5828b;
                a4 a4Var2 = new a4(aVar);
                a4Var2.f5988a = str9;
                a4Var2.q(g7.c.REGISTERED);
                a4Var2.f5990c = str11;
                a4Var2.f5991d = str10;
                a4Var2.f5992e = Long.valueOf(j10);
                a4Var2.f5993f = Long.valueOf(seconds);
                return a4Var2.g();
            }
            throw new f("Firebase Installations Service is unavailable. Please try again later.");
        }
        throw new f("Firebase Installations Service is unavailable. Please try again later.");
    }

    public final void j(Exception exc) {
        synchronized (this.f4444g) {
            Iterator it = this.f4449l.iterator();
            while (it.hasNext()) {
                if (((j) it.next()).b(exc)) {
                    it.remove();
                }
            }
        }
    }

    public final void k(g7.a aVar) {
        synchronized (this.f4444g) {
            Iterator it = this.f4449l.iterator();
            while (it.hasNext()) {
                if (((j) it.next()).a(aVar)) {
                    it.remove();
                }
            }
        }
    }

    public final synchronized void l(String str) {
        this.f4447j = str;
    }

    public final synchronized void m(g7.a aVar, g7.a aVar2) {
        if (this.f4448k.size() != 0 && !TextUtils.equals(aVar.f5354a, aVar2.f5354a)) {
            Iterator it = this.f4448k.iterator();
            if (it.hasNext()) {
                androidx.activity.d.y(it.next());
                throw null;
            }
        }
    }
}