Shinigami ID v1.1.3版本的 MD5 值为:c381e85feac697f048c400ae89b7b92d

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


package z7;

import android.net.TrafficStats;
import android.text.TextUtils;
import android.util.Log;
import b8.a;
import c8.b;
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.List;
import java.util.Set;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Pattern;
import l3.p;
import n4.l;
import n4.v;
import org.json.JSONException;
import org.json.JSONObject;
import q6.m;

public final class c implements d {

    public static final Object f14849m = new Object();

    public final h6.f f14850a;

    public final c8.c f14851b;
    public final b8.c c;

    public final k f14852d;

    public final m<b8.b> f14853e;

    public final i f14854f;

    public final Object f14855g;

    public final ExecutorService f14856h;

    public final Executor f14857i;

    public String f14858j;

    public Set<a8.a> f14859k;
    public final List<j> l;

    static {
        new AtomicInteger(1);
    }

    public c(h6.f fVar, y7.b<w7.f> bVar, ExecutorService executorService, Executor executor) {
        fVar.a();
        c8.c cVar = new c8.c(fVar.f6488a, bVar);
        b8.c cVar2 = new b8.c(fVar);
        k c = k.c();
        m<b8.b> mVar = new m<>(new q6.c(fVar, 2));
        i iVar = new i();
        this.f14855g = new Object();
        this.f14859k = new HashSet();
        this.l = new ArrayList();
        this.f14850a = fVar;
        this.f14851b = cVar;
        this.c = cVar2;
        this.f14852d = c;
        this.f14853e = mVar;
        this.f14854f = iVar;
        this.f14856h = executorService;
        this.f14857i = executor;
    }

    public static c e() {
        return (c) h6.f.d().b(d.class);
    }

    public final void a(boolean z10) {
        b8.d c;
        synchronized (f14849m) {
            h6.f fVar = this.f14850a;
            fVar.a();
            androidx.appcompat.widget.m c10 = androidx.appcompat.widget.m.c(fVar.f6488a);
            try {
                c = this.c.c();
                if (c.i()) {
                    String h10 = h(c);
                    b8.c cVar = this.c;
                    a.C0029a c0029a = new a.C0029a((b8.a) c);
                    c0029a.f2743a = h10;
                    c0029a.f2744b = 3;
                    c = c0029a.a();
                    cVar.b(c);
                }
            } finally {
                if (c10 != null) {
                    c10.x();
                }
            }
        }
        if (z10) {
            a.C0029a c0029a2 = new a.C0029a((b8.a) c);
            c0029a2.c = null;
            c = c0029a2.a();
        }
        k(c);
        this.f14857i.execute(new b(this, z10, 0));
    }

    public final b8.d b(b8.d dVar) {
        int responseCode;
        c8.f f10;
        c8.c cVar = this.f14851b;
        String c = c();
        b8.a aVar = (b8.a) dVar;
        String str = aVar.f2737b;
        String f11 = f();
        String str2 = aVar.f2739e;
        if (!cVar.c.a()) {
            throw new e("Firebase Installations Service is unavailable. Please try again later.");
        }
        URL a10 = cVar.a(String.format("projects/%s/installations/%s/authTokens:generate", f11, str));
        for (int i10 = 0; i10 <= 1; i10++) {
            TrafficStats.setThreadStatsTag(32771);
            HttpURLConnection c10 = cVar.c(a10, c);
            try {
                c10.setRequestMethod("POST");
                c10.addRequestProperty("Authorization", "FIS_v2 " + str2);
                c10.setDoOutput(true);
                cVar.h(c10);
                responseCode = c10.getResponseCode();
                cVar.c.b(responseCode);
            } catch (IOException | AssertionError unused) {
            } catch (Throwable th) {
                c10.disconnect();
                TrafficStats.clearThreadStatsTag();
                throw th;
            }
            if (responseCode >= 200 && responseCode < 300) {
                f10 = cVar.f(c10);
            } else {
                c8.c.b(c10, null, c, f11);
                if (responseCode != 401 && responseCode != 404) {
                    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) {
                        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.");
                        b.a aVar2 = (b.a) c8.f.a();
                        aVar2.c = 2;
                        f10 = aVar2.a();
                    } else {
                        c10.disconnect();
                        TrafficStats.clearThreadStatsTag();
                    }
                }
                b.a aVar3 = (b.a) c8.f.a();
                aVar3.c = 3;
                f10 = aVar3.a();
            }
            c10.disconnect();
            TrafficStats.clearThreadStatsTag();
            c8.b bVar = (c8.b) f10;
            int d10 = p.g.d(bVar.c);
            if (d10 == 0) {
                String str3 = bVar.f3429a;
                long j10 = bVar.f3430b;
                long b10 = this.f14852d.b();
                a.C0029a c0029a = new a.C0029a(aVar);
                c0029a.c = str3;
                c0029a.b(j10);
                c0029a.d(b10);
                return c0029a.a();
            }
            if (d10 == 1) {
                a.C0029a c0029a2 = new a.C0029a(aVar);
                c0029a2.f2748g = "BAD CONFIG";
                c0029a2.f2744b = 5;
                return c0029a2.a();
            }
            if (d10 != 2) {
                throw new e("Firebase Installations Service is unavailable. Please try again later.");
            }
            synchronized (this) {
                this.f14858j = null;
            }
            a.C0029a c0029a3 = new a.C0029a(aVar);
            c0029a3.f2744b = 2;
            return c0029a3.a();
        }
        throw new e("Firebase Installations Service is unavailable. Please try again later.");
    }

    public final String c() {
        h6.f fVar = this.f14850a;
        fVar.a();
        return fVar.c.f6500a;
    }

    public final String d() {
        h6.f fVar = this.f14850a;
        fVar.a();
        return fVar.c.f6501b;
    }

    public final String f() {
        h6.f fVar = this.f14850a;
        fVar.a();
        return fVar.c.f6505g;
    }

    public final void g() {
        p.f(d(), "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.");
        p.f(f(), "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.");
        p.f(c(), "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.");
        String d10 = d();
        Pattern pattern = k.c;
        p.b(d10.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.");
        p.b(k.c.matcher(c()).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.");
    }

    @Override
    public final n4.i<String> getId() {
        String str;
        g();
        synchronized (this) {
            str = this.f14858j;
        }
        if (str != null) {
            return l.e(str);
        }
        n4.j jVar = new n4.j();
        g gVar = new g(jVar);
        synchronized (this.f14855g) {
            this.l.add(gVar);
        }
        v vVar = jVar.f8726a;
        this.f14856h.execute(new androidx.activity.c(this, 18));
        return vVar;
    }

    @Override
    public final n4.i getToken() {
        g();
        n4.j jVar = new n4.j();
        f fVar = new f(this.f14852d, jVar);
        synchronized (this.f14855g) {
            this.l.add(fVar);
        }
        v vVar = jVar.f8726a;
        this.f14856h.execute(new b(this, false, 1));
        return vVar;
    }

    public final String h(b8.d dVar) {
        String string;
        h6.f fVar = this.f14850a;
        fVar.a();
        if (fVar.f6489b.equals("CHIME_ANDROID_SDK") || this.f14850a.k()) {
            if (((b8.a) dVar).c == 1) {
                b8.b bVar = this.f14853e.get();
                synchronized (bVar.f2749a) {
                    synchronized (bVar.f2749a) {
                        string = bVar.f2749a.getString("|S|id", null);
                    }
                    if (string == null) {
                        string = bVar.a();
                    }
                }
                return TextUtils.isEmpty(string) ? this.f14854f.a() : string;
            }
        }
        return this.f14854f.a();
    }

    public final b8.d i(b8.d dVar) {
        int responseCode;
        c8.d e10;
        b8.a aVar = (b8.a) dVar;
        String str = aVar.f2737b;
        String str2 = null;
        if (str != null && str.length() == 11) {
            b8.b bVar = this.f14853e.get();
            synchronized (bVar.f2749a) {
                String[] strArr = b8.b.c;
                int i10 = 0;
                while (true) {
                    if (i10 >= 4) {
                        break;
                    }
                    String str3 = strArr[i10];
                    String string = bVar.f2749a.getString("|T|" + bVar.f2750b + "|" + 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;
                    }
                }
            }
        }
        c8.c cVar = this.f14851b;
        String c = c();
        String str4 = aVar.f2737b;
        String f10 = f();
        String d10 = d();
        if (!cVar.c.a()) {
            throw new e("Firebase Installations Service is unavailable. Please try again later.");
        }
        URL a10 = cVar.a(String.format("projects/%s/installations", f10));
        for (int i11 = 0; i11 <= 1; i11++) {
            TrafficStats.setThreadStatsTag(32769);
            HttpURLConnection c10 = cVar.c(a10, c);
            try {
                try {
                    c10.setRequestMethod("POST");
                    c10.setDoOutput(true);
                    if (str2 != null) {
                        c10.addRequestProperty("x-goog-fis-android-iid-migration-auth", str2);
                    }
                    cVar.g(c10, str4, d10);
                    responseCode = c10.getResponseCode();
                    cVar.c.b(responseCode);
                } finally {
                    c10.disconnect();
                    TrafficStats.clearThreadStatsTag();
                }
            } catch (IOException | AssertionError unused2) {
            }
            if (responseCode >= 200 && responseCode < 300) {
                e10 = cVar.e(c10);
                c10.disconnect();
                TrafficStats.clearThreadStatsTag();
            } else {
                c8.c.b(c10, d10, c, f10);
                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) {
                    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.");
                    c8.a aVar2 = new c8.a(null, null, null, null, 2);
                    c10.disconnect();
                    TrafficStats.clearThreadStatsTag();
                    e10 = aVar2;
                } else {
                    c10.disconnect();
                    TrafficStats.clearThreadStatsTag();
                }
            }
            c8.a aVar3 = (c8.a) e10;
            int d11 = p.g.d(aVar3.f3428e);
            if (d11 != 0) {
                if (d11 != 1) {
                    throw new e("Firebase Installations Service is unavailable. Please try again later.");
                }
                a.C0029a c0029a = new a.C0029a(aVar);
                c0029a.f2748g = "BAD CONFIG";
                c0029a.f2744b = 5;
                return c0029a.a();
            }
            String str5 = aVar3.f3426b;
            String str6 = aVar3.c;
            long b10 = this.f14852d.b();
            String c11 = aVar3.f3427d.c();
            long d12 = aVar3.f3427d.d();
            a.C0029a c0029a2 = new a.C0029a(aVar);
            c0029a2.f2743a = str5;
            c0029a2.f2744b = 4;
            c0029a2.c = c11;
            c0029a2.f2745d = str6;
            c0029a2.b(d12);
            c0029a2.d(b10);
            return c0029a2.a();
        }
        throw new e("Firebase Installations Service is unavailable. Please try again later.");
    }

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

    public final void k(b8.d dVar) {
        synchronized (this.f14855g) {
            Iterator it = this.l.iterator();
            while (it.hasNext()) {
                if (((j) it.next()).a(dVar)) {
                    it.remove();
                }
            }
        }
    }
}