Fast Orange v3.5.3版本的 MD5 值为:33b91aba50c566533dfd683a85f79158

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


package com.free.vpn.proxy.hotspot;

import android.net.TrafficStats;
import android.text.TextUtils;
import android.util.Log;
import com.google.android.gms.appindex.ThingPropertyKeys;
import com.google.android.gms.common.internal.Preconditions;
import com.google.android.gms.tasks.Task;
import com.google.android.gms.tasks.TaskCompletionSource;
import com.google.android.gms.tasks.Tasks;
import com.google.firebase.installations.FirebaseInstallationsException;
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;

public final class d21 implements e21 {
    public static final Object m = new Object();
    public final v11 a;
    public final a21 b;
    public final cj3 c;
    public final ss4 d;
    public final m22 e;
    public final sb3 f;
    public final Object g;
    public final ExecutorService h;
    public final Executor i;
    public String j;
    public final HashSet k;
    public final ArrayList l;

    static {
        new AtomicInteger(1);
    }

    public d21(v11 v11Var, p83 p83Var, ExecutorService executorService, at3 at3Var) {
        v11Var.a();
        a21 a21Var = new a21(v11Var.a, p83Var);
        cj3 cj3Var = new cj3(v11Var);
        ss4 a = ss4.a();
        m22 m22Var = new m22(new t20(v11Var, 2));
        sb3 sb3Var = new sb3();
        this.g = new Object();
        this.k = new HashSet();
        this.l = new ArrayList();
        this.a = v11Var;
        this.b = a21Var;
        this.c = cj3Var;
        this.d = a;
        this.e = m22Var;
        this.f = sb3Var;
        this.h = executorService;
        this.i = at3Var;
    }

    public static d21 d() {
        v11 c = v11.c();
        Preconditions.checkArgument(true, "Null is not a valid value of FirebaseApp.");
        c.a();
        return (d21) c.d.a(e21.class);
    }

    public final Task a() {
        TaskCompletionSource taskCompletionSource = new TaskCompletionSource();
        wb1 wb1Var = new wb1(taskCompletionSource);
        synchronized (this.g) {
            this.l.add(wb1Var);
        }
        return taskCompletionSource.getTask();
    }

    public final ne b(ne neVar) {
        int responseCode;
        boolean z;
        ve f;
        zf2 a;
        ag4 ag4Var;
        v11 v11Var = this.a;
        v11Var.a();
        String str = v11Var.c.a;
        v11Var.a();
        String str2 = v11Var.c.g;
        String str3 = neVar.d;
        a21 a21Var = this.b;
        kh3 kh3Var = a21Var.c;
        boolean b = kh3Var.b();
        f21 f21Var = f21.UNAVAILABLE;
        if (b) {
            URL a2 = a21.a(String.format("projects/%s/installations/%s/authTokens:generate", str2, neVar.a));
            for (int i = 0; i <= 1; i++) {
                TrafficStats.setThreadStatsTag(32771);
                HttpURLConnection c = a21Var.c(a2, str);
                try {
                    try {
                        c.setRequestMethod("POST");
                        try {
                            StringBuilder sb = new StringBuilder();
                            try {
                                sb.append("FIS_v2 ");
                                sb.append(str3);
                                c.addRequestProperty("Authorization", sb.toString());
                                c.setDoOutput(true);
                                a21.h(c);
                                responseCode = c.getResponseCode();
                                kh3Var.d(responseCode);
                                if (responseCode >= 200 && responseCode < 300) {
                                    z = true;
                                } else {
                                    z = false;
                                }
                            } catch (IOException | AssertionError unused) {
                            }
                        } catch (IOException | AssertionError unused2) {
                        }
                    } catch (Throwable th) {
                        c.disconnect();
                        TrafficStats.clearThreadStatsTag();
                        throw th;
                    }
                } catch (IOException | AssertionError unused3) {
                }
                if (z) {
                    f = a21.f(c);
                } else {
                    a21.b(c, 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.");
                                a = ve.a();
                                ag4Var = ag4.BAD_CONFIG;
                                a.c = ag4Var;
                                f = a.k();
                            } else {
                                c.disconnect();
                                TrafficStats.clearThreadStatsTag();
                            }
                        } else {
                            throw new FirebaseInstallationsException("Firebase servers have received too many requests from this client in a short period of time. Please try again later.", f21.TOO_MANY_REQUESTS);
                        }
                    }
                    a = ve.a();
                    ag4Var = ag4.AUTH_ERROR;
                    a.c = ag4Var;
                    f = a.k();
                }
                c.disconnect();
                TrafficStats.clearThreadStatsTag();
                int ordinal = f.c.ordinal();
                if (ordinal != 0) {
                    if (ordinal != 1) {
                        if (ordinal == 2) {
                            j(null);
                            he heVar = new he(neVar, 0);
                            heVar.m(ly2.NOT_GENERATED);
                            return heVar.g();
                        }
                        throw new FirebaseInstallationsException("Firebase Installations Service is unavailable. Please try again later.", f21Var);
                    }
                    he heVar2 = new he(neVar, 0);
                    heVar2.h = "BAD CONFIG";
                    heVar2.m(ly2.REGISTER_ERROR);
                    return heVar2.g();
                }
                ss4 ss4Var = this.d;
                ss4Var.getClass();
                TimeUnit timeUnit = TimeUnit.MILLISECONDS;
                ss4Var.a.getClass();
                long seconds = timeUnit.toSeconds(System.currentTimeMillis());
                he heVar3 = new he(neVar, 0);
                heVar3.d = f.a;
                heVar3.b = Long.valueOf(f.b);
                heVar3.c = Long.valueOf(seconds);
                return heVar3.g();
            }
            throw new FirebaseInstallationsException("Firebase Installations Service is unavailable. Please try again later.", f21Var);
        }
        throw new FirebaseInstallationsException("Firebase Installations Service is unavailable. Please try again later.", f21Var);
    }

    public final Task c() {
        String str;
        v11 v11Var = this.a;
        v11Var.a();
        Preconditions.checkNotEmpty(v11Var.c.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.");
        v11 v11Var2 = this.a;
        v11Var2.a();
        Preconditions.checkNotEmpty(v11Var2.c.g, "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.");
        v11 v11Var3 = this.a;
        v11Var3.a();
        Preconditions.checkNotEmpty(v11Var3.c.a, "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.");
        v11 v11Var4 = this.a;
        v11Var4.a();
        String str2 = v11Var4.c.b;
        Pattern pattern = ss4.c;
        Preconditions.checkArgument(str2.contains(":"), "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.");
        v11 v11Var5 = this.a;
        v11Var5.a();
        Preconditions.checkArgument(ss4.c.matcher(v11Var5.c.a).matches(), "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.");
        synchronized (this) {
            str = this.j;
        }
        if (str != null) {
            return Tasks.forResult(str);
        }
        Task a = a();
        this.h.execute(new ok3(this, 13));
        return a;
    }

    public final void e(ne neVar) {
        synchronized (m) {
            v11 v11Var = this.a;
            v11Var.a();
            dj3 i = dj3.i(v11Var.a);
            try {
                this.c.n(neVar);
            } finally {
                if (i != null) {
                    i.z();
                }
            }
        }
    }

    public final String f(ne neVar) {
        boolean z;
        String a;
        v11 v11Var = this.a;
        v11Var.a();
        if (!v11Var.b.equals("CHIME_ANDROID_SDK")) {
            v11 v11Var2 = this.a;
            v11Var2.a();
        }
        if (neVar.b == ly2.ATTEMPT_MIGRATION) {
            z = true;
        } else {
            z = false;
        }
        if (z) {
            jk1 jk1Var = (jk1) this.e.get();
            synchronized (jk1Var.a) {
                a = jk1Var.a();
                if (a == null) {
                    a = jk1Var.b();
                }
            }
            if (TextUtils.isEmpty(a)) {
                this.f.getClass();
                return sb3.a();
            }
            return a;
        }
        this.f.getClass();
        return sb3.a();
    }

    public final ne g(ne neVar) {
        int responseCode;
        boolean z;
        fe e;
        ne neVar2 = neVar;
        String str = neVar2.a;
        String str2 = null;
        if (str != null && str.length() == 11) {
            jk1 jk1Var = (jk1) this.e.get();
            synchronized (jk1Var.a) {
                String[] strArr = jk1.c;
                int i = 0;
                while (true) {
                    if (i >= 4) {
                        break;
                    }
                    String str3 = strArr[i];
                    String string = jk1Var.a.getString("|T|" + jk1Var.b + "|" + str3, null);
                    if (string != null && !string.isEmpty()) {
                        if (string.startsWith("{")) {
                            try {
                                str2 = new ar1(string).h(ThingPropertyKeys.TOKEN);
                            } catch (JSONException unused) {
                            }
                        } else {
                            str2 = string;
                        }
                    } else {
                        i++;
                    }
                }
            }
        }
        a21 a21Var = this.b;
        v11 v11Var = this.a;
        v11Var.a();
        String str4 = v11Var.c.a;
        String str5 = neVar2.a;
        v11 v11Var2 = this.a;
        v11Var2.a();
        String str6 = v11Var2.c.g;
        v11 v11Var3 = this.a;
        v11Var3.a();
        String str7 = v11Var3.c.b;
        kh3 kh3Var = a21Var.c;
        boolean b = kh3Var.b();
        f21 f21Var = f21.UNAVAILABLE;
        if (b) {
            URL a = a21.a(String.format("projects/%s/installations", str6));
            int i2 = 0;
            for (?? r10 = 1; i2 <= r10; r10 = 1) {
                TrafficStats.setThreadStatsTag(32769);
                HttpURLConnection c = a21Var.c(a, str4);
                try {
                    try {
                        c.setRequestMethod("POST");
                        c.setDoOutput(r10);
                        if (str2 != null) {
                            c.addRequestProperty("x-goog-fis-android-iid-migration-auth", str2);
                        }
                        a21.g(c, str5, str7);
                        responseCode = c.getResponseCode();
                        kh3Var.d(responseCode);
                        if (responseCode >= 200 && responseCode < 300) {
                            z = true;
                        } else {
                            z = false;
                        }
                    } catch (IOException | AssertionError unused2) {
                    }
                    if (z) {
                        e = a21.e(c);
                    } else {
                        a21.b(c, str7, str4, str6);
                        if (responseCode != 429) {
                            if (responseCode < 500 || responseCode >= 600) {
                                try {
                                    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.");
                                    ep0 ep0Var = new ep0(10);
                                    ep0Var.e = ko1.BAD_CONFIG;
                                    e = ep0Var.f();
                                } catch (IOException | AssertionError unused3) {
                                }
                            }
                            c.disconnect();
                            TrafficStats.clearThreadStatsTag();
                            i2++;
                            neVar2 = neVar;
                        } else {
                            throw new FirebaseInstallationsException("Firebase servers have received too many requests from this client in a short period of time. Please try again later.", f21.TOO_MANY_REQUESTS);
                        }
                    }
                    c.disconnect();
                    TrafficStats.clearThreadStatsTag();
                    int ordinal = e.e.ordinal();
                    if (ordinal != 0) {
                        if (ordinal == 1) {
                            he heVar = new he(neVar2, 0);
                            heVar.h = "BAD CONFIG";
                            heVar.m(ly2.REGISTER_ERROR);
                            return heVar.g();
                        }
                        throw new FirebaseInstallationsException("Firebase Installations Service is unavailable. Please try again later.", f21.UNAVAILABLE);
                    }
                    String str8 = e.b;
                    String str9 = e.c;
                    ss4 ss4Var = this.d;
                    ss4Var.getClass();
                    TimeUnit timeUnit = TimeUnit.MILLISECONDS;
                    ss4Var.a.getClass();
                    long seconds = timeUnit.toSeconds(System.currentTimeMillis());
                    ve veVar = e.d;
                    String str10 = veVar.a;
                    long j = veVar.b;
                    he heVar2 = new he(neVar2, 0);
                    heVar2.e = str8;
                    heVar2.m(ly2.REGISTERED);
                    heVar2.d = str10;
                    heVar2.g = str9;
                    heVar2.b = Long.valueOf(j);
                    heVar2.c = Long.valueOf(seconds);
                    return heVar2.g();
                } catch (Throwable th) {
                    c.disconnect();
                    TrafficStats.clearThreadStatsTag();
                    throw th;
                }
            }
            throw new FirebaseInstallationsException("Firebase Installations Service is unavailable. Please try again later.", f21Var);
        }
        throw new FirebaseInstallationsException("Firebase Installations Service is unavailable. Please try again later.", f21Var);
    }

    public final void h() {
        synchronized (this.g) {
            Iterator it = this.l.iterator();
            while (it.hasNext()) {
                ((wb1) it.next()).getClass();
            }
        }
    }

    public final void i(ne neVar) {
        boolean z;
        boolean z2;
        boolean z3;
        synchronized (this.g) {
            Iterator it = this.l.iterator();
            while (it.hasNext()) {
                wb1 wb1Var = (wb1) it.next();
                wb1Var.getClass();
                ly2 ly2Var = ly2.UNREGISTERED;
                ly2 ly2Var2 = neVar.b;
                boolean z4 = true;
                if (ly2Var2 == ly2Var) {
                    z = true;
                } else {
                    z = false;
                }
                if (!z) {
                    if (ly2Var2 == ly2.REGISTERED) {
                        z2 = true;
                    } else {
                        z2 = false;
                    }
                    if (!z2) {
                        if (ly2Var2 == ly2.REGISTER_ERROR) {
                            z3 = true;
                        } else {
                            z3 = false;
                        }
                        if (!z3) {
                            z4 = false;
                            if (!z4) {
                                it.remove();
                            }
                        }
                    }
                }
                wb1Var.a.trySetResult(neVar.a);
                if (!z4) {
                }
            }
        }
    }

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

    public final synchronized void k(ne neVar, ne neVar2) {
        if (this.k.size() != 0 && !TextUtils.equals(neVar.a, neVar2.a)) {
            Iterator it = this.k.iterator();
            if (it.hasNext()) {
                jf2.z(it.next());
                throw null;
            }
        }
    }
}