Lost in The World of Succubi v版本的 MD5 值为:79a6335b1b86e8c40a9ae082e1016caa

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


package a.c.c.s;

import a.c.c.s.i;
import a.c.c.s.q.a;
import a.c.c.s.q.c;
import a.c.c.s.q.d;
import a.c.c.s.r.b;
import a.c.c.s.r.d;
import a.c.c.s.r.f;
import android.net.TrafficStats;
import android.text.TextUtils;
import android.util.Log;
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.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import org.json.JSONException;
import org.json.JSONObject;
public class g implements h {
    public static final Object m = new Object();
    public static final ThreadFactory n = new a();
    public final a.c.c.g f1652a;
    public final a.c.c.s.r.c f1653b;
    public final a.c.c.s.q.c f1654c;
    public final o f1655d;
    public final a.c.c.s.q.b f1656e;
    public final m f1657f;
    public final Object f1658g;
    public final ExecutorService h;
    public final ExecutorService i;
    public String j;
    public Set<a.c.c.s.p.a> k;
    public final List<n> l;

    public class a implements ThreadFactory {
        public final AtomicInteger f1659a = new AtomicInteger(1);

        @Override
        public Thread newThread(Runnable runnable) {
            return new Thread(runnable, String.format("firebase-installations-executor-%d", Integer.valueOf(this.f1659a.getAndIncrement())));
        }
    }

    public g(a.c.c.g gVar, a.c.c.r.b<a.c.c.v.g> bVar, a.c.c.r.b<a.c.c.p.f> bVar2) {
        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(0, 1, 30L, TimeUnit.SECONDS, new LinkedBlockingQueue(), n);
        gVar.a();
        a.c.c.s.r.c cVar = new a.c.c.s.r.c(gVar.f1523a, bVar, bVar2);
        a.c.c.s.q.c cVar2 = new a.c.c.s.q.c(gVar);
        o c2 = o.c();
        a.c.c.s.q.b bVar3 = new a.c.c.s.q.b(gVar);
        m mVar = new m();
        this.f1658g = new Object();
        this.k = new HashSet();
        this.l = new ArrayList();
        this.f1652a = gVar;
        this.f1653b = cVar;
        this.f1654c = cVar2;
        this.f1655d = c2;
        this.f1656e = bVar3;
        this.f1657f = mVar;
        this.h = threadPoolExecutor;
        this.i = new ThreadPoolExecutor(0, 1, 30L, TimeUnit.SECONDS, new LinkedBlockingQueue(), n);
    }

    public static g h(a.c.c.g gVar) {
        a.c.a.b.d.l.n.h(true, "Null is not a valid value of FirebaseApp.");
        gVar.a();
        return (g) gVar.f1526d.a(h.class);
    }

    @Override
    public a.c.a.b.i.i<String> a() {
        String str;
        m();
        synchronized (this) {
            str = this.j;
        }
        if (str != null) {
            return a.c.a.b.d.l.n.G(str);
        }
        a.c.a.b.i.j jVar = new a.c.a.b.i.j();
        k kVar = new k(jVar);
        synchronized (this.f1658g) {
            this.l.add(kVar);
        }
        a.c.a.b.i.i iVar = jVar.f1479a;
        this.h.execute(new Runnable() {
            @Override
            public final void run() {
                g.this.k();
            }
        });
        return iVar;
    }

    @Override
    public a.c.a.b.i.i<l> b(final boolean z) {
        m();
        a.c.a.b.i.j jVar = new a.c.a.b.i.j();
        j jVar2 = new j(this.f1655d, jVar);
        synchronized (this.f1658g) {
            this.l.add(jVar2);
        }
        a.c.a.b.i.i iVar = jVar.f1479a;
        this.h.execute(new Runnable() {
            @Override
            public final void run() {
                g.this.l(z);
            }
        });
        return iVar;
    }

    public final void j(boolean z) {
        a.c.c.s.q.d b2;
        a.c.c.s.q.d o;
        synchronized (m) {
            a.c.c.g gVar = this.f1652a;
            gVar.a();
            f a2 = f.a(gVar.f1523a, "generatefid.lock");
            b2 = this.f1654c.b();
            if (a2 != null) {
                a2.b();
            }
        }
        try {
            if (!b2.b()) {
                if (!(((a.c.c.s.q.a) b2).f1674b == c.a.UNREGISTERED)) {
                    if (!z && !this.f1655d.d(b2)) {
                        return;
                    }
                    o = e(b2);
                    synchronized (m) {
                        a.c.c.g gVar2 = this.f1652a;
                        gVar2.a();
                        f a3 = f.a(gVar2.f1523a, "generatefid.lock");
                        this.f1654c.a(o);
                        if (a3 != null) {
                            a3.b();
                        }
                    }
                    synchronized (this) {
                        if (this.k.size() != 0 && !((a.c.c.s.q.a) b2).f1673a.equals(((a.c.c.s.q.a) o).f1673a)) {
                            for (a.c.c.s.p.a aVar : this.k) {
                                aVar.a(((a.c.c.s.q.a) o).f1673a);
                            }
                        }
                    }
                    if (o.d()) {
                        String str = ((a.c.c.s.q.a) o).f1673a;
                        synchronized (this) {
                            this.j = str;
                        }
                    }
                    if (o.b()) {
                        p(new i(i.a.BAD_CONFIG));
                        return;
                    } else if (o.c()) {
                        p(new IOException("Installation ID could not be validated with the Firebase servers (maybe it was deleted). Firebase Installations will need to create a new Installation ID and auth token. Please retry your last request."));
                        return;
                    } else {
                        q(o);
                        return;
                    }
                }
            }
            o = o(b2);
            synchronized (m) {
            }
        } catch (i e2) {
            p(e2);
        }
    }

    public final void l(final boolean z) {
        a.c.c.s.q.d b2;
        synchronized (m) {
            a.c.c.g gVar = this.f1652a;
            gVar.a();
            f a2 = f.a(gVar.f1523a, "generatefid.lock");
            b2 = this.f1654c.b();
            if (b2.c()) {
                String n2 = n(b2);
                a.c.c.s.q.c cVar = this.f1654c;
                a.b bVar = (a.b) b2.e();
                bVar.f1680a = n2;
                bVar.c(c.a.UNREGISTERED);
                b2 = bVar.a();
                cVar.a(b2);
            }
            if (a2 != null) {
                a2.b();
            }
        }
        if (z) {
            a.b bVar2 = (a.b) b2.e();
            bVar2.f1682c = null;
            b2 = bVar2.a();
        }
        q(b2);
        this.i.execute(new Runnable() {
            @Override
            public final void run() {
                g.this.j(z);
            }
        });
    }

    public final a.c.c.s.q.d e(a.c.c.s.q.d dVar) throws i {
        int responseCode;
        a.c.c.s.r.f f2;
        i.a aVar = i.a.UNAVAILABLE;
        a.c.c.s.r.c cVar = this.f1653b;
        String f3 = f();
        a.c.c.s.q.a aVar2 = (a.c.c.s.q.a) dVar;
        String str = aVar2.f1673a;
        String i = i();
        String str2 = aVar2.f1676d;
        if (cVar.f1714d.a()) {
            URL a2 = cVar.a(String.format("projects/%s/installations/%s/authTokens:generate", i, str));
            for (int i2 = 0; i2 <= 1; i2++) {
                TrafficStats.setThreadStatsTag(32771);
                HttpURLConnection c2 = cVar.c(a2, f3);
                try {
                    c2.setRequestMethod("POST");
                    c2.addRequestProperty("Authorization", "FIS_v2 " + str2);
                    c2.setDoOutput(true);
                    cVar.h(c2);
                    responseCode = c2.getResponseCode();
                    cVar.f1714d.b(responseCode);
                } catch (IOException | AssertionError unused) {
                } catch (Throwable th) {
                    c2.disconnect();
                    TrafficStats.clearThreadStatsTag();
                    throw th;
                }
                if (responseCode >= 200 && responseCode < 300) {
                    f2 = cVar.f(c2);
                } else {
                    a.c.c.s.r.c.b(c2, null, f3, i);
                    if (responseCode != 401 && responseCode != 404) {
                        if (responseCode == 429) {
                            throw new i("Firebase servers have received too many requests from this client in a short period of time. Please try again later.", i.a.TOO_MANY_REQUESTS);
                        }
                        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.C0018b c0018b = (b.C0018b) a.c.c.s.r.f.a();
                            c0018b.f1708c = f.b.BAD_CONFIG;
                            f2 = c0018b.a();
                        } else {
                            c2.disconnect();
                            TrafficStats.clearThreadStatsTag();
                        }
                    }
                    b.C0018b c0018b2 = (b.C0018b) a.c.c.s.r.f.a();
                    c0018b2.f1708c = f.b.AUTH_ERROR;
                    f2 = c0018b2.a();
                }
                c2.disconnect();
                TrafficStats.clearThreadStatsTag();
                a.c.c.s.r.b bVar = (a.c.c.s.r.b) f2;
                int ordinal = bVar.f1705c.ordinal();
                if (ordinal == 0) {
                    String str3 = bVar.f1703a;
                    long j = bVar.f1704b;
                    long b2 = this.f1655d.b();
                    a.b bVar2 = (a.b) dVar.e();
                    bVar2.f1682c = str3;
                    bVar2.f1684e = Long.valueOf(j);
                    bVar2.f1685f = Long.valueOf(b2);
                    return bVar2.a();
                } else if (ordinal == 1) {
                    a.b bVar3 = (a.b) dVar.e();
                    bVar3.f1686g = "BAD CONFIG";
                    bVar3.c(c.a.REGISTER_ERROR);
                    return bVar3.a();
                } else if (ordinal == 2) {
                    synchronized (this) {
                        this.j = null;
                    }
                    d.a e2 = dVar.e();
                    e2.c(c.a.NOT_GENERATED);
                    return e2.a();
                } else {
                    throw new i("Firebase Installations Service is unavailable. Please try again later.", aVar);
                }
            }
            throw new i("Firebase Installations Service is unavailable. Please try again later.", aVar);
        }
        throw new i("Firebase Installations Service is unavailable. Please try again later.", aVar);
    }

    public String f() {
        a.c.c.g gVar = this.f1652a;
        gVar.a();
        return gVar.f1525c.f1534a;
    }

    public String g() {
        a.c.c.g gVar = this.f1652a;
        gVar.a();
        return gVar.f1525c.f1535b;
    }

    public String i() {
        a.c.c.g gVar = this.f1652a;
        gVar.a();
        return gVar.f1525c.f1540g;
    }

    public void k() {
        l(false);
    }

    public final void m() {
        a.c.a.b.d.l.n.l(g(), "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.");
        a.c.a.b.d.l.n.l(i(), "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.");
        a.c.a.b.d.l.n.l(f(), "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.");
        a.c.a.b.d.l.n.h(o.e(g()), "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.");
        a.c.a.b.d.l.n.h(o.f1670c.matcher(f()).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 n(a.c.c.s.q.d dVar) {
        String string;
        a.c.c.g gVar = this.f1652a;
        gVar.a();
        if (!gVar.f1524b.equals("CHIME_ANDROID_SDK")) {
            a.c.c.g gVar2 = this.f1652a;
            gVar2.a();
        }
        if (((a.c.c.s.q.a) dVar).f1674b == c.a.ATTEMPT_MIGRATION) {
            a.c.c.s.q.b bVar = this.f1656e;
            synchronized (bVar.f1688a) {
                synchronized (bVar.f1688a) {
                    string = bVar.f1688a.getString("|S|id", null);
                }
                if (string == null) {
                    string = bVar.a();
                }
            }
            return TextUtils.isEmpty(string) ? this.f1657f.a() : string;
        }
        return this.f1657f.a();
    }

    public final a.c.c.s.q.d o(a.c.c.s.q.d dVar) throws i {
        int responseCode;
        a.c.c.s.r.d e2;
        i.a aVar = i.a.UNAVAILABLE;
        a.c.c.s.q.a aVar2 = (a.c.c.s.q.a) dVar;
        String str = aVar2.f1673a;
        String str2 = null;
        if (str != null && str.length() == 11) {
            a.c.c.s.q.b bVar = this.f1656e;
            synchronized (bVar.f1688a) {
                String[] strArr = a.c.c.s.q.b.f1687c;
                int length = strArr.length;
                int i = 0;
                while (true) {
                    if (i >= length) {
                        break;
                    }
                    String str3 = strArr[i];
                    String str4 = bVar.f1689b;
                    String string = bVar.f1688a.getString("|T|" + str4 + "|" + str3, null);
                    if (string == null || string.isEmpty()) {
                        i++;
                    } else if (string.startsWith("{")) {
                        try {
                            str2 = new JSONObject(string).getString("token");
                        } catch (JSONException unused) {
                        }
                    } else {
                        str2 = string;
                    }
                }
            }
        }
        a.c.c.s.r.c cVar = this.f1653b;
        String f2 = f();
        String str5 = aVar2.f1673a;
        String i2 = i();
        String g2 = g();
        if (cVar.f1714d.a()) {
            URL a2 = cVar.a(String.format("projects/%s/installations", i2));
            for (int i3 = 0; i3 <= 1; i3++) {
                TrafficStats.setThreadStatsTag(32769);
                HttpURLConnection c2 = cVar.c(a2, f2);
                try {
                    c2.setRequestMethod("POST");
                    c2.setDoOutput(true);
                    if (str2 != null) {
                        c2.addRequestProperty("x-goog-fis-android-iid-migration-auth", str2);
                    }
                    cVar.g(c2, str5, g2);
                    responseCode = c2.getResponseCode();
                    cVar.f1714d.b(responseCode);
                } catch (IOException | AssertionError unused2) {
                } catch (Throwable th) {
                    c2.disconnect();
                    TrafficStats.clearThreadStatsTag();
                    throw th;
                }
                if (responseCode >= 200 && responseCode < 300) {
                    e2 = cVar.e(c2);
                    c2.disconnect();
                    TrafficStats.clearThreadStatsTag();
                } else {
                    a.c.c.s.r.c.b(c2, g2, f2, i2);
                    if (responseCode == 429) {
                        throw new i("Firebase servers have received too many requests from this client in a short period of time. Please try again later.", i.a.TOO_MANY_REQUESTS);
                    }
                    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.c.c.s.r.a aVar3 = new a.c.c.s.r.a(null, null, null, null, d.a.BAD_CONFIG, null);
                        c2.disconnect();
                        TrafficStats.clearThreadStatsTag();
                        e2 = aVar3;
                    } else {
                        c2.disconnect();
                        TrafficStats.clearThreadStatsTag();
                    }
                }
                a.c.c.s.r.a aVar4 = (a.c.c.s.r.a) e2;
                int ordinal = aVar4.f1702e.ordinal();
                if (ordinal != 0) {
                    if (ordinal == 1) {
                        a.b bVar2 = (a.b) dVar.e();
                        bVar2.f1686g = "BAD CONFIG";
                        bVar2.c(c.a.REGISTER_ERROR);
                        return bVar2.a();
                    }
                    throw new i("Firebase Installations Service is unavailable. Please try again later.", aVar);
                }
                String str6 = aVar4.f1699b;
                String str7 = aVar4.f1700c;
                long b2 = this.f1655d.b();
                a.c.c.s.r.b bVar3 = (a.c.c.s.r.b) aVar4.f1701d;
                String str8 = bVar3.f1703a;
                long j = bVar3.f1704b;
                a.b bVar4 = (a.b) dVar.e();
                bVar4.f1680a = str6;
                bVar4.c(c.a.REGISTERED);
                bVar4.f1682c = str8;
                bVar4.f1683d = str7;
                bVar4.f1684e = Long.valueOf(j);
                bVar4.f1685f = Long.valueOf(b2);
                return bVar4.a();
            }
            throw new i("Firebase Installations Service is unavailable. Please try again later.", aVar);
        }
        throw new i("Firebase Installations Service is unavailable. Please try again later.", aVar);
    }

    public final void p(Exception exc) {
        synchronized (this.f1658g) {
            Iterator<n> it = this.l.iterator();
            while (it.hasNext()) {
                if (it.next().a(exc)) {
                    it.remove();
                }
            }
        }
    }

    public final void q(a.c.c.s.q.d dVar) {
        synchronized (this.f1658g) {
            Iterator<n> it = this.l.iterator();
            while (it.hasNext()) {
                if (it.next().b(dVar)) {
                    it.remove();
                }
            }
        }
    }
}