Anti Spy v30.16.1.24版本的 MD5 值为:c71fa7f3f1aa08291411b9a5a8b2e65d

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


package c8;

import android.net.TrafficStats;
import android.text.TextUtils;
import com.google.android.gms.tasks.Task;
import com.google.android.gms.tasks.TaskCompletionSource;
import com.google.android.gms.tasks.Tasks;
import e7.o;
import h6.x;
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 k7.k;
import k7.l;
import org.json.JSONException;
import org.json.JSONObject;
public final class c implements d {
    public static final Object f2592m = new Object();
    public final z6.g f2593a;
    public final e8.c f2594b;
    public final k f2595c;
    public final j f2596d;
    public final o f2597e;
    public final h f2598f;
    public final Object f2599g;
    public final ExecutorService f2600h;
    public final Executor f2601i;
    public String f2602j;
    public final HashSet f2603k;
    public final ArrayList f2604l;

    static {
        new AtomicInteger(1);
    }

    public c(z6.g gVar, b8.c cVar, ExecutorService executorService, f7.j jVar) {
        gVar.a();
        e8.c cVar2 = new e8.c(gVar.f20860a, cVar);
        k kVar = new k(gVar);
        j a10 = j.a();
        o oVar = new o(new e7.d(gVar, 2));
        h hVar = new h();
        this.f2599g = new Object();
        this.f2603k = new HashSet();
        this.f2604l = new ArrayList();
        this.f2593a = gVar;
        this.f2594b = cVar2;
        this.f2595c = kVar;
        this.f2596d = a10;
        this.f2597e = oVar;
        this.f2598f = hVar;
        this.f2600h = executorService;
        this.f2601i = jVar;
    }

    public final void a(i iVar) {
        synchronized (this.f2599g) {
            try {
                this.f2604l.add(iVar);
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    public final void b(boolean z10) {
        d8.a l10;
        synchronized (f2592m) {
            try {
                z6.g gVar = this.f2593a;
                gVar.a();
                k a10 = k.a(gVar.f20860a);
                l10 = this.f2595c.l();
                d8.c cVar = d8.c.NOT_GENERATED;
                d8.c cVar2 = l10.f13313b;
                if (cVar2 == cVar || cVar2 == d8.c.ATTEMPT_MIGRATION) {
                    String h10 = h(l10);
                    k kVar = this.f2595c;
                    q8.c cVar3 = new q8.c(l10);
                    cVar3.f18232a = h10;
                    cVar3.k(d8.c.UNREGISTERED);
                    l10 = cVar3.g();
                    kVar.c(l10);
                }
                if (a10 != null) {
                    a10.n();
                }
            } catch (Throwable th) {
                throw th;
            }
        }
        if (z10) {
            q8.c cVar4 = new q8.c(l10);
            cVar4.f18234c = null;
            l10 = cVar4.g();
        }
        k(l10);
        this.f2601i.execute(new b(this, z10, 0));
    }

    public final d8.a c(d8.a aVar) {
        int responseCode;
        e8.b f10;
        z6.g gVar = this.f2593a;
        gVar.a();
        String str = gVar.f20862c.f20875a;
        gVar.a();
        String str2 = gVar.f20862c.f20881g;
        String str3 = aVar.f13315d;
        e8.c cVar = this.f2594b;
        e8.e eVar = cVar.f13760c;
        if (eVar.b()) {
            URL a10 = e8.c.a(String.format("projects/%s/installations/%s/authTokens:generate", str2, aVar.f13312a));
            for (int i10 = 0; i10 <= 1; i10++) {
                TrafficStats.setThreadStatsTag(32771);
                HttpURLConnection c6 = cVar.c(a10, str);
                try {
                    c6.setRequestMethod("POST");
                    c6.addRequestProperty("Authorization", "FIS_v2 " + str3);
                    c6.setDoOutput(true);
                    e8.c.h(c6);
                    responseCode = c6.getResponseCode();
                    eVar.d(responseCode);
                } catch (IOException | AssertionError unused) {
                } catch (Throwable th) {
                    c6.disconnect();
                    TrafficStats.clearThreadStatsTag();
                    throw th;
                }
                if (responseCode >= 200 && responseCode < 300) {
                    f10 = e8.c.f(c6);
                } else {
                    e8.c.b(c6, null, str, str2);
                    if (responseCode == 401 || responseCode == 404) {
                        l a11 = e8.b.a();
                        a11.f15915d = e8.f.AUTH_ERROR;
                        f10 = a11.d();
                    } else if (responseCode == 429) {
                        throw new e("Firebase servers have received too many requests from this client in a short period of time. Please try again later.");
                    } else {
                        if (responseCode < 500 || responseCode >= 600) {
                            l a12 = e8.b.a();
                            a12.f15915d = e8.f.BAD_CONFIG;
                            f10 = a12.d();
                        }
                        c6.disconnect();
                        TrafficStats.clearThreadStatsTag();
                    }
                }
                c6.disconnect();
                TrafficStats.clearThreadStatsTag();
                int ordinal = f10.f13755c.ordinal();
                if (ordinal == 0) {
                    j jVar = this.f2596d;
                    jVar.getClass();
                    TimeUnit timeUnit = TimeUnit.MILLISECONDS;
                    jVar.f2613a.getClass();
                    long seconds = timeUnit.toSeconds(System.currentTimeMillis());
                    q8.c cVar2 = new q8.c(aVar);
                    cVar2.f18234c = f10.f13753a;
                    cVar2.f18236n = Long.valueOf(f10.f13754b);
                    cVar2.f18237o = Long.valueOf(seconds);
                    return cVar2.g();
                } else if (ordinal == 1) {
                    q8.c cVar3 = new q8.c(aVar);
                    cVar3.f18238p = "BAD CONFIG";
                    cVar3.k(d8.c.REGISTER_ERROR);
                    return cVar3.g();
                } else if (ordinal == 2) {
                    l(null);
                    q8.c cVar4 = new q8.c(aVar);
                    cVar4.k(d8.c.NOT_GENERATED);
                    return cVar4.g();
                } else {
                    throw new e("Firebase Installations Service is unavailable. Please try again later.");
                }
            }
            throw new e("Firebase Installations Service is unavailable. Please try again later.");
        }
        throw new e("Firebase Installations Service is unavailable. Please try again later.");
    }

    public final Task d() {
        String str;
        g();
        synchronized (this) {
            try {
                str = this.f2602j;
            } catch (Throwable th) {
                throw th;
            }
        }
        if (str != null) {
            return Tasks.forResult(str);
        }
        TaskCompletionSource taskCompletionSource = new TaskCompletionSource();
        a(new g(taskCompletionSource));
        Task task = taskCompletionSource.getTask();
        this.f2600h.execute(new x(this, 1));
        return task;
    }

    public final Task e() {
        g();
        TaskCompletionSource taskCompletionSource = new TaskCompletionSource();
        a(new f(this.f2596d, taskCompletionSource));
        Task task = taskCompletionSource.getTask();
        this.f2600h.execute(new b(this, false, 1));
        return task;
    }

    public final void f(d8.a aVar) {
        synchronized (f2592m) {
            try {
                z6.g gVar = this.f2593a;
                gVar.a();
                k a10 = k.a(gVar.f20860a);
                this.f2595c.c(aVar);
                if (a10 != null) {
                    a10.n();
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    public final void g() {
        z6.g gVar = this.f2593a;
        gVar.a();
        e6.h.j("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.f20862c.f20876b);
        gVar.a();
        e6.h.j("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.f20862c.f20881g);
        gVar.a();
        e6.h.j("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.f20862c.f20875a);
        gVar.a();
        String str = gVar.f20862c.f20876b;
        Pattern pattern = j.f2611c;
        e6.h.d(str.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.");
        gVar.a();
        e6.h.d(j.f2611c.matcher(gVar.f20862c.f20875a).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.");
    }

    public final String h(d8.a aVar) {
        String a10;
        z6.g gVar = this.f2593a;
        gVar.a();
        if (!gVar.f20861b.equals("CHIME_ANDROID_SDK")) {
            z6.g gVar2 = this.f2593a;
            gVar2.a();
        }
        if (aVar.f13313b == d8.c.ATTEMPT_MIGRATION) {
            d8.b bVar = (d8.b) this.f2597e.get();
            synchronized (bVar.f13320a) {
                try {
                    a10 = bVar.a();
                    if (a10 == null) {
                        a10 = bVar.b();
                    }
                } catch (Throwable th) {
                    throw th;
                }
            }
            if (TextUtils.isEmpty(a10)) {
                this.f2598f.getClass();
                a10 = h.a();
            }
            return a10;
        }
        this.f2598f.getClass();
        return h.a();
    }

    public final d8.a i(d8.a aVar) {
        int responseCode;
        e8.a aVar2;
        String str = aVar.f13312a;
        String str2 = null;
        if (str != null && str.length() == 11) {
            d8.b bVar = (d8.b) this.f2597e.get();
            synchronized (bVar.f13320a) {
                try {
                    String[] strArr = d8.b.f13319c;
                    int i10 = 0;
                    while (true) {
                        if (i10 < 4) {
                            String str3 = strArr[i10];
                            String str4 = bVar.f13321b;
                            String string = bVar.f13320a.getString("|T|" + str4 + "|" + str3, null);
                            if (string == null || string.isEmpty()) {
                                i10++;
                            } else if (string.startsWith("{")) {
                                try {
                                    str2 = new JSONObject(string).getString("token");
                                } catch (JSONException unused) {
                                }
                            } else {
                                str2 = string;
                            }
                        }
                    }
                } finally {
                }
            }
        }
        e8.c cVar = this.f2594b;
        z6.g gVar = this.f2593a;
        gVar.a();
        String str5 = gVar.f20862c.f20875a;
        String str6 = aVar.f13312a;
        z6.g gVar2 = this.f2593a;
        gVar2.a();
        String str7 = gVar2.f20862c.f20881g;
        z6.g gVar3 = this.f2593a;
        gVar3.a();
        String str8 = gVar3.f20862c.f20876b;
        e8.e eVar = cVar.f13760c;
        if (eVar.b()) {
            URL a10 = e8.c.a(String.format("projects/%s/installations", str7));
            for (int i11 = 0; i11 <= 1; i11++) {
                TrafficStats.setThreadStatsTag(32769);
                HttpURLConnection c6 = cVar.c(a10, str5);
                try {
                    c6.setRequestMethod("POST");
                    c6.setDoOutput(true);
                    if (str2 != null) {
                        c6.addRequestProperty("x-goog-fis-android-iid-migration-auth", str2);
                    }
                    e8.c.g(c6, str6, str8);
                    responseCode = c6.getResponseCode();
                    eVar.d(responseCode);
                } catch (IOException | AssertionError unused2) {
                } catch (Throwable th) {
                    c6.disconnect();
                    TrafficStats.clearThreadStatsTag();
                    throw th;
                }
                if (responseCode < 200 || responseCode >= 300) {
                    e8.c.b(c6, str8, str5, str7);
                    if (responseCode == 429) {
                        throw new e("Firebase servers have received too many requests from this client in a short period of time. Please try again later.");
                    }
                    if (responseCode < 500 || responseCode >= 600) {
                        e8.a aVar3 = new e8.a(null, null, null, null, e8.d.BAD_CONFIG);
                        c6.disconnect();
                        TrafficStats.clearThreadStatsTag();
                        aVar2 = aVar3;
                    }
                    c6.disconnect();
                    TrafficStats.clearThreadStatsTag();
                } else {
                    aVar2 = e8.c.e(c6);
                    c6.disconnect();
                    TrafficStats.clearThreadStatsTag();
                }
                int ordinal = aVar2.f13752e.ordinal();
                if (ordinal != 0) {
                    if (ordinal == 1) {
                        q8.c cVar2 = new q8.c(aVar);
                        cVar2.f18238p = "BAD CONFIG";
                        cVar2.k(d8.c.REGISTER_ERROR);
                        return cVar2.g();
                    }
                    throw new e("Firebase Installations Service is unavailable. Please try again later.");
                }
                String str9 = aVar2.f13749b;
                String str10 = aVar2.f13750c;
                j jVar = this.f2596d;
                jVar.getClass();
                TimeUnit timeUnit = TimeUnit.MILLISECONDS;
                jVar.f2613a.getClass();
                long seconds = timeUnit.toSeconds(System.currentTimeMillis());
                e8.b bVar2 = aVar2.f13751d;
                String str11 = bVar2.f13753a;
                long j10 = bVar2.f13754b;
                q8.c cVar3 = new q8.c(aVar);
                cVar3.f18232a = str9;
                cVar3.k(d8.c.REGISTERED);
                cVar3.f18234c = str11;
                cVar3.f18235d = str10;
                cVar3.f18236n = Long.valueOf(j10);
                cVar3.f18237o = Long.valueOf(seconds);
                return cVar3.g();
            }
            throw new e("Firebase Installations Service is unavailable. Please try again later.");
        }
        throw new e("Firebase Installations Service is unavailable. Please try again later.");
    }

    public final void j(Exception exc) {
        synchronized (this.f2599g) {
            try {
                Iterator it = this.f2604l.iterator();
                while (it.hasNext()) {
                    if (((i) it.next()).b(exc)) {
                        it.remove();
                    }
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    public final void k(d8.a aVar) {
        synchronized (this.f2599g) {
            try {
                Iterator it = this.f2604l.iterator();
                while (it.hasNext()) {
                    if (((i) it.next()).a(aVar)) {
                        it.remove();
                    }
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    public final synchronized void l(String str) {
        try {
            this.f2602j = str;
        } catch (Throwable th) {
            throw th;
        }
    }

    public final synchronized void m(d8.a aVar, d8.a aVar2) {
        try {
            if (this.f2603k.size() != 0 && !TextUtils.equals(aVar.f13312a, aVar2.f13312a)) {
                Iterator it = this.f2603k.iterator();
                if (it.hasNext()) {
                    a9.i.B(it.next());
                    throw null;
                }
            }
        } finally {
        }
    }
}