APK反编译源代码展示 - 南明离火平台提供

应用版本信息
应用名称:Ghostify
版本号:4.0
包名称:com.getghostify

MD5 校验值:a9a821418db4ad35214aeeb08c2f5902

反编译源代码说明

d.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。


package g6;

import android.net.TrafficStats;
import android.text.TextUtils;
import android.util.Log;
import androidx.appcompat.widget.b1;
import g2.m;
import i6.a;
import i6.d;
import j6.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.Objects;
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 java.util.regex.Pattern;
import org.json.JSONException;
import org.json.JSONObject;

public class d implements e {

    public static final Object f5250m = new Object();

    public static final ThreadFactory f5251n = new a();

    public final o4.e f5252a;

    public final j6.c f5253b;

    public final i6.c f5254c;

    public final l f5255d;

    public final i6.b f5256e;

    public final j f5257f;

    public final Object f5258g;

    public final ExecutorService f5259h;

    public final ExecutorService f5260i;

    public String f5261j;

    public Set<h6.a> f5262k;

    public final List<k> f5263l;

    public class a implements ThreadFactory {

        public final AtomicInteger f5264k = new AtomicInteger(1);

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

    public d(o4.e eVar, f6.b<d6.e> bVar) {
        TimeUnit timeUnit = TimeUnit.SECONDS;
        LinkedBlockingQueue linkedBlockingQueue = new LinkedBlockingQueue();
        ThreadFactory threadFactory = f5251n;
        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(0, 1, 30L, timeUnit, linkedBlockingQueue, threadFactory);
        eVar.a();
        j6.c cVar = new j6.c(eVar.f7976a, bVar);
        i6.c cVar2 = new i6.c(eVar);
        l c9 = l.c();
        i6.b bVar2 = new i6.b(eVar);
        j jVar = new j();
        this.f5258g = new Object();
        this.f5262k = new HashSet();
        this.f5263l = new ArrayList();
        this.f5252a = eVar;
        this.f5253b = cVar;
        this.f5254c = cVar2;
        this.f5255d = c9;
        this.f5256e = bVar2;
        this.f5257f = jVar;
        this.f5259h = threadPoolExecutor;
        this.f5260i = new ThreadPoolExecutor(0, 1, 30L, timeUnit, new LinkedBlockingQueue(), threadFactory);
    }

    public static d f(o4.e eVar) {
        eVar.a();
        return (d) eVar.f7979d.b(e.class);
    }

    @Override
    public e3.i<i> a(final boolean z8) {
        h();
        e3.j jVar = new e3.j();
        g gVar = new g(this.f5255d, jVar);
        synchronized (this.f5258g) {
            this.f5263l.add(gVar);
        }
        e3.i iVar = jVar.f4208a;
        this.f5259h.execute(new Runnable() {
            @Override
            public final void run() {
                d.this.b(z8);
            }
        });
        return iVar;
    }

    public final void b(final boolean z8) {
        i6.d c9;
        synchronized (f5250m) {
            o4.e eVar = this.f5252a;
            eVar.a();
            d1.a b9 = d1.a.b(eVar.f7976a, "generatefid.lock");
            try {
                c9 = this.f5254c.c();
                if (c9.i()) {
                    String i9 = i(c9);
                    i6.c cVar = this.f5254c;
                    a.b bVar = (a.b) c9.k();
                    bVar.f5576a = i9;
                    bVar.b(3);
                    c9 = bVar.a();
                    cVar.b(c9);
                }
            } finally {
                if (b9 != null) {
                    b9.c();
                }
            }
        }
        if (z8) {
            a.b bVar2 = (a.b) c9.k();
            bVar2.f5578c = null;
            c9 = bVar2.a();
        }
        l(c9);
        this.f5260i.execute(new Runnable() {
            @Override
            public final void run() {
                d1.a b10;
                i6.d c10;
                i6.d j9;
                d dVar = d.this;
                boolean z9 = z8;
                Objects.requireNonNull(dVar);
                Object obj = d.f5250m;
                synchronized (obj) {
                    o4.e eVar2 = dVar.f5252a;
                    eVar2.a();
                    b10 = d1.a.b(eVar2.f7976a, "generatefid.lock");
                    try {
                        c10 = dVar.f5254c.c();
                    } finally {
                        if (b10 != null) {
                            b10.c();
                        }
                    }
                }
                try {
                } catch (f e9) {
                    e = e9;
                }
                if (!c10.h()) {
                    if (!(((i6.a) c10).f5570c == 3)) {
                        if (z9 || dVar.f5255d.d(c10)) {
                            j9 = dVar.c(c10);
                            synchronized (obj) {
                                o4.e eVar3 = dVar.f5252a;
                                eVar3.a();
                                b10 = d1.a.b(eVar3.f7976a, "generatefid.lock");
                                try {
                                    dVar.f5254c.b(j9);
                                    if (b10 != null) {
                                        b10.c();
                                    }
                                } finally {
                                    if (b10 != null) {
                                        b10.c();
                                    }
                                }
                            }
                            synchronized (dVar) {
                                if (dVar.f5262k.size() != 0 && !((i6.a) c10).f5569b.equals(((i6.a) j9).f5569b)) {
                                    Iterator<h6.a> it = dVar.f5262k.iterator();
                                    while (it.hasNext()) {
                                        it.next().a(((i6.a) j9).f5569b);
                                    }
                                }
                            }
                            if (j9.j()) {
                                String str = ((i6.a) j9).f5569b;
                                synchronized (dVar) {
                                    dVar.f5261j = str;
                                }
                            }
                            if (j9.h()) {
                                e = new f(1);
                            } else {
                                if (!j9.i()) {
                                    dVar.l(j9);
                                    return;
                                }
                                e = 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.");
                            }
                            dVar.k(e);
                            return;
                        }
                        return;
                    }
                }
                j9 = dVar.j(c10);
                synchronized (obj) {
                }
            }
        });
    }

    public final i6.d c(i6.d dVar) {
        int responseCode;
        j6.f f3;
        b.C0092b c0092b;
        j6.c cVar = this.f5253b;
        String d9 = d();
        i6.a aVar = (i6.a) dVar;
        String str = aVar.f5569b;
        String g9 = g();
        String str2 = aVar.f5572e;
        if (!cVar.f5701c.a()) {
            throw new f("Firebase Installations Service is unavailable. Please try again later.", 2);
        }
        URL a9 = cVar.a(String.format("projects/%s/installations/%s/authTokens:generate", g9, str));
        for (int i9 = 0; i9 <= 1; i9++) {
            TrafficStats.setThreadStatsTag(32771);
            HttpURLConnection c9 = cVar.c(a9, d9);
            try {
                c9.setRequestMethod("POST");
                c9.addRequestProperty("Authorization", "FIS_v2 " + str2);
                c9.setDoOutput(true);
                cVar.h(c9);
                responseCode = c9.getResponseCode();
                cVar.f5701c.b(responseCode);
            } catch (IOException | AssertionError unused) {
            } catch (Throwable th) {
                c9.disconnect();
                TrafficStats.clearThreadStatsTag();
                throw th;
            }
            if (responseCode >= 200 && responseCode < 300) {
                f3 = cVar.f(c9);
            } else {
                j6.c.b(c9, null, d9, g9);
                if (responseCode != 401 && responseCode != 404) {
                    if (responseCode == 429) {
                        throw new f("Firebase servers have received too many requests from this client in a short period of time. Please try again later.", 3);
                    }
                    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.");
                        c0092b = (b.C0092b) j6.f.a();
                        c0092b.f5696c = 2;
                        f3 = c0092b.a();
                    } else {
                        c9.disconnect();
                        TrafficStats.clearThreadStatsTag();
                    }
                }
                c0092b = (b.C0092b) j6.f.a();
                c0092b.f5696c = 3;
                f3 = c0092b.a();
            }
            c9.disconnect();
            TrafficStats.clearThreadStatsTag();
            j6.b bVar = (j6.b) f3;
            int e9 = m.g.e(bVar.f5693c);
            if (e9 == 0) {
                String str3 = bVar.f5691a;
                long j9 = bVar.f5692b;
                long b9 = this.f5255d.b();
                a.b bVar2 = (a.b) dVar.k();
                bVar2.f5578c = str3;
                bVar2.f5580e = Long.valueOf(j9);
                bVar2.f5581f = Long.valueOf(b9);
                return bVar2.a();
            }
            if (e9 == 1) {
                a.b bVar3 = (a.b) dVar.k();
                bVar3.f5582g = "BAD CONFIG";
                bVar3.b(5);
                return bVar3.a();
            }
            if (e9 == 2) {
                synchronized (this) {
                    this.f5261j = null;
                }
                d.a k9 = dVar.k();
                k9.b(2);
                return k9.a();
            }
            throw new f("Firebase Installations Service is unavailable. Please try again later.", 2);
        }
        throw new f("Firebase Installations Service is unavailable. Please try again later.", 2);
    }

    public String d() {
        o4.e eVar = this.f5252a;
        eVar.a();
        return eVar.f7978c.f7990a;
    }

    public String e() {
        o4.e eVar = this.f5252a;
        eVar.a();
        return eVar.f7978c.f7991b;
    }

    public String g() {
        o4.e eVar = this.f5252a;
        eVar.a();
        return eVar.f7978c.f7996g;
    }

    @Override
    public e3.i<String> getId() {
        String str;
        h();
        synchronized (this) {
            str = this.f5261j;
        }
        if (str != null) {
            return e3.l.e(str);
        }
        e3.j jVar = new e3.j();
        h hVar = new h(jVar);
        synchronized (this.f5258g) {
            this.f5263l.add(hVar);
        }
        e3.i iVar = jVar.f4208a;
        this.f5259h.execute(new b1(this, 13));
        return iVar;
    }

    public final void h() {
        m.f(e(), "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.");
        m.f(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.");
        m.f(d(), "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 e9 = e();
        Pattern pattern = l.f5271c;
        m.b(e9.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.");
        m.b(l.f5271c.matcher(d()).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 i(i6.d dVar) {
        String string;
        o4.e eVar = this.f5252a;
        eVar.a();
        if (eVar.f7977b.equals("CHIME_ANDROID_SDK") || this.f5252a.g()) {
            if (((i6.a) dVar).f5570c == 1) {
                i6.b bVar = this.f5256e;
                synchronized (bVar.f5584a) {
                    synchronized (bVar.f5584a) {
                        string = bVar.f5584a.getString("|S|id", null);
                    }
                    if (string == null) {
                        string = bVar.a();
                    }
                }
                return TextUtils.isEmpty(string) ? this.f5257f.a() : string;
            }
        }
        return this.f5257f.a();
    }

    public final i6.d j(i6.d dVar) {
        int responseCode;
        j6.d e9;
        i6.a aVar = (i6.a) dVar;
        String str = aVar.f5569b;
        String str2 = null;
        boolean z8 = false;
        if (str != null && str.length() == 11) {
            i6.b bVar = this.f5256e;
            synchronized (bVar.f5584a) {
                String[] strArr = i6.b.f5583c;
                int length = strArr.length;
                int i9 = 0;
                while (true) {
                    if (i9 >= length) {
                        break;
                    }
                    String str3 = strArr[i9];
                    String string = bVar.f5584a.getString("|T|" + bVar.f5585b + "|" + str3, null);
                    if (string == null || string.isEmpty()) {
                        i9++;
                    } else if (string.startsWith("{")) {
                        try {
                            str2 = new JSONObject(string).getString("token");
                        } catch (JSONException unused) {
                        }
                    } else {
                        str2 = string;
                    }
                }
            }
        }
        j6.c cVar = this.f5253b;
        String d9 = d();
        String str4 = aVar.f5569b;
        String g9 = g();
        String e10 = e();
        if (!cVar.f5701c.a()) {
            throw new f("Firebase Installations Service is unavailable. Please try again later.", 2);
        }
        URL a9 = cVar.a(String.format("projects/%s/installations", g9));
        int i10 = 0;
        while (i10 <= 1) {
            TrafficStats.setThreadStatsTag(32769);
            HttpURLConnection c9 = cVar.c(a9, d9);
            try {
                try {
                    c9.setRequestMethod("POST");
                    c9.setDoOutput(true);
                    if (str2 != null) {
                        c9.addRequestProperty("x-goog-fis-android-iid-migration-auth", str2);
                    }
                    cVar.g(c9, str4, e10);
                    responseCode = c9.getResponseCode();
                    cVar.f5701c.b(responseCode);
                } catch (IOException | AssertionError unused2) {
                }
                if ((responseCode < 200 || responseCode >= 300) ? z8 : true) {
                    e9 = cVar.e(c9);
                    c9.disconnect();
                    TrafficStats.clearThreadStatsTag();
                } else {
                    j6.c.b(c9, e10, d9, g9);
                    if (responseCode == 429) {
                        throw new f("Firebase servers have received too many requests from this client in a short period of time. Please try again later.", 3);
                    }
                    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.");
                        j6.a aVar2 = new j6.a(null, null, null, null, 2, null);
                        c9.disconnect();
                        TrafficStats.clearThreadStatsTag();
                        e9 = aVar2;
                    } else {
                        c9.disconnect();
                        TrafficStats.clearThreadStatsTag();
                        i10++;
                        z8 = false;
                    }
                }
                j6.a aVar3 = (j6.a) e9;
                int e11 = m.g.e(aVar3.f5690e);
                if (e11 != 0) {
                    if (e11 == 1) {
                        a.b bVar2 = (a.b) dVar.k();
                        bVar2.f5582g = "BAD CONFIG";
                        bVar2.b(5);
                        return bVar2.a();
                    }
                    throw new f("Firebase Installations Service is unavailable. Please try again later.", 2);
                }
                String str5 = aVar3.f5687b;
                String str6 = aVar3.f5688c;
                long b9 = this.f5255d.b();
                String c10 = aVar3.f5689d.c();
                long d10 = aVar3.f5689d.d();
                a.b bVar3 = (a.b) dVar.k();
                bVar3.f5576a = str5;
                bVar3.b(4);
                bVar3.f5578c = c10;
                bVar3.f5579d = str6;
                bVar3.f5580e = Long.valueOf(d10);
                bVar3.f5581f = Long.valueOf(b9);
                return bVar3.a();
            } finally {
                c9.disconnect();
                TrafficStats.clearThreadStatsTag();
            }
        }
        throw new f("Firebase Installations Service is unavailable. Please try again later.", 2);
    }

    public final void k(Exception exc) {
        synchronized (this.f5258g) {
            Iterator<k> it = this.f5263l.iterator();
            while (it.hasNext()) {
                if (it.next().b(exc)) {
                    it.remove();
                }
            }
        }
    }

    public final void l(i6.d dVar) {
        synchronized (this.f5258g) {
            Iterator<k> it = this.f5263l.iterator();
            while (it.hasNext()) {
                if (it.next().a(dVar)) {
                    it.remove();
                }
            }
        }
    }
}