Step Record v1.1.5版本的 MD5 值为:5797275f89198878d2f00ee92d534382

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


package com.chartboost.heliumsdk.impl;

import android.net.TrafficStats;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.GuardedBy;
import androidx.annotation.NonNull;
import com.anythink.expressad.foundation.g.a;
import com.chartboost.heliumsdk.impl.tHzt1;
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.mbridge.msdk.mbbid.out.BidResponsed;
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.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 final class tKHKHHzKH implements tzSHtt {
    public static final Object HzHtt1 = new Object();
    public static final SKHKzK SKzzSKS = new SKHKzK();

    @GuardedBy("FirebaseInstallations.this")
    public final HashSet HKS;
    public final ThreadPoolExecutor HKzHtzz;

    @GuardedBy("lock")
    public final ArrayList Ht;
    public final tH1z HtSH;
    public final ExecutorService KtH1t1;
    public final tzHHzzKKK SKHKzK;
    public final Object Sz1tH;
    public final HK1St11zH t1H1KH1K;
    public final tttSH t1S1zKHK;
    public final HK1St1 tz;
    public final H1tK tzttS1SS1;

    @GuardedBy("this")
    public String zS;

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

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

    public tKHKHHzKH(tzHHzzKKK tzhhzzkkk, @NonNull KKHtzHSz<HKHKtS1K> kKHtzHSz) {
        TimeUnit timeUnit = TimeUnit.SECONDS;
        LinkedBlockingQueue linkedBlockingQueue = new LinkedBlockingQueue();
        SKHKzK sKHKzK = SKzzSKS;
        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(0, 1, 30L, timeUnit, linkedBlockingQueue, sKHKzK);
        tzhhzzkkk.SKHKzK();
        HK1St11zH hK1St11zH = new HK1St11zH(tzhhzzkkk.SKHKzK, kKHtzHSz);
        tH1z th1z = new tH1z(tzhhzzkkk);
        if (KK1z.Sz1tH == null) {
            KK1z.Sz1tH = new KK1z();
        }
        KK1z kK1z = KK1z.Sz1tH;
        if (tttSH.t1S1zKHK == null) {
            tttSH.t1S1zKHK = new tttSH(kK1z);
        }
        tttSH tttsh = tttSH.t1S1zKHK;
        HK1St1 hK1St1 = new HK1St1(tzhhzzkkk);
        H1tK h1tK = new H1tK();
        this.Sz1tH = new Object();
        this.HKS = new HashSet();
        this.Ht = new ArrayList();
        this.SKHKzK = tzhhzzkkk;
        this.t1H1KH1K = hK1St11zH;
        this.HtSH = th1z;
        this.t1S1zKHK = tttsh;
        this.tz = hK1St1;
        this.tzttS1SS1 = h1tK;
        this.KtH1t1 = threadPoolExecutor;
        this.HKzHtzz = new ThreadPoolExecutor(0, 1, 30L, timeUnit, new LinkedBlockingQueue(), sKHKzK);
    }

    @NonNull
    public static tKHKHHzKH t1S1zKHK() {
        tzHHzzKKK t1H1KH1K = tzHHzzKKK.t1H1KH1K();
        Preconditions.checkArgument(true, "Null is not a valid value of FirebaseApp.");
        t1H1KH1K.SKHKzK();
        return (tKHKHHzKH) t1H1KH1K.t1S1zKHK.SKHKzK(tzSHtt.class);
    }

    public final void HKzHtzz(tHzt1 thzt1) {
        synchronized (this.Sz1tH) {
            Iterator it = this.Ht.iterator();
            while (it.hasNext()) {
                if (((zzSt1zz) it.next()).t1H1KH1K(thzt1)) {
                    it.remove();
                }
            }
        }
    }

    public final tHzt1 HtSH(@NonNull tHzt1 thzt1) throws K1HKK {
        ?? r10;
        boolean z;
        String str;
        int i;
        boolean z2;
        int responseCode;
        boolean z3;
        String str2;
        String str3;
        tzHHzzKKK tzhhzzkkk = this.SKHKzK;
        tzhhzzkkk.SKHKzK();
        String str4 = tzhhzzkkk.HtSH.SKHKzK;
        String str5 = thzt1.t1H1KH1K;
        tzHHzzKKK tzhhzzkkk2 = this.SKHKzK;
        tzhhzzkkk2.SKHKzK();
        String str6 = tzhhzzkkk2.HtSH.Sz1tH;
        String str7 = thzt1.tz;
        HK1St11zH hK1St11zH = this.t1H1KH1K;
        ttS tts = hK1St11zH.HtSH;
        synchronized (tts) {
            r10 = 1;
            if (tts.HtSH != 0) {
                tts.SKHKzK.SKHKzK.getClass();
                if (System.currentTimeMillis() <= tts.t1H1KH1K) {
                    z = false;
                }
            }
            z = true;
        }
        String str8 = "Firebase Installations Service is unavailable. Please try again later.";
        if (z) {
            int i2 = 2;
            URL SKHKzK2 = HK1St11zH.SKHKzK(String.format("projects/%s/installations/%s/authTokens:generate", str6, str5));
            int i3 = 0;
            t1KzSH t1kzsh = str4;
            while (i3 <= r10) {
                TrafficStats.setThreadStatsTag(32771);
                HttpURLConnection HtSH = hK1St11zH.HtSH(SKHKzK2, t1kzsh);
                try {
                    try {
                        HtSH.setRequestMethod("POST");
                        HtSH.addRequestProperty("Authorization", "FIS_v2 " + str7);
                        HtSH.setDoOutput(r10);
                        HK1St11zH.KtH1t1(HtSH);
                        responseCode = HtSH.getResponseCode();
                        tts.SKHKzK(responseCode);
                        if (responseCode >= 200 && responseCode < 300) {
                            z3 = r10;
                        } else {
                            z3 = false;
                        }
                    } catch (IOException | AssertionError unused) {
                    }
                    if (z3) {
                        t1kzsh = HK1St11zH.tzttS1SS1(HtSH);
                        str = str8;
                    } else {
                        HK1St11zH.t1H1KH1K(HtSH, null, t1kzsh, str6);
                        if (responseCode != 401 && responseCode != 404) {
                            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.");
                                        Long l = 0L;
                                        if (l == null) {
                                            str3 = " tokenExpirationTimestamp";
                                        } else {
                                            str3 = "";
                                        }
                                        if (str3.isEmpty()) {
                                            str = str8;
                                            t1kzsh = new t1KzSH(null, l.longValue(), i2);
                                        } else {
                                            throw new IllegalStateException("Missing required properties:".concat(str3));
                                        }
                                    } catch (IOException | AssertionError unused2) {
                                        str = str8;
                                        i = i2;
                                        str8 = str;
                                        z2 = true;
                                        HtSH.disconnect();
                                        TrafficStats.clearThreadStatsTag();
                                        i3++;
                                        r10 = z2;
                                        i2 = i;
                                        t1kzsh = t1kzsh;
                                    }
                                }
                                i = i2;
                                z2 = r10;
                                HtSH.disconnect();
                                TrafficStats.clearThreadStatsTag();
                                i3++;
                                r10 = z2;
                                i2 = i;
                                t1kzsh = t1kzsh;
                            } else {
                                throw new K1HKK("Firebase servers have received too many requests from this client in a short period of time. Please try again later.");
                            }
                        } else {
                            try {
                                str = str8;
                                Long l2 = 0L;
                                if (l2 == null) {
                                    str2 = " tokenExpirationTimestamp";
                                } else {
                                    str2 = "";
                                }
                                if (str2.isEmpty()) {
                                    try {
                                        t1kzsh = new t1KzSH(null, l2.longValue(), 3);
                                    } catch (IOException | AssertionError unused3) {
                                        str8 = str;
                                        z2 = true;
                                        i = 2;
                                    }
                                } else {
                                    i = i2;
                                    str8 = str;
                                    z2 = true;
                                    try {
                                        throw new IllegalStateException("Missing required properties:".concat(str2));
                                        break;
                                    } catch (IOException | AssertionError unused4) {
                                        continue;
                                    }
                                }
                            } catch (IOException | AssertionError unused5) {
                                i = i2;
                                str8 = str;
                                z2 = true;
                                HtSH.disconnect();
                                TrafficStats.clearThreadStatsTag();
                                i3++;
                                r10 = z2;
                                i2 = i;
                                t1kzsh = t1kzsh;
                            }
                            HtSH.disconnect();
                            TrafficStats.clearThreadStatsTag();
                            i3++;
                            r10 = z2;
                            i2 = i;
                            t1kzsh = t1kzsh;
                        }
                    }
                    HtSH.disconnect();
                    TrafficStats.clearThreadStatsTag();
                    int Ht = ttSHtSH.Ht(t1kzsh.HtSH);
                    if (Ht != 0) {
                        if (Ht != 1) {
                            if (Ht == 2) {
                                synchronized (this) {
                                    this.zS = null;
                                }
                                tHzt1.SKHKzK sKHKzK = new tHzt1.SKHKzK(thzt1);
                                sKHKzK.t1H1KH1K(2);
                                return sKHKzK.SKHKzK();
                            }
                            throw new K1HKK(str);
                        }
                        tHzt1.SKHKzK KtH1t1 = thzt1.KtH1t1();
                        KtH1t1.Sz1tH = "BAD CONFIG";
                        KtH1t1.t1H1KH1K(5);
                        return KtH1t1.SKHKzK();
                    }
                    tttSH tttsh = this.t1S1zKHK;
                    tttsh.getClass();
                    TimeUnit timeUnit = TimeUnit.MILLISECONDS;
                    tttsh.SKHKzK.getClass();
                    long seconds = timeUnit.toSeconds(System.currentTimeMillis());
                    tHzt1.SKHKzK sKHKzK2 = new tHzt1.SKHKzK(thzt1);
                    sKHKzK2.HtSH = t1kzsh.SKHKzK;
                    sKHKzK2.tz = Long.valueOf(t1kzsh.t1H1KH1K);
                    sKHKzK2.tzttS1SS1 = Long.valueOf(seconds);
                    return sKHKzK2.SKHKzK();
                } catch (Throwable th) {
                    HtSH.disconnect();
                    TrafficStats.clearThreadStatsTag();
                    throw th;
                }
            }
            throw new K1HKK(str8);
        }
        throw new K1HKK("Firebase Installations Service is unavailable. Please try again later.");
    }

    public final void KtH1t1(Exception exc) {
        synchronized (this.Sz1tH) {
            Iterator it = this.Ht.iterator();
            while (it.hasNext()) {
                if (((zzSt1zz) it.next()).SKHKzK(exc)) {
                    it.remove();
                }
            }
        }
    }

    @Override
    @NonNull
    public final Task SKHKzK() {
        tz();
        TaskCompletionSource taskCompletionSource = new TaskCompletionSource();
        zHt1Hztt zht1hztt = new zHt1Hztt(this.t1S1zKHK, taskCompletionSource);
        synchronized (this.Sz1tH) {
            this.Ht.add(zht1hztt);
        }
        Task task = taskCompletionSource.getTask();
        this.KtH1t1.execute(new HzH(1, this, false));
        return task;
    }

    public final tHzt1 Sz1tH(tHzt1 thzt1) throws K1HKK {
        boolean z;
        int responseCode;
        boolean z2;
        tHS tz;
        String str = thzt1.t1H1KH1K;
        String str2 = null;
        if (str != null && str.length() == 11) {
            HK1St1 hK1St1 = this.tz;
            synchronized (hK1St1.SKHKzK) {
                String[] strArr = HK1St1.HtSH;
                int i = 0;
                while (true) {
                    if (i >= 4) {
                        break;
                    }
                    String str3 = strArr[i];
                    String string = hK1St1.SKHKzK.getString("|T|" + hK1St1.t1H1KH1K + a.bU + str3, null);
                    if (string != null && !string.isEmpty()) {
                        if (string.startsWith("{")) {
                            try {
                                str2 = new JSONObject(string).getString(BidResponsed.KEY_TOKEN);
                            } catch (JSONException unused) {
                            }
                        } else {
                            str2 = string;
                        }
                    } else {
                        i++;
                    }
                }
            }
        }
        HK1St11zH hK1St11zH = this.t1H1KH1K;
        tzHHzzKKK tzhhzzkkk = this.SKHKzK;
        tzhhzzkkk.SKHKzK();
        String str4 = tzhhzzkkk.HtSH.SKHKzK;
        String str5 = thzt1.t1H1KH1K;
        tzHHzzKKK tzhhzzkkk2 = this.SKHKzK;
        tzhhzzkkk2.SKHKzK();
        String str6 = tzhhzzkkk2.HtSH.Sz1tH;
        tzHHzzKKK tzhhzzkkk3 = this.SKHKzK;
        tzhhzzkkk3.SKHKzK();
        String str7 = tzhhzzkkk3.HtSH.t1H1KH1K;
        ttS tts = hK1St11zH.HtSH;
        synchronized (tts) {
            if (tts.HtSH != 0) {
                tts.SKHKzK.SKHKzK.getClass();
                if (System.currentTimeMillis() <= tts.t1H1KH1K) {
                    z = false;
                }
            }
            z = true;
        }
        if (z) {
            URL SKHKzK2 = HK1St11zH.SKHKzK(String.format("projects/%s/installations", str6));
            for (int i2 = 0; i2 <= 1; i2++) {
                TrafficStats.setThreadStatsTag(32769);
                HttpURLConnection HtSH = hK1St11zH.HtSH(SKHKzK2, str4);
                try {
                    try {
                        HtSH.setRequestMethod("POST");
                        HtSH.setDoOutput(true);
                        if (str2 != null) {
                            HtSH.addRequestProperty("x-goog-fis-android-iid-migration-auth", str2);
                        }
                        HK1St11zH.Sz1tH(HtSH, str5, str7);
                        responseCode = HtSH.getResponseCode();
                        tts.SKHKzK(responseCode);
                        if (responseCode >= 200 && responseCode < 300) {
                            z2 = true;
                        } else {
                            z2 = false;
                        }
                    } finally {
                        HtSH.disconnect();
                        TrafficStats.clearThreadStatsTag();
                    }
                } catch (IOException | AssertionError unused2) {
                }
                if (z2) {
                    tz = HK1St11zH.tz(HtSH);
                    HtSH.disconnect();
                    TrafficStats.clearThreadStatsTag();
                } else {
                    HK1St11zH.t1H1KH1K(HtSH, 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.");
                                tHS ths = new tHS(null, null, null, null, 2);
                                HtSH.disconnect();
                                TrafficStats.clearThreadStatsTag();
                                tz = ths;
                            } catch (IOException | AssertionError unused3) {
                            }
                        }
                        HtSH.disconnect();
                        TrafficStats.clearThreadStatsTag();
                    } else {
                        throw new K1HKK("Firebase servers have received too many requests from this client in a short period of time. Please try again later.");
                    }
                }
                int Ht = ttSHtSH.Ht(tz.tz);
                if (Ht != 0) {
                    if (Ht == 1) {
                        tHzt1.SKHKzK KtH1t1 = thzt1.KtH1t1();
                        KtH1t1.Sz1tH = "BAD CONFIG";
                        KtH1t1.t1H1KH1K(5);
                        return KtH1t1.SKHKzK();
                    }
                    throw new K1HKK("Firebase Installations Service is unavailable. Please try again later.");
                }
                String str8 = tz.t1H1KH1K;
                String str9 = tz.HtSH;
                tttSH tttsh = this.t1S1zKHK;
                tttsh.getClass();
                TimeUnit timeUnit = TimeUnit.MILLISECONDS;
                tttsh.SKHKzK.getClass();
                long seconds = timeUnit.toSeconds(System.currentTimeMillis());
                String t1H1KH1K = tz.t1S1zKHK.t1H1KH1K();
                long HtSH2 = tz.t1S1zKHK.HtSH();
                tHzt1.SKHKzK sKHKzK = new tHzt1.SKHKzK(thzt1);
                sKHKzK.SKHKzK = str8;
                sKHKzK.t1H1KH1K(4);
                sKHKzK.HtSH = t1H1KH1K;
                sKHKzK.t1S1zKHK = str9;
                sKHKzK.tz = Long.valueOf(HtSH2);
                sKHKzK.tzttS1SS1 = Long.valueOf(seconds);
                return sKHKzK.SKHKzK();
            }
            throw new K1HKK("Firebase Installations Service is unavailable. Please try again later.");
        }
        throw new K1HKK("Firebase Installations Service is unavailable. Please try again later.");
    }

    @Override
    @NonNull
    public final Task<String> getId() {
        String str;
        tz();
        synchronized (this) {
            str = this.zS;
        }
        if (str != null) {
            return Tasks.forResult(str);
        }
        TaskCompletionSource taskCompletionSource = new TaskCompletionSource();
        SStSK sStSK = new SStSK(taskCompletionSource);
        synchronized (this.Sz1tH) {
            this.Ht.add(sStSK);
        }
        Task<String> task = taskCompletionSource.getTask();
        this.KtH1t1.execute(new tzzztH(this, 7));
        return task;
    }

    public final void t1H1KH1K(boolean z) {
        tHzt1 HtSH;
        boolean z2;
        synchronized (HzHtt1) {
            tzHHzzKKK tzhhzzkkk = this.SKHKzK;
            tzhhzzkkk.SKHKzK();
            KtS1KK1H SKHKzK2 = KtS1KK1H.SKHKzK(tzhhzzkkk.SKHKzK);
            try {
                HtSH = this.HtSH.HtSH();
                int i = HtSH.HtSH;
                if (i != 2 && i != 1) {
                    z2 = false;
                    if (z2) {
                        String tzttS1SS1 = tzttS1SS1(HtSH);
                        tH1z th1z = this.HtSH;
                        tHzt1.SKHKzK sKHKzK = new tHzt1.SKHKzK(HtSH);
                        sKHKzK.SKHKzK = tzttS1SS1;
                        sKHKzK.t1H1KH1K(3);
                        HtSH = sKHKzK.SKHKzK();
                        th1z.t1H1KH1K(HtSH);
                    }
                }
                z2 = true;
                if (z2) {
                }
            } finally {
                if (SKHKzK2 != null) {
                    SKHKzK2.t1H1KH1K();
                }
            }
        }
        if (z) {
            tHzt1.SKHKzK sKHKzK2 = new tHzt1.SKHKzK(HtSH);
            sKHKzK2.HtSH = null;
            HtSH = sKHKzK2.SKHKzK();
        }
        HKzHtzz(HtSH);
        this.HKzHtzz.execute(new SzzzKtSHH(1, this, z));
    }

    public final void tz() {
        tzHHzzKKK tzhhzzkkk = this.SKHKzK;
        tzhhzzkkk.SKHKzK();
        Preconditions.checkNotEmpty(tzhhzzkkk.HtSH.t1H1KH1K, "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.");
        tzhhzzkkk.SKHKzK();
        Preconditions.checkNotEmpty(tzhhzzkkk.HtSH.Sz1tH, "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.");
        tzhhzzkkk.SKHKzK();
        Preconditions.checkNotEmpty(tzhhzzkkk.HtSH.SKHKzK, "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.");
        tzhhzzkkk.SKHKzK();
        String str = tzhhzzkkk.HtSH.t1H1KH1K;
        Pattern pattern = tttSH.HtSH;
        Preconditions.checkArgument(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.");
        tzhhzzkkk.SKHKzK();
        Preconditions.checkArgument(tttSH.HtSH.matcher(tzhhzzkkk.HtSH.SKHKzK).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 tzttS1SS1(tHzt1 thzt1) {
        String string;
        tzHHzzKKK tzhhzzkkk = this.SKHKzK;
        tzhhzzkkk.SKHKzK();
        if (!tzhhzzkkk.t1H1KH1K.equals("CHIME_ANDROID_SDK")) {
            tzHHzzKKK tzhhzzkkk2 = this.SKHKzK;
            tzhhzzkkk2.SKHKzK();
        }
        boolean z = true;
        if (thzt1.HtSH != 1) {
            z = false;
        }
        if (z) {
            HK1St1 hK1St1 = this.tz;
            synchronized (hK1St1.SKHKzK) {
                synchronized (hK1St1.SKHKzK) {
                    string = hK1St1.SKHKzK.getString("|S|id", null);
                }
                if (string == null) {
                    string = hK1St1.SKHKzK();
                }
            }
            if (TextUtils.isEmpty(string)) {
                this.tzttS1SS1.getClass();
                return H1tK.SKHKzK();
            }
            return string;
        }
        this.tzttS1SS1.getClass();
        return H1tK.SKHKzK();
    }
}